proper-base 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +186 -0
- package/index.ts +596 -0
- package/install.mjs +84 -0
- package/package.json +68 -0
- package/src/autocomplete-details.ts +406 -0
- package/src/editor-navigation.ts +451 -0
- package/src/footer-colors.ts +382 -0
- package/src/history-guard.ts +32 -0
- package/src/history.ts +87 -0
- package/src/image-context.ts +44 -0
- package/src/image-preview.ts +296 -0
- package/src/jump-to-bottom.ts +126 -0
- package/src/prompt-display.ts +101 -0
- package/src/recorder.ts +61 -0
- package/src/smart-selection.ts +155 -0
- package/src/store.ts +162 -0
- package/src/transcript-cleanup.ts +561 -0
- package/src/transient-retry.ts +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mamba
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# proper-base
|
|
2
|
+
|
|
3
|
+
Baseline [Pi](https://pi.dev) behavior for quieter transcripts, automatic
|
|
4
|
+
session titles, model-preserving `/clear`, project prompt history, prompt
|
|
5
|
+
editing, fullscreen navigation, image handling, cancellation, autocomplete,
|
|
6
|
+
and footer layout.
|
|
7
|
+
|
|
8
|
+
## User-facing features
|
|
9
|
+
|
|
10
|
+
### Sessions and transcript
|
|
11
|
+
|
|
12
|
+
- Completed tools and errors collapse into separate one-line rows after a run
|
|
13
|
+
settles. Click one row to expand it, use its `collapse` control to close it,
|
|
14
|
+
or use Pi's normal tool-output shortcut, Ctrl+O by default, for all rows.
|
|
15
|
+
Settlement resets Pi's global tool-output state to collapsed. Thoughts,
|
|
16
|
+
tool-calling text, direct replies, and agent status updates remain fully
|
|
17
|
+
visible and in their original order.
|
|
18
|
+
- A fresh unnamed session gets a hidden 3 to 7 word title from the first
|
|
19
|
+
successful assistant response. Existing, resumed, and already-named sessions
|
|
20
|
+
keep their names.
|
|
21
|
+
- `/clear` starts an empty session but restores the exact provider and model
|
|
22
|
+
selected in the previous one. No messages, name, or branch state carry over.
|
|
23
|
+
- Prompt-template expansions remain model-facing, while the transcript shows
|
|
24
|
+
the slash command you typed, such as `/implement-ready epic-1 4`.
|
|
25
|
+
- CLIProxyAPI `empty_stream` failures become normal retryable network errors, so
|
|
26
|
+
Pi applies its existing retry budget and backoff.
|
|
27
|
+
|
|
28
|
+
### Prompt editing and cancellation
|
|
29
|
+
|
|
30
|
+
| Input | Behavior |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| Shift+Enter or Alt+Enter | Insert a newline. Alt+Enter no longer queues a follow-up. |
|
|
33
|
+
| Home | Move to the current visible-row start, then the full prompt start. |
|
|
34
|
+
| End | Move to the current logical-line end, then the full prompt end. |
|
|
35
|
+
| Ctrl+C with text | Clear the prompt without arming exit. |
|
|
36
|
+
| Ctrl+C on an empty prompt | Show `Press Ctrl+C again to exit`; repeat within 500 ms to quit. |
|
|
37
|
+
| Esc before assistant work starts | Restore the submitted prompt and remove that turn from the active branch. |
|
|
38
|
+
| Esc after assistant work starts | Keep Pi's normal abort behavior. |
|
|
39
|
+
|
|
40
|
+
Dismissing an `ask_user_question` dialog with Esc aborts the run instead of
|
|
41
|
+
spending another model turn acknowledging the dismissal. Tool or host failures
|
|
42
|
+
still reach the model so it can ask in plain text.
|
|
43
|
+
|
|
44
|
+
### Project prompt history
|
|
45
|
+
|
|
46
|
+
proper-base records eligible editor submissions on a best-effort basis, not
|
|
47
|
+
transformed Pi session messages. History uses an encoded key derived from the
|
|
48
|
+
current working directory.
|
|
49
|
+
|
|
50
|
+
- Up and Down recall prompts from previous sessions in the same project.
|
|
51
|
+
- Ctrl+R starts case-sensitive reverse substring search. Press Ctrl+R again for
|
|
52
|
+
an older match, Backspace or Shift+Backspace to broaden the query, Enter to
|
|
53
|
+
submit, Esc to keep the match for editing, or Ctrl+G to restore the original
|
|
54
|
+
draft.
|
|
55
|
+
- Prompt templates and skills remain in their submitted slash form.
|
|
56
|
+
- Built-in and extension UI commands such as `/model`, `/new`, and
|
|
57
|
+
`/llm-router-config` are not recallable.
|
|
58
|
+
- Duplicate prompts keep their newest timestamp. The editor receives at most
|
|
59
|
+
200 entries.
|
|
60
|
+
|
|
61
|
+
History lives under `~/.pi/agent/proper-history/`. One private JSONL file is
|
|
62
|
+
created per encoded working-directory key. Unusual paths that produce the same
|
|
63
|
+
hyphen encoding can share a file. Prompts over 4096 characters are skipped
|
|
64
|
+
rather than truncated. Startup reads only the newest 512 KiB; stores above
|
|
65
|
+
2 MiB compact to the newest 2000 valid entries. A concurrent append during that
|
|
66
|
+
rare compaction can lose one entry. Delete one file to forget one key, or the
|
|
67
|
+
directory to forget all proper-base history.
|
|
68
|
+
|
|
69
|
+
### Autocomplete
|
|
70
|
+
|
|
71
|
+
- The selected autocomplete description appears in a non-capturing bordered
|
|
72
|
+
panel above the prompt without moving the editor, list, or footer.
|
|
73
|
+
- Slash-command completion works after whitespace and on later prompt lines.
|
|
74
|
+
It replaces only the active slash segment and ignores slashes inside paths
|
|
75
|
+
and URLs.
|
|
76
|
+
- `/model ` results sort by displayed model ID in descending numeric-aware
|
|
77
|
+
order. Typed terms must all match when strict matches exist.
|
|
78
|
+
- Enter or Tab switches immediately only when the complete prompt is a
|
|
79
|
+
single-line `/model ...` command. Inline and multiline slash segments only
|
|
80
|
+
receive the completion. Tab keeps its normal behavior elsewhere.
|
|
81
|
+
|
|
82
|
+
### Fullscreen navigation and selection
|
|
83
|
+
|
|
84
|
+
Enable Pi's native fullscreen mode with `/settings` or:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"tuiMode": "fullscreen"
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
proper-base keeps the prompt, queued messages, status, widgets, and footer
|
|
93
|
+
pinned while Pi scrolls the transcript above them.
|
|
94
|
+
|
|
95
|
+
| Input | Behavior in fullscreen mode |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| Home, End, PageUp, PageDown | Stay assigned to the prompt editor. |
|
|
98
|
+
| Ctrl+Shift+Home or End | Jump the transcript to its top or bottom. |
|
|
99
|
+
| Ctrl+Shift+PageUp or PageDown | Scroll the transcript by one page. |
|
|
100
|
+
| Double-click | Select a complete one-line URL, path, flag, qualified identifier, or quoted value when possible. |
|
|
101
|
+
|
|
102
|
+
Scrolling away from current output adds a `↓ jump to bottom` row above the
|
|
103
|
+
prompt. Clicking it returns to the newest output without disabling scrollbar
|
|
104
|
+
dragging.
|
|
105
|
+
|
|
106
|
+
### Clipboard and model image context
|
|
107
|
+
|
|
108
|
+
Ctrl+V and Ctrl+Shift+V both use Pi's image-or-text clipboard action. Readable
|
|
109
|
+
clipboard image paths appear as short `[image N]` markers, while a text-only
|
|
110
|
+
panel shows their source paths. Deleting inside a marker removes the whole
|
|
111
|
+
marker. On submit, each marker expands back to the path the agent can read.
|
|
112
|
+
|
|
113
|
+
proper-base never enables Kitty rendering or changes terminal image
|
|
114
|
+
capabilities. Images remain in model context for every tool loop in the turn
|
|
115
|
+
that introduced them. A later user message replaces older image blocks only in
|
|
116
|
+
the outbound context copy, so saved sessions, exports, resumes, and branches
|
|
117
|
+
retain the originals.
|
|
118
|
+
|
|
119
|
+
### Footer
|
|
120
|
+
|
|
121
|
+
The built-in footer keeps path, branch, cumulative input, output, cache, cost,
|
|
122
|
+
context use, model, and thinking effort visible in two compact rows. Stable
|
|
123
|
+
colors separate the metrics; context changes color above 70% and 90%.
|
|
124
|
+
Supported `max` and router-provided `ultra` effort levels use a slow rainbow
|
|
125
|
+
highlight. Custom replacement footers are not changed.
|
|
126
|
+
|
|
127
|
+
## Install
|
|
128
|
+
|
|
129
|
+
Node 22.19 or newer is required. The package is tested against Pi 0.84.2.
|
|
130
|
+
|
|
131
|
+
From npm:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pi install npm:proper-base
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
From a local checkout:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
npm install
|
|
141
|
+
pi install /path/to/proper-pi-extensions/proper-base
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Pi supplies the core `@earendil-works/pi-coding-agent` and
|
|
145
|
+
`@earendil-works/pi-tui` peer packages. Local `npm install` prepares development
|
|
146
|
+
tooling and runs the install-time settings seed; it is not a runtime build.
|
|
147
|
+
|
|
148
|
+
When an existing `settings.json` is readable, the postinstall hook sets
|
|
149
|
+
`subagents.agentOverrides.worker.defaultContext` to `fresh` if no worker
|
|
150
|
+
override exists. It leaves existing overrides, missing files, and unreadable
|
|
151
|
+
settings untouched. Installing with `--ignore-scripts` skips that default.
|
|
152
|
+
|
|
153
|
+
This package replaces the former local `proper-customs` identity. Keep only one
|
|
154
|
+
registration. Existing data under the legacy `proper-history` path remains
|
|
155
|
+
compatible.
|
|
156
|
+
|
|
157
|
+
## Compatibility
|
|
158
|
+
|
|
159
|
+
- Fullscreen behavior uses Pi's native `tuiMode: "fullscreen"` renderer.
|
|
160
|
+
- Questionnaire cancellation activates only when `ask_user_question` is
|
|
161
|
+
installed.
|
|
162
|
+
- Editor and footer wrappers compose with existing providers when their Pi
|
|
163
|
+
interfaces are compatible. Private Pi TUI changes or custom renderers may
|
|
164
|
+
disable individual enhancements; later-loaded replacements still win.
|
|
165
|
+
- Ctrl+Shift fullscreen keys require a terminal that reports modifiers
|
|
166
|
+
distinctly.
|
|
167
|
+
- proper-base has no extension-specific runtime config file or feature toggles.
|
|
168
|
+
- Slash commands beginning with `__proper-` are reserved for internal session
|
|
169
|
+
recovery.
|
|
170
|
+
|
|
171
|
+
## Development
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
npm test
|
|
175
|
+
npm run typecheck
|
|
176
|
+
npm run test:coverage
|
|
177
|
+
npm pack --dry-run
|
|
178
|
+
npm publish --dry-run
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
`prepack` runs tests and strict type checking before a tarball or publish. Tests
|
|
182
|
+
use Node's built-in runner. There is no build step.
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT
|