acp-kernel 0.0.21 → 0.0.22

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.
@@ -1,9 +1,10 @@
1
1
  import type { NudgeDecision, CompressibleRange, ProtectedRange } from "./types.js";
2
+ import type { Prompts } from "./prompts.js";
2
3
  export type NudgeVoice = "gentle" | "emergency";
3
4
  export interface RenderedNudge {
4
5
  voice: NudgeVoice;
5
6
  text: string;
6
7
  }
7
8
  export declare function formatRanges(compressible: CompressibleRange[], protectedRanges: ProtectedRange[]): string;
8
- export declare function renderNudgeText(decision: NudgeDecision): RenderedNudge;
9
+ export declare function renderNudgeText(decision: NudgeDecision, prompts?: Prompts): RenderedNudge;
9
10
  //# sourceMappingURL=nudge-text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nudge-text.d.ts","sourceRoot":"","sources":["../src/nudge-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAsC,MAAM,YAAY,CAAC;AAGvH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAqCD,wBAAgB,YAAY,CAAC,YAAY,EAAE,iBAAiB,EAAE,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,MAAM,CAsEzG;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,CAiEtE"}
1
+ {"version":3,"file":"nudge-text.d.ts","sourceRoot":"","sources":["../src/nudge-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAsC,MAAM,YAAY,CAAC;AAEvH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAyCD,wBAAgB,YAAY,CAAC,YAAY,EAAE,iBAAiB,EAAE,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,MAAM,CAsEzG;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,GAAE,OAAwB,GAAG,aAAa,CAiEzG"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Overridable prompt text consumed by the kernel's nudge renderer and, via the
3
+ * adapter, the system prompt. Every field here is LOAD-BEARING: these rules
4
+ * were tuned over months of production use and are quality-critical. Overriding
5
+ * them can degrade summary quality (loss of paths / signatures / decisions →
6
+ * broken retrieval), so {@link resolvePrompts} requires `{ acknowledgeRisk: true }`.
7
+ *
8
+ * Surface-level text (summary section headers, status-report chrome, tool
9
+ * descriptions) is intentionally NOT part of this interface — it is owned by
10
+ * the adapter or a later "prompt-set format" layer and is safe to customize
11
+ * freely. See DESIGN.md for the load-bearing vs surface classification.
12
+ */
13
+ export interface Prompts {
14
+ /** Core compression philosophy. Embedded in the system prompt + every nudge. */
15
+ compressPhilosophy: string;
16
+ /** Rules the model follows when writing a tier-1 summary. */
17
+ howToCompressRules: string;
18
+ /** Rules for tier-2 distillation of existing summaries. */
19
+ tier2DistillRules: string;
20
+ /** Rules for tier-3 ultra-condensation of distilled summaries. */
21
+ tier3CondenseRules: string;
22
+ }
23
+ /**
24
+ * The kernel's canonical prompt values (verbatim from compression-rules.ts).
25
+ * Frozen so a buggy caller cannot mutate the shared singleton and corrupt
26
+ * every other consumer of {@link defaultPrompts}.
27
+ */
28
+ export declare const defaultPrompts: Prompts;
29
+ export interface ResolvePromptsOptions {
30
+ /**
31
+ * Must be `true` to override any prompt field. Every {@link Prompts} field is
32
+ * load-bearing; overriding without acknowledging the quality risk is a
33
+ * programming error and throws.
34
+ */
35
+ acknowledgeRisk?: boolean;
36
+ }
37
+ /**
38
+ * Merge prompt overrides onto the kernel defaults. All fields are load-bearing,
39
+ * so ANY override requires `{ acknowledgeRisk: true }`.
40
+ *
41
+ * Only `string`-valued overrides take effect: an explicit `undefined`/`null` or
42
+ * a wrong type is silently dropped (never clobbers a good default), so a
43
+ * malformed partial never degrades the canonical rules. Resolve once at host
44
+ * startup, then pass the resulting {@link Prompts} to {@link renderNudgeText}
45
+ * and to the adapter's system-prompt composition so both layers stay consistent.
46
+ */
47
+ export declare function resolvePrompts(overrides?: Partial<Prompts>, options?: ResolvePromptsOptions): Prompts;
48
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,OAAO;IACtB,gFAAgF;IAChF,kBAAkB,EAAE,MAAM,CAAC;IAC3B,6DAA6D;IAC7D,kBAAkB,EAAE,MAAM,CAAC;IAC3B,2DAA2D;IAC3D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kEAAkE;IAClE,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,OAKhB,CAAC;AAEd,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAC5B,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAkBT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acp-kernel",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "Framework-agnostic context-compression engine (model-driven, 3-tier LSM). Pure core: no host dependency.",
5
5
  "license": "MIT",
6
6
  "author": "ranxianglei",