@tarquinen/opencode-dcp 3.1.9 → 3.1.11
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 +5 -0
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7905 -76
- package/dist/index.js.map +1 -1
- package/dist/lib/compress/message.d.ts.map +1 -1
- package/dist/lib/compress/protected-content.d.ts +2 -0
- package/dist/lib/compress/protected-content.d.ts.map +1 -1
- package/dist/lib/compress/range.d.ts.map +1 -1
- package/dist/lib/config.d.ts +2 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/hooks.d.ts +2 -10
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/messages/index.d.ts +1 -0
- package/dist/lib/messages/index.d.ts.map +1 -1
- package/dist/lib/messages/inject/utils.d.ts +7 -0
- package/dist/lib/messages/inject/utils.d.ts.map +1 -1
- package/dist/lib/messages/utils.d.ts +1 -1
- package/dist/lib/messages/utils.d.ts.map +1 -1
- package/dist/lib/state/state.d.ts.map +1 -1
- package/dist/lib/state/types.d.ts +0 -1
- package/dist/lib/state/types.d.ts.map +1 -1
- package/dist/lib/update.d.ts +22 -0
- package/dist/lib/update.d.ts.map +1 -0
- package/package.json +6 -5
- package/dist/lib/auth.js +0 -32
- package/dist/lib/auth.js.map +0 -1
- package/dist/lib/commands/compression-targets.js +0 -98
- package/dist/lib/commands/compression-targets.js.map +0 -1
- package/dist/lib/commands/context.js +0 -239
- package/dist/lib/commands/context.js.map +0 -1
- package/dist/lib/commands/decompress.js +0 -174
- package/dist/lib/commands/decompress.js.map +0 -1
- package/dist/lib/commands/help.js +0 -52
- package/dist/lib/commands/help.js.map +0 -1
- package/dist/lib/commands/index.js +0 -8
- package/dist/lib/commands/index.js.map +0 -1
- package/dist/lib/commands/manual.js +0 -75
- package/dist/lib/commands/manual.js.map +0 -1
- package/dist/lib/commands/recompress.js +0 -140
- package/dist/lib/commands/recompress.js.map +0 -1
- package/dist/lib/commands/stats.js +0 -97
- package/dist/lib/commands/stats.js.map +0 -1
- package/dist/lib/commands/sweep.js +0 -195
- package/dist/lib/commands/sweep.js.map +0 -1
- package/dist/lib/compress/index.js +0 -3
- package/dist/lib/compress/index.js.map +0 -1
- package/dist/lib/compress/message-utils.js +0 -179
- package/dist/lib/compress/message-utils.js.map +0 -1
- package/dist/lib/compress/message.js +0 -82
- package/dist/lib/compress/message.js.map +0 -1
- package/dist/lib/compress/pipeline.js +0 -41
- package/dist/lib/compress/pipeline.js.map +0 -1
- package/dist/lib/compress/protected-content.js +0 -106
- package/dist/lib/compress/protected-content.js.map +0 -1
- package/dist/lib/compress/range-utils.js +0 -199
- package/dist/lib/compress/range-utils.js.map +0 -1
- package/dist/lib/compress/range.js +0 -90
- package/dist/lib/compress/range.js.map +0 -1
- package/dist/lib/compress/search.js +0 -204
- package/dist/lib/compress/search.js.map +0 -1
- package/dist/lib/compress/state.js +0 -213
- package/dist/lib/compress/state.js.map +0 -1
- package/dist/lib/compress/timing.js +0 -42
- package/dist/lib/compress/timing.js.map +0 -1
- package/dist/lib/compress/types.js +0 -2
- package/dist/lib/compress/types.js.map +0 -1
- package/dist/lib/compress-permission.js +0 -10
- package/dist/lib/compress-permission.js.map +0 -1
- package/dist/lib/config.js +0 -760
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/hooks.js +0 -245
- package/dist/lib/hooks.js.map +0 -1
- package/dist/lib/host-permissions.js +0 -58
- package/dist/lib/host-permissions.js.map +0 -1
- package/dist/lib/logger.js +0 -204
- package/dist/lib/logger.js.map +0 -1
- package/dist/lib/message-ids.js +0 -128
- package/dist/lib/message-ids.js.map +0 -1
- package/dist/lib/messages/index.js +0 -9
- package/dist/lib/messages/index.js.map +0 -1
- package/dist/lib/messages/inject/inject.js +0 -128
- package/dist/lib/messages/inject/inject.js.map +0 -1
- package/dist/lib/messages/inject/subagent-results.js +0 -58
- package/dist/lib/messages/inject/subagent-results.js.map +0 -1
- package/dist/lib/messages/inject/utils.js +0 -211
- package/dist/lib/messages/inject/utils.js.map +0 -1
- package/dist/lib/messages/priority.js +0 -65
- package/dist/lib/messages/priority.js.map +0 -1
- package/dist/lib/messages/prune.js +0 -180
- package/dist/lib/messages/prune.js.map +0 -1
- package/dist/lib/messages/query.js +0 -52
- package/dist/lib/messages/query.js.map +0 -1
- package/dist/lib/messages/reasoning-strip.js +0 -33
- package/dist/lib/messages/reasoning-strip.js.map +0 -1
- package/dist/lib/messages/shape.js +0 -39
- package/dist/lib/messages/shape.js.map +0 -1
- package/dist/lib/messages/sync.js +0 -93
- package/dist/lib/messages/sync.js.map +0 -1
- package/dist/lib/messages/utils.js +0 -146
- package/dist/lib/messages/utils.js.map +0 -1
- package/dist/lib/prompts/compress-message.js +0 -44
- package/dist/lib/prompts/compress-message.js.map +0 -1
- package/dist/lib/prompts/compress-range.js +0 -61
- package/dist/lib/prompts/compress-range.js.map +0 -1
- package/dist/lib/prompts/context-limit-nudge.js +0 -19
- package/dist/lib/prompts/context-limit-nudge.js.map +0 -1
- package/dist/lib/prompts/extensions/nudge.js +0 -35
- package/dist/lib/prompts/extensions/nudge.js.map +0 -1
- package/dist/lib/prompts/extensions/system.js +0 -30
- package/dist/lib/prompts/extensions/system.js.map +0 -1
- package/dist/lib/prompts/extensions/tool.js +0 -34
- package/dist/lib/prompts/extensions/tool.js.map +0 -1
- package/dist/lib/prompts/index.js +0 -18
- package/dist/lib/prompts/index.js.map +0 -1
- package/dist/lib/prompts/iteration-nudge.js +0 -7
- package/dist/lib/prompts/iteration-nudge.js.map +0 -1
- package/dist/lib/prompts/store.js +0 -358
- package/dist/lib/prompts/store.js.map +0 -1
- package/dist/lib/prompts/system.js +0 -34
- package/dist/lib/prompts/system.js.map +0 -1
- package/dist/lib/prompts/turn-nudge.js +0 -11
- package/dist/lib/prompts/turn-nudge.js.map +0 -1
- package/dist/lib/protected-patterns.js +0 -107
- package/dist/lib/protected-patterns.js.map +0 -1
- package/dist/lib/state/index.js +0 -5
- package/dist/lib/state/index.js.map +0 -1
- package/dist/lib/state/persistence.js +0 -172
- package/dist/lib/state/persistence.js.map +0 -1
- package/dist/lib/state/state.js +0 -143
- package/dist/lib/state/state.js.map +0 -1
- package/dist/lib/state/tool-cache.js +0 -69
- package/dist/lib/state/tool-cache.js.map +0 -1
- package/dist/lib/state/types.js +0 -2
- package/dist/lib/state/types.js.map +0 -1
- package/dist/lib/state/utils.js +0 -265
- package/dist/lib/state/utils.js.map +0 -1
- package/dist/lib/strategies/deduplication.js +0 -100
- package/dist/lib/strategies/deduplication.js.map +0 -1
- package/dist/lib/strategies/index.js +0 -3
- package/dist/lib/strategies/index.js.map +0 -1
- package/dist/lib/strategies/purge-errors.js +0 -62
- package/dist/lib/strategies/purge-errors.js.map +0 -1
- package/dist/lib/subagents/subagent-results.js +0 -52
- package/dist/lib/subagents/subagent-results.js.map +0 -1
- package/dist/lib/token-utils.js +0 -133
- package/dist/lib/token-utils.js.map +0 -1
- package/dist/lib/ui/notification.js +0 -243
- package/dist/lib/ui/notification.js.map +0 -1
- package/dist/lib/ui/utils.js +0 -256
- package/dist/lib/ui/utils.js.map +0 -1
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export const COMPRESS_RANGE = `Collapse a range in the conversation into a detailed summary.
|
|
2
|
-
|
|
3
|
-
THE SUMMARY
|
|
4
|
-
Your summary must be EXHAUSTIVE. Capture file paths, function signatures, decisions made, constraints discovered, key findings... EVERYTHING that maintains context integrity. This is not a brief note - it is an authoritative record so faithful that the original conversation adds no value.
|
|
5
|
-
|
|
6
|
-
USER INTENT FIDELITY
|
|
7
|
-
When the compressed range includes user messages, preserve the user's intent with extra care. Do not change scope, constraints, priorities, acceptance criteria, or requested outcomes.
|
|
8
|
-
Directly quote user messages when they are short enough to include safely. Direct quotes are preferred when they best preserve exact meaning.
|
|
9
|
-
|
|
10
|
-
Yet be LEAN. Strip away the noise: failed attempts that led nowhere, verbose tool outputs, back-and-forth exploration. What remains should be pure signal - golden nuggets of detail that preserve full understanding with zero ambiguity.
|
|
11
|
-
|
|
12
|
-
COMPRESSED BLOCK PLACEHOLDERS
|
|
13
|
-
When the selected range includes previously compressed blocks, use this exact placeholder format when referencing one:
|
|
14
|
-
|
|
15
|
-
- \`(bN)\`
|
|
16
|
-
|
|
17
|
-
Compressed block sections in context are clearly marked with a header:
|
|
18
|
-
|
|
19
|
-
- \`[Compressed conversation section]\`
|
|
20
|
-
|
|
21
|
-
Compressed block IDs always use the \`bN\` form (never \`mNNNN\`) and are represented in the same XML metadata tag format.
|
|
22
|
-
|
|
23
|
-
Rules:
|
|
24
|
-
|
|
25
|
-
- Include every required block placeholder exactly once.
|
|
26
|
-
- Do not invent placeholders for blocks outside the selected range.
|
|
27
|
-
- Treat \`(bN)\` placeholders as RESERVED TOKENS. Do not emit \`(bN)\` text anywhere except intentional placeholders.
|
|
28
|
-
- If you need to mention a block in prose, use plain text like \`compressed bN\` (not as a placeholder).
|
|
29
|
-
- Preflight check before finalizing: the set of \`(bN)\` placeholders in your summary must exactly match the required set, with no duplicates.
|
|
30
|
-
|
|
31
|
-
These placeholders are semantic references. They will be replaced with the full stored compressed block content when the tool processes your output.
|
|
32
|
-
|
|
33
|
-
FLOW PRESERVATION WITH PLACEHOLDERS
|
|
34
|
-
When you use compressed block placeholders, write the surrounding summary text so it still reads correctly AFTER placeholder expansion.
|
|
35
|
-
|
|
36
|
-
- Treat each placeholder as a stand-in for a full conversation segment, not as a short label.
|
|
37
|
-
- Ensure transitions before and after each placeholder preserve chronology and causality.
|
|
38
|
-
- Do not write text that depends on the placeholder staying literal (for example, "as noted in \`(b2)\`").
|
|
39
|
-
- Your final meaning must be coherent once each placeholder is replaced with its full compressed block content.
|
|
40
|
-
|
|
41
|
-
BOUNDARY IDS
|
|
42
|
-
You specify boundaries by ID using the injected IDs visible in the conversation:
|
|
43
|
-
|
|
44
|
-
- \`mNNNN\` IDs identify raw messages
|
|
45
|
-
- \`bN\` IDs identify previously compressed blocks
|
|
46
|
-
|
|
47
|
-
Each message has an ID inside XML metadata tags like \`<dcp-message-id>...</dcp-message-id>\`.
|
|
48
|
-
The same ID tag appears in every tool output of the message it belongs to — each unique ID identifies one complete message.
|
|
49
|
-
Treat these tags as boundary metadata only, not as tool result content.
|
|
50
|
-
|
|
51
|
-
Rules:
|
|
52
|
-
|
|
53
|
-
- Pick \`startId\` and \`endId\` directly from injected IDs in context.
|
|
54
|
-
- IDs must exist in the current visible context.
|
|
55
|
-
- \`startId\` must appear before \`endId\`.
|
|
56
|
-
- Do not invent IDs. Use only IDs that are present in context.
|
|
57
|
-
|
|
58
|
-
BATCHING
|
|
59
|
-
When multiple independent ranges are ready and their boundaries do not overlap, include all of them as separate entries in the \`content\` array of a single tool call. Each entry should have its own \`startId\`, \`endId\`, and \`summary\`.
|
|
60
|
-
`;
|
|
61
|
-
//# sourceMappingURL=compress-range.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compress-range.js","sourceRoot":"","sources":["../../../lib/prompts/compress-range.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2D7B,CAAA"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export const CONTEXT_LIMIT_NUDGE = `<dcp-system-reminder>
|
|
2
|
-
CRITICAL WARNING: MAX CONTEXT LIMIT REACHED
|
|
3
|
-
|
|
4
|
-
You are at or beyond the configured max context threshold. This is an emergency context-recovery moment.
|
|
5
|
-
|
|
6
|
-
You MUST use the \`compress\` tool now. Do not continue normal exploration until compression is handled.
|
|
7
|
-
|
|
8
|
-
If you are in the middle of a critical atomic operation, finish that atomic step first, then compress immediately.
|
|
9
|
-
|
|
10
|
-
SELECTION PROCESS
|
|
11
|
-
Start from older, resolved history and capture as much stale context as safely possible in one pass.
|
|
12
|
-
Avoid the newest active working messages unless it is clearly closed.
|
|
13
|
-
|
|
14
|
-
SUMMARY REQUIREMENTS
|
|
15
|
-
Your summary MUST cover all essential details from the selected messages so work can continue.
|
|
16
|
-
If the compressed range includes user messages, preserve user intent exactly. Prefer direct quotes for short user messages to avoid semantic drift.
|
|
17
|
-
</dcp-system-reminder>
|
|
18
|
-
`;
|
|
19
|
-
//# sourceMappingURL=context-limit-nudge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-limit-nudge.js","sourceRoot":"","sources":["../../../lib/prompts/context-limit-nudge.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;CAiBlC,CAAA"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export function buildCompressedBlockGuidance(state) {
|
|
2
|
-
const refs = Array.from(state.prune.messages.activeBlockIds)
|
|
3
|
-
.filter((id) => Number.isInteger(id) && id > 0)
|
|
4
|
-
.sort((a, b) => a - b)
|
|
5
|
-
.map((id) => `b${id}`);
|
|
6
|
-
const blockCount = refs.length;
|
|
7
|
-
const blockList = blockCount > 0 ? refs.join(", ") : "none";
|
|
8
|
-
return [
|
|
9
|
-
"Compressed block context:",
|
|
10
|
-
`- Active compressed blocks in this session: ${blockCount} (${blockList})`,
|
|
11
|
-
"- If your selected compression range includes any listed block, include each required placeholder exactly once in the summary using `(bN)`.",
|
|
12
|
-
].join("\n");
|
|
13
|
-
}
|
|
14
|
-
export function renderMessagePriorityGuidance(priorityLabel, refs) {
|
|
15
|
-
const refList = refs.length > 0 ? refs.join(", ") : "none";
|
|
16
|
-
return [
|
|
17
|
-
"Message priority context:",
|
|
18
|
-
"- Higher-priority older messages consume more context and should be compressed right away if it is safe to do so.",
|
|
19
|
-
`- ${priorityLabel}-priority message IDs before this point: ${refList}`,
|
|
20
|
-
].join("\n");
|
|
21
|
-
}
|
|
22
|
-
export function appendGuidanceToDcpTag(nudgeText, guidance) {
|
|
23
|
-
if (!guidance.trim()) {
|
|
24
|
-
return nudgeText;
|
|
25
|
-
}
|
|
26
|
-
const closeTag = "</dcp-system-reminder>";
|
|
27
|
-
const closeTagIndex = nudgeText.lastIndexOf(closeTag);
|
|
28
|
-
if (closeTagIndex === -1) {
|
|
29
|
-
return nudgeText;
|
|
30
|
-
}
|
|
31
|
-
const beforeClose = nudgeText.slice(0, closeTagIndex).trimEnd();
|
|
32
|
-
const afterClose = nudgeText.slice(closeTagIndex);
|
|
33
|
-
return `${beforeClose}\n\n${guidance}\n${afterClose}`;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=nudge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nudge.js","sourceRoot":"","sources":["../../../../lib/prompts/extensions/nudge.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,4BAA4B,CAAC,KAAmB;IAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC;SACvD,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC9C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;SACrB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAA;IAC9B,MAAM,SAAS,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;IAE3D,OAAO;QACH,2BAA2B;QAC3B,+CAA+C,UAAU,KAAK,SAAS,GAAG;QAC1E,6IAA6I;KAChJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAChB,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,aAAqB,EAAE,IAAc;IAC/E,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;IAE1D,OAAO;QACH,2BAA2B;QAC3B,mHAAmH;QACnH,KAAK,aAAa,4CAA4C,OAAO,EAAE;KAC1E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAChB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,SAAiB,EAAE,QAAgB;IACtE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;QACnB,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,MAAM,QAAQ,GAAG,wBAAwB,CAAA;IACzC,MAAM,aAAa,GAAG,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;IAErD,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,OAAO,EAAE,CAAA;IAC/D,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;IACjD,OAAO,GAAG,WAAW,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAA;AACzD,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export const MANUAL_MODE_SYSTEM_EXTENSION = `<dcp-system-reminder>
|
|
2
|
-
Manual mode is enabled. Do NOT use compress unless the user has explicitly triggered it through a manual marker.
|
|
3
|
-
|
|
4
|
-
Only use the compress tool after seeing \`<compress triggered manually>\` in the current user instruction context.
|
|
5
|
-
|
|
6
|
-
Issue exactly ONE compress tool per manual trigger. Do NOT launch multiple compress tools in parallel. Each trigger grants a single compression; after it completes, wait for the next trigger.
|
|
7
|
-
|
|
8
|
-
After completing a manually triggered context-management action, STOP IMMEDIATELY. Do NOT continue with any task execution. End your response right after the tool use completes and wait for the next user input.
|
|
9
|
-
</dcp-system-reminder>
|
|
10
|
-
`;
|
|
11
|
-
export const SUBAGENT_SYSTEM_EXTENSION = `<dcp-system-reminder>
|
|
12
|
-
You are operating in a subagent environment.
|
|
13
|
-
|
|
14
|
-
The initial subagent instruction is imperative and must be followed exactly.
|
|
15
|
-
It is the only user message intentionally not assigned a message ID, and therefore is not eligible for compression.
|
|
16
|
-
All subsequent messages in the session will have IDs.
|
|
17
|
-
</dcp-system-reminder>
|
|
18
|
-
`;
|
|
19
|
-
export function buildProtectedToolsExtension(protectedTools) {
|
|
20
|
-
if (protectedTools.length === 0) {
|
|
21
|
-
return "";
|
|
22
|
-
}
|
|
23
|
-
const toolList = protectedTools.map((t) => `\`${t}\``).join(", ");
|
|
24
|
-
return `<dcp-system-reminder>
|
|
25
|
-
The following tools are environment-managed: ${toolList}.
|
|
26
|
-
Their outputs are automatically preserved during compression.
|
|
27
|
-
Do not include their content in compress tool summaries — the environment retains it independently.
|
|
28
|
-
</dcp-system-reminder>`;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=system.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../../lib/prompts/extensions/system.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;CAS3C,CAAA;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;CAOxC,CAAA;AAED,MAAM,UAAU,4BAA4B,CAAC,cAAwB;IACjE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,EAAE,CAAA;IACb,CAAC;IAED,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACjE,OAAO;+CACoC,QAAQ;;;uBAGhC,CAAA;AACvB,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// These format schemas are kept separate from the editable compress prompts
|
|
2
|
-
// so they cannot be modified via custom prompt overrides. The schemas must
|
|
3
|
-
// match the tool's input validation and are not safe to change independently.
|
|
4
|
-
export const RANGE_FORMAT_EXTENSION = `
|
|
5
|
-
THE FORMAT OF COMPRESS
|
|
6
|
-
|
|
7
|
-
\`\`\`
|
|
8
|
-
{
|
|
9
|
-
topic: string, // Short label (3-5 words) - e.g., "Auth System Exploration"
|
|
10
|
-
content: [ // One or more ranges to compress
|
|
11
|
-
{
|
|
12
|
-
startId: string, // Boundary ID at range start: mNNNN or bN
|
|
13
|
-
endId: string, // Boundary ID at range end: mNNNN or bN
|
|
14
|
-
summary: string // Complete technical summary replacing all content in range
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
\`\`\``;
|
|
19
|
-
export const MESSAGE_FORMAT_EXTENSION = `
|
|
20
|
-
THE FORMAT OF COMPRESS
|
|
21
|
-
|
|
22
|
-
\`\`\`
|
|
23
|
-
{
|
|
24
|
-
topic: string, // Short label (3-5 words) for the overall batch
|
|
25
|
-
content: [ // One or more messages to compress independently
|
|
26
|
-
{
|
|
27
|
-
messageId: string, // Raw message ID only: mNNNN (ignore metadata attributes like priority)
|
|
28
|
-
topic: string, // Short label (3-5 words) for this one message summary
|
|
29
|
-
summary: string // Complete technical summary replacing that one message
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
\`\`\``;
|
|
34
|
-
//# sourceMappingURL=tool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../lib/prompts/extensions/tool.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,2EAA2E;AAC3E,8EAA8E;AAE9E,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;OAc/B,CAAA;AAEP,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;OAcjC,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export function renderSystemPrompt(prompts, protectedToolsExtension, manual, subagent) {
|
|
2
|
-
const extensions = [];
|
|
3
|
-
if (protectedToolsExtension) {
|
|
4
|
-
extensions.push(protectedToolsExtension.trim());
|
|
5
|
-
}
|
|
6
|
-
if (manual) {
|
|
7
|
-
extensions.push(prompts.manualExtension.trim());
|
|
8
|
-
}
|
|
9
|
-
if (subagent) {
|
|
10
|
-
extensions.push(prompts.subagentExtension.trim());
|
|
11
|
-
}
|
|
12
|
-
return [prompts.system.trim(), ...extensions]
|
|
13
|
-
.filter(Boolean)
|
|
14
|
-
.join("\n\n")
|
|
15
|
-
.replace(/\n([ \t]*\n)+/g, "\n\n")
|
|
16
|
-
.trim();
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/prompts/index.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,kBAAkB,CAC9B,OAAuB,EACvB,uBAAgC,EAChC,MAAgB,EAChB,QAAkB;IAElB,MAAM,UAAU,GAAa,EAAE,CAAA;IAE/B,IAAI,uBAAuB,EAAE,CAAC;QAC1B,UAAU,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,EAAE,CAAC,CAAA;IACnD,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACT,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAA;IACnD,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACX,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAA;IACrD,CAAC;IAED,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,GAAG,UAAU,CAAC;SACxC,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,MAAM,CAAC;SACZ,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC;SACjC,IAAI,EAAE,CAAA;AACf,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export const ITERATION_NUDGE = `<dcp-system-reminder>
|
|
2
|
-
You've been iterating for a while after the last user message.
|
|
3
|
-
|
|
4
|
-
If there is a closed portion that is unlikely to be referenced immediately (for example, finished research before implementation), use the compress tool on it now.
|
|
5
|
-
</dcp-system-reminder>
|
|
6
|
-
`;
|
|
7
|
-
//# sourceMappingURL=iteration-nudge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"iteration-nudge.js","sourceRoot":"","sources":["../../../lib/prompts/iteration-nudge.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;CAK9B,CAAA"}
|
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync, statSync } from "fs";
|
|
2
|
-
import { join, dirname } from "path";
|
|
3
|
-
import { homedir } from "os";
|
|
4
|
-
import { SYSTEM as SYSTEM_PROMPT } from "./system";
|
|
5
|
-
import { COMPRESS_RANGE as COMPRESS_RANGE_PROMPT } from "./compress-range";
|
|
6
|
-
import { COMPRESS_MESSAGE as COMPRESS_MESSAGE_PROMPT } from "./compress-message";
|
|
7
|
-
import { CONTEXT_LIMIT_NUDGE } from "./context-limit-nudge";
|
|
8
|
-
import { TURN_NUDGE } from "./turn-nudge";
|
|
9
|
-
import { ITERATION_NUDGE } from "./iteration-nudge";
|
|
10
|
-
import { MANUAL_MODE_SYSTEM_EXTENSION, SUBAGENT_SYSTEM_EXTENSION } from "./extensions/system";
|
|
11
|
-
const PROMPT_DEFINITIONS = [
|
|
12
|
-
{
|
|
13
|
-
key: "system",
|
|
14
|
-
fileName: "system.md",
|
|
15
|
-
label: "System",
|
|
16
|
-
description: "Core system-level DCP instruction block",
|
|
17
|
-
usage: "Injected into the model system prompt on every request",
|
|
18
|
-
runtimeField: "system",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
key: "compress-range",
|
|
22
|
-
fileName: "compress-range.md",
|
|
23
|
-
label: "Compress Range",
|
|
24
|
-
description: "range-mode compress tool instructions and summary constraints",
|
|
25
|
-
usage: "Registered as the range-mode compress tool description",
|
|
26
|
-
runtimeField: "compressRange",
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
key: "compress-message",
|
|
30
|
-
fileName: "compress-message.md",
|
|
31
|
-
label: "Compress Message",
|
|
32
|
-
description: "message-mode compress tool instructions and summary constraints",
|
|
33
|
-
usage: "Registered as the message-mode compress tool description",
|
|
34
|
-
runtimeField: "compressMessage",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
key: "context-limit-nudge",
|
|
38
|
-
fileName: "context-limit-nudge.md",
|
|
39
|
-
label: "Context Limit Nudge",
|
|
40
|
-
description: "High-priority nudge when context is over max threshold",
|
|
41
|
-
usage: "Injected when context usage is beyond configured max limits",
|
|
42
|
-
runtimeField: "contextLimitNudge",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
key: "turn-nudge",
|
|
46
|
-
fileName: "turn-nudge.md",
|
|
47
|
-
label: "Turn Nudge",
|
|
48
|
-
description: "Nudge to compress closed ranges at turn boundaries",
|
|
49
|
-
usage: "Injected when context is between min and max limits at a new user turn",
|
|
50
|
-
runtimeField: "turnNudge",
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
key: "iteration-nudge",
|
|
54
|
-
fileName: "iteration-nudge.md",
|
|
55
|
-
label: "Iteration Nudge",
|
|
56
|
-
description: "Nudge after many iterations without user input",
|
|
57
|
-
usage: "Injected when iteration threshold is crossed",
|
|
58
|
-
runtimeField: "iterationNudge",
|
|
59
|
-
},
|
|
60
|
-
];
|
|
61
|
-
export const PROMPT_KEYS = [
|
|
62
|
-
"system",
|
|
63
|
-
"compress-range",
|
|
64
|
-
"compress-message",
|
|
65
|
-
"context-limit-nudge",
|
|
66
|
-
"turn-nudge",
|
|
67
|
-
"iteration-nudge",
|
|
68
|
-
];
|
|
69
|
-
const HTML_COMMENT_REGEX = /<!--[\s\S]*?-->/g;
|
|
70
|
-
const LEGACY_INLINE_COMMENT_LINE_REGEX = /^[ \t]*\/\/.*?\/\/[ \t]*$/gm;
|
|
71
|
-
const DCP_SYSTEM_REMINDER_TAG_REGEX = /^\s*<dcp-system-reminder\b[^>]*>[\s\S]*<\/dcp-system-reminder>\s*$/i;
|
|
72
|
-
const DEFAULTS_README_FILE = "README.md";
|
|
73
|
-
const BUNDLED_EDITABLE_PROMPTS = {
|
|
74
|
-
system: SYSTEM_PROMPT,
|
|
75
|
-
compressRange: COMPRESS_RANGE_PROMPT,
|
|
76
|
-
compressMessage: COMPRESS_MESSAGE_PROMPT,
|
|
77
|
-
contextLimitNudge: CONTEXT_LIMIT_NUDGE,
|
|
78
|
-
turnNudge: TURN_NUDGE,
|
|
79
|
-
iterationNudge: ITERATION_NUDGE,
|
|
80
|
-
};
|
|
81
|
-
const INTERNAL_PROMPT_EXTENSIONS = {
|
|
82
|
-
manualExtension: MANUAL_MODE_SYSTEM_EXTENSION,
|
|
83
|
-
subagentExtension: SUBAGENT_SYSTEM_EXTENSION,
|
|
84
|
-
};
|
|
85
|
-
function createBundledRuntimePrompts() {
|
|
86
|
-
return {
|
|
87
|
-
system: BUNDLED_EDITABLE_PROMPTS.system,
|
|
88
|
-
compressRange: BUNDLED_EDITABLE_PROMPTS.compressRange,
|
|
89
|
-
compressMessage: BUNDLED_EDITABLE_PROMPTS.compressMessage,
|
|
90
|
-
contextLimitNudge: BUNDLED_EDITABLE_PROMPTS.contextLimitNudge,
|
|
91
|
-
turnNudge: BUNDLED_EDITABLE_PROMPTS.turnNudge,
|
|
92
|
-
iterationNudge: BUNDLED_EDITABLE_PROMPTS.iterationNudge,
|
|
93
|
-
manualExtension: INTERNAL_PROMPT_EXTENSIONS.manualExtension,
|
|
94
|
-
subagentExtension: INTERNAL_PROMPT_EXTENSIONS.subagentExtension,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function findOpencodeDir(startDir) {
|
|
98
|
-
let current = startDir;
|
|
99
|
-
while (current !== "/") {
|
|
100
|
-
const candidate = join(current, ".opencode");
|
|
101
|
-
if (existsSync(candidate)) {
|
|
102
|
-
try {
|
|
103
|
-
if (statSync(candidate).isDirectory()) {
|
|
104
|
-
return candidate;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
catch {
|
|
108
|
-
// ignore inaccessible entries while walking upward
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
const parent = dirname(current);
|
|
112
|
-
if (parent === current) {
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
current = parent;
|
|
116
|
-
}
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
function resolvePromptPaths(workingDirectory) {
|
|
120
|
-
const configHome = process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
|
|
121
|
-
const globalRoot = join(configHome, "opencode", "dcp-prompts");
|
|
122
|
-
const defaultsDir = join(globalRoot, "defaults");
|
|
123
|
-
const globalOverridesDir = join(globalRoot, "overrides");
|
|
124
|
-
const configDirOverridesDir = process.env.OPENCODE_CONFIG_DIR
|
|
125
|
-
? join(process.env.OPENCODE_CONFIG_DIR, "dcp-prompts", "overrides")
|
|
126
|
-
: null;
|
|
127
|
-
const opencodeDir = findOpencodeDir(workingDirectory);
|
|
128
|
-
const projectOverridesDir = opencodeDir ? join(opencodeDir, "dcp-prompts", "overrides") : null;
|
|
129
|
-
return {
|
|
130
|
-
defaultsDir,
|
|
131
|
-
globalOverridesDir,
|
|
132
|
-
configDirOverridesDir,
|
|
133
|
-
projectOverridesDir,
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
function stripConditionalTag(content, tagName) {
|
|
137
|
-
const regex = new RegExp(`<${tagName}>[\\s\\S]*?<\/${tagName}>`, "gi");
|
|
138
|
-
return content.replace(regex, "");
|
|
139
|
-
}
|
|
140
|
-
function unwrapDcpTagIfWrapped(content) {
|
|
141
|
-
const trimmed = content.trim();
|
|
142
|
-
if (DCP_SYSTEM_REMINDER_TAG_REGEX.test(trimmed)) {
|
|
143
|
-
return trimmed
|
|
144
|
-
.replace(/^\s*<dcp-system-reminder\b[^>]*>\s*/i, "")
|
|
145
|
-
.replace(/\s*<\/dcp-system-reminder>\s*$/i, "")
|
|
146
|
-
.trim();
|
|
147
|
-
}
|
|
148
|
-
return trimmed;
|
|
149
|
-
}
|
|
150
|
-
function normalizeReminderPromptContent(content) {
|
|
151
|
-
const normalized = content.trim();
|
|
152
|
-
if (!normalized) {
|
|
153
|
-
return "";
|
|
154
|
-
}
|
|
155
|
-
const startsWrapped = /^\s*<dcp-system-reminder\b[^>]*>/i.test(normalized);
|
|
156
|
-
const endsWrapped = /<\/dcp-system-reminder>\s*$/i.test(normalized);
|
|
157
|
-
if (startsWrapped !== endsWrapped) {
|
|
158
|
-
return "";
|
|
159
|
-
}
|
|
160
|
-
return unwrapDcpTagIfWrapped(normalized);
|
|
161
|
-
}
|
|
162
|
-
function stripPromptComments(content) {
|
|
163
|
-
return content
|
|
164
|
-
.replace(/^\uFEFF/, "")
|
|
165
|
-
.replace(/\r\n?/g, "\n")
|
|
166
|
-
.replace(HTML_COMMENT_REGEX, "")
|
|
167
|
-
.replace(LEGACY_INLINE_COMMENT_LINE_REGEX, "");
|
|
168
|
-
}
|
|
169
|
-
function toEditablePromptText(definition, rawContent) {
|
|
170
|
-
let normalized = stripPromptComments(rawContent).trim();
|
|
171
|
-
if (!normalized) {
|
|
172
|
-
return "";
|
|
173
|
-
}
|
|
174
|
-
if (definition.key === "system") {
|
|
175
|
-
normalized = stripConditionalTag(normalized, "manual");
|
|
176
|
-
normalized = stripConditionalTag(normalized, "subagent");
|
|
177
|
-
}
|
|
178
|
-
if (definition.key !== "compress-range" && definition.key !== "compress-message") {
|
|
179
|
-
normalized = normalizeReminderPromptContent(normalized);
|
|
180
|
-
}
|
|
181
|
-
return normalized.trim();
|
|
182
|
-
}
|
|
183
|
-
function wrapRuntimePromptContent(definition, editableText) {
|
|
184
|
-
const trimmed = editableText.trim();
|
|
185
|
-
if (!trimmed) {
|
|
186
|
-
return "";
|
|
187
|
-
}
|
|
188
|
-
if (definition.key === "compress-range" || definition.key === "compress-message") {
|
|
189
|
-
return trimmed;
|
|
190
|
-
}
|
|
191
|
-
return `<dcp-system-reminder>\n${trimmed}\n</dcp-system-reminder>`;
|
|
192
|
-
}
|
|
193
|
-
function buildDefaultPromptFileContent(bundledEditableText) {
|
|
194
|
-
return `${bundledEditableText.trim()}\n`;
|
|
195
|
-
}
|
|
196
|
-
function buildDefaultsReadmeContent() {
|
|
197
|
-
const lines = [];
|
|
198
|
-
lines.push("# DCP Prompt Defaults");
|
|
199
|
-
lines.push("");
|
|
200
|
-
lines.push("This directory stores the DCP prompts.");
|
|
201
|
-
lines.push("Each prompt file here should contain plain text only (no XML wrappers).");
|
|
202
|
-
lines.push("");
|
|
203
|
-
lines.push("## Creating Overrides");
|
|
204
|
-
lines.push("");
|
|
205
|
-
lines.push("1. Copy a prompt file from this directory into an overrides directory using the same filename.");
|
|
206
|
-
lines.push("2. Edit the copied file using plain text.");
|
|
207
|
-
lines.push("3. Restart OpenCode.");
|
|
208
|
-
lines.push("");
|
|
209
|
-
lines.push("To reset an override, delete the matching file from your overrides directory.");
|
|
210
|
-
lines.push("");
|
|
211
|
-
lines.push("Do not edit the default prompt files directly, they are just for reference, only files in the overrides directory are used.");
|
|
212
|
-
lines.push("");
|
|
213
|
-
lines.push("Override precedence (highest first):");
|
|
214
|
-
lines.push("1. `.opencode/dcp-prompts/overrides/` (project)");
|
|
215
|
-
lines.push("2. `$OPENCODE_CONFIG_DIR/dcp-prompts/overrides/` (config dir)");
|
|
216
|
-
lines.push("3. `~/.config/opencode/dcp-prompts/overrides/` (global)");
|
|
217
|
-
lines.push("");
|
|
218
|
-
lines.push("## Prompt Files");
|
|
219
|
-
lines.push("");
|
|
220
|
-
for (const definition of PROMPT_DEFINITIONS) {
|
|
221
|
-
lines.push(`- \`${definition.fileName}\``);
|
|
222
|
-
lines.push(` - Purpose: ${definition.description}.`);
|
|
223
|
-
lines.push(` - Runtime use: ${definition.usage}.`);
|
|
224
|
-
}
|
|
225
|
-
return `${lines.join("\n")}\n`;
|
|
226
|
-
}
|
|
227
|
-
function readFileIfExists(filePath) {
|
|
228
|
-
if (!existsSync(filePath)) {
|
|
229
|
-
return null;
|
|
230
|
-
}
|
|
231
|
-
try {
|
|
232
|
-
return readFileSync(filePath, "utf-8");
|
|
233
|
-
}
|
|
234
|
-
catch {
|
|
235
|
-
return null;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
export class PromptStore {
|
|
239
|
-
logger;
|
|
240
|
-
paths;
|
|
241
|
-
customPromptsEnabled;
|
|
242
|
-
runtimePrompts;
|
|
243
|
-
constructor(logger, workingDirectory, customPromptsEnabled = false) {
|
|
244
|
-
this.logger = logger;
|
|
245
|
-
this.paths = resolvePromptPaths(workingDirectory);
|
|
246
|
-
this.customPromptsEnabled = customPromptsEnabled;
|
|
247
|
-
this.runtimePrompts = createBundledRuntimePrompts();
|
|
248
|
-
if (this.customPromptsEnabled) {
|
|
249
|
-
this.ensureDefaultFiles();
|
|
250
|
-
}
|
|
251
|
-
this.reload();
|
|
252
|
-
}
|
|
253
|
-
getRuntimePrompts() {
|
|
254
|
-
return { ...this.runtimePrompts };
|
|
255
|
-
}
|
|
256
|
-
reload() {
|
|
257
|
-
const nextPrompts = createBundledRuntimePrompts();
|
|
258
|
-
if (!this.customPromptsEnabled) {
|
|
259
|
-
this.runtimePrompts = nextPrompts;
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
for (const definition of PROMPT_DEFINITIONS) {
|
|
263
|
-
const bundledSource = BUNDLED_EDITABLE_PROMPTS[definition.runtimeField];
|
|
264
|
-
const bundledEditable = toEditablePromptText(definition, bundledSource);
|
|
265
|
-
const bundledRuntime = wrapRuntimePromptContent(definition, bundledEditable);
|
|
266
|
-
const fallbackValue = bundledRuntime || bundledSource.trim();
|
|
267
|
-
let effectiveValue = fallbackValue;
|
|
268
|
-
for (const candidate of this.getOverrideCandidates(definition.fileName)) {
|
|
269
|
-
const rawOverride = readFileIfExists(candidate.path);
|
|
270
|
-
if (rawOverride === null) {
|
|
271
|
-
continue;
|
|
272
|
-
}
|
|
273
|
-
const editableOverride = toEditablePromptText(definition, rawOverride);
|
|
274
|
-
if (!editableOverride) {
|
|
275
|
-
this.logger.warn("Prompt override is empty or invalid after normalization", {
|
|
276
|
-
key: definition.key,
|
|
277
|
-
path: candidate.path,
|
|
278
|
-
});
|
|
279
|
-
continue;
|
|
280
|
-
}
|
|
281
|
-
const wrappedOverride = wrapRuntimePromptContent(definition, editableOverride);
|
|
282
|
-
if (!wrappedOverride) {
|
|
283
|
-
this.logger.warn("Prompt override could not be wrapped for runtime", {
|
|
284
|
-
key: definition.key,
|
|
285
|
-
path: candidate.path,
|
|
286
|
-
});
|
|
287
|
-
continue;
|
|
288
|
-
}
|
|
289
|
-
effectiveValue = wrappedOverride;
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
nextPrompts[definition.runtimeField] = effectiveValue;
|
|
293
|
-
}
|
|
294
|
-
this.runtimePrompts = nextPrompts;
|
|
295
|
-
}
|
|
296
|
-
getOverrideCandidates(fileName) {
|
|
297
|
-
const candidates = [];
|
|
298
|
-
if (this.paths.projectOverridesDir) {
|
|
299
|
-
candidates.push({
|
|
300
|
-
path: join(this.paths.projectOverridesDir, fileName),
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
if (this.paths.configDirOverridesDir) {
|
|
304
|
-
candidates.push({
|
|
305
|
-
path: join(this.paths.configDirOverridesDir, fileName),
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
candidates.push({
|
|
309
|
-
path: join(this.paths.globalOverridesDir, fileName),
|
|
310
|
-
});
|
|
311
|
-
return candidates;
|
|
312
|
-
}
|
|
313
|
-
ensureDefaultFiles() {
|
|
314
|
-
try {
|
|
315
|
-
mkdirSync(this.paths.defaultsDir, { recursive: true });
|
|
316
|
-
mkdirSync(this.paths.globalOverridesDir, { recursive: true });
|
|
317
|
-
}
|
|
318
|
-
catch {
|
|
319
|
-
this.logger.warn("Failed to initialize prompt directories", {
|
|
320
|
-
defaultsDir: this.paths.defaultsDir,
|
|
321
|
-
globalOverridesDir: this.paths.globalOverridesDir,
|
|
322
|
-
});
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
for (const definition of PROMPT_DEFINITIONS) {
|
|
326
|
-
const bundledEditable = toEditablePromptText(definition, BUNDLED_EDITABLE_PROMPTS[definition.runtimeField]);
|
|
327
|
-
const managedContent = buildDefaultPromptFileContent(bundledEditable || BUNDLED_EDITABLE_PROMPTS[definition.runtimeField]);
|
|
328
|
-
const filePath = join(this.paths.defaultsDir, definition.fileName);
|
|
329
|
-
try {
|
|
330
|
-
const existing = readFileIfExists(filePath);
|
|
331
|
-
if (existing === managedContent) {
|
|
332
|
-
continue;
|
|
333
|
-
}
|
|
334
|
-
writeFileSync(filePath, managedContent, "utf-8");
|
|
335
|
-
}
|
|
336
|
-
catch {
|
|
337
|
-
this.logger.warn("Failed to write default prompt file", {
|
|
338
|
-
key: definition.key,
|
|
339
|
-
path: filePath,
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
const readmePath = join(this.paths.defaultsDir, DEFAULTS_README_FILE);
|
|
344
|
-
const readmeContent = buildDefaultsReadmeContent();
|
|
345
|
-
try {
|
|
346
|
-
const existing = readFileIfExists(readmePath);
|
|
347
|
-
if (existing !== readmeContent) {
|
|
348
|
-
writeFileSync(readmePath, readmeContent, "utf-8");
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
catch {
|
|
352
|
-
this.logger.warn("Failed to write defaults README", {
|
|
353
|
-
path: readmePath,
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
//# sourceMappingURL=store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../lib/prompts/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAA;AACjF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAE5B,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,EAAE,cAAc,IAAI,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,EAAE,gBAAgB,IAAI,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAiD7F,MAAM,kBAAkB,GAAuB;IAC3C;QACI,GAAG,EAAE,QAAQ;QACb,QAAQ,EAAE,WAAW;QACrB,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE,yCAAyC;QACtD,KAAK,EAAE,wDAAwD;QAC/D,YAAY,EAAE,QAAQ;KACzB;IACD;QACI,GAAG,EAAE,gBAAgB;QACrB,QAAQ,EAAE,mBAAmB;QAC7B,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,+DAA+D;QAC5E,KAAK,EAAE,wDAAwD;QAC/D,YAAY,EAAE,eAAe;KAChC;IACD;QACI,GAAG,EAAE,kBAAkB;QACvB,QAAQ,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AW,EAAE,oBAAoB,CAAC,CAAA;QACrE,MAAM,aAAa,GAAG,0BAA0B,EAAE,CAAA;QAElD,IAAI,CAAC;YACD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAA;YAC7C,IAAI,QAAQ,KAAK,aAAa,EAAE,CAAC;gBAC7B,aAAa,CAAC,UAAU,EAAE,aAAa,EAAE,OAAO,CAAC,CAAA;YACrD,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACL,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iCAAiC,EAAE;gBAChD,IAAI,EAAE,UAAU;aACnB,CAAC,CAAA;QACN,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export const SYSTEM = `
|
|
2
|
-
You operate in a context-constrained environment. Manage context continuously to avoid buildup and preserve retrieval quality. Efficient context management is paramount for your agentic performance.
|
|
3
|
-
|
|
4
|
-
The ONLY tool you have for context management is \`compress\`. It replaces older conversation content with technical summaries you produce.
|
|
5
|
-
|
|
6
|
-
\`<dcp-message-id>\` and \`<dcp-system-reminder>\` tags are environment-injected metadata. Do not output them.
|
|
7
|
-
|
|
8
|
-
THE PHILOSOPHY OF COMPRESS
|
|
9
|
-
\`compress\` transforms conversation content into dense, high-fidelity summaries. This is not cleanup - it is crystallization. Your summary becomes the authoritative record of what transpired.
|
|
10
|
-
|
|
11
|
-
Think of compression as phase transitions: raw exploration becomes refined understanding. The original context served its purpose; your summary now carries that understanding forward.
|
|
12
|
-
|
|
13
|
-
COMPRESS WHEN
|
|
14
|
-
|
|
15
|
-
A section is genuinely closed and the raw conversation has served its purpose:
|
|
16
|
-
|
|
17
|
-
- Research concluded and findings are clear
|
|
18
|
-
- Implementation finished and verified
|
|
19
|
-
- Exploration exhausted and patterns understood
|
|
20
|
-
- Dead-end noise can be discarded without waiting for a whole chapter to close
|
|
21
|
-
|
|
22
|
-
DO NOT COMPRESS IF
|
|
23
|
-
|
|
24
|
-
- Raw context is still relevant and needed for edits or precise references
|
|
25
|
-
- The target content is still actively in progress
|
|
26
|
-
- You may need exact code, error messages, or file contents in the immediate next steps
|
|
27
|
-
|
|
28
|
-
Before compressing, ask: _"Is this section closed enough to become summary-only right now?"_
|
|
29
|
-
|
|
30
|
-
Evaluate conversation signal-to-noise REGULARLY. Use \`compress\` deliberately with quality-first summaries. Prioritize stale content intelligently to maintain a high-signal context window that supports your agency.
|
|
31
|
-
|
|
32
|
-
It is of your responsibility to keep a sharp, high-quality context window for optimal performance.
|
|
33
|
-
`;
|
|
34
|
-
//# sourceMappingURL=system.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../lib/prompts/system.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCrB,CAAA"}
|