dsh-agent-sdk-bridge 1.1.5 → 1.1.7
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/DEVELOPMENT.md +34 -0
- package/FAQ.md +24 -0
- package/client.js +140 -62
- package/lib/index.js +282 -60
- package/lib/types/adapter.d.ts +59 -12
- package/lib/types/api.d.ts +7 -0
- package/lib/types/codebuddy-adapter.d.ts +33 -0
- package/lib/types/codebuddy.d.ts +39 -0
- package/lib/types/index.d.ts +10 -0
- package/lib/types/minimax-adapter.d.ts +8 -0
- package/lib/types/render.d.ts +17 -4
- package/package.json +1 -1
- package/src/adapter.ts +125 -25
- package/src/api.ts +15 -1
- package/src/codebuddy-adapter.ts +91 -16
- package/src/codebuddy.ts +66 -3
- package/src/index.ts +33 -0
- package/src/minimax-adapter.ts +37 -13
- package/src/render.ts +42 -12
package/lib/types/adapter.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
|
|
|
13
13
|
import type { QoderBrand } from './brand.ts';
|
|
14
14
|
import type { Live } from './live.ts';
|
|
15
15
|
import { QoderModelCatalog } from './models.ts';
|
|
16
|
-
import type { Feed } from './render.ts';
|
|
16
|
+
import type { Feed, ImagePathResolver } from './render.ts';
|
|
17
17
|
import type { UsageSnapshot } from './usage.ts';
|
|
18
18
|
/**
|
|
19
19
|
* Read one durable image occurrence into the bytes a request sends.
|
|
@@ -40,6 +40,11 @@ export interface QoderAdapterOptions {
|
|
|
40
40
|
modelCacheTtlMs?: Live<number>;
|
|
41
41
|
/** Request-image reader; absent → images are never forwarded as pixels. */
|
|
42
42
|
readImage?: ImageRequestReader;
|
|
43
|
+
/**
|
|
44
|
+
* The tool-world path of one image, for the handle text that lets the model
|
|
45
|
+
* edit it. Absent → an unreadable image keeps the harness placeholder.
|
|
46
|
+
*/
|
|
47
|
+
imagePath?: ImagePathResolver;
|
|
43
48
|
/** How long an unpaired MCP tool handler waits before failing its call. */
|
|
44
49
|
toolResultTimeoutMs?: Live<number>;
|
|
45
50
|
/** How long the inner process gets to acknowledge an abort. */
|
|
@@ -72,6 +77,12 @@ export interface QoderAdapterOptions {
|
|
|
72
77
|
export declare const QODER_PROVIDER = "qoder-cn";
|
|
73
78
|
/** The international edition's route; a second adapter instance serves it. */
|
|
74
79
|
export declare const QODER_INTL_PROVIDER = "qoder-intl";
|
|
80
|
+
/** The window facts one live catalog entry carries. */
|
|
81
|
+
export type WindowFacts = {
|
|
82
|
+
maxInputTokens?: number;
|
|
83
|
+
defaultContextWindow?: number;
|
|
84
|
+
availableContextWindows?: readonly number[];
|
|
85
|
+
};
|
|
75
86
|
/**
|
|
76
87
|
* Decide the context window to report for one live model.
|
|
77
88
|
*
|
|
@@ -80,17 +91,15 @@ export declare const QODER_INTL_PROVIDER = "qoder-intl";
|
|
|
80
91
|
* actually runs with. `maxInputTokens` is NOT a substitute — it is the ceiling
|
|
81
92
|
* for a single request and is often lower than the session window (e.g. 180 000
|
|
82
93
|
* against a 200 000 session), so falling back to it would understate capacity.
|
|
94
|
+
* Callers that accept a user override should validate it against
|
|
95
|
+
* `availableContextWindows` first — see {@link resolveDeclaredWindow}.
|
|
83
96
|
*
|
|
84
97
|
* @param live - the live catalog entry, when the CLI answered.
|
|
85
98
|
* @param override - the user's chosen window for this model, if any.
|
|
86
99
|
* @param fallback - window used when the catalog has nothing for this model.
|
|
87
100
|
* @returns the window in tokens.
|
|
88
101
|
*/
|
|
89
|
-
export declare function pickContextWindow(live:
|
|
90
|
-
maxInputTokens?: number;
|
|
91
|
-
defaultContextWindow?: number;
|
|
92
|
-
availableContextWindows?: readonly number[];
|
|
93
|
-
} | undefined, override: number | undefined, fallback: number): number;
|
|
102
|
+
export declare function pickContextWindow(live: WindowFacts | undefined, override: number | undefined, fallback: number): number;
|
|
94
103
|
/**
|
|
95
104
|
* The window the CLI will actually run this route with.
|
|
96
105
|
*
|
|
@@ -107,11 +116,21 @@ export declare function pickContextWindow(live: {
|
|
|
107
116
|
* @param declared - the window this route publishes to the harness.
|
|
108
117
|
* @returns the window the CLI runs with, or undefined when unknown.
|
|
109
118
|
*/
|
|
110
|
-
export declare function cliContextWindow(live:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
119
|
+
export declare function cliContextWindow(live: WindowFacts | undefined, declared: number): number | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* The window to publish for one route, which is also the one the CLI is told
|
|
122
|
+
* to run with.
|
|
123
|
+
*
|
|
124
|
+
* A live entry is authoritative: the user's override counts only when the
|
|
125
|
+
* model advertises it. The CLI silently ignores anything else (a 1M choice on
|
|
126
|
+
* a 200K-only route), and dividing by it would understate every reading
|
|
127
|
+
* fivefold. When the catalog is momentarily unavailable, the last successful
|
|
128
|
+
* answer is reused instead of the static 200K default — that fallback used to
|
|
129
|
+
* change the denominator, and the compaction budget, mid-session: a 1M
|
|
130
|
+
* conversation read 1M one turn and 200K the next, and then compacted at what
|
|
131
|
+
* looked like 10%.
|
|
132
|
+
*/
|
|
133
|
+
export declare function resolveDeclaredWindow(live: WindowFacts | undefined, override: number | undefined, remembered: number | undefined, fallback: number): number;
|
|
115
134
|
/**
|
|
116
135
|
* Build the `reasoning` metadata block for a resolved model, or undefined
|
|
117
136
|
* when the model does not support reasoning.
|
|
@@ -138,6 +157,7 @@ export declare class QoderAdapter extends LlmAdapter {
|
|
|
138
157
|
private readonly catalog;
|
|
139
158
|
private readonly usage;
|
|
140
159
|
private readonly readImage;
|
|
160
|
+
private readonly imagePath;
|
|
141
161
|
private readonly brand;
|
|
142
162
|
/**
|
|
143
163
|
* Memoized `Set` view of the disabled-model list.
|
|
@@ -147,6 +167,24 @@ export declare class QoderAdapter extends LlmAdapter {
|
|
|
147
167
|
* hash probe instead of rebuilding a set per call, with no staleness.
|
|
148
168
|
*/
|
|
149
169
|
private disabledCache;
|
|
170
|
+
/**
|
|
171
|
+
* The last window each route resolved to, plus what the model advertised.
|
|
172
|
+
*
|
|
173
|
+
* Reused only when a live entry is missing. Without it a failed refresh fell
|
|
174
|
+
* back to the static 200K, so a 1M session suddenly declared 200K: the ring
|
|
175
|
+
* denominator changed and the compaction engine budgeted against 200K,
|
|
176
|
+
* compacting a history that was still only ~10% of the real window.
|
|
177
|
+
*/
|
|
178
|
+
private readonly knownWindows;
|
|
179
|
+
/**
|
|
180
|
+
* Last verified image capability per route.
|
|
181
|
+
*
|
|
182
|
+
* A missed catalog refresh used to fall back to text-only, and DSH then
|
|
183
|
+
* stripped the pixels before this adapter ran: a vision model silently lost
|
|
184
|
+
* the image for that turn. Remembering the last answer keeps the declared
|
|
185
|
+
* capability stable across a transient miss.
|
|
186
|
+
*/
|
|
187
|
+
private readonly knownVision;
|
|
150
188
|
constructor(options?: QoderAdapterOptions);
|
|
151
189
|
private get defaultMaxTokens();
|
|
152
190
|
private get modelContextWindows();
|
|
@@ -195,8 +233,17 @@ export declare class QoderAdapter extends LlmAdapter {
|
|
|
195
233
|
isModelDisabled(id: string): boolean;
|
|
196
234
|
/** The stored disabled-model set, as a list for rewriting the field. */
|
|
197
235
|
disabledModelIds(): readonly string[];
|
|
198
|
-
/**
|
|
236
|
+
/**
|
|
237
|
+
* The user's window for one model, when the provider accepts it.
|
|
238
|
+
*
|
|
239
|
+
* A stored choice the model does not advertise is not a real choice: the CLI
|
|
240
|
+
* ignores it and keeps its own window, so publishing it would only make the
|
|
241
|
+
* meter divide by a capacity the route never runs with. Until the catalog
|
|
242
|
+
* has answered once the choice is trusted (there is nothing to check yet).
|
|
243
|
+
*/
|
|
199
244
|
contextWindowFor(id: string): number | undefined;
|
|
245
|
+
/** The window this route publishes, remembering it for catalog misses. */
|
|
246
|
+
private declaredWindow;
|
|
200
247
|
/** The stored per-model window map, for rewriting the field. */
|
|
201
248
|
modelWindowChoices(): Readonly<Record<string, number>>;
|
|
202
249
|
listModels(provider: string): Promise<readonly LlmModelInfo[]>;
|
package/lib/types/api.d.ts
CHANGED
|
@@ -38,6 +38,13 @@ export interface ModelRow {
|
|
|
38
38
|
override?: number;
|
|
39
39
|
priceFactor?: number;
|
|
40
40
|
reasoning: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the provider accepts a context-budget choice for this model.
|
|
43
|
+
*
|
|
44
|
+
* Absent (Qoder, MiniMax) means the ordinary menu applies. `false` means the
|
|
45
|
+
* window is fixed upstream, so the page shows the value without a selector.
|
|
46
|
+
*/
|
|
47
|
+
contextWindowSelectable?: boolean;
|
|
41
48
|
}
|
|
42
49
|
/** The adapters the API can reach, one per provider route. */
|
|
43
50
|
export type AdapterMap = Readonly<Record<BrandId, QoderAdapter | CodeBuddyAdapter | MinimaxAdapter>>;
|
|
@@ -15,6 +15,7 @@ import { CodeBuddyAuth } from './codebuddy.ts';
|
|
|
15
15
|
import type { CodeBuddyModel, CodeBuddyUsageSnapshot } from './codebuddy.ts';
|
|
16
16
|
import type { ImageRequestReader } from './adapter.ts';
|
|
17
17
|
import type { Live } from './live.ts';
|
|
18
|
+
import type { ImagePathResolver } from './render.ts';
|
|
18
19
|
/** The CodeBuddy provider route. */
|
|
19
20
|
export declare const CODEBUDDY_PROVIDER = "codebuddy";
|
|
20
21
|
/** Everything the adapter reads lazily from the plugin config. */
|
|
@@ -38,6 +39,11 @@ export interface CodeBuddyAdapterOptions {
|
|
|
38
39
|
* store) → images degrade to their handle text instead of failing the turn.
|
|
39
40
|
*/
|
|
40
41
|
readImage?: ImageRequestReader;
|
|
42
|
+
/**
|
|
43
|
+
* The tool-world path of one image, for the handle text that lets the model
|
|
44
|
+
* edit it. Absent → an unreadable image keeps the harness placeholder.
|
|
45
|
+
*/
|
|
46
|
+
imagePath?: ImagePathResolver;
|
|
41
47
|
}
|
|
42
48
|
/** Map a harness-side id onto a CodeBuddy model value. */
|
|
43
49
|
export declare function resolveCodeBuddyModelId(model: string, aliases?: Readonly<Record<string, string>>): string;
|
|
@@ -49,6 +55,8 @@ export declare class CodeBuddyAdapter extends LlmAdapter {
|
|
|
49
55
|
private readonly accounts;
|
|
50
56
|
private readonly auth;
|
|
51
57
|
private readonly disabledCache;
|
|
58
|
+
/** Last verified image capability, keyed `${region}:${model}`. */
|
|
59
|
+
private readonly knownVision;
|
|
52
60
|
constructor(options?: CodeBuddyAdapterOptions);
|
|
53
61
|
private get region();
|
|
54
62
|
private disabledFor;
|
|
@@ -88,13 +96,38 @@ export declare class CodeBuddyAdapter extends LlmAdapter {
|
|
|
88
96
|
* only shape the CLI sends to the model as pixels.
|
|
89
97
|
*/
|
|
90
98
|
private buildFeed;
|
|
99
|
+
/**
|
|
100
|
+
* The window this model actually runs with.
|
|
101
|
+
*
|
|
102
|
+
* The user's override only applies where the provider accepts one. Every
|
|
103
|
+
* model in the current catalog reports `supportedLengths: null`, so the CLI
|
|
104
|
+
* answers a `set_config.contextWindow` with `Allowed: <none>`; a stored
|
|
105
|
+
* override would then make DSH show a denominator the upstream never uses,
|
|
106
|
+
* which is exactly how the context ring drifted.
|
|
107
|
+
*/
|
|
91
108
|
contextWindowFor(id: string, region?: CodeBuddyRegion): number | undefined;
|
|
109
|
+
/** The catalog snapshot the adapter last read (empty before the first read). */
|
|
110
|
+
private models;
|
|
111
|
+
/** Whether this model lets the user pick a context budget at all. */
|
|
112
|
+
supportsContextWindowChoice(id: string, region?: CodeBuddyRegion): boolean;
|
|
92
113
|
listModels(provider: string): Promise<readonly LlmModelInfo[]>;
|
|
93
114
|
resolveModel(provider: string, model: string): Promise<LlmResolvedModelInfo>;
|
|
94
115
|
prepareCall(provider: string, model: string, signal?: AbortSignal): Promise<PreparedAdapterCall>;
|
|
95
116
|
stream(options: GenerateOptions): AsyncIterable<StreamChunk>;
|
|
96
117
|
private dispatch;
|
|
97
118
|
private firstTurn;
|
|
119
|
+
/**
|
|
120
|
+
* The context window the host and the inner session must agree on.
|
|
121
|
+
*
|
|
122
|
+
* Only a model that offers selectable budgets is configured: one fixed
|
|
123
|
+
* window rejects every value, so the CLI's own default already matches what
|
|
124
|
+
* the host shows. For a model with choices the adapter sends the picked
|
|
125
|
+
* value; returning to "default" sends the model's own default budget, since
|
|
126
|
+
* the CLI rejects a null clear (`contextWindow must be a positive safe
|
|
127
|
+
* integer`). The override lives for the life of the CLI process, so the
|
|
128
|
+
* default has to be sent explicitly to drop a previous choice.
|
|
129
|
+
*/
|
|
130
|
+
private windowOption;
|
|
98
131
|
private cwdOf;
|
|
99
132
|
close(): void;
|
|
100
133
|
}
|
package/lib/types/codebuddy.d.ts
CHANGED
|
@@ -32,7 +32,16 @@ export interface CodeBuddyModel {
|
|
|
32
32
|
description?: string;
|
|
33
33
|
maxInputTokens?: number;
|
|
34
34
|
maxOutputTokens?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Context budgets the provider actually accepts for this model.
|
|
37
|
+
*
|
|
38
|
+
* Empty means the model exposes no selectable window: CodeBuddy validates
|
|
39
|
+
* `set_config.contextWindow` against `contextWindow.supportedLengths` and
|
|
40
|
+
* rejects everything else with `Allowed: <none>`, so the settings page must
|
|
41
|
+
* not offer a choice the CLI will refuse.
|
|
42
|
+
*/
|
|
35
43
|
contextWindows: number[];
|
|
44
|
+
/** The window the model actually runs with (its physical input limit). */
|
|
36
45
|
defaultContextWindow: number;
|
|
37
46
|
vision: boolean;
|
|
38
47
|
reasoningEfforts?: string[];
|
|
@@ -111,6 +120,13 @@ export declare class CodeBuddyCatalog {
|
|
|
111
120
|
private readonly inflight;
|
|
112
121
|
private readonly failures;
|
|
113
122
|
constructor(region: Live<CodeBuddyRegion>, ttlMs?: Live<number>, timeoutMs?: Live<number>);
|
|
123
|
+
/**
|
|
124
|
+
* The last catalog read for a region, without fetching.
|
|
125
|
+
*
|
|
126
|
+
* Callers that must answer synchronously (deciding whether a model exposes a
|
|
127
|
+
* context-budget choice) use this instead of awaiting a refresh.
|
|
128
|
+
*/
|
|
129
|
+
snapshot(requested?: CodeBuddyRegion): readonly CodeBuddyModel[];
|
|
114
130
|
/** Models for one region; a failed refresh keeps the last good list. */
|
|
115
131
|
models(requested?: CodeBuddyRegion): Promise<readonly CodeBuddyModel[]>;
|
|
116
132
|
/** Why the last refresh failed, or undefined when it succeeded. */
|
|
@@ -237,6 +253,10 @@ export declare class CodeBuddySession {
|
|
|
237
253
|
private effort;
|
|
238
254
|
private systemPrompt;
|
|
239
255
|
private cwd;
|
|
256
|
+
/** Context budget the host shows for this session, when a model offers one. */
|
|
257
|
+
private contextWindow;
|
|
258
|
+
/** Budget already pushed to the CLI, keyed by model and value. */
|
|
259
|
+
private appliedWindow;
|
|
240
260
|
/** Host messages already fed to the inner session, for continuation planning. */
|
|
241
261
|
fedMessages: readonly import('@deepseek-ai/dsh-llm').RequestMessage[] | undefined;
|
|
242
262
|
/** Host system prompt last applied; informational for the adapter. */
|
|
@@ -250,7 +270,26 @@ export declare class CodeBuddySession {
|
|
|
250
270
|
effort?: string;
|
|
251
271
|
system?: string;
|
|
252
272
|
cwd?: string;
|
|
273
|
+
contextWindow?: number;
|
|
253
274
|
}): void;
|
|
275
|
+
/**
|
|
276
|
+
* Push the host-visible context window into the inner session.
|
|
277
|
+
*
|
|
278
|
+
* The CLI resolves its own budget (`override > model default > physical
|
|
279
|
+
* limit`) and both its compaction trigger and the upstream gateway enforce
|
|
280
|
+
* that budget. A global-catalog model such as `deepseek-v4.1-flash` declares
|
|
281
|
+
* `supportedLengths [300K, 1M]` with a 300K default, so a session left alone
|
|
282
|
+
* compacts (and the gateway rejects) anything past 276K — while the host,
|
|
283
|
+
* told 1M, keeps showing and feeding a larger history. Replaying that history
|
|
284
|
+
* then collapses to a summary. Applying the same number the host divides by
|
|
285
|
+
* keeps the two in step; models that expose no choice reject it and keep
|
|
286
|
+
* their default.
|
|
287
|
+
*
|
|
288
|
+
* The CLI refuses to clear the override (`contextWindow must be a positive
|
|
289
|
+
* safe integer`), so the adapter sends the model's default instead when the
|
|
290
|
+
* page returns to "default".
|
|
291
|
+
*/
|
|
292
|
+
private applyContextWindow;
|
|
254
293
|
/**
|
|
255
294
|
* Remember the host tools and register them with this session's MCP server.
|
|
256
295
|
*
|
package/lib/types/index.d.ts
CHANGED
|
@@ -41,10 +41,20 @@ interface WebServerService {
|
|
|
41
41
|
handler: (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
|
|
42
42
|
}): () => void;
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* The mounted filesystem provider, used only to translate a host path into
|
|
46
|
+
* the execution world the host tools run in. Declared minimally so the plugin
|
|
47
|
+
* keeps only the peer dependencies it actually needs.
|
|
48
|
+
*/
|
|
49
|
+
interface FileSystemService {
|
|
50
|
+
processPathFromHostPath?(hostPath: string): string | undefined;
|
|
51
|
+
}
|
|
44
52
|
declare module '@deepseek-ai/cordis' {
|
|
45
53
|
interface Context {
|
|
46
54
|
/** Present only in web compositions; reached through a nested inject. */
|
|
47
55
|
webServer?: WebServerService;
|
|
56
|
+
/** Present when a filesystem provider is mounted; reached by inject. */
|
|
57
|
+
fs?: FileSystemService;
|
|
48
58
|
}
|
|
49
59
|
interface Events {
|
|
50
60
|
/**
|
|
@@ -15,6 +15,7 @@ import { MinimaxAuth } from './minimax.ts';
|
|
|
15
15
|
import type { MinimaxModel, MinimaxUsageSnapshot } from './minimax.ts';
|
|
16
16
|
import type { ImageRequestReader } from './adapter.ts';
|
|
17
17
|
import type { Live } from './live.ts';
|
|
18
|
+
import type { ImagePathResolver } from './render.ts';
|
|
18
19
|
/** The MiniMax Code provider route. */
|
|
19
20
|
export declare const MINIMAX_PROVIDER = "minimax-acp";
|
|
20
21
|
/** Everything the adapter reads lazily from the plugin config. */
|
|
@@ -38,6 +39,11 @@ export interface MinimaxAdapterOptions {
|
|
|
38
39
|
* store) → images degrade to their handle text instead of failing the turn.
|
|
39
40
|
*/
|
|
40
41
|
readImage?: ImageRequestReader;
|
|
42
|
+
/**
|
|
43
|
+
* The tool-world path of one image, for the handle text that lets the model
|
|
44
|
+
* edit it. Absent → an unreadable image keeps the harness placeholder.
|
|
45
|
+
*/
|
|
46
|
+
imagePath?: ImagePathResolver;
|
|
41
47
|
}
|
|
42
48
|
/** Map a harness-side id onto an ACP model value. */
|
|
43
49
|
export declare function resolveMinimaxModelId(model: string, aliases?: Readonly<Record<string, string>>): string;
|
|
@@ -49,6 +55,8 @@ export declare class MinimaxAdapter extends LlmAdapter {
|
|
|
49
55
|
private readonly auth;
|
|
50
56
|
private readonly mcpServer;
|
|
51
57
|
private readonly disabledCache;
|
|
58
|
+
/** Last verified image capability, keyed `${region}:${model}`. */
|
|
59
|
+
private readonly knownVision;
|
|
52
60
|
constructor(options?: MinimaxAdapterOptions);
|
|
53
61
|
private get region();
|
|
54
62
|
private disabledFor;
|
package/lib/types/render.d.ts
CHANGED
|
@@ -22,6 +22,18 @@ export type FeedPart = {
|
|
|
22
22
|
type: 'image';
|
|
23
23
|
attachment: ImageAttachmentRef;
|
|
24
24
|
};
|
|
25
|
+
/** Resolve the tool-world path of one durable image attachment. */
|
|
26
|
+
export type ImagePathResolver = (ref: ImageAttachmentRef) => string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Model-facing handle for one image.
|
|
29
|
+
*
|
|
30
|
+
* The host's native adapters use the same text: it names the attachment, its
|
|
31
|
+
* pixel size and media type, and the read-only normalized copy on disk, and it
|
|
32
|
+
* tells the model to copy that file to a writable path before editing. Pixels
|
|
33
|
+
* alone let a model describe an image but not process it — without this path
|
|
34
|
+
* the model goes looking through the workspace for a file that was never there.
|
|
35
|
+
*/
|
|
36
|
+
export declare function imageRefText(ref: ImageAttachmentRef, path: string | undefined): string;
|
|
25
37
|
/** What one inner turn receives: text (the historical shape) or text + images. */
|
|
26
38
|
export type Feed = string | FeedPart[];
|
|
27
39
|
/**
|
|
@@ -31,12 +43,12 @@ export type Feed = string | FeedPart[];
|
|
|
31
43
|
*/
|
|
32
44
|
export declare function imageRefs(blocks: readonly ContentBlock[]): ImageAttachmentRef[];
|
|
33
45
|
/** Render one content-block list as plain text; non-text blocks get handles. */
|
|
34
|
-
export declare function renderBlocks(blocks: readonly ContentBlock[]): string;
|
|
46
|
+
export declare function renderBlocks(blocks: readonly ContentBlock[], imagePath?: ImagePathResolver): string;
|
|
35
47
|
/**
|
|
36
48
|
* Render one request message with its role tag. A request-only user input has
|
|
37
49
|
* no durable identity or source, so it reads exactly like a user message.
|
|
38
50
|
*/
|
|
39
|
-
export declare function renderMessage(message: RequestMessage): string;
|
|
51
|
+
export declare function renderMessage(message: RequestMessage, imagePath?: ImagePathResolver): string;
|
|
40
52
|
/**
|
|
41
53
|
* Join feed sections into one feed. While no section carries an image the
|
|
42
54
|
* result is the historical text shape, sections separated by a blank line;
|
|
@@ -55,13 +67,14 @@ export declare function currentTurnStart(messages: readonly RequestMessage[]): n
|
|
|
55
67
|
/** Image references carried by a feed, in order. */
|
|
56
68
|
export declare function feedImageRefs(feed: Feed): ImageAttachmentRef[];
|
|
57
69
|
/** Flatten a feed back to text, replacing images with the harness handle text. */
|
|
58
|
-
export declare function feedToText(feed: Feed): string;
|
|
70
|
+
export declare function feedToText(feed: Feed, imagePath?: ImagePathResolver): string;
|
|
59
71
|
/** One feed element after image bytes have been resolved (base64). */
|
|
60
72
|
export type ResolvedFeedPart = {
|
|
61
73
|
type: 'text';
|
|
62
74
|
text: string;
|
|
63
75
|
} | {
|
|
64
76
|
type: 'image';
|
|
77
|
+
attachment: ImageAttachmentRef;
|
|
65
78
|
data: string;
|
|
66
79
|
mediaType: string;
|
|
67
80
|
} | {
|
|
@@ -95,7 +108,7 @@ export declare function feedWideCharCount(feed: Feed): number;
|
|
|
95
108
|
* prompt, and the existing conversation as compact context. Messages of the
|
|
96
109
|
* current turn keep their image references; earlier ones are handles.
|
|
97
110
|
*/
|
|
98
|
-
export declare function renderInitialFeed(system: string | undefined, messages: readonly RequestMessage[]): Feed;
|
|
111
|
+
export declare function renderInitialFeed(system: string | undefined, messages: readonly RequestMessage[], imagePath?: ImagePathResolver): Feed;
|
|
99
112
|
/** Render a brand-new host user turn; images stay references, text-only stays a string. */
|
|
100
113
|
export declare function renderUserTurn(blocks: readonly ContentBlock[]): Feed;
|
|
101
114
|
/** Render an in-place-updated message (runtime-context snapshots and the like). */
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "dsh-agent-sdk-bridge",
|
|
3
3
|
"displayName": "Agent SDK Bridge",
|
|
4
4
|
"description": "DeepSeek Harness LLM adapter bridge for Qoder CN, Qoder International, Tencent CodeBuddy and MiniMax Code subscriptions. It reuses each provider's own SDK or official ACP server and CLI login, shows available quota, and exposes per-provider settings pages with independent international and mainland login regions.",
|
|
5
|
-
"version": "1.1.
|
|
5
|
+
"version": "1.1.7",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "k1-h2",
|