billion-context-dsh 0.2.2 → 0.2.4
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.en.md +10 -9
- package/README.md +10 -9
- package/dist/index.js +217 -80
- package/dist/index.js.map +1 -1
- package/dist/messages.d.ts +24 -3
- package/dist/region.d.ts +9 -0
- package/dist/tools.d.ts +1 -1
- package/package.json +1 -1
package/dist/messages.d.ts
CHANGED
|
@@ -22,16 +22,37 @@ import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
|
22
22
|
* compress boundary resolution). Nested arrays are flattened depth-first.
|
|
23
23
|
*/
|
|
24
24
|
export declare function extractText(content: unknown): string;
|
|
25
|
+
/**
|
|
26
|
+
* The tool-call id of one tool/result surface message, or null.
|
|
27
|
+
*
|
|
28
|
+
* Real DSH tool-result events carry NO `message.toolCallId` (hard-won rule
|
|
29
|
+
* 10): the identity lives in the nested `{ type: 'tool-result', toolCallId }`
|
|
30
|
+
* content block, falling back to `message.source.callId`. Shared with
|
|
31
|
+
* `src/region.ts`'s call/result pairing — one implementation, never a copy.
|
|
32
|
+
*/
|
|
33
|
+
export declare function toolCallIdOfResultEvent(event: SessionEvent): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Index of assistant tool-call `id` → tool `name`, used to attribute
|
|
36
|
+
* tool/result messages to their tool. Real DSH tool-results carry no
|
|
37
|
+
* `message.toolName` (rule 10), so the projection backfills it from the
|
|
38
|
+
* matching assistant tool-call. Scans ALL events up front (order-independent:
|
|
39
|
+
* a result may precede its call in the array) and covers shadowed calls too.
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildToolCallIndex(events: readonly SessionEvent[]): ReadonlyMap<string, string>;
|
|
25
42
|
/**
|
|
26
43
|
* Project one surface message event into CoreMessage(s).
|
|
27
44
|
* - user/message → user text (verbatim content)
|
|
28
45
|
* - assistant/message → assistant text, or one CoreMessage per tool-call
|
|
29
|
-
* - tool/result → tool result (
|
|
46
|
+
* - tool/result → tool result (role 'tool'); toolName/toolCallId are
|
|
47
|
+
* backfilled from `toolNames` (assistant tool-call
|
|
48
|
+
* index) — real DSH events do not carry them at the
|
|
49
|
+
* message level. Without an index the result stays
|
|
50
|
+
* untagged (`toolName: ''`), never "text".
|
|
30
51
|
* Non-surface events project to nothing.
|
|
31
52
|
*/
|
|
32
|
-
export declare function projectEvent(event: SessionEvent): CoreMessage[];
|
|
53
|
+
export declare function projectEvent(event: SessionEvent, toolNames?: ReadonlyMap<string, string>): CoreMessage[];
|
|
33
54
|
/** Project a session's message events into CoreMessage[] in log order. */
|
|
34
|
-
export declare function eventsToCoreMessages(events: readonly SessionEvent[]): CoreMessage[];
|
|
55
|
+
export declare function eventsToCoreMessages(events: readonly SessionEvent[], toolNames?: ReadonlyMap<string, string>): CoreMessage[];
|
|
35
56
|
/** The surface-visible message events of a session, in model-visible order. */
|
|
36
57
|
export declare function surfaceEventsOf(session: import('@deepseek-ai/dsh-session').Session): SessionEvent[];
|
|
37
58
|
/**
|
package/dist/region.d.ts
CHANGED
|
@@ -239,6 +239,15 @@ export declare function blockRegistry(session: Session): AcpBlockRegistryEntry[]
|
|
|
239
239
|
export declare function blockRefForSummarySeq(session: Session, seq: number): string | null;
|
|
240
240
|
/** The durable compaction ids distilled by the given kernel block refs (`bN`). */
|
|
241
241
|
export declare function compactionIdsOfKernelBlocks(session: Session, kernelBlockIds: readonly string[]): string[];
|
|
242
|
+
/**
|
|
243
|
+
* Resolve a kernel block ref (`bN`) — as shown by the model tool `acp_status`
|
|
244
|
+
* (kernel `buildStatusReport` renders `block.blockId`) — to the durable
|
|
245
|
+
* compaction id the decompress/search tools accept. Returns null when `bN` is
|
|
246
|
+
* not an exact registry key (unknown ref). Only matches the canonical `bN`
|
|
247
|
+
* form (`/^b\d+$/`); anything else is not a kernel ref and returns null so the
|
|
248
|
+
* caller falls back to its compaction-id prefix match.
|
|
249
|
+
*/
|
|
250
|
+
export declare function blockIdOfKernelRef(session: Session, kernelRef: string): string | null;
|
|
242
251
|
/** The checkpoint summary seq of an ACTIVE kernel block (`bN`), or null. */
|
|
243
252
|
export declare function summarySeqOfKernelBlock(session: Session, kernelBlockId: string): number | null;
|
|
244
253
|
/**
|
package/dist/tools.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { type CompressionCore } from 'acp-kernel';
|
|
|
14
14
|
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
15
15
|
import type { AcpStateStore } from './state.ts';
|
|
16
16
|
import { type KernelConfigInput } from './config.ts';
|
|
17
|
-
import {
|
|
17
|
+
import type { AcpWindow } from './window.ts';
|
|
18
18
|
import { type ResolvedPrompts } from './prompts.ts';
|
|
19
19
|
export interface ToolEnvironment extends KernelConfigInput {
|
|
20
20
|
readonly kernel: CompressionCore;
|
package/package.json
CHANGED