acp-kernel 0.0.46-pr.164.19 → 0.0.46-pr.169.21
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 +26 -0
- package/dist/compress-tools.d.ts +4 -13
- package/dist/compress-tools.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +105 -39
- package/dist/index.js.map +1 -1
- package/dist/surface-config.d.ts +83 -0
- package/dist/surface-config.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Surface text configuration layer.
|
|
3
|
+
*
|
|
4
|
+
* The kernel classifies prompt content as load-bearing (the four {@link Prompts}
|
|
5
|
+
* rules, risk-gated via resolvePrompts) or surface (section chrome, tool
|
|
6
|
+
* descriptions — presentation only, safe to customize freely). This module is
|
|
7
|
+
* the shared mechanism for the surface class, used by the kernel's own prompt
|
|
8
|
+
* builders and by adapters (billion-context-pi, the billion-context proxy) so
|
|
9
|
+
* every host exposes the same config semantics:
|
|
10
|
+
*
|
|
11
|
+
* string → replace the default text
|
|
12
|
+
* null → remove the section
|
|
13
|
+
* omitted → keep the default
|
|
14
|
+
*
|
|
15
|
+
* Malformed values (wrong type) are ignored — a bad override never clobbers a
|
|
16
|
+
* good default.
|
|
17
|
+
*/
|
|
18
|
+
/** Tri-state override for one named section of a system prompt. */
|
|
19
|
+
export type SectionOverride = string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Section keys of the kernel's compress system-prompt builders. Each builder
|
|
22
|
+
* honors a subset ({@link buildCompressSystemPrompt}: acpTags/tools/
|
|
23
|
+
* summariesInContext; text variant: acpTags/textProtocol/textTools; hybrid:
|
|
24
|
+
* acpTags/textProtocol/functionTools). A section's text is the full section —
|
|
25
|
+
* header line included.
|
|
26
|
+
*/
|
|
27
|
+
export type CompressPromptSections = {
|
|
28
|
+
acpTags?: SectionOverride;
|
|
29
|
+
tools?: SectionOverride;
|
|
30
|
+
summariesInContext?: SectionOverride;
|
|
31
|
+
textProtocol?: SectionOverride;
|
|
32
|
+
textTools?: SectionOverride;
|
|
33
|
+
functionTools?: SectionOverride;
|
|
34
|
+
};
|
|
35
|
+
/** Per-tool surface overrides. Keyed by tool name (see ACP_TOOL_NAMES). */
|
|
36
|
+
export interface ToolPromptOverrides {
|
|
37
|
+
/** Replace the tool's description. */
|
|
38
|
+
description?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Replace parameter descriptions by property name, at any nesting depth
|
|
41
|
+
* (top-level `properties` and array `items` properties).
|
|
42
|
+
*/
|
|
43
|
+
paramDescriptions?: Record<string, string>;
|
|
44
|
+
}
|
|
45
|
+
/** Map of tool name → surface overrides. */
|
|
46
|
+
export type ToolPrompts = Record<string, ToolPromptOverrides>;
|
|
47
|
+
/**
|
|
48
|
+
* Apply tri-state section overrides to an ordered list of sections. Each
|
|
49
|
+
* section is a `[key, text]` pair. `string` replaces, `null` removes,
|
|
50
|
+
* omitted/undefined keeps the default; unknown override keys are ignored.
|
|
51
|
+
* Returns the surviving texts in original order.
|
|
52
|
+
*/
|
|
53
|
+
export declare function applySectionOverrides(sections: ReadonlyArray<readonly [string, string]>, overrides?: Record<string, SectionOverride>): string[];
|
|
54
|
+
/**
|
|
55
|
+
* Deep-clone a JSON-like tool parameter schema, replacing the `description` of
|
|
56
|
+
* every property whose name matches an override key, at any nesting depth.
|
|
57
|
+
* Returns the input unchanged when there are no overrides. Never mutates the
|
|
58
|
+
* input.
|
|
59
|
+
*/
|
|
60
|
+
export declare function cloneWithDescriptions(schema: unknown, overrides: Record<string, string>): unknown;
|
|
61
|
+
/** Structural superset of the three ACP wire tool shapes. */
|
|
62
|
+
export interface AcpToolLike {
|
|
63
|
+
name?: string;
|
|
64
|
+
description?: string;
|
|
65
|
+
input_schema?: unknown;
|
|
66
|
+
parameters?: unknown;
|
|
67
|
+
function?: {
|
|
68
|
+
name: string;
|
|
69
|
+
description?: string;
|
|
70
|
+
parameters?: unknown;
|
|
71
|
+
};
|
|
72
|
+
type?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Apply per-name surface overrides to ACP tool definitions. Handles the three
|
|
76
|
+
* wire shapes: anthropic `{name, description, input_schema}`, openai
|
|
77
|
+
* `{type, function: {name, description, parameters}}`, responses flat
|
|
78
|
+
* `{type, name, description, parameters}`. Returns a new array; the shared
|
|
79
|
+
* tool constants are never mutated. Tools without an override pass through by
|
|
80
|
+
* reference.
|
|
81
|
+
*/
|
|
82
|
+
export declare function applyAcpToolOverrides<T extends AcpToolLike>(tools: readonly T[], overrides?: ToolPrompts): T[];
|
|
83
|
+
//# sourceMappingURL=surface-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-config.d.ts","sourceRoot":"","sources":["../src/surface-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,mEAAmE;AACnE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,IAAI,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,kBAAkB,CAAC,EAAE,eAAe,CAAC;IACrC,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,aAAa,CAAC,EAAE,eAAe,CAAC;CACjC,CAAC;AAEF,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5C;AAED,4CAA4C;AAC5C,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAE9D;;;;;GAKG;AAC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