billion-context-pi 0.1.43 → 0.1.45

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/dist/runtime.d.ts CHANGED
@@ -40,20 +40,25 @@ export interface AcpRuntime {
40
40
  nudgeShownFor(turnKey: string): boolean;
41
41
  /** Process compress toolResults for the CURRENT user turn only (the caller
42
42
  * scopes the list — see collectCompressOutcomes in src/index.ts); idempotent
43
- * per toolCallId. Outcome classes: isError → failure (count++), success
44
- * panel text → reset, other non-error text → neutral (count unchanged).
45
- * Returns the failure count, the toolCallId of the newest failure that
46
- * still needs a retry prompt (null when none, capped, or count 0), and
47
- * whether the cap was just reached by this call. */
43
+ * per toolCallId. Outcome classes: isError or noop (0-block panel) →
44
+ * failure (count++), success panel (>= 1 block) → reset, other non-error
45
+ * text → neutral (count unchanged). Returns the failure count, the
46
+ * toolCallId of the newest failure that still needs a retry prompt (null
47
+ * when none, capped, or count 0), and whether the cap was just reached. */
48
48
  noteCompressOutcomes(turnKey: string, outcomes: ReadonlyArray<{
49
49
  toolCallId: string;
50
50
  isError: boolean;
51
51
  success: boolean;
52
+ noop?: boolean;
52
53
  }>): {
53
54
  count: number;
54
55
  retryFor: string | null;
55
56
  cappedNow: boolean;
56
57
  };
58
+ /** True when this turn already burned MAX_COMPRESS_ATTEMPTS failed/no-op
59
+ * compress calls — used to stop re-injecting the (dedup-exempt) emergency
60
+ * nudge that would otherwise keep looping no-op compressions (issue #6). */
61
+ compressRetryCappedFor(turnKey: string): boolean;
57
62
  clearNudgeTracking(): void;
58
63
  clearCompressRetryTracking(): void;
59
64
  liveContextLimit(ctx: ExtensionContext): number;
@@ -1,8 +1,51 @@
1
- export declare function resolveAgentDir(): string;
1
+ /** The four ACP tools to ensure on every pi-subagents builtin agent. */
2
+ export declare const ACP_TOOLS: readonly ["compress", "decompress", "search_context", "acp_status"];
2
3
  export interface SetupResult {
3
4
  path: string;
4
5
  action: "skipped" | "updated" | "failed";
5
6
  reason?: string;
6
7
  }
7
- export declare function ensureSubagentAcpTools(settingsPath?: string): Promise<SetupResult>;
8
- export declare function runSetupAndNotify(notify?: (msg: string) => void): Promise<SetupResult>;
8
+ export interface SetupOptions {
9
+ /** Injectable agent directory (defaults to env PI_CODING_AGENT_DIR or ~/.pi/agent). */
10
+ agentDir?: string;
11
+ /** Injectable cwd for project-scope detection (defaults to process.cwd()). */
12
+ cwd?: string;
13
+ /** Explicit install directory (skips detection; for git installs or forks). */
14
+ installDir?: string;
15
+ }
16
+ /**
17
+ * Resolve the pi agent config directory (e.g. ~/.pi/agent), honoring the
18
+ * PI_CODING_AGENT_DIR environment variable (mirroring pi's own resolution).
19
+ */
20
+ export declare function resolveAgentDir(): string;
21
+ interface ParsedBuiltin {
22
+ name: string;
23
+ /** Frontmatter `tools` list; undefined when the agent is unrestricted. */
24
+ tools?: string[];
25
+ }
26
+ /**
27
+ * Detect an installed pi-subagents package and return its directory, or null
28
+ * when no installation is found.
29
+ *
30
+ * Checked in priority order:
31
+ * 1. user-scope npm install: <agentDir>/npm/node_modules/pi-subagents
32
+ * 2. project-scope npm install: <cwd>/.pi/npm/node_modules/pi-subagents
33
+ * 3. user-scope extension dir: <agentDir>/extensions/<name>/package.json where name === "pi-subagents"
34
+ * 4. project-scope extension dir: <cwd>/.pi/extensions/<name>/package.json
35
+ *
36
+ * Git installs and the legacy global npm location are intentionally not
37
+ * checked: a miss there is a safe no-op (ACP tools stay un-injected).
38
+ */
39
+ export declare function findPiSubagentsInstall(agentDir: string, cwd: string): string | null;
40
+ /**
41
+ * Discover the builtin agents shipped by the detected pi-subagents package
42
+ * from its agents/*.md frontmatter (name + tools). Returns an empty list
43
+ * when the package ships no agents directory.
44
+ */
45
+ export declare function discoverBuiltinAgents(installDir: string): ParsedBuiltin[];
46
+ /**
47
+ * Ensure ACP context tools are present in pi-subagents' agent overrides.
48
+ * No-op (skipped) unless a pi-subagents installation is detected.
49
+ */
50
+ export declare function ensureSubagentAcpTools(settingsPath?: string, options?: SetupOptions): SetupResult;
51
+ export {};
package/dist/update.d.ts CHANGED
@@ -1,2 +1,28 @@
1
+ export type NpmRunner = (args: string[], opts: {
2
+ cwd?: string;
3
+ timeout: number;
4
+ }) => Promise<{
5
+ code: number;
6
+ stdout: string;
7
+ stderr: string;
8
+ }>;
9
+ export declare const runNpm: NpmRunner;
10
+ export declare function setRunNpmForTest(impl: NpmRunner): void;
11
+ export type NodeRunner = (args: string[], opts: {
12
+ timeout: number;
13
+ }) => Promise<{
14
+ code: number;
15
+ stdout: string;
16
+ stderr: string;
17
+ }>;
18
+ export declare const runNode: NodeRunner;
19
+ export declare function setRunNodeForTest(impl: NodeRunner): void;
20
+ export declare function isNewer(latest: string, current: string): boolean;
1
21
  export declare function findNpmRoot(extDir: string): string | undefined;
22
+ export type InstallOutcome = "ok" | "failed" | "rolled-back";
23
+ export declare function verifyInstall(npmDir: string, latest: string): Promise<{
24
+ ok: boolean;
25
+ reason?: string;
26
+ }>;
27
+ export declare function autoInstallLatest(latest: string, extDirOverride?: string): Promise<InstallOutcome>;
2
28
  export declare function checkForUpdate(autoUpdate: boolean, notify?: (msg: string) => void): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billion-context-pi",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
4
4
  "description": "One billion, not one million. Model-driven context management for the Pi coding agent.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -60,7 +60,7 @@
60
60
  "devDependencies": {
61
61
  "@earendil-works/pi-coding-agent": "0.83.0",
62
62
  "@types/node": "^26.1.2",
63
- "acp-kernel": "0.0.30",
63
+ "acp-kernel": "0.0.32",
64
64
  "billion-context-kit": "0.2.0",
65
65
  "tsup": "^8.5.1",
66
66
  "tsx": "^4.23.1",