@toddzheng024/dscode-bundle 0.7.27 → 0.7.29
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 -1
- package/THIRD_PARTY_NOTICES.md +10 -10
- package/bootstrap.mjs +1 -1
- package/cordis.patch.yml +433 -46
- package/package.json +280 -245
- package/plugins/account/index.mjs +178 -0
- package/plugins/account/state.mjs +123 -0
- package/plugins/auto-review/index.mjs +8 -5
- package/plugins/code-review/index.mjs +1 -1
- package/plugins/computer-use/index.mjs +37 -0
- package/plugins/cordis-config/plain.mjs +31 -0
- package/plugins/dscode/index.mjs +1 -1
- package/plugins/exec/cli.mjs +1 -1
- package/plugins/grok/index.mjs +28 -24
- package/plugins/i18n/messages.mjs +204 -0
- package/plugins/memory/index.mjs +1 -1
- package/plugins/message-source/kind.mjs +20 -0
- package/plugins/openrouter/adapter.mjs +29 -13
- package/plugins/openrouter/index.mjs +31 -28
- package/plugins/session-bridge/communication.mjs +6 -3
- package/plugins/session-bridge/server.mjs +3 -2
- package/plugins/session-bridge/tasks.mjs +3 -1
- package/plugins/session-cards/index.mjs +1 -1
- package/plugins/time-marks/index.mjs +3 -2
- package/plugins/time-marks/marks.mjs +6 -5
- package/plugins/triggers/config.mjs +1 -1
- package/plugins/triggers/tools.mjs +1 -1
- package/plugins/tui-tools/doctor.mjs +1 -1
- package/plugins/tui-tools/index.mjs +16 -4
- package/plugins/ultra/policy.mjs +16 -0
- package/vendor/bash/index.js +455 -186
- package/vendor/bash/types/background.d.ts +38 -7
- package/vendor/bash/types/index.d.ts +20 -4
- package/vendor/bash/types/render.d.ts +28 -9
- package/vendor/command-goal/index.js +3 -1
- package/vendor/deepseek/index.js +1378 -1246
- package/vendor/deepseek/types/adapter.d.ts +16 -155
- package/vendor/deepseek/types/config.d.ts +127 -0
- package/vendor/deepseek/types/defaults.d.ts +24 -0
- package/vendor/deepseek/types/file-store.d.ts +5 -3
- package/vendor/deepseek/types/files-api.d.ts +12 -9
- package/vendor/deepseek/types/image-tokens.d.ts +24 -9
- package/vendor/deepseek/types/images.d.ts +35 -0
- package/vendor/deepseek/types/index.d.ts +10 -94
- package/vendor/deepseek/types/messages-api.d.ts +10 -0
- package/vendor/deepseek/types/model-info.d.ts +16 -0
- package/vendor/deepseek/types/models.d.ts +4 -0
- package/vendor/deepseek/types/replay.d.ts +27 -0
- package/vendor/deepseek/types/request-extensions.d.ts +16 -0
- package/vendor/deepseek/types/request-files.d.ts +49 -0
- package/vendor/deepseek/types/request-pricing.d.ts +32 -20
- package/vendor/deepseek/types/serialize.d.ts +17 -82
- package/vendor/deepseek/types/sse.d.ts +6 -22
- package/vendor/deepseek/types/translate.d.ts +13 -36
- package/vendor/deepseek/types/transport.d.ts +15 -0
- package/vendor/deepseek/types/types.d.ts +106 -167
- package/vendor/deepseek/types/wire-types.d.ts +62 -0
- package/vendor/persistent/index.js +9 -3
- package/vendor/subagent/index.js +11 -8
- package/vendor/subagent/model-selection-settings.js +12 -38
- package/vendor/subagent/types/index.d.ts +4 -3
- package/vendor/subagent/types/model-selection-settings.d.ts +12 -10
- package/vendor/subagent-core/index.js +401 -264
- package/vendor/subagent-core/typert.host.js +103 -113
- package/vendor/subagent-core/typert.remote-client.d.ts +1 -3
- package/vendor/subagent-core/typert.remote-client.js +23 -69
- package/vendor/subagent-core/types/archive-admission.d.ts +16 -0
- package/vendor/subagent-core/types/archive-admission.js +151 -0
- package/vendor/subagent-core/types/assistant-output.d.ts +2 -2
- package/vendor/subagent-core/types/catalog.d.ts +17 -10
- package/vendor/subagent-core/types/catalog.js +12 -6
- package/vendor/subagent-core/types/child-agent.d.ts +8 -5
- package/vendor/subagent-core/types/child-agent.js +11 -5
- package/vendor/subagent-core/types/continuation-activation.d.ts +17 -1
- package/vendor/subagent-core/types/continuation-activation.js +41 -4
- package/vendor/subagent-core/types/continuation-messages.d.ts +1 -1
- package/vendor/subagent-core/types/continuation-messages.js +7 -3
- package/vendor/subagent-core/types/continuation.d.ts +1 -1
- package/vendor/subagent-core/types/continuation.js +2 -2
- package/vendor/subagent-core/types/control-types.d.ts +29 -36
- package/vendor/subagent-core/types/control-types.js +2 -3
- package/vendor/subagent-core/types/control.d.ts +2 -28
- package/vendor/subagent-core/types/control.js +3 -40
- package/vendor/subagent-core/types/index.d.ts +45 -41
- package/vendor/subagent-core/types/index.js +46 -82
- package/vendor/subagent-core/types/internal.d.ts +2 -2
- package/vendor/subagent-core/types/internal.js +2 -2
- package/vendor/subagent-core/types/lifecycle.d.ts +1 -1
- package/vendor/subagent-core/types/lifecycle.js +5 -3
- package/vendor/subagent-core/types/list-children.d.ts +15 -32
- package/vendor/subagent-core/types/list-children.js +45 -49
- package/vendor/subagent-core/types/out-of-process.d.ts +1 -1
- package/vendor/subagent-core/types/projection-types.d.ts +9 -1
- package/vendor/subagent-core/types/projection.d.ts +5 -0
- package/vendor/subagent-core/types/projection.js +10 -4
- package/vendor/subagent-core/types/run-settlement.js +1 -1
- package/vendor/subagent-core/types/types.d.ts +2 -2
- package/vendor/terminal/index.js +94 -30
- package/vendor/tui/lib/index.mjs +2 -1
- package/vendor/tui/lib/kernel-panels.mjs +1 -1
- package/vendor/tui/lib/render/projection.mjs +50 -36
- package/presets/dscode/agent.cordis.yml +0 -321
- package/presets/dscode/preset.yml +0 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LlmModelInfo, LlmResolvedModelInfo } from '@deepseek-ai/dsh-llm';
|
|
2
|
+
import type { DeepSeekCatalogModel, DeepSeekConnectionOptions } from './types.ts';
|
|
3
|
+
/** Advertise one catalog entry.
|
|
4
|
+
* @param provider - registered provider id.
|
|
5
|
+
* @param model - advisory catalog entry.
|
|
6
|
+
* @returns selector metadata.
|
|
7
|
+
*/
|
|
8
|
+
export declare function catalogModelInfo(provider: string, model: DeepSeekCatalogModel): LlmModelInfo;
|
|
9
|
+
/** Resolve model capabilities against one configuration generation.
|
|
10
|
+
* @param connection - validated connection facts.
|
|
11
|
+
* @param provider - registered provider id.
|
|
12
|
+
* @param model - requested wire model id.
|
|
13
|
+
* @returns effective model metadata for this operation.
|
|
14
|
+
*/
|
|
15
|
+
export declare function modelInfo(connection: DeepSeekConnectionOptions, provider: string, model: string): LlmResolvedModelInfo;
|
|
16
|
+
//# sourceMappingURL=model-info.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Minimal native thinking metadata; durable Harness blocks own all response text. */
|
|
2
|
+
import type { Message, ReplayEnvelope } from '@deepseek-ai/dsh-llm';
|
|
3
|
+
/** Index-aligned metadata retained alongside each emitted Harness block. */
|
|
4
|
+
export interface ReplayBlock {
|
|
5
|
+
type: 'text' | 'reasoning' | 'tool-call';
|
|
6
|
+
signature?: string;
|
|
7
|
+
}
|
|
8
|
+
/** Reject malformed JSON objects at provider and durable-data reads.
|
|
9
|
+
* @param value - untrusted decoded JSON.
|
|
10
|
+
* @param code - owning failure category.
|
|
11
|
+
* @returns the validated object.
|
|
12
|
+
*/
|
|
13
|
+
export declare function object(value: unknown, code?: string): Record<string, unknown>;
|
|
14
|
+
/** Construct response metadata without duplicating the assistant text.
|
|
15
|
+
* @param model - requested model identity.
|
|
16
|
+
* @param blocks - metadata in emitted block order.
|
|
17
|
+
* @returns the versioned envelope persisted by the existing assembler.
|
|
18
|
+
*/
|
|
19
|
+
export declare function replayState(model: string, blocks: ReplayBlock[]): ReplayEnvelope;
|
|
20
|
+
/** Validate native replay, discarding unusable metadata before serializing durable content.
|
|
21
|
+
* @param message - durable assistant content and source metadata.
|
|
22
|
+
* @param model - target model; cross-model signatures are not portable.
|
|
23
|
+
* @param onDegrade - diagnostic for unusable metadata; receives no message content or signatures.
|
|
24
|
+
* @returns index-aligned metadata, absent for foreign, cross-model or degraded history.
|
|
25
|
+
*/
|
|
26
|
+
export declare function readReplay(message: Message, model: string, onDegrade?: (reason: string) => void): ReplayBlock[] | undefined;
|
|
27
|
+
//# sourceMappingURL=replay.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Prepare plugin-contributed request fields and commit their delivery after HTTP acceptance. */
|
|
2
|
+
import type { DeepSeekLlmApiExtensionRequest } from '@deepseek-ai/dsh-deepseek-llm-api-extensions';
|
|
3
|
+
import type { DeepSeekAdapterOptions } from './types.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Merge contributions without replacing Messages fields. Preparation and
|
|
6
|
+
* acceptance failures report REQUEST_EXTENSION.
|
|
7
|
+
* @param body - serialized Messages request before extension fields.
|
|
8
|
+
* @param options - request identity, purpose, and cancellation.
|
|
9
|
+
* @param prepare - contributor registry captured for this adapter.
|
|
10
|
+
* @returns HTTP payload and a commit to invoke only after a successful HTTP response.
|
|
11
|
+
*/
|
|
12
|
+
export declare function prepareRequestExtensions(body: DeepSeekLlmApiExtensionRequest['body'], options: Omit<DeepSeekLlmApiExtensionRequest, 'body'>, prepare: DeepSeekAdapterOptions['prepareExtensions']): Promise<{
|
|
13
|
+
payload: string;
|
|
14
|
+
accept(): Promise<void>;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=request-extensions.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Shared Files resolution, bounded stale-id recovery, and normalized-image diagnostics. */
|
|
2
|
+
import type { RequestImageAttachment } from '@deepseek-ai/dsh-attachment';
|
|
3
|
+
import type { DeepSeekFileStore, DeepSeekFileConnection, DeepSeekFilePolicy } from './file-store.ts';
|
|
4
|
+
import type { DeepSeekFileId } from './file-id.ts';
|
|
5
|
+
/** Position of an image occurrence in the request's conversation messages. */
|
|
6
|
+
export interface ImageWireLocation {
|
|
7
|
+
message: number;
|
|
8
|
+
image: number;
|
|
9
|
+
}
|
|
10
|
+
/** A file upload failure eligible for request-wide inline fallback. */
|
|
11
|
+
export declare class FileResolutionFailure extends Error {
|
|
12
|
+
constructor(cause: unknown);
|
|
13
|
+
}
|
|
14
|
+
/** Files state owned by one model request, including at most one stale-id retry. */
|
|
15
|
+
export declare class RequestFiles {
|
|
16
|
+
private readonly files;
|
|
17
|
+
private readonly connection;
|
|
18
|
+
private readonly policy;
|
|
19
|
+
private readonly timeoutMs;
|
|
20
|
+
private readonly signal;
|
|
21
|
+
private readonly activity;
|
|
22
|
+
private used;
|
|
23
|
+
private retried;
|
|
24
|
+
constructor(files: DeepSeekFileStore, connection: DeepSeekFileConnection, policy: DeepSeekFilePolicy, timeoutMs: number, signal: AbortSignal, activity: () => void);
|
|
25
|
+
/** Reset occurrence tracking before serializing the next HTTP attempt. */
|
|
26
|
+
beginAttempt(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve a retained image under its own upload deadline.
|
|
29
|
+
* @param version - prepared request image.
|
|
30
|
+
* @param location - occurrence used by provider-rejection diagnostics.
|
|
31
|
+
* @returns the reusable provider id.
|
|
32
|
+
*/
|
|
33
|
+
resolve(version: RequestImageAttachment, location: ImageWireLocation): Promise<DeepSeekFileId>;
|
|
34
|
+
/**
|
|
35
|
+
* Invalidate rejected mappings; only the first stale-id response permits another request.
|
|
36
|
+
* @param detail - provider error fields used for stale-id classification.
|
|
37
|
+
* @returns whether the caller should serialize and dispatch again.
|
|
38
|
+
*/
|
|
39
|
+
retry(detail: string): Promise<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* Attribute a normalized-image rejection to the actual uploaded image occurrences.
|
|
42
|
+
* @param status - rejected request's HTTP status.
|
|
43
|
+
* @param message - provider's error message.
|
|
44
|
+
* @param detail - provider error classification fields.
|
|
45
|
+
* @returns the image diagnostic or the original provider message.
|
|
46
|
+
*/
|
|
47
|
+
errorMessage(status: number, message: string, detail: string): string;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=request-files.d.ts.map
|
|
@@ -1,44 +1,56 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Provider-side request-image pricing for DeepSeek routes:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* Provider-side request-image pricing for DeepSeek routes: prices every
|
|
3
|
+
* retained surface occurrence at its per-model request target with
|
|
4
|
+
* the published vision-token accounting, and every occurrence the surface
|
|
5
|
+
* marks offloaded as its placeholder text. Consumed synchronously by the
|
|
6
|
+
* token meter through `LlmAdapter.imageRequestPricing`; provider usage
|
|
7
|
+
* remains the authoritative anchor for completed requests.
|
|
8
8
|
*
|
|
9
9
|
* @module dsh-llm-deepseek/request-pricing
|
|
10
10
|
*/
|
|
11
11
|
import type { ImageAttachmentAccessResolver, LlmImageRequestPricing } from '@deepseek-ai/dsh-llm';
|
|
12
|
-
import type {
|
|
13
|
-
import type { DeepSeekCatalogModel, DeepSeekConnectionOptions } from './
|
|
12
|
+
import type { ImageAttachmentRef, ImageRequestTarget } from '@deepseek-ai/dsh-attachment';
|
|
13
|
+
import type { DeepSeekCatalogModel, DeepSeekConnectionOptions } from './types.ts';
|
|
14
14
|
/** Default bound on accumulated file-referenced image bytes per request. */
|
|
15
15
|
export declare const DEFAULT_MAX_REQUEST_FILES_BYTES: number;
|
|
16
16
|
/** Provider request image-count limit. */
|
|
17
17
|
export declare const DEFAULT_MAX_IMAGES_PER_REQUEST = 600;
|
|
18
|
-
/** Total-pixel budget matching DeepSeek's normal vision projection. */
|
|
19
|
-
export declare const DEFAULT_REQUEST_IMAGE_PIXEL_BUDGET = 640000;
|
|
20
18
|
/** Total-pixel budget matching provider low-detail image input. */
|
|
21
19
|
export declare const DEFAULT_LOW_DETAIL_IMAGE_PIXEL_BUDGET: number;
|
|
22
20
|
/** Encoded-byte target for one deterministic model-request image; the smallest quality-ladder output is used when no quality fits. */
|
|
23
21
|
export declare const DEFAULT_REQUEST_IMAGE_MAX_BYTES: number;
|
|
24
22
|
/**
|
|
25
|
-
*
|
|
23
|
+
* Provider per-side limit for a request carrying 15 or more images, applied
|
|
24
|
+
* to every request image so the image count never changes a projection.
|
|
25
|
+
*/
|
|
26
|
+
export declare const REQUEST_IMAGE_MAX_DIMENSION = 4096;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the encoded-byte target one DeepSeek model route applies to every request image.
|
|
29
|
+
* @param model - Advertised model route and its optional image overrides.
|
|
30
|
+
* @returns the route's encoded-byte target.
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveRequestImageMaxBytes(model: DeepSeekCatalogModel): number;
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the deterministic request target one DeepSeek model route chooses
|
|
36
|
+
* for one source image: the published token grid unless the model overrides
|
|
37
|
+
* it with a pixel budget, then the provider per-side limit, then the route's
|
|
38
|
+
* encoded-byte target. Small images are never enlarged.
|
|
26
39
|
* @param model - Advertised model route and its optional image overrides.
|
|
27
|
-
* @
|
|
40
|
+
* @param source - intrinsic dimensions of the normalized attachment.
|
|
41
|
+
* @returns Complete request dimensions and encoded-byte target.
|
|
28
42
|
* @internal
|
|
29
43
|
*/
|
|
30
|
-
export declare function
|
|
44
|
+
export declare function resolveRequestImageTarget(model: DeepSeekCatalogModel, source: Pick<ImageAttachmentRef, 'width' | 'height'>): ImageRequestTarget;
|
|
31
45
|
/**
|
|
32
46
|
* Build the request-image pricing for one DeepSeek route from a validated
|
|
33
47
|
* connection snapshot. Uncatalogued and text-only models price every
|
|
34
48
|
* occurrence as its deterministic text substitution; image-capable models
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* this estimate; access paths resolve at pricing time, so a path that changes
|
|
41
|
-
* before the request only shifts the text price by its own length.
|
|
49
|
+
* price an offloaded occurrence as its placeholder text and a retained one by
|
|
50
|
+
* its projected request dimensions, with each occurrence's handle or
|
|
51
|
+
* placeholder text built through the same access resolution the serializer
|
|
52
|
+
* uses. Access paths resolve at pricing time, so a path that changes before
|
|
53
|
+
* the request only shifts the text price by its own length.
|
|
42
54
|
* @param connection - validated connection facts of the pricing resolution.
|
|
43
55
|
* @param model - exact model id named by the request header.
|
|
44
56
|
* @param resolveAccess - current execution-world access resolution shared with request serialization.
|
|
@@ -1,85 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* requests retain string user content; the image path resolves durable
|
|
4
|
-
* attachments into ordered file-id or inline parts. Tool-result images follow their
|
|
5
|
-
* string-only tool messages in a separate user message.
|
|
6
|
-
* @module dsh-llm-deepseek/serialize
|
|
7
|
-
*/
|
|
8
|
-
import type { ContentBlock, GenerateOptions, ImageAttachmentAccessResolver, Message } from '@deepseek-ai/dsh-llm';
|
|
1
|
+
/** Map system snapshots and conversation turns to Messages using the configured route capability. */
|
|
2
|
+
import type { GenerateOptions, ImageAttachmentAccessResolver, RequestMessage } from '@deepseek-ai/dsh-llm';
|
|
9
3
|
import type { ImageAttachmentRef, RequestImageAttachment } from '@deepseek-ai/dsh-attachment';
|
|
10
|
-
import type {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
kind: 'base64';
|
|
25
|
-
};
|
|
26
|
-
/** Dependencies required only when the request contains image input. */
|
|
27
|
-
export interface ImageSerializationOptions {
|
|
28
|
-
/** One representation used for every retained image in this request. */
|
|
29
|
-
representation: ImageRequestRepresentation;
|
|
30
|
-
/** Request versions prepared for the conservatively retained normalized attachments, keyed by attachment id. */
|
|
31
|
-
requestImages: ReadonlyMap<ImageAttachmentRef['attachmentId'], RequestImageAttachment>;
|
|
32
|
-
/** Resolve current tool access independently from deterministic request-image versions. */
|
|
33
|
-
resolveImageAccess?: ImageAttachmentAccessResolver;
|
|
34
|
-
/** Positive bound on accumulated represented image bytes. */
|
|
35
|
-
maxRequestImageBytes: number;
|
|
36
|
-
/** Maximum represented images in one request. */
|
|
37
|
-
maxImagesPerRequest?: number;
|
|
38
|
-
/** Represented-byte removal step applied after the request exceeds its byte bound. */
|
|
39
|
-
byteQuantum?: number;
|
|
40
|
-
/** Image-count removal step applied after the request exceeds its count bound. */
|
|
41
|
-
countQuantum?: number;
|
|
42
|
-
}
|
|
43
|
-
/** Durable message and image ordinal used in provider diagnostics. */
|
|
44
|
-
export interface ImageWireLocation {
|
|
45
|
-
message: number;
|
|
46
|
-
image: number;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Serialize the conversation. `tool-result` blocks become standalone
|
|
50
|
-
* `{role: 'tool'}` messages; the harness puts each tool result in its own
|
|
51
|
-
* user-role message, so a mixed user message contributes its text first and
|
|
52
|
-
* its tool results as separate wire messages after.
|
|
53
|
-
* @param messages - the harness conversation, in order.
|
|
54
|
-
* @returns the wire messages; order preserved, each tool result expanded into its own entry.
|
|
55
|
-
*/
|
|
56
|
-
export declare function serializeMessages(messages: Message[]): WireMessage[];
|
|
57
|
-
/**
|
|
58
|
-
* Serialize image-capable history after resolving durable attachments.
|
|
59
|
-
* Consecutive tool results keep string `tool` messages and share one following
|
|
60
|
-
* user message containing their images.
|
|
61
|
-
* @param messages - transient request history after request-size offloading.
|
|
62
|
-
* @param images - prepared request versions, one provider representation, and its budget.
|
|
63
|
-
* @returns ordered DeepSeek wire messages.
|
|
64
|
-
*/
|
|
65
|
-
export declare function serializeMessagesWithImages(messages: readonly Message[], images: ImageSerializationOptions): Promise<WireMessage[]>;
|
|
66
|
-
/**
|
|
67
|
-
* Build the full wire request. Always streaming (`stream: true`, usage
|
|
68
|
-
* reporting on); optional fields are omitted rather than sent as null, so
|
|
69
|
-
* provider defaults apply.
|
|
70
|
-
* @param options - the harness request (model, history, system, tools, sampling).
|
|
71
|
-
* @param defaults - adapter-level thinking defaults; undefined fields put nothing on the wire.
|
|
72
|
-
* @returns the chat-completions request body.
|
|
73
|
-
*/
|
|
74
|
-
export declare function serializeRequest(options: GenerateOptions, defaults?: RequestDefaults): WireRequest;
|
|
75
|
-
/**
|
|
76
|
-
* Build one image-capable request while keeping durable bytes out of session
|
|
77
|
-
* messages. Oversized oldest images become per-image text after their
|
|
78
|
-
* exact request-version byte lengths are known and before provider serialization.
|
|
79
|
-
* @param options - harness request containing image-capable user content.
|
|
80
|
-
* @param images - request versions, optional current access resolver, and request bounds.
|
|
81
|
-
* @param defaults - adapter-level thinking defaults.
|
|
82
|
-
* @returns the fully materialized DeepSeek request body.
|
|
4
|
+
import type { DeepSeekConnectionOptions as Connection } from './types.ts';
|
|
5
|
+
import type { DeepSeekFileId } from './file-id.ts';
|
|
6
|
+
import type { WireRequest } from './wire-types.ts';
|
|
7
|
+
/** Serialize one complete request using already prepared image bytes.
|
|
8
|
+
* User and tool-result content omits reasoning and tool-call blocks.
|
|
9
|
+
* Empty user messages are skipped; empty tool results retain their call ids.
|
|
10
|
+
* @param options - provider-neutral request.
|
|
11
|
+
* @param connection - validated defaults and thinking policy.
|
|
12
|
+
* @param history - image-projected history with complete system snapshots; durable messages remain unchanged.
|
|
13
|
+
* @param images - request versions for retained images.
|
|
14
|
+
* @param access - execution-world paths for image descriptions.
|
|
15
|
+
* @param onReplayDegrade - diagnostic for discarded native replay metadata.
|
|
16
|
+
* @param fileIds - resolved Files references; omission selects inline image bytes.
|
|
17
|
+
* @returns the Messages API JSON body.
|
|
83
18
|
*/
|
|
84
|
-
export declare function
|
|
19
|
+
export declare function serialize(options: GenerateOptions, connection: Connection, history: readonly RequestMessage[], images: ReadonlyMap<ImageAttachmentRef['attachmentId'], RequestImageAttachment>, access: ImageAttachmentAccessResolver, onReplayDegrade?: (reason: string) => void, fileIds?: ReadonlyMap<ImageAttachmentRef['attachmentId'], DeepSeekFileId>): WireRequest;
|
|
85
20
|
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* DeepSeek protocol: the literal `[DONE]` is yielded so the caller owns final
|
|
7
|
-
* flushing, and EOF before it raises {@link LlmError}. Framing is spec-strict:
|
|
8
|
-
* an event dispatches only on its blank-line terminator, so an unterminated
|
|
9
|
-
* tail at EOF is truncation, not a flushable payload.
|
|
10
|
-
*
|
|
11
|
-
* @module dsh-llm-deepseek/sse
|
|
1
|
+
/** SSE framing delegated to eventsource-parser; JSON errors remain provider failures. */
|
|
2
|
+
/** Decode complete SSE frames without treating an unterminated tail as an event.
|
|
3
|
+
* @param body - provider response bytes.
|
|
4
|
+
* @param activity - pulse the idle watchdog for events and heartbeat comments.
|
|
5
|
+
* @returns JSON events, including message_stop; the translator owns completion.
|
|
12
6
|
*/
|
|
13
|
-
|
|
14
|
-
export declare const DONE = "[DONE]";
|
|
15
|
-
/**
|
|
16
|
-
* Parse an SSE byte stream into data payloads. Yields `[DONE]` as the final
|
|
17
|
-
* value and returns; throws `LlmError('STREAM_CLOSED')` when the stream ends
|
|
18
|
-
* without it (truncated response — the model call cannot be trusted).
|
|
19
|
-
* @param stream - raw SSE bytes; reads may split anywhere, including mid-UTF-8 sequence.
|
|
20
|
-
* @param onComment - optional transport-activity callback; comments never enter the yielded payload stream.
|
|
21
|
-
* @returns each event's data payload in arrival order, the `[DONE]` sentinel last.
|
|
22
|
-
*/
|
|
23
|
-
export declare function parseSse(stream: ReadableStream<BufferSource>, onComment?: (comment: string) => void): AsyncGenerator<string>;
|
|
7
|
+
export declare function parseSse(body: ReadableStream<BufferSource>, activity: () => void): AsyncGenerator<Record<string, unknown>>;
|
|
24
8
|
//# sourceMappingURL=sse.d.ts.map
|
|
@@ -1,37 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* @param reason - the wire `finish_reason` string.
|
|
15
|
-
* @returns the mapped reason; unrecognized values (content_filter, …) become `{kind: 'error'}` with the uppercased value as `code`.
|
|
16
|
-
*/
|
|
17
|
-
export declare function mapFinishReason(reason: string): FinishReason;
|
|
18
|
-
/**
|
|
19
|
-
* Map wire usage fields. DeepSeek's `prompt_tokens` INCLUDES cache hits
|
|
20
|
-
* (`prompt_tokens = prompt_cache_hit_tokens + prompt_cache_miss_tokens`,
|
|
21
|
-
* api/create-chat-completion); the harness TokenUsage convention is
|
|
22
|
-
* DISJOINT counts, so cache reads are subtracted out of `inputTokens`.
|
|
23
|
-
* @param usage - wire usage from the finish chunk or the trailing usage-only chunk.
|
|
24
|
-
* @returns disjoint harness counts; an exact total is present only when the
|
|
25
|
-
* aggregate prompt/completion counters are valid and agree with any wire total.
|
|
26
|
-
*/
|
|
27
|
-
export declare function mapUsage(usage: WireUsage): TokenUsage;
|
|
28
|
-
/**
|
|
29
|
-
* Consume SSE data payloads (ending with `[DONE]`) and yield StreamChunks.
|
|
30
|
-
* Malformed JSON payloads abort the stream with `MALFORMED_RESPONSE`.
|
|
31
|
-
* @param payloads - SSE data payloads from {@link parseSse}, `[DONE]`-terminated.
|
|
32
|
-
* @returns deltas as they arrive; `block-end`s, `usage`, and `finish` are all deferred to the `[DONE]` sentinel.
|
|
33
|
-
* A `stop` (or absent) finish with no opened blocks is a degenerate provider completion and maps to an
|
|
34
|
-
* `EMPTY_RESPONSE` error finish instead of a successful empty message.
|
|
35
|
-
*/
|
|
36
|
-
export declare function translate(payloads: AsyncIterable<string>): AsyncGenerator<StreamChunk>;
|
|
1
|
+
/** Translate Messages events while preserving block order and cumulative usage. */
|
|
2
|
+
import type { StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
3
|
+
/** Decode a required string from provider JSON.
|
|
4
|
+
* @param value - provider field.
|
|
5
|
+
* @returns the validated string.
|
|
6
|
+
*/
|
|
7
|
+
export declare function string(value: unknown): string;
|
|
8
|
+
/** Translate decoded SSE data into the Harness stream protocol.
|
|
9
|
+
* @param events - framed, decoded provider events in arrival order.
|
|
10
|
+
* @param model - requested model id stored in durable replay state.
|
|
11
|
+
* @returns blocks, one final usage value, and exactly one terminal finish.
|
|
12
|
+
*/
|
|
13
|
+
export declare function translate(events: AsyncIterable<Record<string, unknown>>, model: string): AsyncGenerator<StreamChunk>;
|
|
37
14
|
//# sourceMappingURL=translate.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Normalize HTTP and in-band Messages errors into provider-neutral failures. */
|
|
2
|
+
import { LlmError } from '@deepseek-ai/dsh-llm';
|
|
3
|
+
/** Read only provider error fields used by bounded Files recovery.
|
|
4
|
+
* @param raw - decoded HTTP error response.
|
|
5
|
+
* @returns code, type, and message text, without unrelated response fields.
|
|
6
|
+
*/
|
|
7
|
+
export declare function providerErrorDetail(raw: unknown): string;
|
|
8
|
+
/** Classify a provider error without trusting arbitrary response fields.
|
|
9
|
+
* @param raw - decoded response or in-band error event.
|
|
10
|
+
* @param status - HTTP status when the error preceded streaming.
|
|
11
|
+
* @param headers - response headers for retry delay and request identity.
|
|
12
|
+
* @returns a stable error consumed by LlmRuntime and llm-retry.
|
|
13
|
+
*/
|
|
14
|
+
export declare function providerError(raw: unknown, status: number | undefined, headers?: Headers): LlmError;
|
|
15
|
+
//# sourceMappingURL=transport.d.ts.map
|