billion-context-pi 0.1.82 → 0.1.83

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.
@@ -13,6 +13,13 @@ export declare const ACP_EXPORT_CUSTOM_TYPE = "acp-export";
13
13
  * reach the model through the feature's own channel, so the human-facing
14
14
  * report must never be re-billed as model context. */
15
15
  export declare const ACP_RULE_CUSTOM_TYPE = "acp-rule";
16
+ /** Nudge persistence record (issue #326): written via pi.appendEntry as a
17
+ * type:"custom" entry — never projected into the sent view (see above), so
18
+ * the compact one-liner stays out of model context while surviving restarts. */
19
+ export declare const ACP_NUDGE_CUSTOM_TYPE = "acp-nudge";
20
+ export interface AcpNudgeRecord {
21
+ text: string;
22
+ }
16
23
  /** True for host-injected custom_message entries that participate in LLM
17
24
  * context: non-empty custom_message except the UI-only types in
18
25
  * CONTEXT_EXCLUDED_CUSTOM_TYPES (acp-status panels, acp-export docs,
package/dist/runtime.d.ts CHANGED
@@ -68,6 +68,11 @@ export interface AcpRuntime {
68
68
  nudgeShownTokensFor(sid: string, turnKey: string): number | undefined;
69
69
  /** Clears the token-count stamps recorded by markNudgeShown — used on a token-scale flip (issue #267) so the same-turn re-inject floor (#269 / PR #316) is not computed against an old-scale stamp. */
70
70
  clearNudgeTokenStamps(sid: string): void;
71
+ /** Like the nudgeShown* pair but tracks the persisted display-only session
72
+ * entry (issue #326): at most one record per user turn even when the
73
+ * emergency nudge re-injects on every LLM call. */
74
+ markNudgeRecorded(sid: string, turnKey: string): void;
75
+ nudgeRecordedFor(sid: string, turnKey: string): boolean;
71
76
  /** Process compress toolResults for the CURRENT user turn only (the caller
72
77
  * scopes the list — see collectCompressOutcomes in src/index.ts); idempotent
73
78
  * per toolCallId. turnKey MUST be the stable persisted-boundary key
@@ -10,3 +10,14 @@ export declare function parseSessionLog(text: string): SessionEntry[];
10
10
  * returns entries whose base id is in `wantedBaseIds`. The starting session
11
11
  * itself is never included; nearest-ancestor entries win on duplicate ids. */
12
12
  export declare function loadAncestorEntries(sessionFile: string | undefined, wantedBaseIds: Set<string>): Promise<SessionEntry[]>;
13
+ /** Read-only content recovery for content-addressed `live-*` refs (issue
14
+ * #579): fork hosts alias not-yet-persisted tail messages with `live-*` ids
15
+ * (runtime.ts mergeLiveEntries); those aliases appear in NO jsonl, so the
16
+ * entry-id lookup above can never find them. The rawId→identity bridge lives
17
+ * in each session's OWN sidecar (liveRefOrigins). Walks the chain — itself
18
+ * first, then ancestors, same depth/cycle rules as loadAncestorEntries — and
19
+ * at each level pairs that level's declared origins with that same level's
20
+ * log entries matched by messageIdentity. First matching entry wins per rawId
21
+ * (identical identities are interchangeable: identity covers full normalized
22
+ * content). Never writes any sidecar. */
23
+ export declare function loadLiveRefEntries(sessionFile: string | undefined, wantedRawIds: Set<string>): Promise<Map<string, SessionEntry>>;
package/dist/state.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { type CompressionState } from "acp-kernel";
2
+ export declare const STATE_SUFFIX = ".acp.json";
2
3
  export interface LiveRefOrigin {
3
4
  rawId: string;
4
5
  identity: string;
@@ -38,3 +39,4 @@ export declare class SessionStateStore {
38
39
  * use this: their session files carry a parentSession header that already
39
40
  * inherits the parent state verbatim. */
40
41
  export declare function deriveChildState(parent: CompressionState): CompressionState;
42
+ export declare function parseLiveRefOrigins(value: unknown): LiveRefOrigin[];
@@ -27,10 +27,20 @@ export interface TurnBoundaryEntry {
27
27
  * standalone pi users' nudge cadence unchanged. */
28
28
  export interface TurnBoundaryPolicy {
29
29
  countCustomMessages?: boolean;
30
+ /** #578: optional customType allowlist refining countCustomMessages. When
31
+ * set, only injected entries whose customType is listed delimit turns —
32
+ * host metadata injections (harness_digest, ipython_state, …) that enter
33
+ * LLM context without being a real host turn stay out of turn accounting.
34
+ * Unset = every non-empty injected message counts (pre-#578 behavior).
35
+ * Entries without a customType never match; UI-only types stay excluded
36
+ * even when listed. Ignored unless countCustomMessages is true. */
37
+ customMessageTypes?: readonly string[];
30
38
  }
31
39
  /** The ONE turn-boundary predicate (#364): does this entry start a new turn?
32
40
  * Genuine user-role messages always do (pi-native); host-injected
33
- * custom_message entries do only when the host opts in via policy. */
41
+ * custom_message entries do only when the host opts in via policy, optionally
42
+ * refined by a customMessageTypes allowlist so metadata injections
43
+ * (harness_digest, ipython_state) stay out of turn accounting (#578). */
34
44
  export declare function isTurnBoundary(entry: TurnBoundaryEntry, policy?: TurnBoundaryPolicy): boolean;
35
45
  /** Id of the last turn-boundary entry — the per-turn key for nudge
36
46
  * accounting, retry caps and outcome scoping. Defaults to pi-native
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billion-context-pi",
3
- "version": "0.1.82",
3
+ "version": "0.1.83",
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",