@henryqw/pi-auto-compact 1.0.1 → 1.0.3

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/README.md CHANGED
@@ -9,7 +9,13 @@ pi install npm:@henryqw/pi-task-models
9
9
  pi install npm:@henryqw/pi-auto-compact
10
10
  ```
11
11
 
12
- `pi-task-models` provides `/task-models` for the shared compaction routes. Requires Pi Coding Agent 0.84.2+.
12
+ Requires Pi Coding Agent 0.84.2+.
13
+
14
+ ## With
15
+
16
+ | Package | Why |
17
+ | --- | --- |
18
+ | `@henryqw/pi-task-models` | Required. Shared model profiles for compaction routes. |
13
19
 
14
20
  Disable Pi's built-in auto-compaction in `~/.pi/agent/settings.json`:
15
21
 
@@ -21,16 +27,15 @@ Disable Pi's built-in auto-compaction in `~/.pi/agent/settings.json`:
21
27
  }
22
28
  ```
23
29
 
24
- Restart Pi after install or settings changes. Trusted project settings in `.pi/settings.json` must not set `compaction.enabled` back to `true`. Manual `/compact` stays available.
30
+ Restart Pi after install or settings changes. Trusted project settings in `.pi/settings.json` must not set `compaction.enabled` back to `true`.
25
31
 
26
32
  ## Use
27
33
 
28
- | Surface | Purpose |
29
- | --- | --- |
30
- | `/auto-compact` | Set the compaction threshold. |
31
- | `/task-models` | Configure the shared `pi-auto-compact/autoCompact` profile (default `balanced`). |
34
+ | Surface | Type | Purpose |
35
+ | --- | --- | --- |
36
+ | `/auto-compact` | command | Set the compaction threshold. |
32
37
 
33
- Refuses to activate unless effective `compaction.enabled` is `false`. Checks `turn_start`, tool-call `turn_end`, `agent_end`, `context`, and resumed or forked `session_start`. Tries the assigned profile primary, then fallback; if neither route works, the current session model still compacts. After mid-task compaction, a follow-up message continues the current task.
38
+ Refuses to activate unless effective `compaction.enabled` is `false`. Checks `turn_start`, tool-call `turn_end`, `agent_end`, `context`, and resumed or forked `session_start`. `pi-auto-compact/autoCompact` defaults to the `fast` profile. Tries the assigned profile primary, then fallback; if neither route works, the current session model still compacts. After mid-task compaction, a follow-up message continues the current task.
34
39
 
35
40
  ## Config
36
41
 
@@ -11,6 +11,7 @@ import type {
11
11
  ExtensionContext,
12
12
  } from "@earendil-works/pi-coding-agent";
13
13
  import {
14
+ DEFAULT_TASK_ASSIGNMENTS,
14
15
  orderedProfileRoutes,
15
16
  readTaskModelsConfig,
16
17
  resolveTaskModelRoute,
@@ -32,7 +33,7 @@ type AgentMessage = Parameters<typeof estimateTokens>[0];
32
33
  const DEFAULT_COMPACT_THRESHOLD_PERCENT = 50;
33
34
  const MIN_COMPACT_THRESHOLD_PERCENT = 25;
34
35
  const AUTO_COMPACT_TASK = "pi-auto-compact/autoCompact";
35
- const DEFAULT_AUTO_COMPACT_PROFILE = "balanced" as const;
36
+ const DEFAULT_AUTO_COMPACT_PROFILE = DEFAULT_TASK_ASSIGNMENTS[AUTO_COMPACT_TASK];
36
37
  const configPath = () => join(getAgentDir(), "config", "pi-auto-compact.json");
37
38
 
38
39
  type Config = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-auto-compact",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Proactively compact Pi context at a configurable threshold and resume the current task.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -45,6 +45,6 @@
45
45
  ]
46
46
  },
47
47
  "dependencies": {
48
- "@henryqw/pi-task-models": "^0.1.0"
48
+ "@henryqw/pi-task-models": "^0.3.0"
49
49
  }
50
50
  }