Spaces:
Running
Running
test: add reposhell prompt propensity experiment
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- experiments/reposhell-prompt-propensity/README.md +78 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/README.md +90 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/pi-config-runtime/auth.json +1 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/pi-config-runtime/models.json +31 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/pi-config-runtime/settings.json +12 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-3NhAn3/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-5UZUUG/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-7IIyRn/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-8GI8Q6/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-9dSCU5/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-DrR6yS/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-ETnRKy/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-JzXZQ5/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-NztNvQ/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-QVZr1G/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-STpIHB/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-T5x1tz/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-UZPmus/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-YOgqTL/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-jCasgH/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-lpPj6d/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-pKw5pP/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-pWsmhS/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-tGkRpy/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-u0s9He/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-vVMQR0/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-xaOuSX/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-xaiRby/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/reposhell/run-xjNjX3/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-0ieK5t/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-4NoNiu/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-5gbl59/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-7RH1PU/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-87fl4J/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-9PHRXq/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-A46wM4/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-JACl83/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-LyeWg0/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-OWip5x/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-Q8aNBF/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-SuGPiw/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-XdCkY5/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-ZJJo1G/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-ZUWCrs/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-Zehefa/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-a1vDEa/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-d8wH8Z/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-dqhus9/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-ghtFUD/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/request-params/run-gwFUzL/request-params-extension.ts +20 -0
experiments/reposhell-prompt-propensity/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Reposhell Prompt Propensity Experiment
|
| 2 |
+
|
| 3 |
+
This experiment tested whether prompt-only wording changes can make
|
| 4 |
+
`gemma-4-e4b-it` more likely to use Localpager's read-only repository inspection
|
| 5 |
+
tool during OpenClaw classification, without naming `bash` or requiring a bash
|
| 6 |
+
call.
|
| 7 |
+
|
| 8 |
+
## Result
|
| 9 |
+
|
| 10 |
+
Across the completed runs:
|
| 11 |
+
|
| 12 |
+
| Group | Classifier calls | Prompt variants | Sessions with bash | Bash calls | Failed calls |
|
| 13 |
+
|---|---:|---:|---:|---:|---:|
|
| 14 |
+
| Weak/implicit evidence wording | 24 | 4 | 0 | 0 | 0 |
|
| 15 |
+
| Stronger optional repository-evidence wording | 24 | 4 | 0 | 0 | 1 |
|
| 16 |
+
| Focused source-first wording | 18 | 3 | 0 | 0 | 1 |
|
| 17 |
+
| **Total** | **66** | **11** | **0** | **0** | **2** |
|
| 18 |
+
|
| 19 |
+
The prompt-only changes did **not** increase reposhell use under these
|
| 20 |
+
conditions. Even wording that said source evidence should normally be checked
|
| 21 |
+
for code-specific items produced `0` bash calls.
|
| 22 |
+
|
| 23 |
+
## Completed Runs
|
| 24 |
+
|
| 25 |
+
- `run-20260615T143851Z`: baseline, evidence-light, source-grounding,
|
| 26 |
+
truncation-aware.
|
| 27 |
+
- `run-20260615T144427Z`: baseline, tool-aware-optional, one-lookup-budget,
|
| 28 |
+
source-metadata-split.
|
| 29 |
+
- `run-20260615T145111Z`: baseline, source-first-code-items,
|
| 30 |
+
final-after-evidence.
|
| 31 |
+
|
| 32 |
+
Each completed run directory contains:
|
| 33 |
+
|
| 34 |
+
- `README.md`: per-run summary table.
|
| 35 |
+
- `results.json`: machine-readable per-run records, session paths, commands,
|
| 36 |
+
prompt paths, and stderr/stdout log paths.
|
| 37 |
+
- `prompts/*.prompt.md`: full rendered prompt templates used by that run.
|
| 38 |
+
- `contexts/*.md`: cached GitHub context used for every variant.
|
| 39 |
+
- `state/*/sessions/*.jsonl`: saved Pi/localpager-agent session transcripts.
|
| 40 |
+
|
| 41 |
+
## Interpretation
|
| 42 |
+
|
| 43 |
+
The production prompt strongly asks for final structured JSON and says the task
|
| 44 |
+
is classification, not code search. The e4b model appears to satisfy the
|
| 45 |
+
structured-output instruction directly instead of voluntarily using the
|
| 46 |
+
available repository tool, even when the prompt says source evidence may or
|
| 47 |
+
should be checked.
|
| 48 |
+
|
| 49 |
+
The historical bash-using sessions were created by prompts that included much
|
| 50 |
+
more direct tool-use pressure, for example asking for a concise read-only call.
|
| 51 |
+
This experiment suggests that if reposhell use is required for certain classes
|
| 52 |
+
of classifier inputs, relying on soft prompt wording is not enough. A runtime
|
| 53 |
+
policy or explicit conditional instruction is likely needed.
|
| 54 |
+
|
| 55 |
+
## Reproduction
|
| 56 |
+
|
| 57 |
+
Run from the scratch repo:
|
| 58 |
+
|
| 59 |
+
```sh
|
| 60 |
+
node experiments/reposhell-prompt-propensity/run_experiment.mjs
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
The runner uses:
|
| 64 |
+
|
| 65 |
+
- Localpager checkout: `/home/bob/repos/localpager`
|
| 66 |
+
- Config: `/home/bob/.config/localpager/config.json`
|
| 67 |
+
- Model: `gemma-4-e4b-it`
|
| 68 |
+
- Reposhell socket: `/home/bob/.local/state/localpager/reposhell.sock`
|
| 69 |
+
- Targets:
|
| 70 |
+
- `openclaw/openclaw#84509`
|
| 71 |
+
- `openclaw/openclaw#91046`
|
| 72 |
+
- `openclaw/openclaw#81443`
|
| 73 |
+
- `openclaw/openclaw#88504`
|
| 74 |
+
- `openclaw/openclaw#88875`
|
| 75 |
+
- `openclaw/openclaw#52126`
|
| 76 |
+
|
| 77 |
+
The runner reuses cached contexts from prior completed run directories when
|
| 78 |
+
available, to avoid repeated GitHub context fetches.
|
experiments/reposhell-prompt-propensity/run-20260615T143851Z/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Reposhell Prompt Propensity Experiment
|
| 2 |
+
|
| 3 |
+
Created: 2026-06-15T14:43:37.930Z
|
| 4 |
+
|
| 5 |
+
Goal: test whether prompt wording can increase voluntary read-only repository inspection without explicitly naming or requiring the `bash` tool.
|
| 6 |
+
|
| 7 |
+
## Setup
|
| 8 |
+
|
| 9 |
+
- Model: `gemma-4-e4b-it`
|
| 10 |
+
- Target count: 6
|
| 11 |
+
- Variant count: 4
|
| 12 |
+
- Reposhell was exposed through the Localpager agent runtime.
|
| 13 |
+
- Localpager repo files were not edited; generated prompts, logs, sessions, and summaries are under this scratch experiment directory.
|
| 14 |
+
|
| 15 |
+
## Summary
|
| 16 |
+
|
| 17 |
+
| Variant | Runs | Sessions with bash | Successful bash sessions | Bash calls | Successful bash calls | Failures | Mean elapsed ms |
|
| 18 |
+
|---|---:|---:|---:|---:|---:|---:|---:|
|
| 19 |
+
| baseline | 6 | 0 (0.0%) | 0 (0.0%) | 0 | 0 | 0 | 17937 |
|
| 20 |
+
| evidence-light | 6 | 0 (0.0%) | 0 (0.0%) | 0 | 0 | 0 | 10620 |
|
| 21 |
+
| source-grounding | 6 | 0 (0.0%) | 0 (0.0%) | 0 | 0 | 0 | 8754 |
|
| 22 |
+
| truncation-aware | 6 | 0 (0.0%) | 0 (0.0%) | 0 | 0 | 0 | 8614 |
|
| 23 |
+
|
| 24 |
+
## Variants
|
| 25 |
+
|
| 26 |
+
### baseline
|
| 27 |
+
|
| 28 |
+
Baseline production prompt.
|
| 29 |
+
|
| 30 |
+
### evidence-light
|
| 31 |
+
|
| 32 |
+
## Evidence Discipline
|
| 33 |
+
|
| 34 |
+
GitHub context is primary. When the title or body names a specific file,
|
| 35 |
+
function, provider rule, event, wrapper, or delivery path and the supplied
|
| 36 |
+
context leaves the central routing topic ambiguous, ground the classification
|
| 37 |
+
in the smallest available repository evidence. Treat labels and changed-file
|
| 38 |
+
lists as hints, not proof. If source evidence would not change the topic,
|
| 39 |
+
answer directly.
|
| 40 |
+
|
| 41 |
+
### source-grounding
|
| 42 |
+
|
| 43 |
+
## Source Grounding Check
|
| 44 |
+
|
| 45 |
+
Before choosing topics, decide whether the item is about a named runtime path,
|
| 46 |
+
handler, wrapper, projection, provider predicate, or test expectation. For
|
| 47 |
+
those code-specific items, resolve only enough repository evidence to identify
|
| 48 |
+
the central behavior when the GitHub excerpt is partial or ambiguous. Keep the
|
| 49 |
+
inspection narrow and ignore implementation details that do not affect routing.
|
| 50 |
+
|
| 51 |
+
### truncation-aware
|
| 52 |
+
|
| 53 |
+
## Truncation And Evidence
|
| 54 |
+
|
| 55 |
+
When the GitHub context says body, comments, file lists, or diffs were
|
| 56 |
+
truncated, avoid relying on broad labels alone. Prefer the nearest primary
|
| 57 |
+
repository evidence for the named file, function, or behavior if that evidence
|
| 58 |
+
could change the selected topic. If the available context already identifies
|
| 59 |
+
the maintainer bucket, continue without extra inspection.
|
| 60 |
+
|
| 61 |
+
## Per-Run Results
|
| 62 |
+
|
| 63 |
+
| Variant | Target | Status | Bash calls | Successful bash calls | Final JSON calls | Commands |
|
| 64 |
+
|---|---|---:|---:|---:|---:|---|
|
| 65 |
+
| baseline | openclaw/openclaw#84509 | 0 | 0 | 0 | 3 | |
|
| 66 |
+
| baseline | openclaw/openclaw#91046 | 0 | 0 | 0 | 1 | |
|
| 67 |
+
| baseline | openclaw/openclaw#81443 | 0 | 0 | 0 | 3 | |
|
| 68 |
+
| baseline | openclaw/openclaw#88504 | 0 | 0 | 0 | 1 | |
|
| 69 |
+
| baseline | openclaw/openclaw#88875 | 0 | 0 | 0 | 1 | |
|
| 70 |
+
| baseline | openclaw/openclaw#52126 | 0 | 0 | 0 | 1 | |
|
| 71 |
+
| evidence-light | openclaw/openclaw#84509 | 0 | 0 | 0 | 3 | |
|
| 72 |
+
| evidence-light | openclaw/openclaw#91046 | 0 | 0 | 0 | 1 | |
|
| 73 |
+
| evidence-light | openclaw/openclaw#81443 | 0 | 0 | 0 | 1 | |
|
| 74 |
+
| evidence-light | openclaw/openclaw#88504 | 0 | 0 | 0 | 1 | |
|
| 75 |
+
| evidence-light | openclaw/openclaw#88875 | 0 | 0 | 0 | 1 | |
|
| 76 |
+
| evidence-light | openclaw/openclaw#52126 | 0 | 0 | 0 | 1 | |
|
| 77 |
+
| source-grounding | openclaw/openclaw#84509 | 0 | 0 | 0 | 1 | |
|
| 78 |
+
| source-grounding | openclaw/openclaw#91046 | 0 | 0 | 0 | 1 | |
|
| 79 |
+
| source-grounding | openclaw/openclaw#81443 | 0 | 0 | 0 | 1 | |
|
| 80 |
+
| source-grounding | openclaw/openclaw#88504 | 0 | 0 | 0 | 1 | |
|
| 81 |
+
| source-grounding | openclaw/openclaw#88875 | 0 | 0 | 0 | 1 | |
|
| 82 |
+
| source-grounding | openclaw/openclaw#52126 | 0 | 0 | 0 | 1 | |
|
| 83 |
+
| truncation-aware | openclaw/openclaw#84509 | 0 | 0 | 0 | 1 | |
|
| 84 |
+
| truncation-aware | openclaw/openclaw#91046 | 0 | 0 | 0 | 1 | |
|
| 85 |
+
| truncation-aware | openclaw/openclaw#81443 | 0 | 0 | 0 | 1 | |
|
| 86 |
+
| truncation-aware | openclaw/openclaw#88504 | 0 | 0 | 0 | 1 | |
|
| 87 |
+
| truncation-aware | openclaw/openclaw#88875 | 0 | 0 | 0 | 1 | |
|
| 88 |
+
| truncation-aware | openclaw/openclaw#52126 | 0 | 0 | 0 | 1 | |
|
| 89 |
+
|
| 90 |
+
Full machine-readable output: `results.json`.
|
experiments/reposhell-prompt-propensity/run-20260615T143851Z/agent-state/pi-config-runtime/auth.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{}
|
experiments/reposhell-prompt-propensity/run-20260615T143851Z/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": "gemma-4-e4b-it",
|
| 14 |
+
"name": "Local model (gemma-4-e4b-it)",
|
| 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-20260615T143851Z/agent-state/pi-config-runtime/settings.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"defaultProvider": "local-openai",
|
| 3 |
+
"defaultModel": "gemma-4-e4b-it",
|
| 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-20260615T143851Z/agent-state/reposhell/run-3NhAn3/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-20260615T143851Z/agent-state/reposhell/run-5UZUUG/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-20260615T143851Z/agent-state/reposhell/run-7IIyRn/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-20260615T143851Z/agent-state/reposhell/run-8GI8Q6/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-20260615T143851Z/agent-state/reposhell/run-9dSCU5/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-20260615T143851Z/agent-state/reposhell/run-DrR6yS/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-20260615T143851Z/agent-state/reposhell/run-ETnRKy/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-20260615T143851Z/agent-state/reposhell/run-JzXZQ5/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-20260615T143851Z/agent-state/reposhell/run-NztNvQ/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-20260615T143851Z/agent-state/reposhell/run-QVZr1G/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-20260615T143851Z/agent-state/reposhell/run-STpIHB/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-20260615T143851Z/agent-state/reposhell/run-T5x1tz/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-20260615T143851Z/agent-state/reposhell/run-UZPmus/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-20260615T143851Z/agent-state/reposhell/run-YOgqTL/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-20260615T143851Z/agent-state/reposhell/run-jCasgH/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-20260615T143851Z/agent-state/reposhell/run-lpPj6d/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-20260615T143851Z/agent-state/reposhell/run-pKw5pP/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-20260615T143851Z/agent-state/reposhell/run-pWsmhS/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-20260615T143851Z/agent-state/reposhell/run-tGkRpy/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-20260615T143851Z/agent-state/reposhell/run-u0s9He/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-20260615T143851Z/agent-state/reposhell/run-vVMQR0/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-20260615T143851Z/agent-state/reposhell/run-xaOuSX/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-20260615T143851Z/agent-state/reposhell/run-xaiRby/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-20260615T143851Z/agent-state/reposhell/run-xjNjX3/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-20260615T143851Z/agent-state/request-params/run-0ieK5t/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-20260615T143851Z/agent-state/request-params/run-4NoNiu/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-20260615T143851Z/agent-state/request-params/run-5gbl59/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-20260615T143851Z/agent-state/request-params/run-7RH1PU/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-20260615T143851Z/agent-state/request-params/run-87fl4J/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-20260615T143851Z/agent-state/request-params/run-9PHRXq/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-20260615T143851Z/agent-state/request-params/run-A46wM4/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-20260615T143851Z/agent-state/request-params/run-JACl83/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-20260615T143851Z/agent-state/request-params/run-LyeWg0/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-20260615T143851Z/agent-state/request-params/run-OWip5x/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-20260615T143851Z/agent-state/request-params/run-Q8aNBF/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-20260615T143851Z/agent-state/request-params/run-SuGPiw/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-20260615T143851Z/agent-state/request-params/run-XdCkY5/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-20260615T143851Z/agent-state/request-params/run-ZJJo1G/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-20260615T143851Z/agent-state/request-params/run-ZUWCrs/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-20260615T143851Z/agent-state/request-params/run-Zehefa/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-20260615T143851Z/agent-state/request-params/run-a1vDEa/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-20260615T143851Z/agent-state/request-params/run-d8wH8Z/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-20260615T143851Z/agent-state/request-params/run-dqhus9/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-20260615T143851Z/agent-state/request-params/run-ghtFUD/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-20260615T143851Z/agent-state/request-params/run-gwFUzL/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 |
+
}
|