@tarquinen/opencode-dcp 1.3.0-beta.0 → 1.3.1-beta.0
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 +11 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -13
- package/dist/index.js.map +1 -1
- package/dist/lib/auth.d.ts +4 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +32 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/commands/context.d.ts.map +1 -1
- package/dist/lib/commands/context.js +36 -23
- package/dist/lib/commands/context.js.map +1 -1
- package/dist/lib/config.d.ts +6 -6
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +46 -45
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/hooks.js +8 -29
- package/dist/lib/hooks.js.map +1 -1
- package/dist/lib/messages/inject.d.ts +7 -0
- package/dist/lib/messages/inject.d.ts.map +1 -1
- package/dist/lib/messages/inject.js +70 -63
- package/dist/lib/messages/inject.js.map +1 -1
- package/dist/lib/messages/prune.js +7 -7
- package/dist/lib/messages/prune.js.map +1 -1
- package/dist/lib/messages/utils.d.ts +21 -1
- package/dist/lib/messages/utils.d.ts.map +1 -1
- package/dist/lib/messages/utils.js +49 -39
- package/dist/lib/messages/utils.js.map +1 -1
- package/dist/lib/prompts/compress-tool-spec.d.ts +2 -0
- package/dist/lib/prompts/compress-tool-spec.d.ts.map +1 -0
- package/dist/lib/prompts/compress-tool-spec.js +58 -0
- package/dist/lib/prompts/compress-tool-spec.js.map +1 -0
- package/dist/lib/prompts/distill-tool-spec.d.ts +2 -0
- package/dist/lib/prompts/distill-tool-spec.d.ts.map +1 -0
- package/dist/lib/prompts/distill-tool-spec.js +48 -0
- package/dist/lib/prompts/distill-tool-spec.js.map +1 -0
- package/dist/lib/prompts/index.d.ts +7 -0
- package/dist/lib/prompts/index.d.ts.map +1 -1
- package/dist/lib/prompts/index.js +28 -36
- package/dist/lib/prompts/index.js.map +1 -1
- package/dist/lib/prompts/nudge.generated.d.ts +2 -0
- package/dist/lib/prompts/nudge.generated.d.ts.map +1 -0
- package/dist/lib/prompts/nudge.generated.js +17 -0
- package/dist/lib/prompts/nudge.generated.js.map +1 -0
- package/dist/lib/prompts/prune-tool-spec.d.ts +2 -0
- package/dist/lib/prompts/prune-tool-spec.d.ts.map +1 -0
- package/dist/lib/prompts/prune-tool-spec.js +40 -0
- package/dist/lib/prompts/prune-tool-spec.js.map +1 -0
- package/dist/lib/prompts/system.generated.d.ts +2 -0
- package/dist/lib/prompts/system.generated.d.ts.map +1 -0
- package/dist/lib/prompts/system.generated.js +90 -0
- package/dist/lib/prompts/system.generated.js.map +1 -0
- package/dist/lib/state/persistence.d.ts +2 -2
- package/dist/lib/state/persistence.d.ts.map +1 -1
- package/dist/lib/state/persistence.js +1 -1
- package/dist/lib/state/persistence.js.map +1 -1
- package/dist/lib/state/state.js +3 -3
- package/dist/lib/state/state.js.map +1 -1
- package/dist/lib/state/tool-cache.d.ts.map +1 -1
- package/dist/lib/state/tool-cache.js +2 -5
- package/dist/lib/state/tool-cache.js.map +1 -1
- package/dist/lib/state/types.d.ts +2 -2
- package/dist/lib/state/types.d.ts.map +1 -1
- package/dist/lib/state/utils.js +1 -1
- package/dist/lib/state/utils.js.map +1 -1
- package/dist/lib/strategies/index.d.ts +1 -1
- package/dist/lib/strategies/index.d.ts.map +1 -1
- package/dist/lib/strategies/index.js +1 -1
- package/dist/lib/strategies/index.js.map +1 -1
- package/dist/lib/tools/compress.d.ts +4 -0
- package/dist/lib/tools/compress.d.ts.map +1 -0
- package/dist/lib/tools/{squash.js → compress.js} +22 -22
- package/dist/lib/tools/compress.js.map +1 -0
- package/dist/lib/tools/{discard.d.ts → distill.d.ts} +2 -2
- package/dist/lib/tools/distill.d.ts.map +1 -0
- package/dist/lib/tools/{extract.js → distill.js} +12 -7
- package/dist/lib/tools/{extract.js.map → distill.js.map} +1 -1
- package/dist/lib/tools/index.d.ts +3 -3
- package/dist/lib/tools/index.d.ts.map +1 -1
- package/dist/lib/tools/index.js +3 -3
- package/dist/lib/tools/index.js.map +1 -1
- package/dist/lib/tools/prune-shared.d.ts.map +1 -1
- package/dist/lib/tools/prune-shared.js +32 -12
- package/dist/lib/tools/prune-shared.js.map +1 -1
- package/dist/lib/tools/prune.d.ts +4 -0
- package/dist/lib/tools/prune.d.ts.map +1 -0
- package/dist/lib/tools/{discard.js → prune.js} +6 -6
- package/dist/lib/tools/prune.js.map +1 -0
- package/dist/lib/tools/utils.d.ts +3 -3
- package/dist/lib/tools/utils.d.ts.map +1 -1
- package/dist/lib/tools/utils.js +7 -7
- package/dist/lib/tools/utils.js.map +1 -1
- package/dist/lib/ui/notification.d.ts +1 -1
- package/dist/lib/ui/notification.d.ts.map +1 -1
- package/dist/lib/ui/notification.js +6 -6
- package/dist/lib/ui/notification.js.map +1 -1
- package/package.json +6 -4
- package/dist/lib/prompts/discard-tool-spec.d.ts +0 -2
- package/dist/lib/prompts/discard-tool-spec.d.ts.map +0 -1
- package/dist/lib/prompts/discard-tool-spec.js +0 -18
- package/dist/lib/prompts/discard-tool-spec.js.map +0 -1
- package/dist/lib/prompts/extract-tool-spec.d.ts +0 -2
- package/dist/lib/prompts/extract-tool-spec.d.ts.map +0 -1
- package/dist/lib/prompts/extract-tool-spec.js +0 -23
- package/dist/lib/prompts/extract-tool-spec.js.map +0 -1
- package/dist/lib/prompts/nudge/all.d.ts +0 -2
- package/dist/lib/prompts/nudge/all.d.ts.map +0 -1
- package/dist/lib/prompts/nudge/all.js +0 -9
- package/dist/lib/prompts/nudge/all.js.map +0 -1
- package/dist/lib/prompts/nudge/discard-extract.d.ts +0 -2
- package/dist/lib/prompts/nudge/discard-extract.d.ts.map +0 -1
- package/dist/lib/prompts/nudge/discard-extract.js +0 -8
- package/dist/lib/prompts/nudge/discard-extract.js.map +0 -1
- package/dist/lib/prompts/nudge/discard-squash.d.ts +0 -2
- package/dist/lib/prompts/nudge/discard-squash.d.ts.map +0 -1
- package/dist/lib/prompts/nudge/discard-squash.js +0 -8
- package/dist/lib/prompts/nudge/discard-squash.js.map +0 -1
- package/dist/lib/prompts/nudge/discard.d.ts +0 -2
- package/dist/lib/prompts/nudge/discard.d.ts.map +0 -1
- package/dist/lib/prompts/nudge/discard.js +0 -8
- package/dist/lib/prompts/nudge/discard.js.map +0 -1
- package/dist/lib/prompts/nudge/extract-squash.d.ts +0 -2
- package/dist/lib/prompts/nudge/extract-squash.d.ts.map +0 -1
- package/dist/lib/prompts/nudge/extract-squash.js +0 -8
- package/dist/lib/prompts/nudge/extract-squash.js.map +0 -1
- package/dist/lib/prompts/nudge/extract.d.ts +0 -2
- package/dist/lib/prompts/nudge/extract.d.ts.map +0 -1
- package/dist/lib/prompts/nudge/extract.js +0 -8
- package/dist/lib/prompts/nudge/extract.js.map +0 -1
- package/dist/lib/prompts/nudge/squash.d.ts +0 -2
- package/dist/lib/prompts/nudge/squash.d.ts.map +0 -1
- package/dist/lib/prompts/nudge/squash.js +0 -8
- package/dist/lib/prompts/nudge/squash.js.map +0 -1
- package/dist/lib/prompts/squash-tool-spec.d.ts +0 -2
- package/dist/lib/prompts/squash-tool-spec.d.ts.map +0 -1
- package/dist/lib/prompts/squash-tool-spec.js +0 -33
- package/dist/lib/prompts/squash-tool-spec.js.map +0 -1
- package/dist/lib/prompts/system/all.d.ts +0 -2
- package/dist/lib/prompts/system/all.d.ts.map +0 -1
- package/dist/lib/prompts/system/all.js +0 -26
- package/dist/lib/prompts/system/all.js.map +0 -1
- package/dist/lib/prompts/system/discard-extract.d.ts +0 -2
- package/dist/lib/prompts/system/discard-extract.d.ts.map +0 -1
- package/dist/lib/prompts/system/discard-extract.js +0 -26
- package/dist/lib/prompts/system/discard-extract.js.map +0 -1
- package/dist/lib/prompts/system/discard-squash.d.ts +0 -2
- package/dist/lib/prompts/system/discard-squash.d.ts.map +0 -1
- package/dist/lib/prompts/system/discard-squash.js +0 -25
- package/dist/lib/prompts/system/discard-squash.js.map +0 -1
- package/dist/lib/prompts/system/discard.d.ts +0 -2
- package/dist/lib/prompts/system/discard.d.ts.map +0 -1
- package/dist/lib/prompts/system/discard.js +0 -27
- package/dist/lib/prompts/system/discard.js.map +0 -1
- package/dist/lib/prompts/system/extract-squash.d.ts +0 -2
- package/dist/lib/prompts/system/extract-squash.d.ts.map +0 -1
- package/dist/lib/prompts/system/extract-squash.js +0 -25
- package/dist/lib/prompts/system/extract-squash.js.map +0 -1
- package/dist/lib/prompts/system/extract.d.ts +0 -2
- package/dist/lib/prompts/system/extract.d.ts.map +0 -1
- package/dist/lib/prompts/system/extract.js +0 -27
- package/dist/lib/prompts/system/extract.js.map +0 -1
- package/dist/lib/prompts/system/squash.d.ts +0 -2
- package/dist/lib/prompts/system/squash.d.ts.map +0 -1
- package/dist/lib/prompts/system/squash.js +0 -27
- package/dist/lib/prompts/system/squash.js.map +0 -1
- package/dist/lib/tools/discard.d.ts.map +0 -1
- package/dist/lib/tools/discard.js.map +0 -1
- package/dist/lib/tools/extract.d.ts +0 -4
- package/dist/lib/tools/extract.d.ts.map +0 -1
- package/dist/lib/tools/squash.d.ts +0 -4
- package/dist/lib/tools/squash.d.ts.map +0 -1
- package/dist/lib/tools/squash.js.map +0 -1
package/dist/lib/tools/utils.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Searches messages for a string and returns the message ID where it's found.
|
|
3
3
|
* Searches in text parts, tool outputs, tool inputs, and other textual content.
|
|
4
|
-
* Also searches through existing
|
|
4
|
+
* Also searches through existing compress summaries to enable chained compression.
|
|
5
5
|
* Throws an error if the string is not found or found more than once.
|
|
6
6
|
*/
|
|
7
|
-
export function findStringInMessages(messages, searchString, logger,
|
|
7
|
+
export function findStringInMessages(messages, searchString, logger, compressSummaries = [], stringType) {
|
|
8
8
|
const matches = [];
|
|
9
|
-
// First, search through existing
|
|
10
|
-
// This allows referencing text from previous
|
|
11
|
-
for (const summary of
|
|
9
|
+
// First, search through existing compress summaries
|
|
10
|
+
// This allows referencing text from previous compress operations
|
|
11
|
+
for (const summary of compressSummaries) {
|
|
12
12
|
if (summary.summary.includes(searchString)) {
|
|
13
13
|
const anchorIndex = messages.findIndex((m) => m.info.id === summary.anchorMessageId);
|
|
14
14
|
if (anchorIndex !== -1) {
|
|
@@ -45,10 +45,10 @@ export function findStringInMessages(messages, searchString, logger, squashSumma
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
if (matches.length === 0) {
|
|
48
|
-
throw new Error(
|
|
48
|
+
throw new Error(`${stringType} not found in conversation. Make sure the string exists and is spelled exactly as it appears.`);
|
|
49
49
|
}
|
|
50
50
|
if (matches.length > 1) {
|
|
51
|
-
throw new Error(`
|
|
51
|
+
throw new Error(`Found multiple matches for ${stringType}. Provide more surrounding context to uniquely identify the intended match.`);
|
|
52
52
|
}
|
|
53
53
|
return matches[0];
|
|
54
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/tools/utils.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAChC,QAAqB,EACrB,YAAoB,EACpB,MAAc,EACd,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/tools/utils.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAChC,QAAqB,EACrB,YAAoB,EACpB,MAAc,EACd,oBAAuC,EAAE,EACzC,UAAuC;IAEvC,MAAM,OAAO,GAAkD,EAAE,CAAA;IAEjE,oDAAoD;IACpD,iEAAiE;IACjE,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAAC;QACtC,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACzC,MAAM,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CA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I,CAAC,IAAI,CAAC,CAAA;YAC5B,CAAC;iBAAM,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;gBAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAY,CAAA;gBACnC,IAAI,SAAS,EAAE,KAAK,EAAE,CAAC;oBACnB,QAAQ,CAAC,IAAI,CACT,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ;wBAC/B,CAAC,CAAC,SAAS,CAAC,KAAK;wBACjB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CACxC,CAAA;gBACL,CAAC;gBACD,IAAI,SAAS,EAAE,MAAM,KAAK,WAAW,IAAI,SAAS,EAAE,MAAM,EAAE,CAAC;oBACzD,QAAQ,CAAC,IAAI,CACT,OAAO,SAAS,CAAC,MAAM,KAAK,QAAQ;wBAChC,CAAC,CAAC,SAAS,CAAC,MAAM;wBAClB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CACzC,CAAA;gBACL,CAAC;qBAAM,IAAI,SAAS,EAAE,MAAM,KAAK,OAAO,IAAI,SAAS,EAAE,KAAK,EAAE,CAAC;oBAC3D,QAAQ,CAAC,IAAI,CACT,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ;wBAC/B,CAAC,CAAC,SAAS,CAAC,KAAK;wBACjB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CACxC,CAAA;gBACL,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAA;AACnB,CAAC"}
|
|
@@ -5,6 +5,6 @@ import { PluginConfig } from "../config";
|
|
|
5
5
|
export type PruneReason = "completion" | "noise" | "extraction";
|
|
6
6
|
export declare const PRUNE_REASON_LABELS: Record<PruneReason, string>;
|
|
7
7
|
export declare function sendUnifiedNotification(client: any, logger: Logger, config: PluginConfig, state: SessionState, sessionId: string, pruneToolIds: string[], toolMetadata: Map<string, ToolParameterEntry>, reason: PruneReason | undefined, params: any, workingDirectory: string, distillation?: string[]): Promise<boolean>;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function sendCompressNotification(client: any, logger: Logger, config: PluginConfig, state: SessionState, sessionId: string, toolIds: string[], messageIds: string[], topic: string, summary: string, startResult: any, endResult: any, totalMessages: number, params: any): Promise<boolean>;
|
|
9
9
|
export declare function sendIgnoredMessage(client: any, sessionID: string, text: string, params: any, logger: Logger): Promise<void>;
|
|
10
10
|
//# sourceMappingURL=notification.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../lib/ui/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAS5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,OAAO,GAAG,YAAY,CAAA;AAC/D,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAI3D,CAAA;AA+CD,wBAAsB,uBAAuB,CACzC,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EAAE,EACtB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC7C,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,MAAM,EAAE,GAAG,EACX,gBAAgB,EAAE,MAAM,EACxB,YAAY,CAAC,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,OAAO,CAAC,CA2BlB;AAED,wBAAsB,
|
|
1
|
+
{"version":3,"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X,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAiCf"}
|
|
@@ -6,7 +6,7 @@ export const PRUNE_REASON_LABELS = {
|
|
|
6
6
|
};
|
|
7
7
|
function buildMinimalMessage(state, reason, distillation, showDistillation) {
|
|
8
8
|
const extractedTokens = countDistillationTokens(distillation);
|
|
9
|
-
const extractedSuffix = extractedTokens > 0 ? ` (
|
|
9
|
+
const extractedSuffix = extractedTokens > 0 ? ` (distilled ${formatTokenCount(extractedTokens)})` : "";
|
|
10
10
|
const reasonSuffix = reason && extractedTokens === 0 ? ` — ${PRUNE_REASON_LABELS[reason]}` : "";
|
|
11
11
|
let message = formatStatsHeader(state.stats.totalPruneTokens, state.stats.pruneTokenCounter) +
|
|
12
12
|
reasonSuffix +
|
|
@@ -18,7 +18,7 @@ function buildDetailedMessage(state, reason, pruneToolIds, toolMetadata, working
|
|
|
18
18
|
if (pruneToolIds.length > 0) {
|
|
19
19
|
const pruneTokenCounterStr = `~${formatTokenCount(state.stats.pruneTokenCounter)}`;
|
|
20
20
|
const extractedTokens = countDistillationTokens(distillation);
|
|
21
|
-
const extractedSuffix = extractedTokens > 0 ? `,
|
|
21
|
+
const extractedSuffix = extractedTokens > 0 ? `, distilled ${formatTokenCount(extractedTokens)}` : "";
|
|
22
22
|
const reasonLabel = reason && extractedTokens === 0 ? ` — ${PRUNE_REASON_LABELS[reason]}` : "";
|
|
23
23
|
message += `\n\n▣ Pruning (${pruneTokenCounterStr}${extractedSuffix})${reasonLabel}`;
|
|
24
24
|
const itemLines = formatPrunedItemsList(pruneToolIds, toolMetadata, workingDirectory);
|
|
@@ -34,14 +34,14 @@ export async function sendUnifiedNotification(client, logger, config, state, ses
|
|
|
34
34
|
if (config.pruneNotification === "off") {
|
|
35
35
|
return false;
|
|
36
36
|
}
|
|
37
|
-
const showDistillation = config.tools.
|
|
37
|
+
const showDistillation = config.tools.distill.showDistillation;
|
|
38
38
|
const message = config.pruneNotification === "minimal"
|
|
39
39
|
? buildMinimalMessage(state, reason, distillation, showDistillation)
|
|
40
40
|
: buildDetailedMessage(state, reason, pruneToolIds, toolMetadata, workingDirectory, distillation, showDistillation);
|
|
41
41
|
await sendIgnoredMessage(client, sessionId, message, params, logger);
|
|
42
42
|
return true;
|
|
43
43
|
}
|
|
44
|
-
export async function
|
|
44
|
+
export async function sendCompressNotification(client, logger, config, state, sessionId, toolIds, messageIds, topic, summary, startResult, endResult, totalMessages, params) {
|
|
45
45
|
if (config.pruneNotification === "off") {
|
|
46
46
|
return false;
|
|
47
47
|
}
|
|
@@ -53,7 +53,7 @@ export async function sendSquashNotification(client, logger, config, state, sess
|
|
|
53
53
|
message = formatStatsHeader(state.stats.totalPruneTokens, state.stats.pruneTokenCounter);
|
|
54
54
|
const pruneTokenCounterStr = `~${formatTokenCount(state.stats.pruneTokenCounter)}`;
|
|
55
55
|
const progressBar = formatProgressBar(totalMessages, startResult.messageIndex, endResult.messageIndex, 25);
|
|
56
|
-
message += `\n\n▣
|
|
56
|
+
message += `\n\n▣ Compressing (${pruneTokenCounterStr}) ${progressBar}`;
|
|
57
57
|
message += `\n→ Topic: ${topic}`;
|
|
58
58
|
message += `\n→ Items: ${messageIds.length} messages`;
|
|
59
59
|
if (toolIds.length > 0) {
|
|
@@ -62,7 +62,7 @@ export async function sendSquashNotification(client, logger, config, state, sess
|
|
|
62
62
|
else {
|
|
63
63
|
message += ` condensed`;
|
|
64
64
|
}
|
|
65
|
-
if (config.tools.
|
|
65
|
+
if (config.tools.compress.showSummary) {
|
|
66
66
|
message += `\n→ Summary: ${summary}`;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../lib/ui/notification.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,uBAAuB,EACvB,eAAe,EACf,qBAAqB,EACrB,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AAM,CAAC,KAAK,IAAI,SAAS,CAAA;IACvC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,SAAS,CAAA;IAC3C,MAAM,KAAK,GACP,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,OAAO;QAC/B,CAAC,CAAC;YACI,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,OAAO,EAAE,MAAM,CAAC,OAAO;SAC1B;QACH,CAAC,CAAC,SAAS,CAAA;IAEnB,IAAI,CAAC;QACD,MAAM,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;YACxB,IAAI,EAAE;gBACF,EAAE,EAAE,SAAS;aAChB;YACD,IAAI,EAAE;gBACF,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,KAAK;gBACZ,OAAO,EAAE,OAAO;gBAChB,KAAK,EAAE;oBACH;wBACI,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI;wBACV,OAAO,EAAE,IAAI;qBAChB;iBACJ;aACJ;SACJ,CAAC,CAAA;IACN,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,MAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;IACzE,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@tarquinen/opencode-dcp",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.1-beta.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "OpenCode plugin that optimizes token usage by pruning obsolete tool outputs from conversation context",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"clean": "rm -rf dist",
|
|
11
|
+
"generate:prompts": "tsx scripts/generate-prompts.ts",
|
|
12
|
+
"prebuild": "npm run generate:prompts",
|
|
11
13
|
"build": "npm run clean && tsc",
|
|
12
|
-
"postbuild": "rm -rf dist/logs",
|
|
13
14
|
"prepublishOnly": "npm run build",
|
|
14
15
|
"dev": "opencode plugin dev",
|
|
15
|
-
"typecheck": "tsc --noEmit",
|
|
16
|
+
"typecheck": "npm run generate:prompts && tsc --noEmit",
|
|
16
17
|
"test": "node --import tsx --test tests/*.test.ts",
|
|
17
18
|
"format": "prettier --write .",
|
|
18
|
-
"format:check": "prettier --check ."
|
|
19
|
+
"format:check": "prettier --check .",
|
|
20
|
+
"dcp": "tsx scripts/print.ts"
|
|
19
21
|
},
|
|
20
22
|
"keywords": [
|
|
21
23
|
"opencode",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const DISCARD_TOOL_SPEC = "**Purpose:** Discard tool outputs from context to manage size and reduce noise.\n**IDs:** Use numeric IDs from `<prunable-tools>` (format: `ID: tool, parameter`).\n**Use When:**\n- Noise \u2192 irrelevant, unhelpful, or superseded outputs\n**Do NOT Use When:**\n- Output contains useful information\n- Output needed later (files to edit, implementation context)\n**Best Practices:**\n- Batch multiple items; avoid single small outputs (unless pure noise)\n- Criterion: \"Needed for upcoming task?\" \u2192 keep it\n**Format:**\n- `ids`: string[] \u2014 numeric IDs from prunable list\n**Example:**\nNoise removal:\n ids: [\"5\"]\n Context: Read wrong_file.ts \u2014 not relevant to auth system\n";
|
|
2
|
-
//# sourceMappingURL=discard-tool-spec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard-tool-spec.d.ts","sourceRoot":"","sources":["../../../lib/prompts/discard-tool-spec.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,ksBAgB7B,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export const DISCARD_TOOL_SPEC = `**Purpose:** Discard tool outputs from context to manage size and reduce noise.
|
|
2
|
-
**IDs:** Use numeric IDs from \`<prunable-tools>\` (format: \`ID: tool, parameter\`).
|
|
3
|
-
**Use When:**
|
|
4
|
-
- Noise → irrelevant, unhelpful, or superseded outputs
|
|
5
|
-
**Do NOT Use When:**
|
|
6
|
-
- Output contains useful information
|
|
7
|
-
- Output needed later (files to edit, implementation context)
|
|
8
|
-
**Best Practices:**
|
|
9
|
-
- Batch multiple items; avoid single small outputs (unless pure noise)
|
|
10
|
-
- Criterion: "Needed for upcoming task?" → keep it
|
|
11
|
-
**Format:**
|
|
12
|
-
- \`ids\`: string[] — numeric IDs from prunable list
|
|
13
|
-
**Example:**
|
|
14
|
-
Noise removal:
|
|
15
|
-
ids: ["5"]
|
|
16
|
-
Context: Read wrong_file.ts — not relevant to auth system
|
|
17
|
-
`;
|
|
18
|
-
//# sourceMappingURL=discard-tool-spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard-tool-spec.js","sourceRoot":"","sources":["../../../lib/prompts/discard-tool-spec.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;CAgBhC,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const EXTRACT_TOOL_SPEC = "**Purpose:** Extract key findings from tool outputs into distilled knowledge; remove raw outputs from context.\n**IDs:** Use numeric IDs from `<prunable-tools>` (format: `ID: tool, parameter`).\n**Use When:**\n- Task complete \u2192 preserve findings\n- Distill context \u2192 keep specifics, drop noise\n**Do NOT Use When:**\n- Need exact syntax (edits/grep) \u2192 keep raw output\n- Planning modifications \u2192 keep read output\n**Best Practices:**\n- Batch multiple items; avoid frequent small extractions\n- Preserve raw output if editing/modifying later\n**Format:**\n- `ids`: string[] \u2014 numeric IDs from prunable list\n- `distillation`: string[] \u2014 positional mapping (distillation[i] for ids[i])\n- Detail level: signatures, logic, constraints, values\n**Example:**\n `ids`: [\"10\", \"11\"]\n `distillation`: [\n \"auth.ts: validateToken(token: string)\u2192User|null. Cache 5min TTL then OIDC. bcrypt 12 rounds. Tokens \u2265128 chars.\",\n \"user.ts: interface User {id: string; email: string; permissions: ('read'|'write'|'admin')[]; status: 'active'|'suspended'}\"\n ]\n";
|
|
2
|
-
//# sourceMappingURL=extract-tool-spec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract-tool-spec.d.ts","sourceRoot":"","sources":["../../../lib/prompts/extract-tool-spec.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,8lCAqB7B,CAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const EXTRACT_TOOL_SPEC = `**Purpose:** Extract key findings from tool outputs into distilled knowledge; remove raw outputs from context.
|
|
2
|
-
**IDs:** Use numeric IDs from \`<prunable-tools>\` (format: \`ID: tool, parameter\`).
|
|
3
|
-
**Use When:**
|
|
4
|
-
- Task complete → preserve findings
|
|
5
|
-
- Distill context → keep specifics, drop noise
|
|
6
|
-
**Do NOT Use When:**
|
|
7
|
-
- Need exact syntax (edits/grep) → keep raw output
|
|
8
|
-
- Planning modifications → keep read output
|
|
9
|
-
**Best Practices:**
|
|
10
|
-
- Batch multiple items; avoid frequent small extractions
|
|
11
|
-
- Preserve raw output if editing/modifying later
|
|
12
|
-
**Format:**
|
|
13
|
-
- \`ids\`: string[] — numeric IDs from prunable list
|
|
14
|
-
- \`distillation\`: string[] — positional mapping (distillation[i] for ids[i])
|
|
15
|
-
- Detail level: signatures, logic, constraints, values
|
|
16
|
-
**Example:**
|
|
17
|
-
\`ids\`: ["10", "11"]
|
|
18
|
-
\`distillation\`: [
|
|
19
|
-
"auth.ts: validateToken(token: string)→User|null. Cache 5min TTL then OIDC. bcrypt 12 rounds. Tokens ≥128 chars.",
|
|
20
|
-
"user.ts: interface User {id: string; email: string; permissions: ('read'|'write'|'admin')[]; status: 'active'|'suspended'}"
|
|
21
|
-
]
|
|
22
|
-
`;
|
|
23
|
-
//# sourceMappingURL=extract-tool-spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract-tool-spec.js","sourceRoot":"","sources":["../../../lib/prompts/extract-tool-spec.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBhC,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const NUDGE_ALL = "<instruction name=context_management_required>\n**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.\n**Actions:**\n1. Task done \u2192 use `squash` to condense entire sequence into summary\n2. Noise \u2192 files/commands with no value, use `discard`\n3. Knowledge \u2192 valuable raw data to reference later, use `extract` to distill insights\n**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, perform context management.\n</instruction>";
|
|
2
|
-
//# sourceMappingURL=all.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/nudge/all.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,0fAOP,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export const NUDGE_ALL = `<instruction name=context_management_required>
|
|
2
|
-
**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.
|
|
3
|
-
**Actions:**
|
|
4
|
-
1. Task done → use \`squash\` to condense entire sequence into summary
|
|
5
|
-
2. Noise → files/commands with no value, use \`discard\`
|
|
6
|
-
3. Knowledge → valuable raw data to reference later, use \`extract\` to distill insights
|
|
7
|
-
**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, perform context management.
|
|
8
|
-
</instruction>`;
|
|
9
|
-
//# sourceMappingURL=all.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"all.js","sourceRoot":"","sources":["../../../../lib/prompts/nudge/all.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;eAOV,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const NUDGE_DISCARD_EXTRACT = "<instruction name=context_management_required>\n**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.\n**Actions:**\n1. Noise \u2192 files/commands with no value, use `discard`\n2. Knowledge \u2192 valuable raw data to reference later, use `extract` to distill insights\n**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, perform context management.\n</instruction>";
|
|
2
|
-
//# sourceMappingURL=discard-extract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard-extract.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/nudge/discard-extract.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,+aAMnB,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const NUDGE_DISCARD_EXTRACT = `<instruction name=context_management_required>
|
|
2
|
-
**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.
|
|
3
|
-
**Actions:**
|
|
4
|
-
1. Noise → files/commands with no value, use \`discard\`
|
|
5
|
-
2. Knowledge → valuable raw data to reference later, use \`extract\` to distill insights
|
|
6
|
-
**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, perform context management.
|
|
7
|
-
</instruction>`;
|
|
8
|
-
//# sourceMappingURL=discard-extract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard-extract.js","sourceRoot":"","sources":["../../../../lib/prompts/nudge/discard-extract.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;eAMtB,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const NUDGE_DISCARD_SQUASH = "<instruction name=context_management_required>\n**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.\n**Actions:**\n1. Task done \u2192 sub-task/phase complete, use `squash` to condense into summary\n2. Noise \u2192 files/commands with no value, use `discard`\n**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, perform context management.\n</instruction>";
|
|
2
|
-
//# sourceMappingURL=discard-squash.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard-squash.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/nudge/discard-squash.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,saAMlB,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const NUDGE_DISCARD_SQUASH = `<instruction name=context_management_required>
|
|
2
|
-
**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.
|
|
3
|
-
**Actions:**
|
|
4
|
-
1. Task done → sub-task/phase complete, use \`squash\` to condense into summary
|
|
5
|
-
2. Noise → files/commands with no value, use \`discard\`
|
|
6
|
-
**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, perform context management.
|
|
7
|
-
</instruction>`;
|
|
8
|
-
//# sourceMappingURL=discard-squash.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard-squash.js","sourceRoot":"","sources":["../../../../lib/prompts/nudge/discard-squash.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;eAMrB,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const NUDGE_DISCARD = "<instruction name=context_management_required>\n**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.\n**Actions:**\n1. Noise \u2192 files/commands with no value, use `discard`\n2. Outdated \u2192 outputs no longer relevant, discard\n**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, discard unneeded outputs.\n</instruction>";
|
|
2
|
-
//# sourceMappingURL=discard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/nudge/discard.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,wYAMX,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const NUDGE_DISCARD = `<instruction name=context_management_required>
|
|
2
|
-
**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.
|
|
3
|
-
**Actions:**
|
|
4
|
-
1. Noise → files/commands with no value, use \`discard\`
|
|
5
|
-
2. Outdated → outputs no longer relevant, discard
|
|
6
|
-
**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, discard unneeded outputs.
|
|
7
|
-
</instruction>`;
|
|
8
|
-
//# sourceMappingURL=discard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard.js","sourceRoot":"","sources":["../../../../lib/prompts/nudge/discard.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;eAMd,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const NUDGE_EXTRACT_SQUASH = "<instruction name=context_management_required>\n**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.\n**Actions:**\n1. Task done \u2192 sub-task/phase complete, use `squash` to condense into summary\n2. Knowledge \u2192 valuable raw data to reference later, use `extract` to distill insights\n**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, perform context management.\n</instruction>";
|
|
2
|
-
//# sourceMappingURL=extract-squash.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract-squash.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/nudge/extract-squash.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,scAMlB,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const NUDGE_EXTRACT_SQUASH = `<instruction name=context_management_required>
|
|
2
|
-
**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.
|
|
3
|
-
**Actions:**
|
|
4
|
-
1. Task done → sub-task/phase complete, use \`squash\` to condense into summary
|
|
5
|
-
2. Knowledge → valuable raw data to reference later, use \`extract\` to distill insights
|
|
6
|
-
**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, perform context management.
|
|
7
|
-
</instruction>`;
|
|
8
|
-
//# sourceMappingURL=extract-squash.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract-squash.js","sourceRoot":"","sources":["../../../../lib/prompts/nudge/extract-squash.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;eAMrB,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const NUDGE_EXTRACT = "<instruction name=context_management_required>\n**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.\n**Actions:**\n1. Knowledge \u2192 valuable raw data to reference later, use `extract` with high-fidelity distillation\n2. Phase done \u2192 extract key findings to keep context focused\n**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, extract valuable findings.\n</instruction>";
|
|
2
|
-
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/nudge/extract.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,gcAMX,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const NUDGE_EXTRACT = `<instruction name=context_management_required>
|
|
2
|
-
**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.
|
|
3
|
-
**Actions:**
|
|
4
|
-
1. Knowledge → valuable raw data to reference later, use \`extract\` with high-fidelity distillation
|
|
5
|
-
2. Phase done → extract key findings to keep context focused
|
|
6
|
-
**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, extract valuable findings.
|
|
7
|
-
</instruction>`;
|
|
8
|
-
//# sourceMappingURL=extract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../../../lib/prompts/nudge/extract.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;eAMd,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const NUDGE_SQUASH = "<instruction name=context_management_required>\n**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.\n**Actions:**\n1. Task done \u2192 sub-task/phase complete, use `squash` to condense sequence into summary\n2. Exploration done \u2192 squash results to focus on next task\n**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, squash unneeded ranges.\n</instruction>";
|
|
2
|
-
//# sourceMappingURL=squash.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"squash.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/nudge/squash.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,+aAMV,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const NUDGE_SQUASH = `<instruction name=context_management_required>
|
|
2
|
-
**CONTEXT WARNING:** Context filling with tool outputs. Context hygiene required.
|
|
3
|
-
**Actions:**
|
|
4
|
-
1. Task done → sub-task/phase complete, use \`squash\` to condense sequence into summary
|
|
5
|
-
2. Exploration done → squash results to focus on next task
|
|
6
|
-
**Protocol:** Prioritize cleanup. Don't interrupt atomic ops. After immediate step, squash unneeded ranges.
|
|
7
|
-
</instruction>`;
|
|
8
|
-
//# sourceMappingURL=squash.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"squash.js","sourceRoot":"","sources":["../../../../lib/prompts/nudge/squash.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;eAMb,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const SQUASH_TOOL_SPEC = "**Purpose:** Collapse a contiguous range of conversation into a single summary.\n**Use When:**\n- Task complete \u2192 squash entire sequence (research, tool calls, implementation) into summary\n- Exploration done \u2192 multiple files/commands explored, only need summary\n- Failed attempts \u2192 condense unsuccessful approaches into brief note\n- Verbose output \u2192 section grown large but can be summarized\n**Do NOT Use When:**\n- Need specific details (exact code, file contents, error messages from range)\n- Individual tool outputs \u2192 squash targets conversation ranges, not single outputs\n- Recent content \u2192 may still need for current task\n**How It Works:**\n1. `startString` \u2014 unique text marking range start\n2. `endString` \u2014 unique text marking range end\n3. `topic` \u2014 short label (3-5 words)\n4. `summary` \u2014 replacement text\n5. Everything between (inclusive) removed, summary inserted\n**Best Practices:**\n- Choose unique strings appearing only once\n- Write concise topics: \"Auth System Exploration\", \"Token Logic Refactor\"\n- Write comprehensive summaries with key information\n- Best after finishing work phase, not during active exploration\n**Format:**\n- `input`: [startString, endString, topic, summary]\n**Example:**\n Conversation: [Asked about auth] \u2192 [Read 5 files] \u2192 [Analyzed patterns] \u2192 [Found \"JWT tokens with 24h expiry\"]\n input: [\n \"Asked about authentication\",\n \"JWT tokens with 24h expiry\",\n \"Auth System Exploration\",\n \"Auth: JWT 24h expiry, bcrypt passwords, refresh rotation. Files: auth.ts, tokens.ts, middleware/auth.ts\"\n ]\n";
|
|
2
|
-
//# sourceMappingURL=squash-tool-spec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"squash-tool-spec.d.ts","sourceRoot":"","sources":["../../../lib/prompts/squash-tool-spec.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,ooDA+B5B,CAAA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export const SQUASH_TOOL_SPEC = `**Purpose:** Collapse a contiguous range of conversation into a single summary.
|
|
2
|
-
**Use When:**
|
|
3
|
-
- Task complete → squash entire sequence (research, tool calls, implementation) into summary
|
|
4
|
-
- Exploration done → multiple files/commands explored, only need summary
|
|
5
|
-
- Failed attempts → condense unsuccessful approaches into brief note
|
|
6
|
-
- Verbose output → section grown large but can be summarized
|
|
7
|
-
**Do NOT Use When:**
|
|
8
|
-
- Need specific details (exact code, file contents, error messages from range)
|
|
9
|
-
- Individual tool outputs → squash targets conversation ranges, not single outputs
|
|
10
|
-
- Recent content → may still need for current task
|
|
11
|
-
**How It Works:**
|
|
12
|
-
1. \`startString\` — unique text marking range start
|
|
13
|
-
2. \`endString\` — unique text marking range end
|
|
14
|
-
3. \`topic\` — short label (3-5 words)
|
|
15
|
-
4. \`summary\` — replacement text
|
|
16
|
-
5. Everything between (inclusive) removed, summary inserted
|
|
17
|
-
**Best Practices:**
|
|
18
|
-
- Choose unique strings appearing only once
|
|
19
|
-
- Write concise topics: "Auth System Exploration", "Token Logic Refactor"
|
|
20
|
-
- Write comprehensive summaries with key information
|
|
21
|
-
- Best after finishing work phase, not during active exploration
|
|
22
|
-
**Format:**
|
|
23
|
-
- \`input\`: [startString, endString, topic, summary]
|
|
24
|
-
**Example:**
|
|
25
|
-
Conversation: [Asked about auth] → [Read 5 files] → [Analyzed patterns] → [Found "JWT tokens with 24h expiry"]
|
|
26
|
-
input: [
|
|
27
|
-
"Asked about authentication",
|
|
28
|
-
"JWT tokens with 24h expiry",
|
|
29
|
-
"Auth System Exploration",
|
|
30
|
-
"Auth: JWT 24h expiry, bcrypt passwords, refresh rotation. Files: auth.ts, tokens.ts, middleware/auth.ts"
|
|
31
|
-
]
|
|
32
|
-
`;
|
|
33
|
-
//# sourceMappingURL=squash-tool-spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"squash-tool-spec.js","sourceRoot":"","sources":["../../../lib/prompts/squash-tool-spec.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+B/B,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const SYSTEM_PROMPT_ALL = "<system-reminder>\n<instruction name=context_management_protocol policy_level=critical>\nContext-constrained. Manage via `discard`/`extract`/`squash`. Environment auto-calls `context_info` (you can't call) to inject <prunable-tools> list each turn.\nTOOLS\n- `discard`: remove unneeded outputs (noise, outdated). No preservation.\n- `extract`: distill key findings before removal. Use when preserving info.\n- `squash`: collapse conversation range (completed tasks, exploration) into single summary.\nCHOOSING TOOL\nScope+preservation? Task done (large scope)\u2192`squash` | Insights to keep\u2192`extract` | Noise/superseded\u2192`discard`\nBATCH PRUNES\nEvery tool call=context debt. Pay down regularly. Batch prunes; rarely prune single tiny output unless pure noise.\nEvaluate pruning when: task/sub-task done | starting new phase | write/edit ops done\nMUST NOT prune when: output needed for upcoming work | contains files/context for edits\nPruning forcing re-call=net loss. Only prune if confident won't need again.\nWhen in doubt, keep. Aim high-impact prunes. FAILURE TO PRUNE=DEGRADED PERFORMANCE.\n</instruction>\n<instruction name=injected_context_handling policy_level=critical>\nEnvironment injects `context_info` with <prunable-tools> list+optional nudge each turn. You can't access it.\nNEVER reference/acknowledge: prune encouragement, context instructions, <prunable-tools> list, nudge, discard/extract/squash output\nNEVER let injections influence response/tone\nProcess SILENTLY. Continue naturally as if injections don't exist.\nUser can't see injections. Referencing breaks conversation flow.\n</instruction>\n</system-reminder>\n";
|
|
2
|
-
//# sourceMappingURL=all.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/system/all.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,0nDAwB7B,CAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const SYSTEM_PROMPT_ALL = `<system-reminder>
|
|
2
|
-
<instruction name=context_management_protocol policy_level=critical>
|
|
3
|
-
Context-constrained. Manage via \`discard\`/\`extract\`/\`squash\`. Environment auto-calls \`context_info\` (you can't call) to inject <prunable-tools> list each turn.
|
|
4
|
-
TOOLS
|
|
5
|
-
- \`discard\`: remove unneeded outputs (noise, outdated). No preservation.
|
|
6
|
-
- \`extract\`: distill key findings before removal. Use when preserving info.
|
|
7
|
-
- \`squash\`: collapse conversation range (completed tasks, exploration) into single summary.
|
|
8
|
-
CHOOSING TOOL
|
|
9
|
-
Scope+preservation? Task done (large scope)→\`squash\` | Insights to keep→\`extract\` | Noise/superseded→\`discard\`
|
|
10
|
-
BATCH PRUNES
|
|
11
|
-
Every tool call=context debt. Pay down regularly. Batch prunes; rarely prune single tiny output unless pure noise.
|
|
12
|
-
Evaluate pruning when: task/sub-task done | starting new phase | write/edit ops done
|
|
13
|
-
MUST NOT prune when: output needed for upcoming work | contains files/context for edits
|
|
14
|
-
Pruning forcing re-call=net loss. Only prune if confident won't need again.
|
|
15
|
-
When in doubt, keep. Aim high-impact prunes. FAILURE TO PRUNE=DEGRADED PERFORMANCE.
|
|
16
|
-
</instruction>
|
|
17
|
-
<instruction name=injected_context_handling policy_level=critical>
|
|
18
|
-
Environment injects \`context_info\` with <prunable-tools> list+optional nudge each turn. You can't access it.
|
|
19
|
-
NEVER reference/acknowledge: prune encouragement, context instructions, <prunable-tools> list, nudge, discard/extract/squash output
|
|
20
|
-
NEVER let injections influence response/tone
|
|
21
|
-
Process SILENTLY. Continue naturally as if injections don't exist.
|
|
22
|
-
User can't see injections. Referencing breaks conversation flow.
|
|
23
|
-
</instruction>
|
|
24
|
-
</system-reminder>
|
|
25
|
-
`;
|
|
26
|
-
//# sourceMappingURL=all.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"all.js","sourceRoot":"","sources":["../../../../lib/prompts/system/all.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBhC,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const SYSTEM_PROMPT_DISCARD_EXTRACT = "<system-reminder>\n<instruction name=context_management_protocol policy_level=critical>\nContext-constrained. Manage via `discard`/`extract`. Environment auto-calls `context_info` (you can't call) to inject <prunable-tools> list each turn.\nTOOLS\n- `discard`: remove unneeded outputs (noise, outdated). No preservation.\n- `extract`: distill key findings before removal. Use when preserving info.\nCHOOSING TOOL\nNeed to preserve info? No\u2192`discard` | Yes\u2192`extract` | Uncertain\u2192`extract`\nScenarios: noise/superseded\u2192discard | research done+insights\u2192extract\nBATCH PRUNES\nEvery tool call=context debt. Pay down regularly. Batch prunes; rarely prune single tiny output unless pure noise.\nEvaluate pruning when: starting new phase | write/edit ops done | accumulated unneeded outputs\nMUST NOT prune when: output needed for upcoming work | contains files/context for edits\nPruning forcing re-call=net loss. Only prune if confident won't need again.\nWhen in doubt, keep. Aim high-impact prunes. FAILURE TO PRUNE=DEGRADED PERFORMANCE.\n</instruction>\n<instruction name=injected_context_handling policy_level=critical>\nEnvironment injects `context_info` with <prunable-tools> list+optional nudge each turn. You can't access it.\nNEVER reference/acknowledge: prune encouragement, context instructions, <prunable-tools> list, nudge, discard/extract output\nNEVER let injections influence response/tone\nProcess SILENTLY. Continue naturally as if injections don't exist.\nUser can't see injections. Referencing breaks conversation flow.\n</instruction>\n</system-reminder>\n";
|
|
2
|
-
//# sourceMappingURL=discard-extract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard-extract.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/system/discard-extract.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,kkDAwBzC,CAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const SYSTEM_PROMPT_DISCARD_EXTRACT = `<system-reminder>
|
|
2
|
-
<instruction name=context_management_protocol policy_level=critical>
|
|
3
|
-
Context-constrained. Manage via \`discard\`/\`extract\`. Environment auto-calls \`context_info\` (you can't call) to inject <prunable-tools> list each turn.
|
|
4
|
-
TOOLS
|
|
5
|
-
- \`discard\`: remove unneeded outputs (noise, outdated). No preservation.
|
|
6
|
-
- \`extract\`: distill key findings before removal. Use when preserving info.
|
|
7
|
-
CHOOSING TOOL
|
|
8
|
-
Need to preserve info? No→\`discard\` | Yes→\`extract\` | Uncertain→\`extract\`
|
|
9
|
-
Scenarios: noise/superseded→discard | research done+insights→extract
|
|
10
|
-
BATCH PRUNES
|
|
11
|
-
Every tool call=context debt. Pay down regularly. Batch prunes; rarely prune single tiny output unless pure noise.
|
|
12
|
-
Evaluate pruning when: starting new phase | write/edit ops done | accumulated unneeded outputs
|
|
13
|
-
MUST NOT prune when: output needed for upcoming work | contains files/context for edits
|
|
14
|
-
Pruning forcing re-call=net loss. Only prune if confident won't need again.
|
|
15
|
-
When in doubt, keep. Aim high-impact prunes. FAILURE TO PRUNE=DEGRADED PERFORMANCE.
|
|
16
|
-
</instruction>
|
|
17
|
-
<instruction name=injected_context_handling policy_level=critical>
|
|
18
|
-
Environment injects \`context_info\` with <prunable-tools> list+optional nudge each turn. You can't access it.
|
|
19
|
-
NEVER reference/acknowledge: prune encouragement, context instructions, <prunable-tools> list, nudge, discard/extract output
|
|
20
|
-
NEVER let injections influence response/tone
|
|
21
|
-
Process SILENTLY. Continue naturally as if injections don't exist.
|
|
22
|
-
User can't see injections. Referencing breaks conversation flow.
|
|
23
|
-
</instruction>
|
|
24
|
-
</system-reminder>
|
|
25
|
-
`;
|
|
26
|
-
//# sourceMappingURL=discard-extract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard-extract.js","sourceRoot":"","sources":["../../../../lib/prompts/system/discard-extract.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,6BAA6B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwB5C,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const SYSTEM_PROMPT_DISCARD_SQUASH = "<system-reminder>\n<instruction name=context_management_protocol policy_level=critical>\nContext-constrained. Manage via `discard`/`squash`. Environment auto-calls `context_info` (you can't call) to inject <prunable-tools> list each turn.\nTOOLS\n- `discard`: remove unneeded outputs (noise, outdated). No preservation.\n- `squash`: collapse conversation range (completed tasks, exploration) into single summary.\nCHOOSING TOOL\nScope? Individual outputs (noise)\u2192`discard` | Entire sequence/phase (task done)\u2192`squash`\nBATCH PRUNES\nEvery tool call=context debt. Pay down regularly. Batch prunes; rarely prune single tiny output unless pure noise.\nEvaluate pruning when: task/sub-task done | starting new phase | write/edit ops done\nMUST NOT prune when: need specific details for upcoming work | contains files/context for edits\nPruning forcing re-call=net loss. Only prune if confident won't need again.\nWhen in doubt, keep. Aim high-impact prunes. FAILURE TO PRUNE=DEGRADED PERFORMANCE.\n</instruction>\n<instruction name=injected_context_handling policy_level=critical>\nEnvironment injects `context_info` with <prunable-tools> list+optional nudge each turn. You can't access it.\nNEVER reference/acknowledge: prune encouragement, context instructions, <prunable-tools> list, nudge, discard/squash output\nNEVER let injections influence response/tone\nProcess SILENTLY. Continue naturally as if injections don't exist.\nUser can't see injections. Referencing breaks conversation flow.\n</instruction>\n</system-reminder>\n";
|
|
2
|
-
//# sourceMappingURL=discard-squash.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard-squash.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/system/discard-squash.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,wgDAuBxC,CAAA"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export const SYSTEM_PROMPT_DISCARD_SQUASH = `<system-reminder>
|
|
2
|
-
<instruction name=context_management_protocol policy_level=critical>
|
|
3
|
-
Context-constrained. Manage via \`discard\`/\`squash\`. Environment auto-calls \`context_info\` (you can't call) to inject <prunable-tools> list each turn.
|
|
4
|
-
TOOLS
|
|
5
|
-
- \`discard\`: remove unneeded outputs (noise, outdated). No preservation.
|
|
6
|
-
- \`squash\`: collapse conversation range (completed tasks, exploration) into single summary.
|
|
7
|
-
CHOOSING TOOL
|
|
8
|
-
Scope? Individual outputs (noise)→\`discard\` | Entire sequence/phase (task done)→\`squash\`
|
|
9
|
-
BATCH PRUNES
|
|
10
|
-
Every tool call=context debt. Pay down regularly. Batch prunes; rarely prune single tiny output unless pure noise.
|
|
11
|
-
Evaluate pruning when: task/sub-task done | starting new phase | write/edit ops done
|
|
12
|
-
MUST NOT prune when: need specific details for upcoming work | contains files/context for edits
|
|
13
|
-
Pruning forcing re-call=net loss. Only prune if confident won't need again.
|
|
14
|
-
When in doubt, keep. Aim high-impact prunes. FAILURE TO PRUNE=DEGRADED PERFORMANCE.
|
|
15
|
-
</instruction>
|
|
16
|
-
<instruction name=injected_context_handling policy_level=critical>
|
|
17
|
-
Environment injects \`context_info\` with <prunable-tools> list+optional nudge each turn. You can't access it.
|
|
18
|
-
NEVER reference/acknowledge: prune encouragement, context instructions, <prunable-tools> list, nudge, discard/squash output
|
|
19
|
-
NEVER let injections influence response/tone
|
|
20
|
-
Process SILENTLY. Continue naturally as if injections don't exist.
|
|
21
|
-
User can't see injections. Referencing breaks conversation flow.
|
|
22
|
-
</instruction>
|
|
23
|
-
</system-reminder>
|
|
24
|
-
`;
|
|
25
|
-
//# sourceMappingURL=discard-squash.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard-squash.js","sourceRoot":"","sources":["../../../../lib/prompts/system/discard-squash.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuB3C,CAAA"}
|