acp-kernel 0.0.65 → 0.0.66-pr.264.118
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 +236 -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,e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AClB,oBAAoB,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,234 @@ 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: `HOW TO COMPRESS (condensed)
|
|
3148
|
+
|
|
3149
|
+
Your summary becomes the only record of the replaced range \u2014 make it self-contained: a reader must be able to continue the task without the original. It records the PAST: label recorded task state as history ("TASK AS OF THIS BLOCK: ...") \u2014 never as a live instruction. Record facts and state only \u2014 never a simulated transcript of the dialogue (no Q&A lists, no "(answered)" claims): an answer not actually sent is PENDING, and a user question is recorded as asked \u2014 with its ref \u2014 not as answered.
|
|
3150
|
+
|
|
3151
|
+
KEEP VERBATIM: full paths with line numbers on every mention (\`lib/hooks.ts:347\`, never a bare \`hooks.ts\`); signatures AND the critical code line that IS the finding; exact error text; findings with numbers + mechanism ("1.76\xD7 PPL because KV store is static", not "X is worse"); decisions WITH rationale ("chose X over Y because Z"); constraints ("must support Node 22"); exact versions/config keys/thresholds; user intent \u2014 verbatim quotes ONLY with a message ref (\`User said (m00132): "ship it tonight"\`), otherwise paraphrase and never present a reconstructed phrase as a quote; the overall goal and how it evolved; the purpose behind significant actions; open questions/TODOs; anchor refs (\`m00420\`\u2013\`m00510\`).
|
|
3152
|
+
|
|
3153
|
+
DROP (extract the signal, discard the vessel): verbose logs after capturing the error/result; duplicate reads; consumed and dead-end exploration (preserve one line: "tried X, failed because Y"); back-and-forth once the final position is captured; repeated status checks. For each significant dropped item add a one-line CONTENT description of what it covers ("probe_kvnet.py: tests n-gram baseline, generation quality, long-range dependency"), not where it lives.
|
|
3154
|
+
|
|
3155
|
+
PRIORITY: 1. user goal/intent/constraints 2. decisions+rationale 3. exact artifacts (paths/signatures/errors/values) 4. conclusions 5. lessons.
|
|
3156
|
+
|
|
3157
|
+
Dense scannable bullets under short thematic headers \u2014 never narrative prose. Do not mimic the style of existing summaries in context.`,
|
|
3158
|
+
multiTierIntro: null,
|
|
3159
|
+
tier2: null,
|
|
3160
|
+
tier3: null,
|
|
3161
|
+
decompressPhilosophy: null,
|
|
3162
|
+
contextBreakdown: null,
|
|
3163
|
+
throttleRetry: null
|
|
3164
|
+
},
|
|
3165
|
+
toolExtras: {
|
|
3166
|
+
compress: { promptSnippet: "", promptGuidelines: [] },
|
|
3167
|
+
decompress: { promptSnippet: "", promptGuidelines: [] },
|
|
3168
|
+
search_context: { promptSnippet: "", promptGuidelines: [] },
|
|
3169
|
+
acp_status: { promptSnippet: "", promptGuidelines: [] }
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
}
|
|
3174
|
+
};
|
|
3175
|
+
var BUILTIN_REGISTRY = {
|
|
3176
|
+
default: defaultPack,
|
|
3177
|
+
lean: leanPack
|
|
3178
|
+
};
|
|
3179
|
+
var builtinSource = {
|
|
3180
|
+
id: "builtin",
|
|
3181
|
+
resolve(name) {
|
|
3182
|
+
return BUILTIN_REGISTRY[name] ?? null;
|
|
3183
|
+
},
|
|
3184
|
+
list() {
|
|
3185
|
+
return Object.values(BUILTIN_REGISTRY);
|
|
3186
|
+
}
|
|
3187
|
+
};
|
|
3188
|
+
function readPackFile(file) {
|
|
3189
|
+
try {
|
|
3190
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
3191
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
3192
|
+
} catch {
|
|
3193
|
+
return null;
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
function createDirPackSource(id, dir) {
|
|
3197
|
+
const resolve = (name) => {
|
|
3198
|
+
if (!isValidPackName(name)) return null;
|
|
3199
|
+
const file = path.join(dir, `${name}.json`);
|
|
3200
|
+
const raw = readPackFile(file);
|
|
3201
|
+
if (!raw) return null;
|
|
3202
|
+
return {
|
|
3203
|
+
name,
|
|
3204
|
+
version: typeof raw.version === "string" ? raw.version : void 0,
|
|
3205
|
+
description: typeof raw.description === "string" ? raw.description : void 0,
|
|
3206
|
+
surface: sanitizePackSurface(raw),
|
|
3207
|
+
source: `file:${file}`
|
|
3208
|
+
};
|
|
3209
|
+
};
|
|
3210
|
+
return {
|
|
3211
|
+
id,
|
|
3212
|
+
resolve,
|
|
3213
|
+
list() {
|
|
3214
|
+
let names;
|
|
3215
|
+
try {
|
|
3216
|
+
names = readdirSync(dir).filter((f) => f.endsWith(".json"));
|
|
3217
|
+
} catch {
|
|
3218
|
+
return [];
|
|
3219
|
+
}
|
|
3220
|
+
const out = [];
|
|
3221
|
+
for (const f of names) {
|
|
3222
|
+
const pack = resolve(f.slice(0, -5));
|
|
3223
|
+
if (pack) out.push(pack);
|
|
3224
|
+
}
|
|
3225
|
+
return out;
|
|
3226
|
+
}
|
|
3227
|
+
};
|
|
3228
|
+
}
|
|
3229
|
+
function createPackResolver(sources) {
|
|
3230
|
+
return {
|
|
3231
|
+
sources,
|
|
3232
|
+
resolve(name) {
|
|
3233
|
+
if (!isValidPackName(name)) return null;
|
|
3234
|
+
for (const source of sources) {
|
|
3235
|
+
const pack = source.resolve(name);
|
|
3236
|
+
if (pack) return pack;
|
|
3237
|
+
}
|
|
3238
|
+
return null;
|
|
3239
|
+
},
|
|
3240
|
+
listPacks() {
|
|
3241
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3242
|
+
const out = [];
|
|
3243
|
+
for (const source of sources) {
|
|
3244
|
+
for (const pack of source.list?.() ?? []) {
|
|
3245
|
+
if (!seen.has(pack.name)) {
|
|
3246
|
+
seen.add(pack.name);
|
|
3247
|
+
out.push(pack);
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
return out;
|
|
3252
|
+
}
|
|
3253
|
+
};
|
|
3254
|
+
}
|
|
3255
|
+
function defaultPackSources(opts) {
|
|
3256
|
+
const sources = [createDirPackSource("project", opts.projectDir)];
|
|
3257
|
+
for (const dir of opts.userDirs ?? []) sources.push(createDirPackSource("user", dir));
|
|
3258
|
+
sources.push(builtinSource);
|
|
3259
|
+
return sources;
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3034
3262
|
// src/decompress.ts
|
|
3035
3263
|
function parseBlockIdArg(arg) {
|
|
3036
3264
|
const normalized = arg.trim().toLowerCase();
|
|
@@ -4339,6 +4567,7 @@ export {
|
|
|
4339
4567
|
buildRecap,
|
|
4340
4568
|
buildRestoredContentPreview,
|
|
4341
4569
|
buildStatusReport,
|
|
4570
|
+
builtinSource,
|
|
4342
4571
|
clearDocFeatures,
|
|
4343
4572
|
clearMessageFilters,
|
|
4344
4573
|
cloneWithDescriptions,
|
|
@@ -4347,11 +4576,15 @@ export {
|
|
|
4347
4576
|
coveredMessageIds,
|
|
4348
4577
|
createBpeTokenizer,
|
|
4349
4578
|
createCore,
|
|
4579
|
+
createDirPackSource,
|
|
4350
4580
|
createInitialState,
|
|
4581
|
+
createPackResolver,
|
|
4351
4582
|
createRenderRefsNode,
|
|
4352
4583
|
deactivateBlock,
|
|
4353
4584
|
defaultConfig,
|
|
4354
4585
|
defaultCountTokens,
|
|
4586
|
+
defaultPack,
|
|
4587
|
+
defaultPackSources,
|
|
4355
4588
|
defaultPrompts,
|
|
4356
4589
|
docCacheInfo,
|
|
4357
4590
|
docFeatures,
|
|
@@ -4372,6 +4605,8 @@ export {
|
|
|
4372
4605
|
isMessageProtected,
|
|
4373
4606
|
isRenderedSummaryMessage,
|
|
4374
4607
|
isSummaryMessageId,
|
|
4608
|
+
isValidPackName,
|
|
4609
|
+
leanPack,
|
|
4375
4610
|
listMessageFilters,
|
|
4376
4611
|
listSearchAlgorithms,
|
|
4377
4612
|
makeIO,
|
|
@@ -4401,6 +4636,7 @@ export {
|
|
|
4401
4636
|
resolvePrompts,
|
|
4402
4637
|
resolveTransformChannel,
|
|
4403
4638
|
runPipeline,
|
|
4639
|
+
sanitizePackSurface,
|
|
4404
4640
|
searchBlocks,
|
|
4405
4641
|
searchBlocksAsync,
|
|
4406
4642
|
setDocCacheCap,
|