@agimon-ai/doompi-autocompact 0.0.1-alpha.8 → 0.0.1-alpha.80
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 +103 -18
- package/dist/apiContracts.cjs +17 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +53 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +13 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/compactionPolicy-Cs-Av0Wu.cjs +458 -0
- package/dist/compactionPolicy-Cs-Av0Wu.cjs.map +1 -0
- package/dist/compactionPolicy-DA7s42KV.mjs +327 -0
- package/dist/compactionPolicy-DA7s42KV.mjs.map +1 -0
- package/dist/extensions/pi.cjs +876 -1
- package/dist/extensions/pi.cjs.map +1 -1
- package/dist/extensions/pi.d.mts +5 -2
- package/dist/extensions/pi.d.mts.map +1 -0
- package/dist/extensions/pi.mjs +871 -1
- package/dist/extensions/pi.mjs.map +1 -1
- package/dist/extensions/server.cjs +39 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +34 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/extensions/web.mjs +161 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +3 -1
- package/dist/index.d.mts +11 -4
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -1
- package/package.json +80 -16
- package/dist/checkpointWorker.cjs +0 -2
- package/dist/checkpointWorker.cjs.map +0 -1
- package/dist/checkpointWorker.d.cts +0 -1
- package/dist/checkpointWorker.d.mts +0 -1
- package/dist/checkpointWorker.mjs +0 -2
- package/dist/checkpointWorker.mjs.map +0 -1
- package/dist/constants.cjs +0 -2
- package/dist/constants.cjs.map +0 -1
- package/dist/constants.mjs +0 -2
- package/dist/constants.mjs.map +0 -1
- package/dist/extension.cjs +0 -50
- package/dist/extension.cjs.map +0 -1
- package/dist/extension.d.cts +0 -36
- package/dist/extension.d.cts.map +0 -1
- package/dist/extension.d.mts +0 -36
- package/dist/extension.d.mts.map +0 -1
- package/dist/extension.mjs +0 -50
- package/dist/extension.mjs.map +0 -1
- package/dist/extensions/pi.d.cts +0 -2
- package/dist/index.d.cts +0 -4
- package/dist/logSinkTelemetry.cjs +0 -2
- package/dist/logSinkTelemetry.cjs.map +0 -1
- package/dist/logSinkTelemetry.d.cts +0 -26
- package/dist/logSinkTelemetry.d.cts.map +0 -1
- package/dist/logSinkTelemetry.d.mts +0 -26
- package/dist/logSinkTelemetry.d.mts.map +0 -1
- package/dist/logSinkTelemetry.mjs +0 -2
- package/dist/logSinkTelemetry.mjs.map +0 -1
- package/dist/policy.cjs +0 -8
- package/dist/policy.cjs.map +0 -1
- package/dist/policy.d.cts +0 -6
- package/dist/policy.d.cts.map +0 -1
- package/dist/policy.d.mts +0 -6
- package/dist/policy.d.mts.map +0 -1
- package/dist/policy.mjs +0 -8
- package/dist/policy.mjs.map +0 -1
- package/dist/standard.cjs +0 -2
- package/dist/standard.cjs.map +0 -1
- package/dist/standard.d.cts +0 -8
- package/dist/standard.d.cts.map +0 -1
- package/dist/standard.d.mts +0 -8
- package/dist/standard.d.mts.map +0 -1
- package/dist/standard.mjs +0 -2
- package/dist/standard.mjs.map +0 -1
- package/dist/summarizationModel.cjs +0 -2
- package/dist/summarizationModel.cjs.map +0 -1
- package/dist/summarizationModel.d.cts +0 -10
- package/dist/summarizationModel.d.cts.map +0 -1
- package/dist/summarizationModel.d.mts +0 -10
- package/dist/summarizationModel.d.mts.map +0 -1
- package/dist/summarizationModel.mjs +0 -2
- package/dist/summarizationModel.mjs.map +0 -1
- package/dist/types.d.cts +0 -5
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.mts +0 -5
- package/dist/types.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -1,36 +1,121 @@
|
|
|
1
1
|
# @agimon-ai/doompi-autocompact
|
|
2
2
|
|
|
3
|
-
Staged checkpoint
|
|
3
|
+
Staged checkpoint summarization and iterative context compaction for DoomPi.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
it. It reads the live plan, task graph, and team snapshot and commits them next to the
|
|
7
|
-
summary as authoritative, rather than leaving coordination state to be reconstructed from
|
|
8
|
-
prose.
|
|
5
|
+
Part of the [DoomPi distribution](https://www.npmjs.com/package/@agimon-ai/doompi).
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
Instead of waiting for one final summary near the context limit, Autocompact creates up to three
|
|
8
|
+
asynchronous checkpoints and combines each checkpoint with subsequent messages.
|
|
9
|
+
|
|
10
|
+
> **Alpha:** thresholds and compaction steering may change between releases.
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
- Node.js 22.19.0 or newer
|
|
15
|
+
- Pi 0.85.0
|
|
16
|
+
- Authentication for the model selected for summarization
|
|
13
17
|
|
|
14
18
|
## Install
|
|
15
19
|
|
|
20
|
+
`doompi init` and `dpi init` include Autocompact in `default.packages` in `.doom/modes.yaml`.
|
|
21
|
+
Remove it or move it to a named layer to change which major modes load it. Pi discovers its sole
|
|
22
|
+
extension entry through `package.json.pi.extensions`. For direct Pi installation:
|
|
23
|
+
|
|
16
24
|
```bash
|
|
17
|
-
|
|
25
|
+
pi install npm:@agimon-ai/doompi-autocompact
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The extension entry is `@agimon-ai/doompi-autocompact/extensions/pi`.
|
|
29
|
+
|
|
30
|
+
## Checkpoint ladder
|
|
31
|
+
|
|
32
|
+
The standard adapter uses thresholds around 50%, 75%, and 95% of the usable context window,
|
|
33
|
+
subject to token caps and Pi's native-compaction clamp:
|
|
34
|
+
|
|
35
|
+
1. create an initial compact summary;
|
|
36
|
+
2. combine it with later messages and allow the model to decide whether compaction is ready;
|
|
37
|
+
3. combine again and force compaction on the final pass.
|
|
38
|
+
|
|
39
|
+
## Per-model token checkpoints
|
|
40
|
+
|
|
41
|
+
Ratios scale with the window, which is usually what you want. On a very large window they can
|
|
42
|
+
also mean the first checkpoint waits far longer than you would like: half of a one-million-token
|
|
43
|
+
window is 500,000 tokens. `modes.autocompact.overrides` pins individual passes to an absolute
|
|
44
|
+
token count for the models you name, and leaves every other model on the ratio ladder.
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
modes:
|
|
48
|
+
autocompact:
|
|
49
|
+
overrides:
|
|
50
|
+
- model: 'claude-opus-4-[6-9]'
|
|
51
|
+
tokens:
|
|
52
|
+
pass1: 75000
|
|
53
|
+
pass2: 150000
|
|
54
|
+
pass3: 200000
|
|
18
55
|
```
|
|
19
56
|
|
|
20
|
-
|
|
57
|
+
- Entries are tried in file order and the first match wins. A model matching nothing behaves
|
|
58
|
+
exactly as it does without this key.
|
|
59
|
+
- `model` is a glob supporting `*` and character classes such as `[6-9]`. A pattern containing
|
|
60
|
+
`/` is matched against `provider/id`, anything else against the bare model id, because the
|
|
61
|
+
wildcard does not cross the separator. Matching ignores case.
|
|
62
|
+
- The lower of the ratio and the token count wins, so an override can only bring a checkpoint
|
|
63
|
+
forward, never push one past the point Pi compacts natively.
|
|
64
|
+
- Counts are compared against total context usage, not against growth since the last compaction.
|
|
65
|
+
- A count at or below the current cycle's baseline is ignored and the pass falls back to its
|
|
66
|
+
ratio. Without that, a compaction landing above the count would satisfy the pass as soon as
|
|
67
|
+
the next cycle opened and re-fire it every turn.
|
|
68
|
+
- A pass never fires before the one before it. A list that puts a later pass lower is raised to
|
|
69
|
+
match, the same way a ratio below the previous pass is.
|
|
70
|
+
- A repository config replaces the global list whole rather than merging entry by entry.
|
|
71
|
+
- These keys are not on the cockpit settings page; edit `.doom/config.yaml` directly.
|
|
72
|
+
Summarization runs asynchronously in the background, on the session's own provider, so a model
|
|
73
|
+
registered by a Pi provider extension summarizes through that extension. Checkpoints are
|
|
74
|
+
persisted as hidden session entries and used for later steering.
|
|
21
75
|
|
|
22
|
-
|
|
23
|
-
|
|
76
|
+
DoomPi uses the configured planning subagent model and thinking level when available, then falls
|
|
77
|
+
back to the active Pi model. Standalone Pi without DoomPi planning configuration uses the active
|
|
78
|
+
model. Each checkpoint can therefore make another provider request, consume quota, and require the
|
|
79
|
+
credentials for the selected model. Provider errors or missing authentication affect checkpoint
|
|
80
|
+
generation rather than granting a free local summary.
|
|
24
81
|
|
|
25
|
-
|
|
82
|
+
## Coordination state
|
|
26
83
|
|
|
27
|
-
|
|
84
|
+
Autocompact does not own `@agimon-ai/doompi-task` or `@agimon-ai/doompi-team` persistence. The
|
|
85
|
+
standard adapter reads best-effort snapshots from those packages when available, while Task's
|
|
86
|
+
`tasks.json` and Team's run and intercom state remain owned by their respective packages. Missing
|
|
87
|
+
snapshot data is reported as unavailable and must not be inferred from an Autocompact summary.
|
|
28
88
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
89
|
+
## Public API
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { installAutocompactRuntime, thresholdTokens } from '@agimon-ai/doompi-autocompact';
|
|
93
|
+
import type { AutocompactPass } from '@agimon-ai/doompi-autocompact';
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Normal Pi activation should use the discovered `extensions/pi` entry. Host integrations can call
|
|
97
|
+
`installAutocompactRuntime` to install package resources into the shared runner-scoped Cordis host.
|
|
98
|
+
The extension entry manages its plugin lifecycle and releases the host lease when the Pi session
|
|
99
|
+
shuts down. `thresholdTokens` exposes the threshold policy for hosts that need to preview or test
|
|
100
|
+
checkpoint boundaries.
|
|
101
|
+
|
|
102
|
+
## Development
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pnpm build
|
|
106
|
+
pnpm typecheck
|
|
107
|
+
pnpm test
|
|
108
|
+
pnpm lint
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Maintained by [Agimon](https://agimon.ai/about).
|
|
33
112
|
|
|
34
113
|
## License
|
|
35
114
|
|
|
36
115
|
MIT
|
|
116
|
+
|
|
117
|
+
## Extension lifecycle and source layout
|
|
118
|
+
|
|
119
|
+
`extensions/pi.ts` declares the Autocompact runtime's optional services, typed events, and `onStop` cleanup. Shutdown cancels checkpoint generation and awaits pending work before releasing telemetry and runtime state. Session-tree changes retain their existing generation cancellation behavior. The runtime and policy live in `services/<name>/`, with constants and shared types in dedicated roots.
|
|
120
|
+
|
|
121
|
+
The direct server entry declares validated configuration resources and a native-fallback status activity from `controllers/serverAutocompact.ts`. The web entry declares settings sections. Flat `exports/` publishes reusable capabilities without forwarding extension entry points.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
//#region src/schemas/apiContracts.ts
|
|
6
|
+
/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
7
|
+
const apiContracts = (0, require("@agimon-ai/doompi-core/apiContracts").defineApiContract)({
|
|
8
|
+
version: 1,
|
|
9
|
+
http: [],
|
|
10
|
+
sockets: [],
|
|
11
|
+
dynamic: []
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.apiContracts = apiContracts;
|
|
15
|
+
exports.default = apiContracts;
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=apiContracts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/doompi-core/apiContracts';\n\n/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;AAGA,MAAa,gBAAA,gDAAeA,CAAAA,CAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/schemas/apiContracts.d.ts
|
|
2
|
+
/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
3
|
+
export declare const apiContracts: {
|
|
4
|
+
version: 1;
|
|
5
|
+
protocols?: Record<string, string> | undefined;
|
|
6
|
+
schemas?: Record<string, boolean | object> | undefined;
|
|
7
|
+
http: {
|
|
8
|
+
id: string;
|
|
9
|
+
scope: "global" | "session" | "workspace";
|
|
10
|
+
basePath?: string | undefined;
|
|
11
|
+
path: string;
|
|
12
|
+
method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
|
|
13
|
+
description: string;
|
|
14
|
+
availability?: string | undefined;
|
|
15
|
+
authentication: "device" | "none" | "owner";
|
|
16
|
+
parameters?: {
|
|
17
|
+
name: string;
|
|
18
|
+
in: "header" | "path" | "query";
|
|
19
|
+
required: boolean;
|
|
20
|
+
schema: boolean | object;
|
|
21
|
+
}[] | undefined;
|
|
22
|
+
body?: {
|
|
23
|
+
contentType: string;
|
|
24
|
+
contentTypes?: string[] | undefined;
|
|
25
|
+
required: boolean;
|
|
26
|
+
schema: boolean | object;
|
|
27
|
+
} | undefined;
|
|
28
|
+
responses: Record<string, {
|
|
29
|
+
description: string;
|
|
30
|
+
contentType?: string | undefined;
|
|
31
|
+
schema?: boolean | object | undefined;
|
|
32
|
+
events?: Record<string, boolean | object> | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
}[];
|
|
35
|
+
sockets: {
|
|
36
|
+
id: string;
|
|
37
|
+
scope: "global" | "session" | "workspace";
|
|
38
|
+
description: string;
|
|
39
|
+
availability?: string | undefined;
|
|
40
|
+
service: string;
|
|
41
|
+
member: string;
|
|
42
|
+
direction: "client-to-server" | "server-to-client";
|
|
43
|
+
kind: "channel" | "method" | "state";
|
|
44
|
+
input: boolean | object;
|
|
45
|
+
output?: boolean | object | undefined;
|
|
46
|
+
errors?: boolean | object | undefined;
|
|
47
|
+
}[];
|
|
48
|
+
dynamic: string[];
|
|
49
|
+
gaps?: string[] | undefined;
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { apiContracts as default };
|
|
53
|
+
//# sourceMappingURL=apiContracts.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAGa"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineApiContract } from "@agimon-ai/doompi-core/apiContracts";
|
|
2
|
+
//#region src/schemas/apiContracts.ts
|
|
3
|
+
/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
4
|
+
const apiContracts = defineApiContract({
|
|
5
|
+
version: 1,
|
|
6
|
+
http: [],
|
|
7
|
+
sockets: [],
|
|
8
|
+
dynamic: []
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { apiContracts, apiContracts as default };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=apiContracts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/doompi-core/apiContracts';\n\n/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAa,eAAe,kBAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
|