@trim21/personal-pi-extensions 0.0.273 → 0.0.277

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trim21/personal-pi-extensions",
3
- "version": "0.0.273",
3
+ "version": "0.0.277",
4
4
  "type": "module",
5
5
  "description": "Custom pi coding-agent extensions: bwrap sandbox, workspace guard, opencode edit, and more",
6
6
  "keywords": [
@@ -65,8 +65,7 @@
65
65
  "src/talk/index.ts"
66
66
  ],
67
67
  "skills": [
68
- "src/talk/skills",
69
- "src/claude-code/skills"
68
+ "src/talk/skills"
70
69
  ]
71
70
  },
72
71
  "lint-staged": {
package/src/talk/core.ts CHANGED
@@ -112,6 +112,7 @@ export class TalkCore {
112
112
  private inboxPoll: ReturnType<typeof setInterval> | undefined;
113
113
  private watchPoller: ReturnType<typeof setInterval> | undefined;
114
114
  private sweeper: ReturnType<typeof setInterval> | undefined;
115
+ private initialDrain: ReturnType<typeof setTimeout> | undefined;
115
116
  private lastDeliveryFailureAt = 0;
116
117
 
117
118
  constructor(options: TalkCoreOptions) {
@@ -155,9 +156,11 @@ export class TalkCore {
155
156
  void this.checkInbox();
156
157
  }, INITIAL_DRAIN_DELAY_MS);
157
158
  initial.unref();
159
+ this.initialDrain = initial;
158
160
  }
159
161
 
160
162
  async stop(): Promise<void> {
163
+ if (this.initialDrain) clearTimeout(this.initialDrain);
161
164
  if (this.watchPoller) clearInterval(this.watchPoller);
162
165
  if (this.inboxPoll) clearInterval(this.inboxPoll);
163
166
  if (this.sweeper) clearInterval(this.sweeper);
@@ -1,75 +0,0 @@
1
- ---
2
- name: claude-code-tools
3
- description: Exact behavior of the Claude Code style tools (Read/Edit/Write/Grep/Glob/Bash/TodoWrite/AskUserQuestion) in the @trim21/personal-pi-extensions package: output formats, matching rules, read-before-write requirements, pagination semantics, and conventions. Load whenever you use these tools or are unsure how they behave.
4
- ---
5
-
6
- # Claude Code Tools Behavior
7
-
8
- This package registers two parallel tool suites: opencode style (lowercase `read`/`edit`/`write`/`bash`/`todowrite`/`question`) and Claude Code style (capitalized `Read`/`Edit`/`Write`/`Bash`/`Grep`/`Glob`/`TodoWrite`/`AskUserQuestion`). They share the bwrap sandbox and write-guard. **Only one suite should be enabled** — enabling both duplicates commands (e.g. `/bwrap` vs `/bwrap:1`) and injects the bwrap system-prompt section twice.
9
-
10
- The capitalized tools below follow Claude Code behavior with a few deliberate deviations. Where behavior differs from stock Claude Code it is called out.
11
-
12
- ## Read
13
-
14
- - Output is `<lineNumber>\t<content>` per line, 1-indexed, **no padding** (compact format).
15
- - Input is normalized: UTF-8 BOM stripped, `\r\n` → `\n` (CRLF stripped), and a trailing empty line is always present — **`totalLines` is one more than the editor line count** for non-empty files.
16
- - By default reads the **entire file**, capped at 256 KB (bytes) and a rough 25K-token estimate (4 chars/token, no tokenizer). Whole reads over either cap error with `File content (X) exceeds maximum allowed size/tokens (...) — use offset and limit`; providing `limit` bypasses the byte cap and only the selected range counts toward the token cap.
17
- - `offset`/`limit` are 1-based positive integers. Out-of-range offset returns `Warning: the file exists but is shorter than the provided offset (N). The file has M lines.`; empty files return `Warning: the file exists but the contents are empty.`
18
- - Missing file → `File does not exist. Note: your current working directory is <cwd>.` plus a `Did you mean ...?` suggestion (same-base different-extension, or a corrected path under cwd).
19
-
20
- ## Edit / Write
21
-
22
- - **You must Read a file before editing or overwriting it.** The tool compares a content digest against the last read; after your own Edit/Write the recorded digest is refreshed, so consecutive edits by you are fine. An external change (user edit, linter, another process) triggers `File has been modified since read, either by the user or by a linter. Read it again before attempting to write it.` — re-Read before writing.
23
- - **Deviation from Claude Code:** staleness is checked by content digest, not mtime.
24
-
25
- ### Edit specifics
26
-
27
- - Matching first tries an exact match, then a **quote-normalized match** (curly quotes in the file match straight quotes from the model); the replacement inherits the file's curly-quote style.
28
- - Matching happens on CRLF-normalized content — `old_string` never needs `\r` — and the file's dominant line ending is restored on write.
29
- - Empty `old_string` means create-or-fill: nonexistent file → create it; empty file → fill it; non-empty file → `Cannot create new file - file already exists.` Neither create nor fill requires a prior Read.
30
- - `old_string === new_string` → `No changes to make: old_string and new_string are exactly the same.`
31
- - Not found → `String to replace not found in file.\nString: <old_string>`
32
- - Multiple matches without `replace_all` → error listing the match count and asking for more context, with `\nString: <old_string>`.
33
- - `replace_all: true` success message: `The file X has been updated. All occurrences were successfully replaced.`
34
- - Missing file → `File does not exist. Note: your current working directory is <cwd>.` plus a `Did you mean ...?` suggestion (same-base different-extension, or a corrected path under cwd).
35
- - Files over 1 GiB are refused; `.ipynb` files are refused.
36
-
37
- ### Write specifics
38
-
39
- - Creating a new file → `File created successfully at: X`; overwriting an existing file → `The file X has been updated successfully.` (the distinction is reported even though both are one tool).
40
- - New files need no prior Read; overwriting does.
41
-
42
- ## Grep
43
-
44
- - Modes: `files_with_matches` (default), `content`, `count`. All output paths are **relative to cwd** (absolute when outside cwd).
45
- - `files_with_matches`: `Found N files\n<relative paths>` sorted by mtime, newest first. No matches → `No files found`.
46
- - `content`: `path:line:content` lines. No matches → `No matches found`.
47
- - `count`: per-file match-line counts (`-c` semantics, not match occurrences) plus `Found N total occurrences across M files.` No matches → `No matches found` + `Found 0 total occurrences across 0 files.`
48
- - `head_limit` defaults to 250 (0 = unlimited), `offset` skips entries. When truncation or offset actually applied, a pagination note is appended (`limit: N, offset: N`), e.g. `[Showing results with pagination = limit: N, offset: N]`.
49
- - `glob` accepts comma/space-separated patterns (brace patterns not split). `-i`, `-B/-A/-C`/`context`, `-n` (default true in content mode), `type`, `multiline` map to ripgrep flags. VCS dirs (`.git` etc.) are excluded.
50
- - A missing `path` → `Path does not exist: ... Note: your current working directory is <cwd>.` with a corrected-path suggestion when applicable.
51
-
52
- ## Glob
53
-
54
- - Backed by ripgrep (`--files --sort=modified`): results are **oldest first**, hidden files included, `.git` excluded, up to 100 results.
55
- - Output paths are relative to cwd. When truncated, a final line `(Results are truncated. Consider using a more specific path or pattern.)` is appended.
56
- - No matches → `No files found`. `path` must be an existing directory, else `Directory does not exist: ...` / `Path is not a directory: ...`.
57
-
58
- ## Bash
59
-
60
- - Commands run through the bwrap sandbox (modes: `allow-all` / `workspace-write` / `allow-net` / `readonly`), switchable via `/bwrap-*` commands. `dangerouslyDisableSandbox: true` requests one-time unsandboxed execution. Approval flow: commands are parsed (tree-sitter, including nested `$(...)`) and matched against `approvalRules` from `bwrap.json` — an `allow` rule auto-approves, a `deny` rule rejects outright (last matching rule wins), and only unmatched commands show the approval dialog. In headless sessions unsandboxed execution is denied.
61
- - `timeout` is in milliseconds, default 120000, max 600000. `workdir` overrides the working directory.
62
- - **Non-zero exit code is a tool failure**: the error text starts with `Exit code N` followed by the full output (head/tail-truncated at 10000 chars if larger). **Deviation from Claude Code:** no command-semantics special cases — `grep` with no matches (exit 1), `diff` differences, `test` false, etc. all fail like any other non-zero exit.
63
- - Output is streamed to a file under `agent-dir/tmp/<uuid>.txt` during execution; the tool result only contains the truncated tail (2000 lines / 50 KB). On truncation a note is appended: `[Showing lines X-Y of N. Full output: <path>]` — read that file for the complete output. In a read-only sandbox where the write fails, the result degrades to the in-memory tail only.
64
- - **Deviation from Claude Code:** no auto-backgrounding on timeout — a timed-out command is killed and the error reports `Command timed out after N milliseconds`.
65
- - The lowercase opencode-style `bash` tool differs: it **never throws** on non-zero exit — it returns the output plus a `Command exited with code N.` status text block; a timeout returns `Command exceeded timeout of N ms. Retry with a larger timeout...` instead of failing.
66
-
67
- ## TodoWrite
68
-
69
- - Full-list replacement semantics: pass the complete updated list every call; exactly one `in_progress` allowed; statuses `pending` | `in_progress` | `completed`; each item needs `content` and `activeForm`.
70
- - The list renders as a widget and is persisted in tool `details`; after a restart the widget is restored from the session branch. The list is **not** auto-cleared when all items are completed.
71
-
72
- ## AskUserQuestion
73
-
74
- - Blocking: 1–4 questions, 2–4 options each; `multiSelect` for multiple selection. An `Other` free-text option is provided automatically.
75
- - Returns `User has answered your questions: "q"="a", ... . You can now continue with the user's answers in mind.`