pi-blackhole 0.4.2 → 0.4.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 +15 -0
- package/dist/index.js +11660 -0
- package/dist/index.js.map +1 -0
- package/example-config.json +1 -1
- package/index.ts +37 -63
- package/package.json +21 -9
- package/src/commands/cleanup.ts +279 -240
- package/src/commands/memory.ts +236 -184
- package/src/commands/pi-vcc.ts +202 -152
- package/src/commands/vcc-recall.ts +126 -95
- package/src/core/brief.ts +167 -33
- package/src/core/build-sections.ts +8 -2
- package/src/core/config-env.ts +117 -0
- package/src/core/content.ts +31 -7
- package/src/core/drill-down.ts +41 -11
- package/src/core/filter-noise.ts +9 -3
- package/src/core/format-recall.ts +15 -6
- package/src/core/format.ts +14 -4
- package/src/core/lineage.ts +9 -3
- package/src/core/load-messages.ts +24 -5
- package/src/core/normalize.ts +38 -14
- package/src/core/recall-scope.ts +11 -3
- package/src/core/render-entries.ts +22 -6
- package/src/core/sanitize.ts +5 -1
- package/src/core/search-entries.ts +111 -19
- package/src/core/settings.ts +1 -3
- package/src/core/summarize.ts +42 -21
- package/src/core/unified-config.ts +549 -411
- package/src/extract/commits.ts +4 -2
- package/src/extract/files.ts +10 -5
- package/src/extract/goals.ts +7 -2
- package/src/hooks/before-compact.ts +210 -88
- package/src/om/agents/dropper/agent.ts +380 -265
- package/src/om/agents/dropper/coverage.ts +102 -82
- package/src/om/agents/observer/agent.ts +242 -206
- package/src/om/agents/reflector/agent.ts +212 -153
- package/src/om/cleanup.ts +239 -218
- package/src/om/clipboard.ts +59 -51
- package/src/om/compaction-trigger.ts +448 -333
- package/src/om/config.ts +13 -6
- package/src/om/configure-overlay.ts +518 -355
- package/src/om/consolidation.ts +1460 -953
- package/src/om/cooldown.ts +75 -65
- package/src/om/debug-log.ts +86 -68
- package/src/om/ids.ts +1 -1
- package/src/om/ledger/fold.ts +89 -78
- package/src/om/ledger/progress.ts +181 -153
- package/src/om/ledger/projection.ts +248 -185
- package/src/om/ledger/recall.ts +247 -196
- package/src/om/ledger/render-summary.ts +79 -50
- package/src/om/ledger/types.ts +146 -117
- package/src/om/model-budget.ts +23 -13
- package/src/om/pending.ts +243 -179
- package/src/om/provider-stream.ts +52 -7
- package/src/om/retryable-error.ts +12 -16
- package/src/om/reverse-recall.ts +97 -91
- package/src/om/runtime.ts +474 -375
- package/src/om/serialize.ts +190 -166
- package/src/om/status-overlay.ts +246 -195
- package/src/om/tokens.ts +28 -21
- package/src/pi-base/blackhole-settings.ts +437 -0
- package/src/pi-base/config-manager.ts +440 -0
- package/src/pi-base/config.ts +469 -0
- package/src/pi-base/env.ts +43 -0
- package/src/pi-base/paths.ts +47 -0
- package/src/pi-base/settings/body.ts +1648 -0
- package/src/pi-base/settings/fields/action.ts +43 -0
- package/src/pi-base/settings/fields/boolean.ts +47 -0
- package/src/pi-base/settings/fields/custom.ts +72 -0
- package/src/pi-base/settings/fields/enum.ts +310 -0
- package/src/pi-base/settings/fields/index.ts +46 -0
- package/src/pi-base/settings/fields/model.ts +452 -0
- package/src/pi-base/settings/fields/string.ts +527 -0
- package/src/pi-base/settings/fields/text.ts +115 -0
- package/src/pi-base/settings/frame.ts +197 -0
- package/src/pi-base/settings/index.ts +77 -0
- package/src/pi-base/settings/inline-edit.ts +313 -0
- package/src/pi-base/settings/modal.ts +152 -0
- package/src/pi-base/settings/types.ts +500 -0
- package/src/pi-base/settings/validate-field.ts +113 -0
- package/src/pi-base/shell.ts +117 -0
- package/src/pi-base/types.ts +6 -0
- package/src/pi-base/ui.ts +32 -0
- package/src/tools/recall.ts +347 -225
- package/src/types.ts +20 -3
- package/tsup.config.ts +23 -0
- package/vitest.config.ts +15 -15
package/example-config.json
CHANGED
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"observationsPoolTargetTokens": 10000,
|
|
97
97
|
"reflectorInputMaxTokens": 80000,
|
|
98
98
|
"dropperInputMaxTokens": 80000,
|
|
99
|
-
"dropperPressureThreshold": 0.
|
|
99
|
+
"dropperPressureThreshold": 0.7,
|
|
100
100
|
"observerChunkMaxTokens": 40000,
|
|
101
101
|
"observerPreambleMaxTokens": 0,
|
|
102
102
|
"agentMaxTurns": 16,
|
package/index.ts
CHANGED
|
@@ -16,69 +16,43 @@ import { registerConsolidationTrigger } from "./src/om/consolidation.js";
|
|
|
16
16
|
import { registerCompactionTrigger } from "./src/om/compaction-trigger.js";
|
|
17
17
|
import { registerRecallTool } from "./src/tools/recall";
|
|
18
18
|
import { Runtime } from "./src/om/runtime.js";
|
|
19
|
+
import { captureRegisteredProviderStreams } from "./src/om/provider-stream.js";
|
|
19
20
|
|
|
20
21
|
export default (pi: ExtensionAPI) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (registered && typeof registered.forEach === "function") {
|
|
58
|
-
registered.forEach((config: any, _name: string) => {
|
|
59
|
-
if (config && config.streamSimple && config.api && !providerStreams.has(config.api)) {
|
|
60
|
-
providerStreams.set(config.api, config.streamSimple);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
scaffoldSettings();
|
|
67
|
-
|
|
68
|
-
const omRuntime = new Runtime();
|
|
69
|
-
|
|
70
|
-
// Observational memory: background consolidation pipeline
|
|
71
|
-
registerConsolidationTrigger(pi, omRuntime); // agent_start + turn_end → observer/reflector/dropper
|
|
72
|
-
registerCompactionTrigger(pi, omRuntime); // agent_end → auto-compaction
|
|
73
|
-
|
|
74
|
-
// Pi-vcc: compaction + om injection
|
|
75
|
-
registerBeforeCompactHook(pi, omRuntime); // session_before_compact → pi-vcc + om content
|
|
76
|
-
|
|
77
|
-
// Commands
|
|
78
|
-
registerPiVccCommand(pi, omRuntime); // /pi-vcc (needs runtime for noAutoCompact flush)
|
|
79
|
-
registerMemoryCommand(pi, omRuntime); // /blackhole-memory [status|view|full]
|
|
80
|
-
registerVccRecallCommand(pi); // /blackhole-recall <query>
|
|
81
|
-
|
|
82
|
-
// Tools
|
|
83
|
-
registerRecallTool(pi); // unified recall (#N + [12char])
|
|
22
|
+
// ── Bridge: capture custom provider stream functions for jiti-loaded agents ──
|
|
23
|
+
// pi-blackhole's consolidation agents are loaded via jiti with moduleCache: false,
|
|
24
|
+
// which creates a separate pi-ai instance whose apiProviderRegistry lacks custom
|
|
25
|
+
// providers (e.g., claude-bridge registered by other extensions). This bridge stores
|
|
26
|
+
// streamSimple functions in a Symbol.for() global so agents can access them without
|
|
27
|
+
// going through pi-ai's registry.
|
|
28
|
+
//
|
|
29
|
+
// Capture custom provider streams from Pi's model registry before each run.
|
|
30
|
+
// This works regardless of extension load order and includes providers added
|
|
31
|
+
// after startup.
|
|
32
|
+
const PROVIDER_STREAMS_KEY = Symbol.for("pi-blackhole:provider-streams");
|
|
33
|
+
const providerStreams: Map<string, Function> = ((globalThis as any)[
|
|
34
|
+
PROVIDER_STREAMS_KEY
|
|
35
|
+
] ??= new Map());
|
|
36
|
+
pi.on("agent_start", (_event: unknown, ctx: any) => {
|
|
37
|
+
captureRegisteredProviderStreams(ctx.modelRegistry, providerStreams);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
scaffoldSettings();
|
|
41
|
+
|
|
42
|
+
const omRuntime = new Runtime();
|
|
43
|
+
|
|
44
|
+
// Observational memory: background consolidation pipeline
|
|
45
|
+
registerConsolidationTrigger(pi, omRuntime); // agent_start + turn_end → observer/reflector/dropper
|
|
46
|
+
registerCompactionTrigger(pi, omRuntime); // agent_end → auto-compaction
|
|
47
|
+
|
|
48
|
+
// Pi-vcc: compaction + om injection
|
|
49
|
+
registerBeforeCompactHook(pi, omRuntime); // session_before_compact → pi-vcc + om content
|
|
50
|
+
|
|
51
|
+
// Commands
|
|
52
|
+
registerPiVccCommand(pi, omRuntime); // /pi-vcc (needs runtime for noAutoCompact flush)
|
|
53
|
+
registerMemoryCommand(pi, omRuntime); // /blackhole-memory [status|view|full]
|
|
54
|
+
registerVccRecallCommand(pi); // /blackhole-recall <query>
|
|
55
|
+
|
|
56
|
+
// Tools
|
|
57
|
+
registerRecallTool(pi); // unified recall (#N + [12char])
|
|
84
58
|
};
|
package/package.json
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-blackhole",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"packageManager": "pnpm@11.2.2",
|
|
5
5
|
"description": "Unified compaction + observational memory extension for Pi — compresses conversation context while preserving durable observations and reflections",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.js",
|
|
8
9
|
"files": [
|
|
10
|
+
"dist/",
|
|
9
11
|
"*.ts",
|
|
10
12
|
"src/**/*.ts",
|
|
11
13
|
"!src/**/*.test.ts",
|
|
12
14
|
"!tests/",
|
|
15
|
+
"tsup.config.ts",
|
|
13
16
|
"LICENSE",
|
|
14
17
|
"README.md",
|
|
15
18
|
"example-config.json"
|
|
16
19
|
],
|
|
17
20
|
"scripts": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
21
|
+
"build": "tsup",
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"lint": "eslint .",
|
|
24
|
+
"format": "prettier --write .",
|
|
25
|
+
"format:check": "prettier --check .",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:watch": "vitest",
|
|
28
|
+
"check": "pnpm typecheck && pnpm lint",
|
|
29
|
+
"prepare": "node scripts/prepare.mjs"
|
|
20
30
|
},
|
|
21
31
|
"keywords": [
|
|
22
32
|
"pi-package",
|
|
@@ -47,19 +57,21 @@
|
|
|
47
57
|
},
|
|
48
58
|
"pi": {
|
|
49
59
|
"extensions": [
|
|
50
|
-
"./index.
|
|
60
|
+
"./dist/index.js"
|
|
51
61
|
]
|
|
52
62
|
},
|
|
53
63
|
"devDependencies": {
|
|
54
|
-
"@earendil-works/pi-agent-core": "0.
|
|
55
|
-
"@earendil-works/pi-ai": "0.
|
|
56
|
-
"@earendil-works/pi-coding-agent": "0.
|
|
57
|
-
"@earendil-works/pi-tui": "0.
|
|
64
|
+
"@earendil-works/pi-agent-core": "0.83.0",
|
|
65
|
+
"@earendil-works/pi-ai": "0.83.0",
|
|
66
|
+
"@earendil-works/pi-coding-agent": "0.83.0",
|
|
67
|
+
"@earendil-works/pi-tui": "0.83.0",
|
|
58
68
|
"@typescript-eslint/eslint-plugin": "8.60.0",
|
|
59
69
|
"@typescript-eslint/parser": "8.60.0",
|
|
60
70
|
"eslint": "9.39.4",
|
|
61
71
|
"husky": "9.1.7",
|
|
72
|
+
"tsup": "^8.5.1",
|
|
62
73
|
"lint-staged": "15.5.2",
|
|
74
|
+
"prettier": "3.9.6",
|
|
63
75
|
"typebox": "1.1.38",
|
|
64
76
|
"typescript": "5.9.3",
|
|
65
77
|
"vitest": "4.1.9"
|