@tarquinen/opencode-dcp 3.2.4-beta0 → 3.2.5-beta0

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.
@@ -1,77 +0,0 @@
1
- import type { SessionState } from "../state/types"
2
- import { attachCompressionDuration } from "./state"
3
-
4
- export interface PendingCompressionDuration {
5
- messageId: string
6
- callId: string
7
- durationMs: number
8
- }
9
-
10
- export interface CompressionTimingState {
11
- startsByCallId: Map<string, number>
12
- pendingByCallId: Map<string, PendingCompressionDuration>
13
- }
14
-
15
- export function buildCompressionTimingKey(messageId: string, callId: string): string {
16
- return `${messageId}:${callId}`
17
- }
18
-
19
- export function consumeCompressionStart(
20
- state: SessionState,
21
- messageId: string,
22
- callId: string,
23
- ): number | undefined {
24
- const key = buildCompressionTimingKey(messageId, callId)
25
- const start = state.compressionTiming.startsByCallId.get(key)
26
- state.compressionTiming.startsByCallId.delete(key)
27
- return start
28
- }
29
-
30
- export function resolveCompressionDuration(
31
- startedAt: number | undefined,
32
- eventTime: number | undefined,
33
- partTime: { start?: unknown; end?: unknown } | undefined,
34
- ): number | undefined {
35
- const runningAt =
36
- typeof partTime?.start === "number" && Number.isFinite(partTime.start)
37
- ? partTime.start
38
- : eventTime
39
- const pendingToRunningMs =
40
- typeof startedAt === "number" && typeof runningAt === "number"
41
- ? Math.max(0, runningAt - startedAt)
42
- : undefined
43
-
44
- const toolStart = partTime?.start
45
- const toolEnd = partTime?.end
46
- const runtimeMs =
47
- typeof toolStart === "number" &&
48
- Number.isFinite(toolStart) &&
49
- typeof toolEnd === "number" &&
50
- Number.isFinite(toolEnd)
51
- ? Math.max(0, toolEnd - toolStart)
52
- : undefined
53
-
54
- return typeof pendingToRunningMs === "number" ? pendingToRunningMs : runtimeMs
55
- }
56
-
57
- export function applyPendingCompressionDurations(state: SessionState): number {
58
- if (state.compressionTiming.pendingByCallId.size === 0) {
59
- return 0
60
- }
61
-
62
- let updates = 0
63
- for (const [key, entry] of state.compressionTiming.pendingByCallId) {
64
- const applied = attachCompressionDuration(
65
- state.prune.messages,
66
- entry.messageId,
67
- entry.callId,
68
- entry.durationMs,
69
- )
70
- if (applied > 0) {
71
- updates += applied
72
- state.compressionTiming.pendingByCallId.delete(key)
73
- }
74
- }
75
-
76
- return updates
77
- }
@@ -1,108 +0,0 @@
1
- import type { PluginConfig } from "../config"
2
- import type { Logger } from "../logger"
3
- import type { PromptStore } from "../prompts/store"
4
- import type { CompressionBlock, CompressionMode, SessionState, WithParts } from "../state"
5
-
6
- export interface ToolContext {
7
- client: any
8
- state: SessionState
9
- logger: Logger
10
- config: PluginConfig
11
- prompts: PromptStore
12
- }
13
-
14
- export interface CompressRangeEntry {
15
- startId: string
16
- endId: string
17
- summary: string
18
- }
19
-
20
- export interface CompressRangeToolArgs {
21
- topic: string
22
- content: CompressRangeEntry[]
23
- }
24
-
25
- export interface CompressMessageEntry {
26
- messageId: string
27
- topic: string
28
- summary: string
29
- }
30
-
31
- export interface CompressMessageToolArgs {
32
- topic: string
33
- content: CompressMessageEntry[]
34
- }
35
-
36
- export interface BoundaryReference {
37
- kind: "message" | "compressed-block"
38
- rawIndex: number
39
- messageId?: string
40
- blockId?: number
41
- anchorMessageId?: string
42
- }
43
-
44
- export interface SearchContext {
45
- rawMessages: WithParts[]
46
- rawMessagesById: Map<string, WithParts>
47
- rawIndexById: Map<string, number>
48
- summaryByBlockId: Map<number, CompressionBlock>
49
- }
50
-
51
- export interface SelectionResolution {
52
- startReference: BoundaryReference
53
- endReference: BoundaryReference
54
- messageIds: string[]
55
- messageTokenById: Map<string, number>
56
- toolIds: string[]
57
- requiredBlockIds: number[]
58
- }
59
-
60
- export interface ResolvedMessageCompression {
61
- entry: CompressMessageEntry
62
- selection: SelectionResolution
63
- anchorMessageId: string
64
- }
65
-
66
- export interface ResolvedRangeCompression {
67
- index: number
68
- entry: CompressRangeEntry
69
- selection: SelectionResolution
70
- anchorMessageId: string
71
- }
72
-
73
- export interface ResolvedMessageCompressionsResult {
74
- plans: ResolvedMessageCompression[]
75
- skippedIssues: string[]
76
- skippedCount: number
77
- }
78
-
79
- export interface ParsedBlockPlaceholder {
80
- raw: string
81
- blockId: number
82
- startIndex: number
83
- endIndex: number
84
- }
85
-
86
- export interface InjectedSummaryResult {
87
- expandedSummary: string
88
- consumedBlockIds: number[]
89
- }
90
-
91
- export interface AppliedCompressionResult {
92
- compressedTokens: number
93
- messageIds: string[]
94
- newlyCompressedMessageIds: string[]
95
- newlyCompressedToolIds: string[]
96
- }
97
-
98
- export interface CompressionStateInput {
99
- topic: string
100
- batchTopic: string
101
- startId: string
102
- endId: string
103
- mode: CompressionMode
104
- runId: number
105
- compressMessageId: string
106
- compressCallId?: string
107
- summaryTokens: number
108
- }