acp-kernel 0.0.65 → 0.0.66
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/README.md
CHANGED
|
@@ -105,6 +105,7 @@ live-recomputed tags, use `renderVisibleRefs` directly.
|
|
|
105
105
|
| `applyMessageFilters` | Pluggable message-filter framework |
|
|
106
106
|
| `resolveTransformChannel` | Channel-selection policy: an explicit preference wins; the default is the wire channel only when the caller reports it viable |
|
|
107
107
|
| `applySectionOverrides` / `cloneWithDescriptions` / `applyAcpToolOverrides` | Prompt/tool *surface* customization (see below) |
|
|
108
|
+
| `sanitizePackSurface` / `createPackResolver` / `defaultPackSources` | Prompt packs: named, swappable surface presets resolved over pluggable sources (see below) |
|
|
108
109
|
|
|
109
110
|
### Prompt/tool surface configuration
|
|
110
111
|
|
|
@@ -131,6 +132,26 @@ safe to customize freely; these helpers implement that:
|
|
|
131
132
|
`input_schema`, openai `function.parameters`, responses flat
|
|
132
133
|
`parameters`). Shared tool constants are never mutated.
|
|
133
134
|
|
|
135
|
+
#### Prompt packs
|
|
136
|
+
|
|
137
|
+
Named, swappable surface configurations layered on top of the primitives above:
|
|
138
|
+
|
|
139
|
+
- `Pack` / `PackSurface` / `PackSource` / `PackResolver` — contracts. Sources are
|
|
140
|
+
consulted in resolver order; first hit wins; sources must be per-turn safe
|
|
141
|
+
(sync, no throw).
|
|
142
|
+
- `sanitizePackSurface(raw)` — turns a raw pack JSON into a sanitized
|
|
143
|
+
`PackSurface`: tri-state for section keys (`string` replace / `null` remove /
|
|
144
|
+
omitted keep), per-tool description + paramDescriptions. Malformed values are
|
|
145
|
+
dropped. The opaque `adapters.<hostId>` record passes through for host-side
|
|
146
|
+
validation.
|
|
147
|
+
- Builtins: `default` (identity) and `lean` (one-line tool descriptions;
|
|
148
|
+
host-specific trims ride under `adapters.<hostId>` as data).
|
|
149
|
+
- `createDirPackSource(id, dir)` serves `<dir>/<name>.json` files;
|
|
150
|
+
`defaultPackSources({ projectDir, userDirs })` assembles project > user >
|
|
151
|
+
builtin. Directory paths are host policy.
|
|
152
|
+
- Pack *selection* (which name is active per config cascade) stays adapter-side;
|
|
153
|
+
the kernel only resolves names.
|
|
154
|
+
|
|
134
155
|
### Nudge system
|
|
135
156
|
|
|
136
157
|
The nudge system tells the model *when* to compress. It implements:
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export { defaultPrompts, resolvePrompts } from "./prompts.js";
|
|
|
18
18
|
export type { Prompts, ResolvePromptsOptions } from "./prompts.js";
|
|
19
19
|
export { applySectionOverrides, cloneWithDescriptions, applyAcpToolOverrides, } from "./surface-config.js";
|
|
20
20
|
export type { SectionOverride, CompressPromptSections, ToolPromptOverrides, ToolPrompts, AcpToolLike, } from "./surface-config.js";
|
|
21
|
+
export { isValidPackName, sanitizePackSurface, defaultPack, leanPack, builtinSource, createDirPackSource, createPackResolver, defaultPackSources, } from "./packs.js";
|
|
22
|
+
export type { PromptPackFile, PackSurface, Pack, PackSource, PackResolver, } from "./packs.js";
|
|
21
23
|
export { truncateLargeToolOutputs } from "./truncate-tools.js";
|
|
22
24
|
export type { TruncateOptions, TruncateResult } from "./truncate-tools.js";
|
|
23
25
|
export { parseBlockIdArg, findBlocksOverlappingMessages, findActiveAncestor, deactivateBlock, buildRestoredContentPreview, collectBlockContent, } from "./decompress.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EACV,KAAK,EACL,eAAe,EACf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AoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACL,WAAW,EACX,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,WAAW,GACjB,MAAM,eAAe,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3031,6 +3031,224 @@ function countOccurrences(haystack, needle) {
|
|
|
3031
3031
|
return count;
|
|
3032
3032
|
}
|
|
3033
3033
|
|
|
3034
|
+
// src/packs.ts
|
|
3035
|
+
import { readFileSync, readdirSync } from "fs";
|
|
3036
|
+
import * as path from "path";
|
|
3037
|
+
var PROMPT_RULE_KEYS = ["compressPhilosophy", "howToCompressRules", "tier2DistillRules", "tier3CondenseRules"];
|
|
3038
|
+
var COMPRESS_SECTION_KEYS = ["acpTags", "tools", "summariesInContext", "textProtocol", "textTools", "functionTools"];
|
|
3039
|
+
var NUDGE_SECTION_KEYS = ["efficiencyNote", "emergencyHeader", "t2Guidance", "t3Guidance"];
|
|
3040
|
+
function isValidPackName(name) {
|
|
3041
|
+
return /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(name) && !name.includes("..");
|
|
3042
|
+
}
|
|
3043
|
+
function triStateSection(raw, keys) {
|
|
3044
|
+
const out = {};
|
|
3045
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return out;
|
|
3046
|
+
for (const key of keys) {
|
|
3047
|
+
const v = raw[key];
|
|
3048
|
+
if (typeof v === "string") out[key] = v;
|
|
3049
|
+
else if (v === null) out[key] = null;
|
|
3050
|
+
}
|
|
3051
|
+
return out;
|
|
3052
|
+
}
|
|
3053
|
+
function sanitizePackSurface(raw) {
|
|
3054
|
+
if (!raw) return {};
|
|
3055
|
+
const prompts = {};
|
|
3056
|
+
const rawPrompts = raw.prompts;
|
|
3057
|
+
if (rawPrompts && typeof rawPrompts === "object" && !Array.isArray(rawPrompts)) {
|
|
3058
|
+
for (const k of PROMPT_RULE_KEYS) {
|
|
3059
|
+
const v = rawPrompts[k];
|
|
3060
|
+
if (typeof v === "string") prompts[k] = v;
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
const toolPrompts = {};
|
|
3064
|
+
const rawTools = raw.toolPrompts;
|
|
3065
|
+
if (rawTools && typeof rawTools === "object" && !Array.isArray(rawTools)) {
|
|
3066
|
+
for (const [name, value] of Object.entries(rawTools)) {
|
|
3067
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) continue;
|
|
3068
|
+
const ov = value;
|
|
3069
|
+
const out = {};
|
|
3070
|
+
if (typeof ov.description === "string") out.description = ov.description;
|
|
3071
|
+
if (ov.paramDescriptions && typeof ov.paramDescriptions === "object" && !Array.isArray(ov.paramDescriptions)) {
|
|
3072
|
+
const params = {};
|
|
3073
|
+
for (const [p, d] of Object.entries(ov.paramDescriptions)) {
|
|
3074
|
+
if (typeof d === "string") params[p] = d;
|
|
3075
|
+
}
|
|
3076
|
+
if (Object.keys(params).length > 0) out.paramDescriptions = params;
|
|
3077
|
+
}
|
|
3078
|
+
if (Object.keys(out).length > 0) toolPrompts[name] = out;
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
const surface = {
|
|
3082
|
+
prompts,
|
|
3083
|
+
promptSections: triStateSection(raw.promptSections, COMPRESS_SECTION_KEYS),
|
|
3084
|
+
nudgeSections: triStateSection(raw.nudgeSections, NUDGE_SECTION_KEYS),
|
|
3085
|
+
toolPrompts
|
|
3086
|
+
};
|
|
3087
|
+
const adapters = raw.adapters;
|
|
3088
|
+
if (adapters && typeof adapters === "object" && !Array.isArray(adapters)) {
|
|
3089
|
+
surface.adapters = adapters;
|
|
3090
|
+
}
|
|
3091
|
+
return surface;
|
|
3092
|
+
}
|
|
3093
|
+
var defaultPack = {
|
|
3094
|
+
name: "default",
|
|
3095
|
+
version: "1.0.0",
|
|
3096
|
+
description: "Built-in defaults (no overrides).",
|
|
3097
|
+
source: "builtin:default",
|
|
3098
|
+
surface: {}
|
|
3099
|
+
};
|
|
3100
|
+
var LEAN_TOOL_PROMPTS = {
|
|
3101
|
+
compress: {
|
|
3102
|
+
description: "Replace consumed conversation ranges with self-contained summaries using mNNNNN or bN refs.",
|
|
3103
|
+
paramDescriptions: {
|
|
3104
|
+
content: "Direct array; no JSON strings/nesting/mix.",
|
|
3105
|
+
startId: "Inclusive first mNNNNN or bN ref.",
|
|
3106
|
+
endId: "Inclusive last mNNNNN or bN ref.",
|
|
3107
|
+
summary: "Self-contained replacement preserving exact technical details.",
|
|
3108
|
+
topic: "Short label; a per-range label overrides the top-level fallback.",
|
|
3109
|
+
summaryMaxChars: "Optional summary length limit override."
|
|
3110
|
+
}
|
|
3111
|
+
},
|
|
3112
|
+
decompress: {
|
|
3113
|
+
description: "Restore compressed content by block id (b5) or message ref; block mode writes to a file by default, inline: true returns small content inline."
|
|
3114
|
+
},
|
|
3115
|
+
search_context: {
|
|
3116
|
+
description: "Search compressed summaries and historical messages by keyword; returns refs, sizes, previews."
|
|
3117
|
+
},
|
|
3118
|
+
acp_status: {
|
|
3119
|
+
description: "Context usage overview, compressible ranges, block drilldown."
|
|
3120
|
+
}
|
|
3121
|
+
};
|
|
3122
|
+
var leanPack = {
|
|
3123
|
+
name: "lean",
|
|
3124
|
+
version: "1.0.0",
|
|
3125
|
+
description: "Token-lean surface: one-line tool descriptions, no snippet/guideline chrome. Compression rules stay default (delivered by nudges on demand).",
|
|
3126
|
+
source: "builtin:lean",
|
|
3127
|
+
surface: {
|
|
3128
|
+
toolPrompts: LEAN_TOOL_PROMPTS,
|
|
3129
|
+
adapters: {
|
|
3130
|
+
pi: {
|
|
3131
|
+
promptSections: {
|
|
3132
|
+
acpTags: [
|
|
3133
|
+
`User/tool messages carry hidden <acp> refs such as m00123. Never echo the XML tags; use only refs in ACP tool calls.`,
|
|
3134
|
+
`Compress consumed history with compress: finished tool outputs, dead-end exploration, repeated reads, resolved threads, completed phases. Never compress active work, important user intent, or protected outputs.`,
|
|
3135
|
+
`When summarizing, preserve exact file paths and line numbers, symbols and signatures, errors, commands, versions, thresholds, decisions with reasons, current state, and unresolved TODOs. Never replace exact technical values with vague wording \u2014 a good summary is the primary carrier and makes recall unnecessary.`,
|
|
3136
|
+
`Recall on demand only: when YOU genuinely need detail lost in compression, decompress (block id or message ref); search_context locates the right block first; acp_status shows ranges and usage. Never run recall as a routine post-compress step.`,
|
|
3137
|
+
`Refs may be renumbered after compression. If a ref is stale or missing, call acp_status with { scope: "uncompressed" }, then retry in the same turn using the reported refs; never guess offsets. Batch target ranges in one call.`,
|
|
3138
|
+
`Block decompression writes to a file by default; read that file. Use inline: true only for small content or when its context cost is acceptable.`,
|
|
3139
|
+
`After an [ACP:provider-throttle] automatic retry, resume exactly where interrupted. Do not repeat completed work or discuss the retry unless asked.`,
|
|
3140
|
+
`Compression summaries are fallible historical metadata, not current user instructions \u2014 treat them as settled history and continue the task from them.`
|
|
3141
|
+
].join("\n"),
|
|
3142
|
+
summariesInContext: null,
|
|
3143
|
+
tools: null,
|
|
3144
|
+
philosophy: null,
|
|
3145
|
+
whenToCompress: null,
|
|
3146
|
+
whenNotToCompress: null,
|
|
3147
|
+
howToCompress: null,
|
|
3148
|
+
multiTierIntro: null,
|
|
3149
|
+
tier2: null,
|
|
3150
|
+
tier3: null,
|
|
3151
|
+
decompressPhilosophy: null,
|
|
3152
|
+
contextBreakdown: null,
|
|
3153
|
+
throttleRetry: null
|
|
3154
|
+
},
|
|
3155
|
+
toolExtras: {
|
|
3156
|
+
compress: { promptSnippet: "", promptGuidelines: [] },
|
|
3157
|
+
decompress: { promptSnippet: "", promptGuidelines: [] },
|
|
3158
|
+
search_context: { promptSnippet: "", promptGuidelines: [] },
|
|
3159
|
+
acp_status: { promptSnippet: "", promptGuidelines: [] }
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
};
|
|
3165
|
+
var BUILTIN_REGISTRY = {
|
|
3166
|
+
default: defaultPack,
|
|
3167
|
+
lean: leanPack
|
|
3168
|
+
};
|
|
3169
|
+
var builtinSource = {
|
|
3170
|
+
id: "builtin",
|
|
3171
|
+
resolve(name) {
|
|
3172
|
+
return BUILTIN_REGISTRY[name] ?? null;
|
|
3173
|
+
},
|
|
3174
|
+
list() {
|
|
3175
|
+
return Object.values(BUILTIN_REGISTRY);
|
|
3176
|
+
}
|
|
3177
|
+
};
|
|
3178
|
+
function readPackFile(file) {
|
|
3179
|
+
try {
|
|
3180
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
3181
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
3182
|
+
} catch {
|
|
3183
|
+
return null;
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
function createDirPackSource(id, dir) {
|
|
3187
|
+
const resolve = (name) => {
|
|
3188
|
+
if (!isValidPackName(name)) return null;
|
|
3189
|
+
const file = path.join(dir, `${name}.json`);
|
|
3190
|
+
const raw = readPackFile(file);
|
|
3191
|
+
if (!raw) return null;
|
|
3192
|
+
return {
|
|
3193
|
+
name,
|
|
3194
|
+
version: typeof raw.version === "string" ? raw.version : void 0,
|
|
3195
|
+
description: typeof raw.description === "string" ? raw.description : void 0,
|
|
3196
|
+
surface: sanitizePackSurface(raw),
|
|
3197
|
+
source: `file:${file}`
|
|
3198
|
+
};
|
|
3199
|
+
};
|
|
3200
|
+
return {
|
|
3201
|
+
id,
|
|
3202
|
+
resolve,
|
|
3203
|
+
list() {
|
|
3204
|
+
let names;
|
|
3205
|
+
try {
|
|
3206
|
+
names = readdirSync(dir).filter((f) => f.endsWith(".json"));
|
|
3207
|
+
} catch {
|
|
3208
|
+
return [];
|
|
3209
|
+
}
|
|
3210
|
+
const out = [];
|
|
3211
|
+
for (const f of names) {
|
|
3212
|
+
const pack = resolve(f.slice(0, -5));
|
|
3213
|
+
if (pack) out.push(pack);
|
|
3214
|
+
}
|
|
3215
|
+
return out;
|
|
3216
|
+
}
|
|
3217
|
+
};
|
|
3218
|
+
}
|
|
3219
|
+
function createPackResolver(sources) {
|
|
3220
|
+
return {
|
|
3221
|
+
sources,
|
|
3222
|
+
resolve(name) {
|
|
3223
|
+
if (!isValidPackName(name)) return null;
|
|
3224
|
+
for (const source of sources) {
|
|
3225
|
+
const pack = source.resolve(name);
|
|
3226
|
+
if (pack) return pack;
|
|
3227
|
+
}
|
|
3228
|
+
return null;
|
|
3229
|
+
},
|
|
3230
|
+
listPacks() {
|
|
3231
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3232
|
+
const out = [];
|
|
3233
|
+
for (const source of sources) {
|
|
3234
|
+
for (const pack of source.list?.() ?? []) {
|
|
3235
|
+
if (!seen.has(pack.name)) {
|
|
3236
|
+
seen.add(pack.name);
|
|
3237
|
+
out.push(pack);
|
|
3238
|
+
}
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
return out;
|
|
3242
|
+
}
|
|
3243
|
+
};
|
|
3244
|
+
}
|
|
3245
|
+
function defaultPackSources(opts) {
|
|
3246
|
+
const sources = [createDirPackSource("project", opts.projectDir)];
|
|
3247
|
+
for (const dir of opts.userDirs ?? []) sources.push(createDirPackSource("user", dir));
|
|
3248
|
+
sources.push(builtinSource);
|
|
3249
|
+
return sources;
|
|
3250
|
+
}
|
|
3251
|
+
|
|
3034
3252
|
// src/decompress.ts
|
|
3035
3253
|
function parseBlockIdArg(arg) {
|
|
3036
3254
|
const normalized = arg.trim().toLowerCase();
|
|
@@ -4339,6 +4557,7 @@ export {
|
|
|
4339
4557
|
buildRecap,
|
|
4340
4558
|
buildRestoredContentPreview,
|
|
4341
4559
|
buildStatusReport,
|
|
4560
|
+
builtinSource,
|
|
4342
4561
|
clearDocFeatures,
|
|
4343
4562
|
clearMessageFilters,
|
|
4344
4563
|
cloneWithDescriptions,
|
|
@@ -4347,11 +4566,15 @@ export {
|
|
|
4347
4566
|
coveredMessageIds,
|
|
4348
4567
|
createBpeTokenizer,
|
|
4349
4568
|
createCore,
|
|
4569
|
+
createDirPackSource,
|
|
4350
4570
|
createInitialState,
|
|
4571
|
+
createPackResolver,
|
|
4351
4572
|
createRenderRefsNode,
|
|
4352
4573
|
deactivateBlock,
|
|
4353
4574
|
defaultConfig,
|
|
4354
4575
|
defaultCountTokens,
|
|
4576
|
+
defaultPack,
|
|
4577
|
+
defaultPackSources,
|
|
4355
4578
|
defaultPrompts,
|
|
4356
4579
|
docCacheInfo,
|
|
4357
4580
|
docFeatures,
|
|
@@ -4372,6 +4595,8 @@ export {
|
|
|
4372
4595
|
isMessageProtected,
|
|
4373
4596
|
isRenderedSummaryMessage,
|
|
4374
4597
|
isSummaryMessageId,
|
|
4598
|
+
isValidPackName,
|
|
4599
|
+
leanPack,
|
|
4375
4600
|
listMessageFilters,
|
|
4376
4601
|
listSearchAlgorithms,
|
|
4377
4602
|
makeIO,
|
|
@@ -4401,6 +4626,7 @@ export {
|
|
|
4401
4626
|
resolvePrompts,
|
|
4402
4627
|
resolveTransformChannel,
|
|
4403
4628
|
runPipeline,
|
|
4629
|
+
sanitizePackSurface,
|
|
4404
4630
|
searchBlocks,
|
|
4405
4631
|
searchBlocksAsync,
|
|
4406
4632
|
setDocCacheCap,
|