acp-kernel 0.0.65 → 0.0.66-pr.262.117
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 +21 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +226 -0
- package/dist/index.js.map +1 -1
- package/dist/packs.d.ts +74 -0
- package/dist/packs.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/packs.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Prompts } from "./prompts.js";
|
|
2
|
+
import type { CompressPromptSections, ToolPrompts } from "./surface-config.js";
|
|
3
|
+
import type { NudgePromptSections } from "./nudge-text.js";
|
|
4
|
+
/** Raw on-disk pack JSON (user-authored file or installer payload). Every
|
|
5
|
+
* field optional; sanitized into a {@link PackSurface} before use. */
|
|
6
|
+
export interface PromptPackFile {
|
|
7
|
+
name?: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
prompts?: unknown;
|
|
11
|
+
promptSections?: unknown;
|
|
12
|
+
nudgeSections?: unknown;
|
|
13
|
+
toolPrompts?: unknown;
|
|
14
|
+
/** Opaque per-host extras, keyed by host id (e.g. `pi`). Hosts sanitize
|
|
15
|
+
* their own sub-object; the kernel only checks it is a plain object. */
|
|
16
|
+
adapters?: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** Sanitized surface bundle a pack contributes. */
|
|
19
|
+
export interface PackSurface {
|
|
20
|
+
prompts?: Partial<Prompts>;
|
|
21
|
+
promptSections?: CompressPromptSections;
|
|
22
|
+
nudgeSections?: NudgePromptSections;
|
|
23
|
+
toolPrompts?: ToolPrompts;
|
|
24
|
+
adapters?: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
/** A resolved prompt pack: name + sanitized surface, tagged with provenance
|
|
27
|
+
* (`builtin:lean`, `file:/home/u/.config/x/packs/lean.json`, …). */
|
|
28
|
+
export interface Pack {
|
|
29
|
+
name: string;
|
|
30
|
+
version?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
surface: PackSurface;
|
|
33
|
+
source: string;
|
|
34
|
+
}
|
|
35
|
+
/** A pluggable pack origin. Sources are consulted in resolver order; the
|
|
36
|
+
* first non-null wins. Implementations must be safe to call per turn (sync,
|
|
37
|
+
* no throw). */
|
|
38
|
+
export interface PackSource {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
resolve(name: string): Pack | null;
|
|
41
|
+
list?(): Pack[];
|
|
42
|
+
}
|
|
43
|
+
/** Ordered pack resolution over pluggable sources. */
|
|
44
|
+
export interface PackResolver {
|
|
45
|
+
readonly sources: readonly PackSource[];
|
|
46
|
+
resolve(name: string): Pack | null;
|
|
47
|
+
listPacks(): Pack[];
|
|
48
|
+
}
|
|
49
|
+
export declare function isValidPackName(name: string): boolean;
|
|
50
|
+
/** Sanitize a raw pack file body into a kernel {@link PackSurface}. Malformed
|
|
51
|
+
* values are dropped — a bad override never clobbers a good default. The
|
|
52
|
+
* `adapters` record is passed through opaquely for host-side validation. */
|
|
53
|
+
export declare function sanitizePackSurface(raw: PromptPackFile | null | undefined): PackSurface;
|
|
54
|
+
/** The identity pack: no overrides, kernel defaults everywhere. */
|
|
55
|
+
export declare const defaultPack: Pack;
|
|
56
|
+
/** Token-lean surface: one-line tool descriptions, no snippets or guidelines.
|
|
57
|
+
* Host-specific trims (e.g. the Pi adapter's compact system-prompt block)
|
|
58
|
+
* ride under `adapters` and are validated by that host. Compression rules
|
|
59
|
+
* stay default — delivered by nudges on demand. */
|
|
60
|
+
export declare const leanPack: Pack;
|
|
61
|
+
export declare const builtinSource: PackSource;
|
|
62
|
+
/** A pack directory source: `<dir>/<name>.json` files. Serves project-local,
|
|
63
|
+
* user-global, and any future installer-managed directory identically. */
|
|
64
|
+
export declare function createDirPackSource(id: string, dir: string): PackSource;
|
|
65
|
+
/** Ordered resolution over the given sources; the first non-null wins. */
|
|
66
|
+
export declare function createPackResolver(sources: readonly PackSource[]): PackResolver;
|
|
67
|
+
/** Default source chain: project pack dir, then any user pack dirs, then the
|
|
68
|
+
* builtin registry. Directory paths are host policy — the kernel only
|
|
69
|
+
* assembles the chain. */
|
|
70
|
+
export declare function defaultPackSources(opts: {
|
|
71
|
+
projectDir: string;
|
|
72
|
+
userDirs?: readonly string[];
|
|
73
|
+
}): PackSource[];
|
|
74
|
+
//# sourceMappingURL=packs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packs.d.ts","sourceRoot":"","sources":["../src/packs.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D;sEACsE;AACtE,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;4EACwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,mDAAmD;AACnD,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3B,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;oEACoE;AACpE,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAA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