@p4r4d0xb0x/opencode-dcp 3.0.5 → 3.1.12
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 +31 -26
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7909 -76
- package/dist/index.js.map +1 -1
- package/dist/lib/commands/compression-targets.d.ts +14 -0
- package/dist/lib/commands/compression-targets.d.ts.map +1 -0
- package/dist/lib/commands/context.d.ts.map +1 -1
- package/dist/lib/commands/decompress.d.ts.map +1 -1
- package/dist/lib/commands/index.d.ts +8 -0
- package/dist/lib/commands/index.d.ts.map +1 -0
- package/dist/lib/commands/manual.d.ts +1 -0
- package/dist/lib/commands/manual.d.ts.map +1 -1
- package/dist/lib/commands/recompress.d.ts.map +1 -1
- package/dist/lib/commands/stats.d.ts.map +1 -1
- package/dist/lib/commands/sweep.d.ts.map +1 -1
- package/dist/lib/compress/index.d.ts +4 -0
- package/dist/lib/compress/index.d.ts.map +1 -0
- package/dist/lib/compress/message-utils.d.ts +8 -0
- package/dist/lib/compress/message-utils.d.ts.map +1 -0
- package/dist/lib/compress/message.d.ts +4 -0
- package/dist/lib/compress/message.d.ts.map +1 -0
- package/dist/lib/compress/pipeline.d.ts +29 -0
- package/dist/lib/compress/pipeline.d.ts.map +1 -0
- package/dist/lib/compress/protected-content.d.ts +7 -0
- package/dist/lib/compress/protected-content.d.ts.map +1 -0
- package/dist/lib/compress/range-utils.d.ts +10 -0
- package/dist/lib/compress/range-utils.d.ts.map +1 -0
- package/dist/lib/compress/range.d.ts +4 -0
- package/dist/lib/compress/range.d.ts.map +1 -0
- package/dist/lib/compress/search.d.ts +11 -0
- package/dist/lib/compress/search.d.ts.map +1 -0
- package/dist/lib/compress/state.d.ts +9 -0
- package/dist/lib/compress/state.d.ts.map +1 -0
- package/dist/lib/compress/timing.d.ts +18 -0
- package/dist/lib/compress/timing.d.ts.map +1 -0
- package/dist/lib/compress/types.d.ts +94 -0
- package/dist/lib/compress/types.d.ts.map +1 -0
- package/dist/lib/{shared-utils.d.ts → compress-permission.d.ts} +2 -4
- package/dist/lib/compress-permission.d.ts.map +1 -0
- package/dist/lib/config.d.ts +7 -7
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/hooks.d.ts +4 -1
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/message-ids.d.ts +1 -1
- package/dist/lib/message-ids.d.ts.map +1 -1
- package/dist/lib/messages/index.d.ts +2 -0
- package/dist/lib/messages/index.d.ts.map +1 -1
- package/dist/lib/messages/inject/inject.d.ts +3 -2
- package/dist/lib/messages/inject/inject.d.ts.map +1 -1
- package/dist/lib/messages/inject/utils.d.ts +2 -3
- package/dist/lib/messages/inject/utils.d.ts.map +1 -1
- package/dist/lib/messages/priority.d.ts +13 -0
- package/dist/lib/messages/priority.d.ts.map +1 -0
- package/dist/lib/messages/prune.d.ts.map +1 -1
- package/dist/lib/messages/query.d.ts +7 -0
- package/dist/lib/messages/query.d.ts.map +1 -0
- package/dist/lib/messages/shape.d.ts +5 -0
- package/dist/lib/messages/shape.d.ts.map +1 -0
- package/dist/lib/messages/utils.d.ts +10 -4
- package/dist/lib/messages/utils.d.ts.map +1 -1
- package/dist/lib/prompts/compress-message.d.ts +2 -0
- package/dist/lib/prompts/compress-message.d.ts.map +1 -0
- package/dist/lib/prompts/compress-range.d.ts +2 -0
- package/dist/lib/prompts/compress-range.d.ts.map +1 -0
- package/dist/lib/prompts/context-limit-nudge.d.ts +1 -1
- package/dist/lib/prompts/context-limit-nudge.d.ts.map +1 -1
- package/dist/lib/prompts/extensions/nudge.d.ts +5 -0
- package/dist/lib/prompts/extensions/nudge.d.ts.map +1 -0
- package/dist/lib/prompts/extensions/system.d.ts +4 -0
- package/dist/lib/prompts/extensions/system.d.ts.map +1 -0
- package/dist/lib/prompts/extensions/tool.d.ts +3 -0
- package/dist/lib/prompts/extensions/tool.d.ts.map +1 -0
- package/dist/lib/prompts/index.d.ts +2 -1
- package/dist/lib/prompts/index.d.ts.map +1 -1
- package/dist/lib/prompts/iteration-nudge.d.ts +1 -1
- package/dist/lib/prompts/iteration-nudge.d.ts.map +1 -1
- package/dist/lib/prompts/store.d.ts +5 -4
- package/dist/lib/prompts/store.d.ts.map +1 -1
- package/dist/lib/prompts/system.d.ts +1 -1
- package/dist/lib/prompts/system.d.ts.map +1 -1
- package/dist/lib/prompts/turn-nudge.d.ts +1 -1
- package/dist/lib/prompts/turn-nudge.d.ts.map +1 -1
- package/dist/lib/state/index.d.ts +1 -0
- package/dist/lib/state/index.d.ts.map +1 -1
- package/dist/lib/state/persistence.d.ts +1 -0
- package/dist/lib/state/persistence.d.ts.map +1 -1
- package/dist/lib/state/state.d.ts.map +1 -1
- package/dist/lib/state/types.d.ts +10 -1
- package/dist/lib/state/types.d.ts.map +1 -1
- package/dist/lib/state/utils.d.ts +9 -5
- package/dist/lib/state/utils.d.ts.map +1 -1
- package/dist/lib/strategies/index.d.ts +0 -1
- package/dist/lib/strategies/index.d.ts.map +1 -1
- package/dist/lib/{strategies/utils.d.ts → token-utils.d.ts} +6 -8
- package/dist/lib/token-utils.d.ts.map +1 -0
- package/dist/lib/ui/notification.d.ts +8 -1
- package/dist/lib/ui/notification.d.ts.map +1 -1
- package/dist/lib/ui/utils.d.ts +1 -1
- package/dist/lib/ui/utils.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 +26 -15
- package/dist/lib/auth.js +0 -32
- package/dist/lib/auth.js.map +0 -1
- package/dist/lib/commands/context.js +0 -241
- package/dist/lib/commands/context.js.map +0 -1
- package/dist/lib/commands/decompress.js +0 -159
- 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/manual.js +0 -48
- package/dist/lib/commands/manual.js.map +0 -1
- package/dist/lib/commands/recompress.js +0 -137
- package/dist/lib/commands/recompress.js.map +0 -1
- package/dist/lib/commands/stats.js +0 -62
- package/dist/lib/commands/stats.js.map +0 -1
- package/dist/lib/commands/sweep.js +0 -194
- package/dist/lib/commands/sweep.js.map +0 -1
- package/dist/lib/config.js +0 -766
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/hooks.js +0 -195
- 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 -112
- package/dist/lib/message-ids.js.map +0 -1
- package/dist/lib/messages/index.js +0 -7
- package/dist/lib/messages/index.js.map +0 -1
- package/dist/lib/messages/inject/inject.js +0 -131
- 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 -198
- package/dist/lib/messages/inject/utils.js.map +0 -1
- package/dist/lib/messages/prune.js +0 -177
- package/dist/lib/messages/prune.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/sync.js +0 -93
- package/dist/lib/messages/sync.js.map +0 -1
- package/dist/lib/messages/utils.js +0 -118
- package/dist/lib/messages/utils.js.map +0 -1
- package/dist/lib/prompts/compress.d.ts +0 -2
- package/dist/lib/prompts/compress.d.ts.map +0 -1
- package/dist/lib/prompts/compress.js +0 -85
- package/dist/lib/prompts/compress.js.map +0 -1
- package/dist/lib/prompts/context-limit-nudge.js +0 -25
- package/dist/lib/prompts/context-limit-nudge.js.map +0 -1
- package/dist/lib/prompts/index.js +0 -19
- package/dist/lib/prompts/index.js.map +0 -1
- package/dist/lib/prompts/internal-overlays.d.ts +0 -5
- package/dist/lib/prompts/internal-overlays.d.ts.map +0 -1
- package/dist/lib/prompts/internal-overlays.js +0 -43
- package/dist/lib/prompts/internal-overlays.js.map +0 -1
- package/dist/lib/prompts/iteration-nudge.js +0 -9
- package/dist/lib/prompts/iteration-nudge.js.map +0 -1
- package/dist/lib/prompts/store.js +0 -346
- package/dist/lib/prompts/store.js.map +0 -1
- package/dist/lib/prompts/system.js +0 -30
- package/dist/lib/prompts/system.js.map +0 -1
- package/dist/lib/prompts/turn-nudge.js +0 -12
- 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/shared-utils.d.ts.map +0 -1
- package/dist/lib/shared-utils.js +0 -30
- package/dist/lib/shared-utils.js.map +0 -1
- package/dist/lib/state/index.js +0 -4
- package/dist/lib/state/index.js.map +0 -1
- package/dist/lib/state/persistence.js +0 -174
- package/dist/lib/state/persistence.js.map +0 -1
- package/dist/lib/state/state.js +0 -134
- 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 -196
- 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 -4
- 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/strategies/supersede-writes.d.ts +0 -13
- package/dist/lib/strategies/supersede-writes.d.ts.map +0 -1
- package/dist/lib/strategies/supersede-writes.js +0 -94
- package/dist/lib/strategies/supersede-writes.js.map +0 -1
- package/dist/lib/strategies/utils.d.ts.map +0 -1
- package/dist/lib/strategies/utils.js +0 -128
- package/dist/lib/strategies/utils.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/tools/compress.d.ts +0 -4
- package/dist/lib/tools/compress.d.ts.map +0 -1
- package/dist/lib/tools/compress.js +0 -110
- package/dist/lib/tools/compress.js.map +0 -1
- package/dist/lib/tools/index.d.ts +0 -3
- package/dist/lib/tools/index.d.ts.map +0 -1
- package/dist/lib/tools/index.js +0 -2
- package/dist/lib/tools/index.js.map +0 -1
- package/dist/lib/tools/types.d.ts +0 -13
- 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 -80
- package/dist/lib/tools/utils.d.ts.map +0 -1
- package/dist/lib/tools/utils.js +0 -675
- package/dist/lib/tools/utils.js.map +0 -1
- package/dist/lib/ui/notification.js +0 -182
- package/dist/lib/ui/notification.js.map +0 -1
- package/dist/lib/ui/utils.js +0 -255
- package/dist/lib/ui/utils.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SessionState, WithParts } from "../state";
|
|
2
|
-
export declare const createSyntheticUserMessage: (baseMessage: WithParts, content: string,
|
|
2
|
+
export declare const createSyntheticUserMessage: (baseMessage: WithParts, content: string, stableSeed?: string) => WithParts;
|
|
3
3
|
export declare const createSyntheticTextPart: (baseMessage: WithParts, content: string, stableSeed?: string) => {
|
|
4
4
|
id: string;
|
|
5
5
|
sessionID: string;
|
|
@@ -11,10 +11,16 @@ type MessagePart = WithParts["parts"][number];
|
|
|
11
11
|
type ToolPart = Extract<MessagePart, {
|
|
12
12
|
type: "tool";
|
|
13
13
|
}>;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
type TextPart = Extract<MessagePart, {
|
|
15
|
+
type: "text";
|
|
16
|
+
}>;
|
|
17
|
+
export declare const appendToLastTextPart: (message: WithParts, injection: string) => boolean;
|
|
18
|
+
export declare const appendToTextPart: (part: TextPart, injection: string) => boolean;
|
|
19
|
+
export declare const appendToAllToolParts: (message: WithParts, tag: string) => boolean;
|
|
20
|
+
export declare const appendToToolPart: (part: ToolPart, tag: string) => boolean;
|
|
21
|
+
export declare const hasContent: (message: WithParts) => boolean;
|
|
16
22
|
export declare function buildToolIdList(state: SessionState, messages: WithParts[]): string[];
|
|
17
|
-
export declare const
|
|
23
|
+
export declare const replaceBlockIdsWithBlocked: (text: string) => string;
|
|
18
24
|
export declare const stripHallucinationsFromString: (text: string) => string;
|
|
19
25
|
export declare const stripHallucinations: (messages: WithParts[]) => void;
|
|
20
26
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/messages/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/messages/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAcvD,eAAO,MAAM,0BAA0B,GACnC,aAAa,SAAS,EACtB,SAAS,MAAM,EACf,aAAa,MAAM,KACpB,SA0BF,CAAA;AAED,eAAO,MAAM,uBAAuB,GAChC,aAAa,SAAS,EACtB,SAAS,MAAM,EACf,aAAa,MAAM;;;;;;CAatB,CAAA;AAED,KAAK,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAC7C,KAAK,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AACtD,KAAK,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAEtD,eAAO,MAAM,oBAAoB,GAAI,SAAS,SAAS,EAAE,WAAW,MAAM,KAAG,OAO5E,CAAA;AAaD,eAAO,MAAM,gBAAgB,GAAI,MAAM,QAAQ,EAAE,WAAW,MAAM,KAAG,OAgBpE,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,SAAS,SAAS,EAAE,KAAK,MAAM,KAAG,OAQtE,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,MAAM,QAAQ,EAAE,KAAK,MAAM,KAAG,OAU9D,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,SAAS,SAAS,KAAG,OAU/C,CAAA;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAiBpF;AAED,eAAO,MAAM,0BAA0B,GAAI,MAAM,MAAM,KAAG,MAEzD,CAAA;AAED,eAAO,MAAM,6BAA6B,GAAI,MAAM,MAAM,KAAG,MAE5D,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,UAAU,SAAS,EAAE,KAAG,IAgB3D,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const COMPRESS_MESSAGE = "Collapse selected individual messages in the conversation into detailed summaries.\n\nTHE SUMMARY\nYour summary must be EXHAUSTIVE. Capture file paths, function signatures, decisions made, constraints discovered, key findings, tool outcomes, and user intent details that matter... EVERYTHING that preserves the value of the selected message after the raw message is removed.\n\nUSER INTENT FIDELITY\nWhen a selected message contains user intent, preserve that intent with extra care. Do not change scope, constraints, priorities, acceptance criteria, or requested outcomes.\nDirectly quote short user instructions when that best preserves exact meaning.\n\nYet be LEAN. Strip away the noise: failed attempts that led nowhere, verbose tool output, and repetition. What remains should be pure signal - golden nuggets of detail that preserve full understanding with zero ambiguity.\nIf a message contains no significant technical decisions, code changes, or user requirements, produce a minimal one-line summary rather than a detailed one.\n\nMESSAGE IDS\nYou specify individual raw messages by ID using the injected IDs visible in the conversation:\n\n- `mNNNN` IDs identify raw messages\n\nEach message has an ID inside XML metadata tags like `<dcp-message-id priority=\"high\">m0007</dcp-message-id>`.\nThe same ID tag appears in every tool output of the message it belongs to \u2014 each unique ID identifies one complete message.\nTreat these tags as message metadata only, not as content to summarize. Use only the inner `mNNNN` value as the `messageId`.\nThe `priority` attribute indicates relative context cost. You MUST compress high-priority messages when their full text is no longer necessary for the active task.\nIf prior compress-tool results are present, always compress and summarize them minimally only as part of a broader compression pass. Do not invoke the compress tool solely to re-compress an earlier compression result.\nMessages marked as `<dcp-message-id>BLOCKED</dcp-message-id>` cannot be compressed.\n\nRules:\n\n- Pick each `messageId` directly from injected IDs visible in context.\n- Only use raw message IDs of the form `mNNNN`.\n- Ignore XML attributes such as `priority` when copying the ID; use only the inner `mNNNN` value.\n- Do not invent IDs. Use only IDs that are present in context.\n\nBATCHING\nSelect MANY messages in a single tool call when they are safe to compress.\nEach entry should summarize exactly one message, and the tool can receive as many entries as needed in one batch.\n\nGENERAL CLEANUP\nUse the topic \"general cleanup\" for broad cleanup passes.\nDuring general cleanup, compress all medium and high-priority messages that are not relevant to the active task.\nOptimize for reducing context footprint, not for grouping messages by topic.\nDo not compress away still-active instructions, unresolved questions, or constraints that are likely to matter soon.\nPrioritize the earliest messages in the context as they will be the least relevant to the active task.\nGeneral cleanup should be done periodically between other normal compression tool passes, not as the primary form of compression.\n";
|
|
2
|
+
//# sourceMappingURL=compress-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compress-message.d.ts","sourceRoot":"","sources":["../../../lib/prompts/compress-message.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,qlGA0C5B,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const COMPRESS_RANGE = "Collapse a range in the conversation into a detailed summary.\n\nTHE SUMMARY\nYour 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.\n\nUSER INTENT FIDELITY\nWhen 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.\nDirectly quote user messages when they are short enough to include safely. Direct quotes are preferred when they best preserve exact meaning.\n\nYet 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.\n\nCOMPRESSED BLOCK PLACEHOLDERS\nWhen the selected range includes previously compressed blocks, use this exact placeholder format when referencing one:\n\n- `(bN)`\n\nCompressed block sections in context are clearly marked with a header:\n\n- `[Compressed conversation section]`\n\nCompressed block IDs always use the `bN` form (never `mNNNN`) and are represented in the same XML metadata tag format.\n\nRules:\n\n- Include every required block placeholder exactly once.\n- Do not invent placeholders for blocks outside the selected range.\n- Treat `(bN)` placeholders as RESERVED TOKENS. Do not emit `(bN)` text anywhere except intentional placeholders.\n- If you need to mention a block in prose, use plain text like `compressed bN` (not as a placeholder).\n- Preflight check before finalizing: the set of `(bN)` placeholders in your summary must exactly match the required set, with no duplicates.\n\nThese placeholders are semantic references. They will be replaced with the full stored compressed block content when the tool processes your output.\n\nFLOW PRESERVATION WITH PLACEHOLDERS\nWhen you use compressed block placeholders, write the surrounding summary text so it still reads correctly AFTER placeholder expansion.\n\n- Treat each placeholder as a stand-in for a full conversation segment, not as a short label.\n- Ensure transitions before and after each placeholder preserve chronology and causality.\n- Do not write text that depends on the placeholder staying literal (for example, \"as noted in `(b2)`\").\n- Your final meaning must be coherent once each placeholder is replaced with its full compressed block content.\n\nBOUNDARY IDS\nYou specify boundaries by ID using the injected IDs visible in the conversation:\n\n- `mNNNN` IDs identify raw messages\n- `bN` IDs identify previously compressed blocks\n\nEach message has an ID inside XML metadata tags like `<dcp-message-id>...</dcp-message-id>`.\nThe same ID tag appears in every tool output of the message it belongs to \u2014 each unique ID identifies one complete message.\nTreat these tags as boundary metadata only, not as tool result content.\n\nRules:\n\n- Pick `startId` and `endId` directly from injected IDs in context.\n- IDs must exist in the current visible context.\n- `startId` must appear before `endId`.\n- Do not invent IDs. Use only IDs that are present in context.\n\nBATCHING\nWhen 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`.\n";
|
|
2
|
+
//# sourceMappingURL=compress-range.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compress-range.d.ts","sourceRoot":"","sources":["../../../lib/prompts/compress-range.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,k/GA2D1B,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CONTEXT_LIMIT_NUDGE = "<dcp-system-reminder>\nCRITICAL WARNING: MAX CONTEXT LIMIT REACHED\n\nYou are at or beyond the configured max context threshold. This is an emergency context-recovery moment.\n\nYou MUST use the `compress` tool now. Do not continue normal exploration until compression is handled.\n\nIf you are in the middle of a critical atomic operation, finish that atomic step first, then compress immediately.\n\
|
|
1
|
+
export declare const CONTEXT_LIMIT_NUDGE = "<dcp-system-reminder>\nCRITICAL WARNING: MAX CONTEXT LIMIT REACHED\n\nYou are at or beyond the configured max context threshold. This is an emergency context-recovery moment.\n\nYou MUST use the `compress` tool now. Do not continue normal exploration until compression is handled.\n\nIf you are in the middle of a critical atomic operation, finish that atomic step first, then compress immediately.\n\nSELECTION PROCESS\nStart from older, resolved history and capture as much stale context as safely possible in one pass.\nAvoid the newest active working messages unless it is clearly closed.\n\nSUMMARY REQUIREMENTS\nYour summary MUST cover all essential details from the selected messages so work can continue.\nIf the compressed range includes user messages, preserve user intent exactly. Prefer direct quotes for short user messages to avoid semantic drift.\n</dcp-system-reminder>\n";
|
|
2
2
|
//# sourceMappingURL=context-limit-nudge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-limit-nudge.d.ts","sourceRoot":"","sources":["../../../lib/prompts/context-limit-nudge.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"context-limit-nudge.d.ts","sourceRoot":"","sources":["../../../lib/prompts/context-limit-nudge.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,43BAiB/B,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SessionState } from "../../state";
|
|
2
|
+
export declare function buildCompressedBlockGuidance(state: SessionState): string;
|
|
3
|
+
export declare function renderMessagePriorityGuidance(priorityLabel: string, refs: string[]): string;
|
|
4
|
+
export declare function appendGuidanceToDcpTag(nudgeText: string, guidance: string): string;
|
|
5
|
+
//# sourceMappingURL=nudge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nudge.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/extensions/nudge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAaxE;AAED,wBAAgB,6BAA6B,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAQ3F;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAelF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const MANUAL_MODE_SYSTEM_EXTENSION = "<dcp-system-reminder>\nManual mode is enabled. Do NOT use compress unless the user has explicitly triggered it through a manual marker.\n\nOnly use the compress tool after seeing `<compress triggered manually>` in the current user instruction context.\n\nIssue 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.\n\nAfter 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.\n</dcp-system-reminder>\n";
|
|
2
|
+
export declare const SUBAGENT_SYSTEM_EXTENSION = "<dcp-system-reminder>\nYou are operating in a subagent environment.\n\nThe initial subagent instruction is imperative and must be followed exactly.\nIt is the only user message intentionally not assigned a message ID, and therefore is not eligible for compression.\nAll subsequent messages in the session will have IDs.\n</dcp-system-reminder>\n";
|
|
3
|
+
export declare function buildProtectedToolsExtension(protectedTools: string[]): string;
|
|
4
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/extensions/system.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,mrBASxC,CAAA;AAED,eAAO,MAAM,yBAAyB,8VAOrC,CAAA;AAED,wBAAgB,4BAA4B,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,MAAM,CAW7E"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const RANGE_FORMAT_EXTENSION = "\nTHE FORMAT OF COMPRESS\n\n```\n{\n topic: string, // Short label (3-5 words) - e.g., \"Auth System Exploration\"\n content: [ // One or more ranges to compress\n {\n startId: string, // Boundary ID at range start: mNNNN or bN\n endId: string, // Boundary ID at range end: mNNNN or bN\n summary: string // Complete technical summary replacing all content in range\n }\n ]\n}\n```";
|
|
2
|
+
export declare const MESSAGE_FORMAT_EXTENSION = "\nTHE FORMAT OF COMPRESS\n\n```\n{\n topic: string, // Short label (3-5 words) for the overall batch\n content: [ // One or more messages to compress independently\n {\n messageId: string, // Raw message ID only: mNNNN (ignore metadata attributes like priority)\n topic: string, // Short label (3-5 words) for this one message summary\n summary: string // Complete technical summary replacing that one message\n }\n ]\n}\n```";
|
|
3
|
+
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/extensions/tool.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB,gcAc5B,CAAA;AAEP,eAAO,MAAM,wBAAwB,2eAc9B,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { RuntimePrompts } from "./store";
|
|
2
|
-
export
|
|
2
|
+
export type { PromptStore, RuntimePrompts } from "./store";
|
|
3
|
+
export declare function renderSystemPrompt(prompts: RuntimePrompts, protectedToolsExtension?: string, manual?: boolean, subagent?: boolean): string;
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE1D,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,cAAc,EACvB,uBAAuB,CAAC,EAAE,MAAM,EAChC,MAAM,CAAC,EAAE,OAAO,EAChB,QAAQ,CAAC,EAAE,OAAO,GACnB,MAAM,CAoBR"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ITERATION_NUDGE = "<dcp-system-reminder>\nYou've been iterating for a while after the last user message.\n\nIf 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.\n
|
|
1
|
+
export declare const ITERATION_NUDGE = "<dcp-system-reminder>\nYou've been iterating for a while after the last user message.\n\nIf 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.\n</dcp-system-reminder>\n";
|
|
2
2
|
//# sourceMappingURL=iteration-nudge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iteration-nudge.d.ts","sourceRoot":"","sources":["../../../lib/prompts/iteration-nudge.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"iteration-nudge.d.ts","sourceRoot":"","sources":["../../../lib/prompts/iteration-nudge.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,2RAK3B,CAAA"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { Logger } from "../logger";
|
|
2
|
-
export type PromptKey = "system" | "compress" | "context-limit-nudge" | "turn-nudge" | "iteration-nudge";
|
|
2
|
+
export type PromptKey = "system" | "compress-range" | "compress-message" | "context-limit-nudge" | "turn-nudge" | "iteration-nudge";
|
|
3
3
|
export interface RuntimePrompts {
|
|
4
4
|
system: string;
|
|
5
|
-
|
|
5
|
+
compressRange: string;
|
|
6
|
+
compressMessage: string;
|
|
6
7
|
contextLimitNudge: string;
|
|
7
8
|
turnNudge: string;
|
|
8
9
|
iterationNudge: string;
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
manualExtension: string;
|
|
11
|
+
subagentExtension: string;
|
|
11
12
|
}
|
|
12
13
|
export declare const PROMPT_KEYS: PromptKey[];
|
|
13
14
|
export declare class PromptStore {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../lib/prompts/store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../lib/prompts/store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AASvC,MAAM,MAAM,SAAS,GACf,QAAQ,GACR,gBAAgB,GAChB,kBAAkB,GAClB,qBAAqB,GACrB,YAAY,GACZ,iBAAiB,CAAA;AA8BvB,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;CAC5B;AAqDD,eAAO,MAAM,WAAW,EAAE,SAAS,EAOlC,CAAA;AA8MD,qBAAa,WAAW;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,cAAc,CAAgB;gBAE1B,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,oBAAoB,UAAQ;IAYlF,iBAAiB,IAAI,cAAc;IAInC,MAAM,IAAI,IAAI;IAiDd,OAAO,CAAC,qBAAqB;IAsB7B,OAAO,CAAC,kBAAkB;CAkD7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SYSTEM = "\nYou 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.\n\nThe ONLY tool you have for context management is `compress`. It replaces
|
|
1
|
+
export declare const SYSTEM = "\nYou 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.\n\nThe ONLY tool you have for context management is `compress`. It replaces older conversation content with technical summaries you produce.\n\n`<dcp-message-id>` and `<dcp-system-reminder>` tags are environment-injected metadata. Do not output them.\n\nTHE PHILOSOPHY OF COMPRESS\n`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.\n\nThink of compression as phase transitions: raw exploration becomes refined understanding. The original context served its purpose; your summary now carries that understanding forward.\n\nCOMPRESS WHEN\n\nA section is genuinely closed and the raw conversation has served its purpose:\n\n- Research concluded and findings are clear\n- Implementation finished and verified\n- Exploration exhausted and patterns understood\n- Dead-end noise can be discarded without waiting for a whole chapter to close\n\nDO NOT COMPRESS IF\n\n- Raw context is still relevant and needed for edits or precise references\n- The target content is still actively in progress\n- You may need exact code, error messages, or file contents in the immediate next steps\n\nBefore compressing, ask: _\"Is this section closed enough to become summary-only right now?\"_\n\nEvaluate 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.\n\nIt is of your responsibility to keep a sharp, high-quality context window for optimal performance.\n";
|
|
2
2
|
//# sourceMappingURL=system.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../lib/prompts/system.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../lib/prompts/system.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,gzDAgClB,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const TURN_NUDGE = "<dcp-system-reminder>\nEvaluate the conversation for compressible ranges.\n\nIf any
|
|
1
|
+
export declare const TURN_NUDGE = "<dcp-system-reminder>\nEvaluate the conversation for compressible ranges.\n\nIf any messages are cleanly closed and unlikely to be needed again, use the compress tool on them.\nIf direction has shifted, compress earlier ranges that are now less relevant.\n\nThe goal is to filter noise and distill key information so context accumulation stays under control.\nKeep active context uncompressed.\n</dcp-system-reminder>\n";
|
|
2
2
|
//# sourceMappingURL=turn-nudge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turn-nudge.d.ts","sourceRoot":"","sources":["../../../lib/prompts/turn-nudge.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"turn-nudge.d.ts","sourceRoot":"","sources":["../../../lib/prompts/turn-nudge.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,waAStB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/state/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/state/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../lib/state/persistence.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC/F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../lib/state/persistence.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC/F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGvC,oCAAoC;AACpC,MAAM,WAAW,2BAA2B;IACxC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAC/C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;IAC5C,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/C,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,cAAc;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,QAAQ,CAAC,EAAE,2BAA2B,CAAA;CACzC;AAED,MAAM,WAAW,eAAe;IAC5B,mBAAmB,EAAE,MAAM,EAAE,CAAA;IAC7B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAA;CACnC;AAED,MAAM,WAAW,qBAAqB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,cAAc,CAAA;IACrB,MAAM,EAAE,eAAe,CAAA;IACvB,KAAK,EAAE,YAAY,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;CACtB;AAqCD,wBAAsB,gBAAgB,CAClC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CA4Bf;AAED,wBAAsB,gBAAgB,CAClC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAwFvC;AAED,MAAM,WAAW,eAAe;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;CACvB;AAED,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CA2ClF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../lib/state/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAsB,SAAS,EAAE,MAAM,SAAS,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../lib/state/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAsB,SAAS,EAAE,MAAM,SAAS,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAevC,eAAO,MAAM,YAAY,GACrB,QAAQ,GAAG,EACX,OAAO,YAAY,EACnB,QAAQ,MAAM,EACd,UAAU,SAAS,EAAE,EACrB,mBAAmB,OAAO,KAC3B,OAAO,CAAC,IAAI,CAwCd,CAAA;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CAqCjD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CA+B3D;AAED,wBAAsB,wBAAwB,CAC1C,MAAM,EAAE,GAAG,EACX,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS,EAAE,EACrB,iBAAiB,EAAE,OAAO,GAC3B,OAAO,CAAC,IAAI,CAAC,CA4Cf"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CompressionTimingState } from "../compress/timing";
|
|
1
2
|
import { Message, Part } from "@opencode-ai/sdk/v2";
|
|
2
3
|
export interface WithParts {
|
|
3
4
|
info: Message;
|
|
@@ -21,16 +22,23 @@ export interface PrunedMessageEntry {
|
|
|
21
22
|
allBlockIds: number[];
|
|
22
23
|
activeBlockIds: number[];
|
|
23
24
|
}
|
|
25
|
+
export type CompressionMode = "range" | "message";
|
|
24
26
|
export interface CompressionBlock {
|
|
25
27
|
blockId: number;
|
|
28
|
+
runId: number;
|
|
26
29
|
active: boolean;
|
|
27
30
|
deactivatedByUser: boolean;
|
|
28
31
|
compressedTokens: number;
|
|
32
|
+
summaryTokens: number;
|
|
33
|
+
durationMs: number;
|
|
34
|
+
mode?: CompressionMode;
|
|
29
35
|
topic: string;
|
|
36
|
+
batchTopic?: string;
|
|
30
37
|
startId: string;
|
|
31
38
|
endId: string;
|
|
32
39
|
anchorMessageId: string;
|
|
33
40
|
compressMessageId: string;
|
|
41
|
+
compressCallId?: string;
|
|
34
42
|
includedBlockIds: number[];
|
|
35
43
|
consumedBlockIds: number[];
|
|
36
44
|
parentBlockIds: number[];
|
|
@@ -49,6 +57,7 @@ export interface PruneMessagesState {
|
|
|
49
57
|
activeBlockIds: Set<number>;
|
|
50
58
|
activeByAnchorMessageId: Map<string, number>;
|
|
51
59
|
nextBlockId: number;
|
|
60
|
+
nextRunId: number;
|
|
52
61
|
}
|
|
53
62
|
export interface Prune {
|
|
54
63
|
tools: Map<string, number>;
|
|
@@ -77,13 +86,13 @@ export interface SessionState {
|
|
|
77
86
|
prune: Prune;
|
|
78
87
|
nudges: Nudges;
|
|
79
88
|
stats: SessionStats;
|
|
89
|
+
compressionTiming: CompressionTimingState;
|
|
80
90
|
toolParameters: Map<string, ToolParameterEntry>;
|
|
81
91
|
subAgentResultCache: Map<string, string>;
|
|
82
92
|
toolIdList: string[];
|
|
83
93
|
messageIds: MessageIdState;
|
|
84
94
|
lastCompaction: number;
|
|
85
95
|
currentTurn: number;
|
|
86
|
-
variant: string | undefined;
|
|
87
96
|
modelContextLimit: number | undefined;
|
|
88
97
|
systemPromptTokens: number | undefined;
|
|
89
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/state/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAEnD,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,IAAI,EAAE,CAAA;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAA;AAEtE,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,GAAG,CAAA;IACf,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,YAAY;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,gBAAgB,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,kBAA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E,GAAG,CAAC,MAAM,CAAC,CAAA;IAChC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7B,qBAAqB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACrC;AAED,MAAM,WAAW,YAAY;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,KAAK,GAAG,QAAQ,GAAG,kBAAkB,CAAA;IACjD,kBAAkB,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;IACxD,oBAAoB,EAAE,oBAAoB,GAAG,IAAI,CAAA;IACjD,KAAK,EAAE,KAAK,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,YAAY,CAAA;IACnB,iBAAiB,EAAE,sBAAsB,CAAA;IACzC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAC/C,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,UAAU,EAAE,cAAc,CAAA;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAA;CACzC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { CompressionBlock, PruneMessagesState, PrunedMessageEntry, SessionState, WithParts } from "./types";
|
|
2
|
+
export declare const isMessageCompacted: (state: SessionState, msg: WithParts) => boolean;
|
|
2
3
|
interface PersistedPruneMessagesState {
|
|
3
|
-
byMessageId
|
|
4
|
-
blocksById
|
|
5
|
-
activeBlockIds
|
|
6
|
-
activeByAnchorMessageId
|
|
7
|
-
nextBlockId
|
|
4
|
+
byMessageId: Record<string, PrunedMessageEntry>;
|
|
5
|
+
blocksById: Record<string, CompressionBlock>;
|
|
6
|
+
activeBlockIds: number[];
|
|
7
|
+
activeByAnchorMessageId: Record<string, number>;
|
|
8
|
+
nextBlockId: number;
|
|
9
|
+
nextRunId: number;
|
|
8
10
|
}
|
|
11
|
+
export declare function serializePruneMessagesState(messagesState: PruneMessagesState): PersistedPruneMessagesState;
|
|
9
12
|
export declare function isSubAgentSession(client: any, sessionID: string): Promise<boolean>;
|
|
10
13
|
export declare function findLastCompactionTimestamp(messages: WithParts[]): number;
|
|
11
14
|
export declare function countTurns(state: SessionState, messages: WithParts[]): number;
|
|
@@ -13,6 +16,7 @@ export declare function loadPruneMap(obj?: Record<string, number>): Map<string,
|
|
|
13
16
|
export declare function createPruneMessagesState(): PruneMessagesState;
|
|
14
17
|
export declare function loadPruneMessagesState(persisted?: PersistedPruneMessagesState): PruneMessagesState;
|
|
15
18
|
export declare function collectTurnNudgeAnchors(messages: WithParts[]): Set<string>;
|
|
19
|
+
export declare function getActiveSummaryTokenUsage(state: SessionState): number;
|
|
16
20
|
export declare function resetOnCompaction(state: SessionState): void;
|
|
17
21
|
export {};
|
|
18
22
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/state/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACZ,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/state/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACZ,MAAM,SAAS,CAAA;AAKhB,eAAO,MAAM,kBAAkB,GAAI,OAAO,YAAY,EAAE,KAAK,SAAS,KAAG,OAaxE,CAAA;AAED,UAAU,2BAA2B;IACjC,WAAW,E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AM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/strategies/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { SessionState, WithParts } from "
|
|
2
|
-
import { Logger } from "
|
|
3
|
-
|
|
4
|
-
* Get current token usage from the last assistant message.
|
|
5
|
-
* Returns total tokens (input + output + reasoning + cache).
|
|
6
|
-
*/
|
|
7
|
-
export declare function getCurrentTokenUsage(messages: WithParts[]): number;
|
|
1
|
+
import { SessionState, WithParts } from "./state";
|
|
2
|
+
import { Logger } from "./logger";
|
|
3
|
+
export declare function getCurrentTokenUsage(state: SessionState, messages: WithParts[]): number;
|
|
8
4
|
export declare function getCurrentParams(state: SessionState, messages: WithParts[], logger: Logger): {
|
|
9
5
|
providerId: string | undefined;
|
|
10
6
|
modelId: string | undefined;
|
|
@@ -13,9 +9,11 @@ export declare function getCurrentParams(state: SessionState, messages: WithPart
|
|
|
13
9
|
};
|
|
14
10
|
export declare function countTokens(text: string): number;
|
|
15
11
|
export declare function estimateTokensBatch(texts: string[]): number;
|
|
12
|
+
export declare const COMPACTED_TOOL_OUTPUT_PLACEHOLDER = "[Old tool result content cleared]";
|
|
13
|
+
export declare function extractCompletedToolOutput(part: any): string | undefined;
|
|
16
14
|
export declare function extractToolContent(part: any): string[];
|
|
17
15
|
export declare function countToolTokens(part: any): number;
|
|
18
16
|
export declare function getTotalToolTokens(state: SessionState, toolIds: string[]): number;
|
|
19
17
|
export declare function countMessageTextTokens(msg: WithParts): number;
|
|
20
18
|
export declare function countAllMessageTokens(msg: WithParts): number;
|
|
21
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
19
|
+
//# sourceMappingURL=token-utils.d.ts.map
|
|
@@ -0,0 +1 @@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ameterEntry } from "../state";
|
|
|
4
4
|
import { PluginConfig } from "../config";
|
|
5
5
|
export type PruneReason = "completion" | "noise" | "extraction";
|
|
6
6
|
export declare const PRUNE_REASON_LABELS: Record<PruneReason, string>;
|
|
7
|
+
interface CompressionNotificationEntry {
|
|
8
|
+
blockId: number;
|
|
9
|
+
runId: number;
|
|
10
|
+
summary: string;
|
|
11
|
+
summaryTokens: number;
|
|
12
|
+
}
|
|
7
13
|
export declare function sendUnifiedNotification(client: any, logger: Logger, config: PluginConfig, state: SessionState, sessionId: string, pruneToolIds: string[], toolMetadata: Map<string, ToolParameterEntry>, reason: PruneReason | undefined, params: any, workingDirectory: string): Promise<boolean>;
|
|
8
|
-
export declare function sendCompressNotification(client: any, logger: Logger, config: PluginConfig, state: SessionState, sessionId: string,
|
|
14
|
+
export declare function sendCompressNotification(client: any, logger: Logger, config: PluginConfig, state: SessionState, sessionId: string, entries: CompressionNotificationEntry[], batchTopic: string | undefined, sessionMessageIds: string[], params: any): Promise<boolean>;
|
|
9
15
|
export declare function sendIgnoredMessage(client: any, sessionID: string, text: string, params: any, logger: Logger): Promise<void>;
|
|
16
|
+
export {};
|
|
10
17
|
//# sourceMappingURL=notification.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../lib/ui/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAO5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../lib/ui/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EA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,CAAC,CAiCf"}
|
package/dist/lib/ui/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SessionState, ToolParameterEntry, WithParts } from "../state";
|
|
2
2
|
export declare function formatStatsHeader(totalTokensSaved: number, pruneTokenCounter: number): string;
|
|
3
|
-
export declare function formatTokenCount(tokens: number): string;
|
|
3
|
+
export declare function formatTokenCount(tokens: number, compact?: boolean): string;
|
|
4
4
|
export declare function truncate(str: string, maxLen?: number): string;
|
|
5
5
|
export declare function formatProgressBar(messageIds: string[], prunedMessages: Map<string, number>, recentMessageIds: string[], width?: number): string;
|
|
6
6
|
export declare function cacheSystemPromptTokens(state: SessionState, messages: WithParts[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/ui/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AA2ItE,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,MAAM,CAG7F;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/ui/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AA2ItE,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,MAAM,CAG7F;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAM1E;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,MAAW,GAAG,MAAM,CAGjE;AAED,wBAAgB,iBAAiB,CAC7B,UAAU,EAAE,MAAM,EAAE,EACpB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,KAAK,GAAE,MAAW,GACnB,MAAM,CA4BR;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,CAqCxF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAU5E;AAeD,wBAAgB,qBAAqB,CACjC,YAAY,EAAE,MAAM,EAAE,EACtB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC7C,gBAAgB,CAAC,EAAE,MAAM,GAC1B,MAAM,EAAE,CA0BV;AAED,wBAAgB,0BAA0B,CACtC,SAAS,EAAE,MAAM,EAAE,EACnB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC7C,gBAAgB,CAAC,EAAE,MAAM,GAC1B,MAAM,CAWR"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
type UpdateResult = {
|
|
3
|
+
updated: true;
|
|
4
|
+
name: string;
|
|
5
|
+
current: string;
|
|
6
|
+
latest: string;
|
|
7
|
+
} | {
|
|
8
|
+
updated: false;
|
|
9
|
+
error: "remove_failed";
|
|
10
|
+
name: string;
|
|
11
|
+
current: string;
|
|
12
|
+
latest: string;
|
|
13
|
+
} | {
|
|
14
|
+
updated: false;
|
|
15
|
+
};
|
|
16
|
+
export declare function startAutoUpdate(ctx: PluginInput, enabled: boolean): void;
|
|
17
|
+
export declare function checkAutoUpdate(signal: AbortSignal): Promise<UpdateResult>;
|
|
18
|
+
export declare function updateRemoveDir(packageDir: string, name: string): Promise<string | undefined>;
|
|
19
|
+
export declare function isAutoUpdatableSpec(spec: string): boolean;
|
|
20
|
+
export declare function isVersionNewer(latest: string, current: string): boolean;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../lib/update.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAQtD,KAAK,YAAY,GACX;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAChE;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzF;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,CAAA;AAIxB,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAqBxE;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CA0BhF;AAcD,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,+BAarE;AAgBD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,WAQ/C;AA6BD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,WA4B7D"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@p4r4d0xb0x/opencode-dcp",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.1.12",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "OpenCode plugin that optimizes token usage by pruning obsolete tool outputs from conversation context",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./server": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
9
19
|
"scripts": {
|
|
10
20
|
"clean": "rm -rf dist",
|
|
11
|
-
"build": "npm run clean && tsc",
|
|
12
|
-
"
|
|
21
|
+
"build": "npm run clean && tsup && tsc --emitDeclarationOnly",
|
|
22
|
+
"verify:package": "node scripts/verify-package.mjs",
|
|
23
|
+
"check:package": "npm run build && npm run verify:package",
|
|
24
|
+
"prepublishOnly": "npm run check:package",
|
|
13
25
|
"dev": "opencode plugin dev",
|
|
14
26
|
"typecheck": "tsc --noEmit",
|
|
15
27
|
"test": "node --import tsx --test tests/*.test.ts",
|
|
@@ -28,30 +40,29 @@
|
|
|
28
40
|
],
|
|
29
41
|
"repository": {
|
|
30
42
|
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/
|
|
43
|
+
"url": "git+https://github.com/Tarquinen/opencode-dynamic-context-pruning.git"
|
|
32
44
|
},
|
|
33
45
|
"bugs": {
|
|
34
|
-
"url": "https://github.com/
|
|
46
|
+
"url": "https://github.com/Tarquinen/opencode-dynamic-context-pruning/issues"
|
|
35
47
|
},
|
|
36
|
-
"homepage": "https://github.com/
|
|
37
|
-
"author": "
|
|
48
|
+
"homepage": "https://github.com/Tarquinen/opencode-dynamic-context-pruning#readme",
|
|
49
|
+
"author": "tarquinen",
|
|
38
50
|
"license": "AGPL-3.0-or-later",
|
|
39
51
|
"peerDependencies": {
|
|
40
|
-
"@opencode-ai/plugin": ">=
|
|
52
|
+
"@opencode-ai/plugin": ">=1.4.3"
|
|
41
53
|
},
|
|
42
54
|
"dependencies": {
|
|
43
55
|
"@anthropic-ai/tokenizer": "^0.0.4",
|
|
44
|
-
"@opencode-ai/sdk": "^1.
|
|
45
|
-
"
|
|
46
|
-
"jsonc-parser": "^3.3.1",
|
|
47
|
-
"zod": "^4.3.6"
|
|
56
|
+
"@opencode-ai/sdk": "^1.4.3",
|
|
57
|
+
"jsonc-parser": "^3.3.1"
|
|
48
58
|
},
|
|
49
59
|
"devDependencies": {
|
|
50
|
-
"@opencode-ai/plugin": "^1.
|
|
51
|
-
"@types/node": "^25.
|
|
60
|
+
"@opencode-ai/plugin": "^1.4.3",
|
|
61
|
+
"@types/node": "^25.5.0",
|
|
52
62
|
"prettier": "^3.8.1",
|
|
63
|
+
"tsup": "^8.5.1",
|
|
53
64
|
"tsx": "^4.21.0",
|
|
54
|
-
"typescript": "^
|
|
65
|
+
"typescript": "^6.0.2"
|
|
55
66
|
},
|
|
56
67
|
"files": [
|
|
57
68
|
"dist/",
|
package/dist/lib/auth.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export function isSecureMode() {
|
|
2
|
-
return !!process.env.OPENCODE_SERVER_PASSWORD;
|
|
3
|
-
}
|
|
4
|
-
export function getAuthorizationHeader() {
|
|
5
|
-
const password = process.env.OPENCODE_SERVER_PASSWORD;
|
|
6
|
-
if (!password)
|
|
7
|
-
return undefined;
|
|
8
|
-
const username = process.env.OPENCODE_SERVER_USERNAME ?? "opencode";
|
|
9
|
-
// Use Buffer for Node.js base64 encoding (btoa may not be available in all Node versions)
|
|
10
|
-
const credentials = Buffer.from(`${username}:${password}`).toString("base64");
|
|
11
|
-
return `Basic ${credentials}`;
|
|
12
|
-
}
|
|
13
|
-
export function configureClientAuth(client) {
|
|
14
|
-
const authHeader = getAuthorizationHeader();
|
|
15
|
-
if (!authHeader) {
|
|
16
|
-
return client;
|
|
17
|
-
}
|
|
18
|
-
// The SDK client has an internal client with request interceptors
|
|
19
|
-
// Access the underlying client to add the interceptor
|
|
20
|
-
const innerClient = client._client || client.client;
|
|
21
|
-
if (innerClient?.interceptors?.request) {
|
|
22
|
-
innerClient.interceptors.request.use((request) => {
|
|
23
|
-
// Only add auth header if not already present
|
|
24
|
-
if (!request.headers.has("Authorization")) {
|
|
25
|
-
request.headers.set("Authorization", authHeader);
|
|
26
|
-
}
|
|
27
|
-
return request;
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return client;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=auth.js.map
|
package/dist/lib/auth.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../lib/auth.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY;IACxB,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAA;AACjD,CAAC;AAED,MAAM,UAAU,sBAAsB;IAClC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAA;IACrD,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAA;IAE/B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,UAAU,CAAA;IACnE,0FAA0F;IAC1F,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAC7E,OAAO,SAAS,WAAW,EAAE,CAAA;AACjC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAW;IAC3C,MAAM,UAAU,GAAG,sBAAsB,EAAE,CAAA;IAE3C,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,OAAO,MAAM,CAAA;IACjB,CAAC;IAED,kEAAkE;IAClE,sDAAsD;IACtD,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAA;IAEnD,IAAI,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;QAC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