@tarquinen/opencode-dcp 1.3.0-beta.1 → 1.3.1-beta1
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 +1 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -17
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +0 -5
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +0 -30
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/hooks.js +2 -15
- package/dist/lib/hooks.js.map +1 -1
- package/dist/lib/messages/inject.d.ts.map +1 -1
- package/dist/lib/messages/inject.js +40 -74
- package/dist/lib/messages/inject.js.map +1 -1
- package/dist/lib/messages/prune.d.ts.map +1 -1
- package/dist/lib/messages/prune.js +1 -42
- package/dist/lib/messages/prune.js.map +1 -1
- package/dist/lib/messages/utils.d.ts +21 -3
- package/dist/lib/messages/utils.d.ts.map +1 -1
- package/dist/lib/messages/utils.js +52 -27
- package/dist/lib/messages/utils.js.map +1 -1
- package/dist/lib/prompts/discard-tool-spec.d.ts +1 -1
- package/dist/lib/prompts/discard-tool-spec.d.ts.map +1 -1
- package/dist/lib/prompts/discard-tool-spec.js +40 -17
- package/dist/lib/prompts/discard-tool-spec.js.map +1 -1
- package/dist/lib/prompts/extract-tool-spec.d.ts +1 -1
- package/dist/lib/prompts/extract-tool-spec.d.ts.map +1 -1
- package/dist/lib/prompts/extract-tool-spec.js +47 -22
- package/dist/lib/prompts/extract-tool-spec.js.map +1 -1
- package/dist/lib/prompts/index.d.ts.map +1 -1
- package/dist/lib/prompts/index.js +4 -22
- package/dist/lib/prompts/index.js.map +1 -1
- package/dist/lib/prompts/nudge/both.d.ts +2 -0
- package/dist/lib/prompts/nudge/both.d.ts.map +1 -0
- package/dist/lib/prompts/nudge/both.js +11 -0
- package/dist/lib/prompts/nudge/both.js.map +1 -0
- package/dist/lib/prompts/nudge/discard.d.ts +1 -1
- package/dist/lib/prompts/nudge/discard.d.ts.map +1 -1
- package/dist/lib/prompts/nudge/discard.js +7 -5
- package/dist/lib/prompts/nudge/discard.js.map +1 -1
- package/dist/lib/prompts/nudge/extract.d.ts +1 -1
- package/dist/lib/prompts/nudge/extract.d.ts.map +1 -1
- package/dist/lib/prompts/nudge/extract.js +7 -5
- package/dist/lib/prompts/nudge/extract.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/system/both.d.ts +2 -0
- package/dist/lib/prompts/system/both.d.ts.map +1 -0
- package/dist/lib/prompts/system/both.js +61 -0
- package/dist/lib/prompts/system/both.js.map +1 -0
- package/dist/lib/prompts/system/discard.d.ts +1 -1
- package/dist/lib/prompts/system/discard.d.ts.map +1 -1
- package/dist/lib/prompts/system/discard.js +43 -18
- package/dist/lib/prompts/system/discard.js.map +1 -1
- package/dist/lib/prompts/system/extract.d.ts +1 -1
- package/dist/lib/prompts/system/extract.d.ts.map +1 -1
- package/dist/lib/prompts/system/extract.js +43 -18
- package/dist/lib/prompts/system/extract.js.map +1 -1
- 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/shared-utils.d.ts +1 -1
- package/dist/lib/shared-utils.d.ts.map +1 -1
- package/dist/lib/shared-utils.js +3 -10
- package/dist/lib/shared-utils.js.map +1 -1
- package/dist/lib/state/persistence.d.ts +1 -2
- package/dist/lib/state/persistence.d.ts.map +1 -1
- package/dist/lib/state/persistence.js +0 -1
- package/dist/lib/state/persistence.js.map +1 -1
- package/dist/lib/state/state.d.ts +1 -0
- package/dist/lib/state/state.d.ts.map +1 -1
- package/dist/lib/state/state.js +29 -10
- 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 -4
- package/dist/lib/state/tool-cache.js.map +1 -1
- package/dist/lib/state/types.d.ts +0 -6
- package/dist/lib/state/types.d.ts.map +1 -1
- package/dist/lib/state/utils.d.ts +0 -4
- package/dist/lib/state/utils.d.ts.map +1 -1
- package/dist/lib/state/utils.js +0 -33
- 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/types.d.ts → strategies/tools.d.ts} +4 -1
- package/dist/lib/strategies/tools.d.ts.map +1 -0
- package/dist/lib/strategies/tools.js +135 -0
- package/dist/lib/strategies/tools.js.map +1 -0
- package/dist/lib/strategies/utils.d.ts +0 -1
- package/dist/lib/strategies/utils.d.ts.map +1 -1
- package/dist/lib/strategies/utils.js +4 -5
- package/dist/lib/strategies/utils.js.map +1 -1
- package/dist/lib/ui/notification.d.ts +0 -1
- package/dist/lib/ui/notification.d.ts.map +1 -1
- package/dist/lib/ui/notification.js +1 -29
- package/dist/lib/ui/notification.js.map +1 -1
- package/dist/lib/ui/utils.d.ts +0 -1
- package/dist/lib/ui/utils.d.ts.map +1 -1
- package/dist/lib/ui/utils.js +0 -16
- package/dist/lib/ui/utils.js.map +1 -1
- package/package.json +1 -2
- package/dist/lib/auth.d.ts +0 -4
- package/dist/lib/auth.d.ts.map +0 -1
- package/dist/lib/auth.js +0 -32
- package/dist/lib/auth.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/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/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/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/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 +0 -4
- package/dist/lib/tools/discard.d.ts.map +0 -1
- package/dist/lib/tools/discard.js +0 -21
- 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/extract.js +0 -30
- package/dist/lib/tools/extract.js.map +0 -1
- package/dist/lib/tools/index.d.ts +0 -5
- package/dist/lib/tools/index.d.ts.map +0 -1
- package/dist/lib/tools/index.js +0 -4
- package/dist/lib/tools/index.js.map +0 -1
- package/dist/lib/tools/prune-shared.d.ts +0 -6
- package/dist/lib/tools/prune-shared.d.ts.map +0 -1
- package/dist/lib/tools/prune-shared.js +0 -107
- package/dist/lib/tools/prune-shared.js.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 +0 -81
- package/dist/lib/tools/squash.js.map +0 -1
- package/dist/lib/tools/types.d.ts.map +0 -1
- package/dist/lib/tools/types.js +0 -2
- package/dist/lib/tools/types.js.map +0 -1
- package/dist/lib/tools/utils.d.ts +0 -26
- package/dist/lib/tools/utils.d.ts.map +0 -1
- package/dist/lib/tools/utils.js +0 -121
- package/dist/lib/tools/utils.js.map +0 -1
|
@@ -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_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_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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const SYSTEM_PROMPT_EXTRACT_SQUASH = "<system-reminder>\n<instruction name=context_management_protocol policy_level=critical>\nContext-constrained. Manage via `extract`/`squash`. Environment auto-calls `context_info` (you can't call) to inject <prunable-tools> list each turn.\nTOOLS\n- `extract`: distill key findings before removal. Use when preserving detailed info.\n- `squash`: collapse conversation range (completed tasks, exploration) into single summary.\nCHOOSING TOOL\nScope+detail needed? Individual outputs (detailed context)\u2192`extract` | Entire sequence/phase (task done)\u2192`squash`\nBATCH PRUNES\nEvery tool call=context debt. Pay down regularly. Batch prunes; rarely prune single tiny output.\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, 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=extract-squash.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract-squash.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/system/extract-squash.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,2hDAuBxC,CAAA"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export const SYSTEM_PROMPT_EXTRACT_SQUASH = `<system-reminder>
|
|
2
|
-
<instruction name=context_management_protocol policy_level=critical>
|
|
3
|
-
Context-constrained. Manage via \`extract\`/\`squash\`. Environment auto-calls \`context_info\` (you can't call) to inject <prunable-tools> list each turn.
|
|
4
|
-
TOOLS
|
|
5
|
-
- \`extract\`: distill key findings before removal. Use when preserving detailed info.
|
|
6
|
-
- \`squash\`: collapse conversation range (completed tasks, exploration) into single summary.
|
|
7
|
-
CHOOSING TOOL
|
|
8
|
-
Scope+detail needed? Individual outputs (detailed context)→\`extract\` | 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.
|
|
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, extract/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=extract-squash.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract-squash.js","sourceRoot":"","sources":["../../../../lib/prompts/system/extract-squash.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuB3C,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const SYSTEM_PROMPT_SQUASH = "<system-reminder>\n<instruction name=context_management_protocol policy_level=critical>\nENVIRONMENT\nContext-constrained. Manage via `squash` tool. Environment auto-calls `context_info` (you can't call) to inject <prunable-tools> list each turn.\nTOOL\n- `squash`: collapse conversation range (completed tasks, exploration) into single summary.\nSQUASH METHODICALLY \u2014 BATCH ACTIONS\nEvery tool call=context debt. Pay down regularly. Evaluate what should be squashed before acting.\nWHEN TO SQUASH\n- Task Complete \u2192 sub-task/unit done, condense entire sequence into summary\n- Exploration Done \u2192 multiple files/commands explored, only need summary\nEvaluate squashing when ANY true: task/sub-task done | starting new phase | significant conversation accumulated\nMUST NOT squash when: need specific details for upcoming work | range contains files/context for edits\nSquashing that forces re-read=net loss. Only squash when confident info won't be needed again.\nNOTES\nWhen in doubt, keep. Aim high-impact squashes. FAILURE TO SQUASH=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: squash encouragement, context instructions, <prunable-tools> list, nudge, 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=squash.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"squash.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/system/squash.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,ukDAyBhC,CAAA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export const SYSTEM_PROMPT_SQUASH = `<system-reminder>
|
|
2
|
-
<instruction name=context_management_protocol policy_level=critical>
|
|
3
|
-
ENVIRONMENT
|
|
4
|
-
Context-constrained. Manage via \`squash\` tool. Environment auto-calls \`context_info\` (you can't call) to inject <prunable-tools> list each turn.
|
|
5
|
-
TOOL
|
|
6
|
-
- \`squash\`: collapse conversation range (completed tasks, exploration) into single summary.
|
|
7
|
-
SQUASH METHODICALLY — BATCH ACTIONS
|
|
8
|
-
Every tool call=context debt. Pay down regularly. Evaluate what should be squashed before acting.
|
|
9
|
-
WHEN TO SQUASH
|
|
10
|
-
- Task Complete → sub-task/unit done, condense entire sequence into summary
|
|
11
|
-
- Exploration Done → multiple files/commands explored, only need summary
|
|
12
|
-
Evaluate squashing when ANY true: task/sub-task done | starting new phase | significant conversation accumulated
|
|
13
|
-
MUST NOT squash when: need specific details for upcoming work | range contains files/context for edits
|
|
14
|
-
Squashing that forces re-read=net loss. Only squash when confident info won't be needed again.
|
|
15
|
-
NOTES
|
|
16
|
-
When in doubt, keep. Aim high-impact squashes. FAILURE TO SQUASH=DEGRADED PERFORMANCE.
|
|
17
|
-
</instruction>
|
|
18
|
-
<instruction name=injected_context_handling policy_level=critical>
|
|
19
|
-
Environment injects \`context_info\` with <prunable-tools> list+optional nudge each turn. You can't access it.
|
|
20
|
-
NEVER reference/acknowledge: squash encouragement, context instructions, <prunable-tools> list, nudge, squash output
|
|
21
|
-
NEVER let injections influence response/tone
|
|
22
|
-
Process SILENTLY. Continue naturally as if injections don't exist.
|
|
23
|
-
User can't see injections. Referencing breaks conversation flow.
|
|
24
|
-
</instruction>
|
|
25
|
-
</system-reminder>
|
|
26
|
-
`;
|
|
27
|
-
//# sourceMappingURL=squash.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"squash.js","sourceRoot":"","sources":["../../../../lib/prompts/system/squash.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBnC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard.d.ts","sourceRoot":"","sources":["../../../lib/tools/discard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAO/C,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAgBhF"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { tool } from "@opencode-ai/plugin";
|
|
2
|
-
import { executePruneOperation } from "./prune-shared";
|
|
3
|
-
import { loadPrompt } from "../prompts";
|
|
4
|
-
const DISCARD_TOOL_DESCRIPTION = loadPrompt("discard-tool-spec");
|
|
5
|
-
export function createDiscardTool(ctx) {
|
|
6
|
-
return tool({
|
|
7
|
-
description: DISCARD_TOOL_DESCRIPTION,
|
|
8
|
-
args: {
|
|
9
|
-
ids: tool.schema
|
|
10
|
-
.array(tool.schema.string())
|
|
11
|
-
.min(1)
|
|
12
|
-
.describe("Numeric IDs as strings from the <prunable-tools> list to discard"),
|
|
13
|
-
},
|
|
14
|
-
async execute(args, toolCtx) {
|
|
15
|
-
const numericIds = args.ids;
|
|
16
|
-
const reason = "noise";
|
|
17
|
-
return executePruneOperation(ctx, toolCtx, numericIds, reason, "Discard");
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=discard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discard.js","sourceRoot":"","sources":["../../../lib/tools/discard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAE1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,MAAM,wBAAwB,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAA;AAEhE,MAAM,UAAU,iBAAiB,CAAC,GAAqB;IACnD,OAAO,IAAI,CAAC;QACR,WAAW,EAAE,wBAAwB;QACrC,IAAI,EAAE;YACF,GAAG,EAAE,IAAI,CAAC,MAAM;iBACX,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;iBAC3B,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CAAC,kEAAkE,CAAC;SACpF;QACD,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO;YACvB,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAA;YAC3B,MAAM,MAAM,GAAG,OAAO,CAAA;YAEtB,OAAO,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,CAAA;QAC7E,CAAC;KACJ,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../lib/tools/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAO/C,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAuChF"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { tool } from "@opencode-ai/plugin";
|
|
2
|
-
import { executePruneOperation } from "./prune-shared";
|
|
3
|
-
import { loadPrompt } from "../prompts";
|
|
4
|
-
const EXTRACT_TOOL_DESCRIPTION = loadPrompt("extract-tool-spec");
|
|
5
|
-
export function createExtractTool(ctx) {
|
|
6
|
-
return tool({
|
|
7
|
-
description: EXTRACT_TOOL_DESCRIPTION,
|
|
8
|
-
args: {
|
|
9
|
-
ids: tool.schema
|
|
10
|
-
.array(tool.schema.string())
|
|
11
|
-
.min(1)
|
|
12
|
-
.describe("Numeric IDs as strings to extract from the <prunable-tools> list"),
|
|
13
|
-
distillation: tool.schema
|
|
14
|
-
.array(tool.schema.string())
|
|
15
|
-
.min(1)
|
|
16
|
-
.describe("Required array of distillation strings, one per ID (positional: distillation[0] for ids[0], etc.)"),
|
|
17
|
-
},
|
|
18
|
-
async execute(args, toolCtx) {
|
|
19
|
-
if (!args.distillation || args.distillation.length === 0) {
|
|
20
|
-
ctx.logger.debug("Extract tool called without distillation: " + JSON.stringify(args));
|
|
21
|
-
throw new Error("Missing distillation. You must provide a distillation string for each ID.");
|
|
22
|
-
}
|
|
23
|
-
// Log the distillation for debugging/analysis
|
|
24
|
-
ctx.logger.info("Distillation data received:");
|
|
25
|
-
ctx.logger.info(JSON.stringify(args.distillation, null, 2));
|
|
26
|
-
return executePruneOperation(ctx, toolCtx, args.ids, "extraction", "Extract", args.distillation);
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=extract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../../lib/tools/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAE1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,MAAM,wBAAwB,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAA;AAEhE,MAAM,UAAU,iBAAiB,CAAC,GAAqB;IACnD,OAAO,IAAI,CAAC;QACR,WAAW,EAAE,wBAAwB;QACrC,IAAI,EAAE;YACF,GAAG,EAAE,IAAI,CAAC,MAAM;iBACX,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;iBAC3B,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CAAC,kEAAkE,CAAC;YACjF,YAAY,EAAE,IAAI,CAAC,MAAM;iBACpB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;iBAC3B,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CACL,mGAAmG,CACtG;SACR;QACD,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO;YACvB,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvD,GAAG,CAAC,MAAM,CAAC,KAAK,CACZ,4CAA4C,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CACtE,CAAA;gBACD,MAAM,IAAI,KAAK,CACX,2EAA2E,CAC9E,CAAA;YACL,CAAC;YAED,8CAA8C;YAC9C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAA;YAC9C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;YAE3D,OAAO,qBAAqB,CACxB,GAAG,EACH,OAAO,EACP,IAAI,CAAC,GAAG,EACR,YAA2B,EAC3B,SAAS,EACT,IAAI,CAAC,YAAY,CACpB,CAAA;QACL,CAAC;KACJ,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/lib/tools/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { PruneToolContext } from "./types";
|
|
2
|
-
import { PruneReason } from "../ui/notification";
|
|
3
|
-
export declare function executePruneOperation(ctx: PruneToolContext, toolCtx: {
|
|
4
|
-
sessionID: string;
|
|
5
|
-
}, ids: string[], reason: PruneReason, toolName: string, distillation?: string[]): Promise<string>;
|
|
6
|
-
//# sourceMappingURL=prune-shared.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prune-shared.d.ts","sourceRoot":"","sources":["../../../lib/tools/prune-shared.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG/C,OAAO,EAAE,WAAW,EAA2B,MAAM,oBAAoB,CAAA;AAQzE,wBAAsB,qBAAqB,CACvC,GAAG,EAAE,gBAAgB,EACrB,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAC9B,GAAG,EAAE,MAAM,EAAE,EACb,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,MAAM,CAAC,CAyIjB"}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { buildToolIdList } from "../messages/utils";
|
|
2
|
-
import { syncToolCache } from "../state/tool-cache";
|
|
3
|
-
import { sendUnifiedNotification } from "../ui/notification";
|
|
4
|
-
import { formatPruningResultForTool } from "../ui/utils";
|
|
5
|
-
import { ensureSessionInitialized } from "../state";
|
|
6
|
-
import { saveSessionState } from "../state/persistence";
|
|
7
|
-
import { calculateTokensSaved, getCurrentParams } from "../strategies/utils";
|
|
8
|
-
import { getFilePathFromParameters, isProtectedFilePath } from "../protected-file-patterns";
|
|
9
|
-
// Shared logic for executing prune operations.
|
|
10
|
-
export async function executePruneOperation(ctx, toolCtx, ids, reason, toolName, distillation) {
|
|
11
|
-
const { client, state, logger, config, workingDirectory } = ctx;
|
|
12
|
-
const sessionId = toolCtx.sessionID;
|
|
13
|
-
logger.info(`${toolName} tool invoked`);
|
|
14
|
-
logger.info(JSON.stringify(reason ? { ids, reason } : { ids }));
|
|
15
|
-
if (!ids || ids.length === 0) {
|
|
16
|
-
logger.debug(`${toolName} tool called but ids is empty or undefined`);
|
|
17
|
-
throw new Error(`No IDs provided. Check the <prunable-tools> list for available IDs to ${toolName.toLowerCase()}.`);
|
|
18
|
-
}
|
|
19
|
-
const numericToolIds = ids
|
|
20
|
-
.map((id) => parseInt(id, 10))
|
|
21
|
-
.filter((n) => !isNaN(n));
|
|
22
|
-
if (numericToolIds.length === 0) {
|
|
23
|
-
logger.debug(`No numeric tool IDs provided for ${toolName}: ` + JSON.stringify(ids));
|
|
24
|
-
throw new Error("No numeric IDs provided. Format: ids: [id1, id2, ...]");
|
|
25
|
-
}
|
|
26
|
-
// Fetch messages to calculate tokens and find current agent
|
|
27
|
-
const messagesResponse = await client.session.messages({
|
|
28
|
-
path: { id: sessionId },
|
|
29
|
-
});
|
|
30
|
-
const messages = messagesResponse.data || messagesResponse;
|
|
31
|
-
await ensureSessionInitialized(ctx.client, state, sessionId, logger, messages);
|
|
32
|
-
await syncToolCache(state, config, logger, messages);
|
|
33
|
-
const currentParams = getCurrentParams(state, messages, logger);
|
|
34
|
-
const toolIdList = buildToolIdList(state, messages, logger);
|
|
35
|
-
const validNumericIds = [];
|
|
36
|
-
const skippedIds = [];
|
|
37
|
-
// Validate and filter IDs
|
|
38
|
-
for (const index of numericToolIds) {
|
|
39
|
-
// Validate that all numeric IDs are within bounds
|
|
40
|
-
if (index < 0 || index >= toolIdList.length) {
|
|
41
|
-
logger.debug(`Rejecting prune request - index out of bounds: ${index}`);
|
|
42
|
-
skippedIds.push(index.toString());
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
const id = toolIdList[index];
|
|
46
|
-
const metadata = state.toolParameters.get(id);
|
|
47
|
-
// Validate that all IDs exist in cache and aren't protected
|
|
48
|
-
// (rejects hallucinated IDs and turn-protected tools not shown in <prunable-tools>)
|
|
49
|
-
if (!metadata) {
|
|
50
|
-
logger.debug("Rejecting prune request - ID not in cache (turn-protected or hallucinated)", { index, id });
|
|
51
|
-
skippedIds.push(index.toString());
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
const allProtectedTools = config.tools.settings.protectedTools;
|
|
55
|
-
if (allProtectedTools.includes(metadata.tool)) {
|
|
56
|
-
logger.debug("Rejecting prune request - protected tool", {
|
|
57
|
-
index,
|
|
58
|
-
id,
|
|
59
|
-
tool: metadata.tool,
|
|
60
|
-
});
|
|
61
|
-
skippedIds.push(index.toString());
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
const filePath = getFilePathFromParameters(metadata.parameters);
|
|
65
|
-
if (isProtectedFilePath(filePath, config.protectedFilePatterns)) {
|
|
66
|
-
logger.debug("Rejecting prune request - protected file path", {
|
|
67
|
-
index,
|
|
68
|
-
id,
|
|
69
|
-
tool: metadata.tool,
|
|
70
|
-
filePath,
|
|
71
|
-
});
|
|
72
|
-
skippedIds.push(index.toString());
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
validNumericIds.push(index);
|
|
76
|
-
}
|
|
77
|
-
if (validNumericIds.length === 0) {
|
|
78
|
-
const errorMsg = skippedIds.length > 0
|
|
79
|
-
? `Invalid IDs provided: [${skippedIds.join(", ")}]. Only use numeric IDs from the <prunable-tools> list.`
|
|
80
|
-
: `No valid IDs provided to ${toolName.toLowerCase()}.`;
|
|
81
|
-
throw new Error(errorMsg);
|
|
82
|
-
}
|
|
83
|
-
const pruneToolIds = validNumericIds.map((index) => toolIdList[index]);
|
|
84
|
-
state.prune.toolIds.push(...pruneToolIds);
|
|
85
|
-
const toolMetadata = new Map();
|
|
86
|
-
for (const id of pruneToolIds) {
|
|
87
|
-
const toolParameters = state.toolParameters.get(id);
|
|
88
|
-
if (toolParameters) {
|
|
89
|
-
toolMetadata.set(id, toolParameters);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
logger.debug("No metadata found for ID", { id });
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
state.stats.pruneTokenCounter += calculateTokensSaved(state, messages, pruneToolIds);
|
|
96
|
-
await sendUnifiedNotification(client, logger, config, state, sessionId, pruneToolIds, toolMetadata, reason, currentParams, workingDirectory, distillation);
|
|
97
|
-
state.stats.totalPruneTokens += state.stats.pruneTokenCounter;
|
|
98
|
-
state.stats.pruneTokenCounter = 0;
|
|
99
|
-
state.nudgeCounter = 0;
|
|
100
|
-
saveSessionState(state, logger).catch((err) => logger.error("Failed to persist state", { error: err.message }));
|
|
101
|
-
let result = formatPruningResultForTool(pruneToolIds, toolMetadata, workingDirectory);
|
|
102
|
-
if (skippedIds.length > 0) {
|
|
103
|
-
result += `\n\nNote: ${skippedIds.length} IDs were skipped (invalid, protected, or missing metadata): ${skippedIds.join(", ")}`;
|
|
104
|
-
}
|
|
105
|
-
return result;
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=prune-shared.js.map
|