@diegopetrucci/pi-extensions 0.1.55 → 0.1.57
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/.pi-fleet-tested-version +1 -1
- package/README.md +2 -2
- package/extensions/agent-workflow-audit/.pi-fleet-tested-version +1 -1
- package/extensions/agent-workflow-audit/package.json +1 -1
- package/extensions/annotate-git-diff/.pi-fleet-tested-version +1 -1
- package/extensions/annotate-git-diff/package.json +2 -2
- package/extensions/annotate-last-message/.pi-fleet-tested-version +1 -1
- package/extensions/annotate-last-message/package.json +1 -1
- package/extensions/brrr/.pi-fleet-tested-version +1 -1
- package/extensions/brrr/README.md +3 -3
- package/extensions/brrr/index.ts +26 -6
- package/extensions/brrr/package.json +1 -1
- package/extensions/claude-fast/.pi-fleet-tested-version +1 -1
- package/extensions/claude-fast/README.md +3 -3
- package/extensions/claude-fast/index.ts +1 -2
- package/extensions/claude-fast/package.json +1 -1
- package/extensions/code-reviewer/.pi-fleet-tested-version +1 -1
- package/extensions/code-reviewer/index.ts +27 -19
- package/extensions/code-reviewer/package.json +1 -1
- package/extensions/confirm-destructive/.pi-fleet-tested-version +1 -1
- package/extensions/confirm-destructive/package.json +1 -1
- package/extensions/context-cap/.pi-fleet-tested-version +1 -1
- package/extensions/context-cap/package.json +1 -1
- package/extensions/context-inspector/.pi-fleet-tested-version +1 -1
- package/extensions/context-inspector/README.md +4 -2
- package/extensions/context-inspector/index.ts +10 -4
- package/extensions/context-inspector/package.json +1 -1
- package/extensions/contrarian/.pi-fleet-tested-version +1 -1
- package/extensions/contrarian/index.ts +96 -92
- package/extensions/contrarian/package.json +1 -1
- package/extensions/dirty-repo-guard/.pi-fleet-tested-version +1 -1
- package/extensions/dirty-repo-guard/package.json +1 -1
- package/extensions/dynamic-context-pruning/.pi-fleet-tested-version +1 -1
- package/extensions/dynamic-context-pruning/package.json +1 -1
- package/extensions/git-footer/.pi-fleet-tested-version +1 -1
- package/extensions/git-footer/package.json +1 -1
- package/extensions/gnosis/.pi-fleet-tested-version +1 -1
- package/extensions/gnosis/package.json +1 -1
- package/extensions/illustrations-to-explain-things/.pi-fleet-tested-version +1 -1
- package/extensions/illustrations-to-explain-things/package.json +1 -1
- package/extensions/inline-bash/.pi-fleet-tested-version +1 -1
- package/extensions/inline-bash/package.json +1 -1
- package/extensions/librarian/.pi-fleet-tested-version +1 -1
- package/extensions/librarian/README.md +1 -1
- package/extensions/librarian/index.ts +39 -8
- package/extensions/librarian/package.json +1 -1
- package/extensions/minimal-footer/.pi-fleet-tested-version +1 -1
- package/extensions/minimal-footer/README.md +3 -3
- package/extensions/minimal-footer/index.ts +1 -1
- package/extensions/minimal-footer/package.json +1 -1
- package/extensions/notify/.pi-fleet-tested-version +1 -1
- package/extensions/notify/README.md +3 -3
- package/extensions/notify/index.ts +4 -6
- package/extensions/notify/package.json +1 -1
- package/extensions/openai-fast/.pi-fleet-tested-version +1 -1
- package/extensions/openai-fast/README.md +5 -5
- package/extensions/openai-fast/index.ts +11 -5
- package/extensions/openai-fast/package.json +2 -2
- package/extensions/oracle/.pi-fleet-tested-version +1 -1
- package/extensions/oracle/index.ts +97 -90
- package/extensions/oracle/package.json +1 -1
- package/extensions/permission-gate/.pi-fleet-tested-version +1 -1
- package/extensions/permission-gate/README.md +11 -4
- package/extensions/permission-gate/index.ts +156 -17
- package/extensions/permission-gate/package.json +5 -3
- package/extensions/quiet-tools/.pi-fleet-tested-version +1 -1
- package/extensions/quiet-tools/package.json +1 -1
- package/extensions/review/.pi-fleet-tested-version +1 -1
- package/extensions/review/README.md +1 -1
- package/extensions/review/index.ts +4 -4
- package/extensions/review/package.json +1 -1
- package/extensions/todo/.pi-fleet-tested-version +1 -1
- package/extensions/todo/package.json +1 -1
- package/extensions/triage-comments/.pi-fleet-tested-version +1 -1
- package/extensions/triage-comments/package.json +1 -1
- package/package.json +9 -6
package/.pi-fleet-tested-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.80.
|
|
1
|
+
0.80.6
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ A collection of [pi](https://pi.dev) agent extensions I made. (btw, [I am also b
|
|
|
14
14
|
### Providers
|
|
15
15
|
|
|
16
16
|
- [`claude-fast`](./extensions/claude-fast): Adds `/claude-fast` to enable Anthropic Claude Fast mode for supported Claude Opus models by injecting `speed: "fast"`.
|
|
17
|
-
- [`openai-fast`](./extensions/openai-fast): Adds `/fast` to enable OpenAI Codex Fast mode for ChatGPT-auth GPT-5.4 and GPT-5.
|
|
17
|
+
- [`openai-fast`](./extensions/openai-fast): Adds `/fast` to enable OpenAI Codex Fast mode for ChatGPT-auth GPT-5.4, GPT-5.5, and GPT-5.6 Codex variants by injecting the priority service tier.
|
|
18
18
|
|
|
19
19
|
### UI
|
|
20
20
|
|
|
@@ -40,7 +40,7 @@ A collection of [pi](https://pi.dev) agent extensions I made. (btw, [I am also b
|
|
|
40
40
|
|
|
41
41
|
- [`confirm-destructive`](./extensions/confirm-destructive): Confirms before destructive session actions like clear, switch, and fork.
|
|
42
42
|
- [`dirty-repo-guard`](./extensions/dirty-repo-guard): Prompts before new sessions, session switches, or forks when the current git repo has uncommitted changes.
|
|
43
|
-
- [`permission-gate`](./extensions/permission-gate): Prompts for confirmation before dangerous bash commands
|
|
43
|
+
- [`permission-gate`](./extensions/permission-gate): Prompts for confirmation before dangerous bash commands and protected `write`/`edit` targets like `.git`, `node_modules`, and secret-bearing `.env` files.
|
|
44
44
|
|
|
45
45
|
### Quality of life
|
|
46
46
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.80.
|
|
1
|
+
0.80.6
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.80.
|
|
1
|
+
0.80.6
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diegopetrucci/pi-annotate-git-diff",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "A standalone pi extension that adds /annotate-git-diff, a native Glimpse UI for annotating git diffs and sending feedback to the editor.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@earendil-works/pi-coding-agent": "*"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@tailwindcss/browser": "^4.3.
|
|
45
|
+
"@tailwindcss/browser": "^4.3.2",
|
|
46
46
|
"glimpseui": "^0.8.1",
|
|
47
47
|
"monaco-editor": "0.52.2"
|
|
48
48
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.80.
|
|
1
|
+
0.80.6
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diegopetrucci/pi-annotate-last-message",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "A standalone pi extension that adds /annotate-last-message, a native Glimpse UI for annotating the latest assistant reply.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.80.
|
|
1
|
+
0.80.6
|
|
@@ -32,10 +32,10 @@ Then reload pi:
|
|
|
32
32
|
|
|
33
33
|
Config files are merged, with project config overriding global config:
|
|
34
34
|
|
|
35
|
-
-
|
|
36
|
-
- `<project
|
|
35
|
+
- `~/<pi-config-dir>/agent/extensions/brrr.json`
|
|
36
|
+
- `<project>/<pi-config-dir>/brrr.json`
|
|
37
37
|
|
|
38
|
-
Project config is only read after Pi reports that the project is trusted.
|
|
38
|
+
Here `<pi-config-dir>` is Pi's runtime config directory name (`CONFIG_DIR_NAME`; `.pi` by default). Project config is only read after Pi reports that the project is trusted.
|
|
39
39
|
|
|
40
40
|
The default config expects your webhook in `BRRR_WEBHOOK_URL`:
|
|
41
41
|
|
package/extensions/brrr/index.ts
CHANGED
|
@@ -5,18 +5,17 @@
|
|
|
5
5
|
* for more input.
|
|
6
6
|
*
|
|
7
7
|
* Config files (project overrides global):
|
|
8
|
-
* -
|
|
9
|
-
* - <cwd
|
|
8
|
+
* - ~/<pi-config-dir>/agent/extensions/brrr.json
|
|
9
|
+
* - <cwd>/<pi-config-dir>/brrr.json, when the project is trusted
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { execFile } from "node:child_process";
|
|
13
13
|
import { existsSync, readFileSync } from "node:fs";
|
|
14
14
|
import { basename, join } from "node:path";
|
|
15
15
|
import { promisify } from "node:util";
|
|
16
|
-
import { getAgentDir, type ExtensionAPI, type ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
16
|
+
import { CONFIG_DIR_NAME, getAgentDir, type ExtensionAPI, type ExtensionCommandContext, type SessionEntry } from "@earendil-works/pi-coding-agent";
|
|
17
17
|
|
|
18
18
|
const execFileAsync = promisify(execFile);
|
|
19
|
-
const CONFIG_DIR_NAME = ".pi";
|
|
20
19
|
|
|
21
20
|
interface BrrrConfig {
|
|
22
21
|
enabled: boolean;
|
|
@@ -180,6 +179,25 @@ function lastAssistantMessage(messages: readonly unknown[]): string | undefined
|
|
|
180
179
|
return undefined;
|
|
181
180
|
}
|
|
182
181
|
|
|
182
|
+
type SessionMessageSource = {
|
|
183
|
+
buildContextEntries(): SessionEntry[];
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
function sessionMessages(sessionManager: SessionMessageSource | undefined): readonly unknown[] {
|
|
187
|
+
if (!sessionManager) return [];
|
|
188
|
+
|
|
189
|
+
return sessionManager
|
|
190
|
+
.buildContextEntries()
|
|
191
|
+
.flatMap((entry: SessionEntry) => (entry.type === "message" ? [entry.message] : []));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function resolveAssistantMessage(
|
|
195
|
+
sessionManager: SessionMessageSource | undefined,
|
|
196
|
+
fallbackMessages: readonly unknown[],
|
|
197
|
+
): string | undefined {
|
|
198
|
+
return lastAssistantMessage(sessionMessages(sessionManager)) ?? lastAssistantMessage(fallbackMessages);
|
|
199
|
+
}
|
|
200
|
+
|
|
183
201
|
function truncateMessage(value: string): string {
|
|
184
202
|
const trimmed = value.trim();
|
|
185
203
|
if (trimmed.length <= 800) return trimmed;
|
|
@@ -237,7 +255,7 @@ export default function brrrExtension(pi: ExtensionAPI) {
|
|
|
237
255
|
},
|
|
238
256
|
});
|
|
239
257
|
|
|
240
|
-
pi.on("
|
|
258
|
+
pi.on("agent_settled", async (event, ctx) => {
|
|
241
259
|
const config = loadConfig(ctx);
|
|
242
260
|
if (!config.enabled) return;
|
|
243
261
|
if (config.onlyWhenInteractive && !ctx.hasUI) return;
|
|
@@ -246,7 +264,9 @@ export default function brrrExtension(pi: ExtensionAPI) {
|
|
|
246
264
|
if (!webhook || !isBrrrWebhookUrl(webhook)) return;
|
|
247
265
|
if (await shouldSkipForIdleThreshold(config.idleSeconds)) return;
|
|
248
266
|
|
|
249
|
-
const assistantMessage = config.includeLastAssistantMessage
|
|
267
|
+
const assistantMessage = config.includeLastAssistantMessage
|
|
268
|
+
? resolveAssistantMessage(ctx.sessionManager, (event as { messages?: readonly unknown[] }).messages ?? [])
|
|
269
|
+
: undefined;
|
|
250
270
|
const message = truncateMessage(assistantMessage || formatTemplate(config.message, ctx.cwd));
|
|
251
271
|
const result = await sendBrrr(webhook, {
|
|
252
272
|
title: formatTemplate(config.title, ctx.cwd),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.80.
|
|
1
|
+
0.80.6
|
|
@@ -42,16 +42,16 @@ The extension defaults to off so installing the full collection does not acciden
|
|
|
42
42
|
Optional global config:
|
|
43
43
|
|
|
44
44
|
```text
|
|
45
|
-
|
|
45
|
+
~/<pi-config-dir>/agent/extensions/claude-fast.json
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
Optional project config:
|
|
49
49
|
|
|
50
50
|
```text
|
|
51
|
-
|
|
51
|
+
<project>/<pi-config-dir>/claude-fast.json
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Project config overrides global config after Pi reports that the project is trusted.
|
|
54
|
+
Here `<pi-config-dir>` is Pi's runtime config directory name (`CONFIG_DIR_NAME`; `.pi` by default). Project config overrides global config after Pi reports that the project is trusted.
|
|
55
55
|
|
|
56
56
|
```json
|
|
57
57
|
{
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import {
|
|
4
|
+
CONFIG_DIR_NAME,
|
|
4
5
|
getAgentDir,
|
|
5
6
|
type ExtensionAPI,
|
|
6
7
|
type ExtensionContext,
|
|
7
8
|
} from "@earendil-works/pi-coding-agent";
|
|
8
9
|
|
|
9
|
-
const CONFIG_DIR_NAME = ".pi";
|
|
10
|
-
|
|
11
10
|
const EXTENSION_ID = "claude-fast";
|
|
12
11
|
const PROVIDER_ID = "anthropic";
|
|
13
12
|
const API_ID = "anthropic-messages";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.80.
|
|
1
|
+
0.80.6
|
|
@@ -16,55 +16,63 @@ const MAX_TURNS = 8;
|
|
|
16
16
|
const MAX_RUN_MS = 8 * 60 * 1000;
|
|
17
17
|
const DEFAULT_BASH_TIMEOUT_SECONDS = 30;
|
|
18
18
|
const DEFAULT_THINKING_LEVEL = "high";
|
|
19
|
-
const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh"] as const;
|
|
19
|
+
const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"] as const;
|
|
20
20
|
|
|
21
21
|
type ThinkingLevel = (typeof THINKING_LEVELS)[number];
|
|
22
22
|
type ThinkingLevelMap = Partial<Record<ThinkingLevel, unknown | null>>;
|
|
23
23
|
const CODE_REVIEWER_MODEL_PREFERENCES = [
|
|
24
|
+
"gpt-5.6-sol",
|
|
25
|
+
"gpt-5.6-terra",
|
|
26
|
+
"gpt-5.6-luna",
|
|
24
27
|
"gpt-5.5",
|
|
25
28
|
"claude-opus-4-8",
|
|
26
29
|
"claude-opus-4.8",
|
|
27
|
-
"claude-sonnet-5-0",
|
|
28
|
-
"claude-sonnet-5.0",
|
|
29
30
|
"claude-sonnet-5",
|
|
30
31
|
"claude-sonnet-4-6",
|
|
31
32
|
"claude-sonnet-4.6",
|
|
32
33
|
"claude-sonnet-4-5",
|
|
33
34
|
"claude-sonnet-4.5",
|
|
34
|
-
"claude-sonnet-4-0",
|
|
35
35
|
"claude-sonnet-4",
|
|
36
|
+
"grok-4.5",
|
|
37
|
+
"gemini-3.5-flash",
|
|
36
38
|
];
|
|
37
39
|
const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
|
|
38
40
|
"amazon-bedrock": [
|
|
39
41
|
"claude-fable-5",
|
|
40
42
|
"claude-opus-4-8",
|
|
41
|
-
"claude-opus-4.8",
|
|
42
43
|
"claude-sonnet-5",
|
|
43
44
|
"claude-sonnet-4-6",
|
|
44
|
-
"claude-sonnet-4.6",
|
|
45
45
|
"claude-sonnet-4-5",
|
|
46
|
-
"claude-sonnet-4.5",
|
|
47
|
-
"claude-sonnet-4",
|
|
48
46
|
],
|
|
49
47
|
anthropic: [
|
|
50
48
|
"claude-fable-5",
|
|
51
49
|
"claude-opus-4-8",
|
|
52
|
-
"claude-opus-4.8",
|
|
53
50
|
"claude-sonnet-5",
|
|
54
51
|
"claude-sonnet-4-6",
|
|
55
|
-
"claude-sonnet-4.6",
|
|
56
52
|
"claude-sonnet-4-5",
|
|
57
|
-
"claude-sonnet-4.5",
|
|
58
|
-
"claude-sonnet-4",
|
|
59
53
|
],
|
|
60
|
-
openai: ["gpt-5.5", "gpt-5", "gpt-4.1", "o3", "o4-mini"
|
|
61
|
-
"
|
|
54
|
+
openai: ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-5.5", "gpt-5", "gpt-4.1", "o3", "o4-mini"],
|
|
55
|
+
"openai-codex": [
|
|
56
|
+
"gpt-5.6-sol",
|
|
57
|
+
"gpt-5.6-terra",
|
|
58
|
+
"gpt-5.6-luna",
|
|
62
59
|
"gpt-5.5",
|
|
60
|
+
"gpt-5.4",
|
|
61
|
+
"gpt-5.4-mini",
|
|
62
|
+
"gpt-5.3-codex-spark",
|
|
63
|
+
],
|
|
64
|
+
"vercel-ai-gateway": [
|
|
63
65
|
"anthropic/claude-fable-5",
|
|
64
|
-
"anthropic/claude-opus-4.
|
|
65
|
-
"anthropic/claude-opus-4",
|
|
66
|
+
"anthropic/claude-opus-4.8",
|
|
67
|
+
"anthropic/claude-opus-4.7",
|
|
68
|
+
"anthropic/claude-opus-4.6",
|
|
66
69
|
"anthropic/claude-sonnet-5",
|
|
67
|
-
"
|
|
70
|
+
"openai/gpt-5.6-sol",
|
|
71
|
+
"openai/gpt-5.6-terra",
|
|
72
|
+
"openai/gpt-5.6-luna",
|
|
73
|
+
"openai/gpt-5.5",
|
|
74
|
+
"xai/grok-4.5",
|
|
75
|
+
"google/gemini-3.5-flash",
|
|
68
76
|
],
|
|
69
77
|
};
|
|
70
78
|
|
|
@@ -392,8 +400,8 @@ function isThinkingLevelSupported(model: PiModel, level: ThinkingLevel): boolean
|
|
|
392
400
|
if (!model.reasoning) return level === "off";
|
|
393
401
|
|
|
394
402
|
const map = model.thinkingLevelMap;
|
|
395
|
-
if (level === "xhigh") {
|
|
396
|
-
return !!map && Object.prototype.hasOwnProperty.call(map,
|
|
403
|
+
if (level === "xhigh" || level === "max") {
|
|
404
|
+
return !!map && Object.prototype.hasOwnProperty.call(map, level) && map[level] != null;
|
|
397
405
|
}
|
|
398
406
|
return map?.[level] !== null;
|
|
399
407
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.80.
|
|
1
|
+
0.80.6
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.80.
|
|
1
|
+
0.80.6
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.80.
|
|
1
|
+
0.80.6
|
|
@@ -28,17 +28,19 @@ The report is self-contained HTML written locally with private file permissions.
|
|
|
28
28
|
Options:
|
|
29
29
|
|
|
30
30
|
- `--no-open`: write the HTML report but do not open a browser.
|
|
31
|
-
- `--keep`: save under
|
|
31
|
+
- `--keep`: save under `<pi-config-dir>/context-reports/` instead of the OS temp directory.
|
|
32
32
|
- `--redact`: keep token attribution but hide message/tool contents plus paths, commands, session identifiers, and timestamps in the report.
|
|
33
33
|
- `--full`: open the report on the full active branch tab by default.
|
|
34
34
|
|
|
35
|
+
`<pi-config-dir>` is Pi's runtime config directory name (`CONFIG_DIR_NAME`; `.pi` by default).
|
|
36
|
+
|
|
35
37
|
## Notes
|
|
36
38
|
|
|
37
39
|
- Per-component token counts are estimates. Providers expose aggregate usage, not exact token attribution per message or block.
|
|
38
40
|
- The current-context chart reconciles to pi's footer-compatible context total when pi knows it.
|
|
39
41
|
- Immediately after compaction, pi may not know exact current context usage until the next model response.
|
|
40
42
|
- The full branch tab includes old pre-compaction history for inspection; that history is not necessarily sent verbatim to the model.
|
|
41
|
-
- `--keep` writes reports under
|
|
43
|
+
- `--keep` writes reports under `<pi-config-dir>/context-reports/`; avoid committing those reports because they can contain sensitive session data unless redacted.
|
|
42
44
|
|
|
43
45
|
## Install
|
|
44
46
|
|
|
@@ -2,7 +2,7 @@ import { chmodSync, mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
-
import type
|
|
5
|
+
import { CONFIG_DIR_NAME, type ExtensionAPI, type ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
6
6
|
|
|
7
7
|
const EXTENSION_ID = "context-inspector";
|
|
8
8
|
const IMAGE_TOKEN_ESTIMATE = 1200;
|
|
@@ -309,7 +309,7 @@ function usageText(): string {
|
|
|
309
309
|
"",
|
|
310
310
|
"Options:",
|
|
311
311
|
" --no-open Write the report but do not open a browser.",
|
|
312
|
-
" --keep Save under
|
|
312
|
+
" --keep Save under " + CONFIG_DIR_NAME + "/context-reports/ instead of the OS temp directory.",
|
|
313
313
|
" --redact Hide message/tool contents while keeping token attribution.",
|
|
314
314
|
" --full Open the report on the full active branch tab instead of current context.",
|
|
315
315
|
].join("\n");
|
|
@@ -757,6 +757,12 @@ function collectCurrentContextEntries(branchEntries: MinimalEntry[]): MinimalEnt
|
|
|
757
757
|
return result;
|
|
758
758
|
}
|
|
759
759
|
|
|
760
|
+
function resolveCurrentContextEntries(ctx: ExtensionCommandContext, branchEntries: MinimalEntry[]): MinimalEntry[] {
|
|
761
|
+
const currentEntries = safeCall(() => ctx.sessionManager.buildContextEntries()) as MinimalEntry[] | undefined;
|
|
762
|
+
if (Array.isArray(currentEntries)) return currentEntries;
|
|
763
|
+
return collectCurrentContextEntries(branchEntries);
|
|
764
|
+
}
|
|
765
|
+
|
|
760
766
|
function analyzeEntries(entries: MinimalEntry[], redact: boolean): { segments: Segment[]; messageCount: number } {
|
|
761
767
|
const state: AnalyzerState = { segments: [], sequence: 0, turn: 0, redact };
|
|
762
768
|
let messageCount = 0;
|
|
@@ -921,7 +927,7 @@ function getSessionName(ctx: ExtensionCommandContext): string | undefined {
|
|
|
921
927
|
|
|
922
928
|
function buildReportData(pi: ExtensionAPI, ctx: ExtensionCommandContext, options: CommandOptions): ReportData {
|
|
923
929
|
const branchEntries = ctx.sessionManager.getBranch() as MinimalEntry[];
|
|
924
|
-
const currentEntries =
|
|
930
|
+
const currentEntries = resolveCurrentContextEntries(ctx, branchEntries);
|
|
925
931
|
const overhead = buildOverheadSegments(pi, ctx, options.redact);
|
|
926
932
|
const currentAnalysis = analyzeEntries(currentEntries, options.redact);
|
|
927
933
|
const fullAnalysis = analyzeEntries(branchEntries, options.redact);
|
|
@@ -1006,7 +1012,7 @@ function reportPath(ctx: ExtensionCommandContext, options: CommandOptions): stri
|
|
|
1006
1012
|
const rawSessionId = options.redact ? "redacted" : (safeCall(() => ctx.sessionManager.getSessionId()) ?? "session");
|
|
1007
1013
|
const fileName = `pi-context-${sanitizeFilePart(rawSessionId)}-${Date.now()}.html`;
|
|
1008
1014
|
if (options.keep) {
|
|
1009
|
-
const dir = join(ctx.cwd,
|
|
1015
|
+
const dir = join(ctx.cwd, CONFIG_DIR_NAME, "context-reports");
|
|
1010
1016
|
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
1011
1017
|
try { chmodSync(dir, 0o700); } catch { /* best effort */ }
|
|
1012
1018
|
return join(dir, fileName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.80.
|
|
1
|
+
0.80.6
|