@toddzheng024/dscode-bundle 0.1.0

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.
Files changed (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/THIRD_PARTY_NOTICES.md +11 -0
  4. package/bin/apply_patch +4 -0
  5. package/bootstrap.mjs +21 -0
  6. package/cordis.patch.yml +756 -0
  7. package/package.json +327 -0
  8. package/plugins/auto-review/audit.mjs +20 -0
  9. package/plugins/auto-review/index.mjs +181 -0
  10. package/plugins/auto-review/policy.mjs +59 -0
  11. package/plugins/dscode/index.mjs +35 -0
  12. package/plugins/session-metrics/index.mjs +44 -0
  13. package/plugins/session-metrics/pricing.mjs +18 -0
  14. package/plugins/session-metrics/store.mjs +24 -0
  15. package/plugins/session-metrics/view.mjs +58 -0
  16. package/plugins/tui-tools/hooks.mjs +23 -0
  17. package/plugins/tui-tools/index.mjs +164 -0
  18. package/plugins/ultra/policy.mjs +11 -0
  19. package/presets/dscode/agent.cordis.yml +288 -0
  20. package/presets/dscode/preset.yml +3 -0
  21. package/vendor/bash/LICENSE +21 -0
  22. package/vendor/bash/index.js +449 -0
  23. package/vendor/bash/types/background.d.ts +19 -0
  24. package/vendor/bash/types/index.d.ts +22 -0
  25. package/vendor/bash/types/render.d.ts +38 -0
  26. package/vendor/deepseek/LICENSE +21 -0
  27. package/vendor/deepseek/index.js +2102 -0
  28. package/vendor/deepseek/types/adapter.d.ts +163 -0
  29. package/vendor/deepseek/types/file-id.d.ts +19 -0
  30. package/vendor/deepseek/types/file-store.d.ts +83 -0
  31. package/vendor/deepseek/types/files-api.d.ts +103 -0
  32. package/vendor/deepseek/types/image-tokens.d.ts +19 -0
  33. package/vendor/deepseek/types/index.d.ts +106 -0
  34. package/vendor/deepseek/types/request-pricing.d.ts +48 -0
  35. package/vendor/deepseek/types/serialize.d.ts +85 -0
  36. package/vendor/deepseek/types/sse.d.ts +24 -0
  37. package/vendor/deepseek/types/translate.d.ts +37 -0
  38. package/vendor/deepseek/types/types.d.ts +178 -0
  39. package/vendor/deepseek/types/upload-index.d.ts +68 -0
  40. package/vendor/persistent/LICENSE +21 -0
  41. package/vendor/persistent/index.js +386 -0
  42. package/vendor/persistent/types/index.d.ts +24 -0
  43. package/vendor/tui/LICENSE +21 -0
  44. package/vendor/tui/devtools-CdTl3MNy.mjs +3643 -0
  45. package/vendor/tui/index.mjs +39105 -0
  46. package/vendor/tui/invariant.mjs +21 -0
  47. package/vendor/tui/rolldown-runtime-CMFfr-1z.mjs +26 -0
  48. package/vendor/tui/startup.mjs +109 -0
  49. package/vendor/tui/theme-DCT8Y2xf.mjs +628 -0
  50. package/vendor/tui/types/app.d.ts +304 -0
  51. package/vendor/tui/types/approval.d.ts +59 -0
  52. package/vendor/tui/types/attachments.d.ts +52 -0
  53. package/vendor/tui/types/authorization-panel.d.ts +22 -0
  54. package/vendor/tui/types/authorization.d.ts +36 -0
  55. package/vendor/tui/types/commands.d.ts +52 -0
  56. package/vendor/tui/types/editor-keys.d.ts +105 -0
  57. package/vendor/tui/types/editor.d.ts +6 -0
  58. package/vendor/tui/types/fork.d.ts +8 -0
  59. package/vendor/tui/types/git-workflow.d.ts +32 -0
  60. package/vendor/tui/types/history.d.ts +97 -0
  61. package/vendor/tui/types/index.d.ts +124 -0
  62. package/vendor/tui/types/input-split.d.ts +54 -0
  63. package/vendor/tui/types/internals.d.ts +26 -0
  64. package/vendor/tui/types/invariant.d.ts +15 -0
  65. package/vendor/tui/types/kernel-panels.d.ts +167 -0
  66. package/vendor/tui/types/keyboard.d.ts +80 -0
  67. package/vendor/tui/types/mentions.d.ts +81 -0
  68. package/vendor/tui/types/model-capabilities.d.ts +82 -0
  69. package/vendor/tui/types/models.d.ts +119 -0
  70. package/vendor/tui/types/permissions.d.ts +27 -0
  71. package/vendor/tui/types/plugin-inventory.d.ts +11 -0
  72. package/vendor/tui/types/presets.d.ts +22 -0
  73. package/vendor/tui/types/provider-settings.d.ts +239 -0
  74. package/vendor/tui/types/questions.d.ts +54 -0
  75. package/vendor/tui/types/render/animations.d.ts +265 -0
  76. package/vendor/tui/types/render/editor.d.ts +162 -0
  77. package/vendor/tui/types/render/export.d.ts +9 -0
  78. package/vendor/tui/types/render/fuzzy.d.ts +21 -0
  79. package/vendor/tui/types/render/inspector.d.ts +36 -0
  80. package/vendor/tui/types/render/lines.d.ts +66 -0
  81. package/vendor/tui/types/render/markdown.d.ts +29 -0
  82. package/vendor/tui/types/render/projection.d.ts +461 -0
  83. package/vendor/tui/types/render/status.d.ts +196 -0
  84. package/vendor/tui/types/render/text.d.ts +58 -0
  85. package/vendor/tui/types/render/tool-detail.d.ts +94 -0
  86. package/vendor/tui/types/render/tool-preview.d.ts +28 -0
  87. package/vendor/tui/types/render/width.d.ts +29 -0
  88. package/vendor/tui/types/session-directory.d.ts +173 -0
  89. package/vendor/tui/types/session-switch.d.ts +17 -0
  90. package/vendor/tui/types/settings-file.d.ts +41 -0
  91. package/vendor/tui/types/skills.d.ts +47 -0
  92. package/vendor/tui/types/startup.d.ts +65 -0
  93. package/vendor/tui/types/store.d.ts +58 -0
  94. package/vendor/tui/types/subagents.d.ts +70 -0
  95. package/vendor/tui/types/theme-panel.d.ts +24 -0
  96. package/vendor/tui/types/theme.d.ts +215 -0
  97. package/vendor/tui/types/version.d.ts +18 -0
  98. package/vendor/tui/types/whale-glyph.d.ts +6 -0
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Translate DeepSeek SSE payloads with one stateful harness block per content, reasoning, or tool
3
+ * call index. An empty initial reasoning delta does not open a block. Finish reason and the latest
4
+ * usage are deferred until `[DONE]`, covering both finish-attached and trailing usage-only shapes
5
+ * while ensuring no chunk follows `finish`.
6
+ *
7
+ * Translate DeepSeek wire chunks into the harness `StreamChunk` protocol.
8
+ * @module dsh-llm-deepseek/translate
9
+ */
10
+ import type { FinishReason, StreamChunk, TokenUsage } from '@deepseek-ai/dsh-llm';
11
+ import type { WireUsage } from './types.ts';
12
+ /**
13
+ * Map the wire finish_reason vocabulary to the harness FinishReason.
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>;
37
+ //# sourceMappingURL=translate.d.ts.map
@@ -0,0 +1,178 @@
1
+ /**
2
+ * DeepSeek chat-completions wire format (OpenAI-compatible). Types only.
3
+ *
4
+ * Source of truth: the official API docs at
5
+ * `~/repos/deepsuite-docs/apps/docs/docs` (api/create-chat-completion,
6
+ * guides/thinking_mode.mdx, guides/tool_calls.md), cross-checked against
7
+ * live streams from the internal endpoint (2026-06).
8
+ *
9
+ * @module dsh-llm-deepseek/types
10
+ */
11
+ /** Request body for `POST {baseURL}/chat/completions`. */
12
+ export interface WireRequest {
13
+ model: string;
14
+ messages: WireMessage[];
15
+ stream: true;
16
+ stream_options: {
17
+ include_usage: true;
18
+ };
19
+ /** Thinking-mode toggle (top level, NOT inside extra_body on the wire). */
20
+ thinking?: {
21
+ type: 'enabled' | 'disabled';
22
+ };
23
+ /** Thinking effort (official levels). */
24
+ reasoning_effort?: 'low' | 'high' | 'max';
25
+ tools?: WireTool[];
26
+ temperature?: number;
27
+ max_tokens?: number;
28
+ /**
29
+ * Stop sequences (OpenAI `stop`): generation halts as soon as the model
30
+ * produces any one of these strings. Mapped from `GenerateOptions.stop`.
31
+ */
32
+ stop?: string[];
33
+ }
34
+ /** System-role message: a single string of instructions. */
35
+ export interface WireSystemMessage {
36
+ role: 'system';
37
+ content: string;
38
+ }
39
+ /** Text part inside a multimodal user message. */
40
+ export interface WireTextContentPart {
41
+ type: 'text';
42
+ text: string;
43
+ }
44
+ /** Files API reference inside a multimodal user message. */
45
+ export interface WireFileContentPart {
46
+ type: 'file';
47
+ file_id: string;
48
+ }
49
+ /** Inline base64 data URL inside a multimodal user message. */
50
+ export interface WireImageUrlContentPart {
51
+ type: 'image_url';
52
+ image_url: {
53
+ url: string;
54
+ };
55
+ }
56
+ /** One image representation accepted by a multimodal user message. */
57
+ export type WireImageContentPart = WireFileContentPart | WireImageUrlContentPart;
58
+ /** Ordered input part accepted by a multimodal user message. */
59
+ export type WireUserContentPart = WireTextContentPart | WireImageContentPart;
60
+ /** User-role message: text-only string or ordered multimodal input. */
61
+ export interface WireUserMessage {
62
+ role: 'user';
63
+ content: string | WireUserContentPart[];
64
+ }
65
+ /** Tool-role message: the result of one tool call, keyed by its call id. */
66
+ export interface WireToolMessage {
67
+ role: 'tool';
68
+ tool_call_id: string;
69
+ content: string;
70
+ }
71
+ /** One entry of the request `messages` array, discriminated on `role`. */
72
+ export type WireMessage = WireSystemMessage | WireUserMessage | WireAssistantMessage | WireToolMessage;
73
+ /**
74
+ * Assistant-role history message. The harness replays `content: ""` (never
75
+ * null) on tool-call-only turns — some gateways reject null — and sends null
76
+ * only when the turn carried neither text nor tool calls.
77
+ */
78
+ export interface WireAssistantMessage {
79
+ role: 'assistant';
80
+ content: string | null;
81
+ /**
82
+ * CoT passback, present on every turn whose assistant content carried
83
+ * reasoning. REQUIRED on tool-call turns in thinking mode (see
84
+ * guides/thinking_mode.mdx § Tool Calls); DeepSeek ignores it elsewhere,
85
+ * while a gateway re-encoding for another vendor recovers that turn's
86
+ * thinking signature by hashing it.
87
+ */
88
+ reasoning_content?: string;
89
+ tool_calls?: WireToolCall[];
90
+ }
91
+ /** A completed tool call replayed on an assistant history message; `arguments` is the raw JSON string. */
92
+ export interface WireToolCall {
93
+ id: string;
94
+ type: 'function';
95
+ function: {
96
+ name: string;
97
+ arguments: string;
98
+ };
99
+ }
100
+ /** One entry of the request `tools` array; `parameters` is a JSON Schema object. */
101
+ export interface WireTool {
102
+ type: 'function';
103
+ function: {
104
+ name: string;
105
+ description: string;
106
+ parameters: Record<string, unknown>;
107
+ };
108
+ }
109
+ /** One parsed SSE `data:` payload (a chat.completion.chunk). */
110
+ export interface WireChunk {
111
+ choices?: WireChoice[];
112
+ /** Arrives attached to the finish chunk and/or as a trailing usage-only chunk. */
113
+ usage?: WireUsage | null;
114
+ }
115
+ /** One streamed choice (requests always ask for a single one); `finish_reason` is non-null only on its terminal chunk. */
116
+ export interface WireChoice {
117
+ delta?: WireDelta;
118
+ finish_reason?: string | null;
119
+ }
120
+ /** The incremental content of one streamed choice; any subset of fields may be present per chunk. */
121
+ export interface WireDelta {
122
+ role?: string;
123
+ /** Visible text. Null/empty on reasoning/tool-call chunks. */
124
+ content?: string | null;
125
+ /**
126
+ * Thinking-mode CoT. The FIRST chunk carries an empty string (must not
127
+ * open a reasoning block); absent entirely in non-thinking mode.
128
+ */
129
+ reasoning_content?: string | null;
130
+ tool_calls?: WireToolCallDelta[];
131
+ }
132
+ /** A streamed fragment of one tool call; fragments sharing an `index` concatenate into one call. */
133
+ export interface WireToolCallDelta {
134
+ /** Disambiguates parallel tool calls; stable across a call's deltas. */
135
+ index: number;
136
+ /**
137
+ * Carried by the first delta of each call. Gateways observed in the wild
138
+ * repeat it on continuation deltas as `''` or `null`; both mean "unchanged".
139
+ */
140
+ id?: string | null;
141
+ type?: 'function';
142
+ function?: {
143
+ /** Carried by the first delta of each call, with the same `''`/`null` repetition as {@link WireToolCallDelta.id}. */
144
+ name?: string | null;
145
+ /** Argument JSON fragment (concatenate across deltas). */
146
+ arguments?: string | null;
147
+ };
148
+ }
149
+ /**
150
+ * Wire token accounting. `prompt_tokens` INCLUDES cache hits (it equals
151
+ * `prompt_cache_hit_tokens + prompt_cache_miss_tokens`); `mapUsage` subtracts
152
+ * them to keep the harness convention of disjoint counts.
153
+ * `prompt_tokens_details.cached_tokens` is the OpenAI-compat spelling of the
154
+ * hit count.
155
+ */
156
+ export interface WireUsage {
157
+ prompt_tokens: number;
158
+ completion_tokens: number;
159
+ /** Provider-reported aggregate across prompt and completion tokens. */
160
+ total_tokens?: number;
161
+ prompt_cache_hit_tokens?: number;
162
+ prompt_cache_miss_tokens?: number;
163
+ prompt_tokens_details?: {
164
+ cached_tokens?: number;
165
+ };
166
+ completion_tokens_details?: {
167
+ reasoning_tokens?: number;
168
+ };
169
+ }
170
+ /** Non-2xx error body. */
171
+ export interface WireError {
172
+ error?: {
173
+ message?: string;
174
+ type?: string;
175
+ code?: string;
176
+ };
177
+ }
178
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,68 @@
1
+ /** Durable DeepSeek attachment-to-file-id index. @module dsh-llm-deepseek/upload-index */
2
+ import type { AttachmentId, ImageVariantId as ImageVariantIdType } from '@deepseek-ai/dsh-attachment';
3
+ import type { DeepSeekFileId as DeepSeekFileIdType, DeepSeekFileScope as DeepSeekFileScopeType } from './file-id.ts';
4
+ /** One durable remote upload mapping. Unix times are milliseconds. */
5
+ export interface DeepSeekUploadRecord {
6
+ scope: DeepSeekFileScopeType;
7
+ /** Provider-independent normalized attachment from which the uploaded request version was derived. */
8
+ attachmentId: AttachmentId;
9
+ /** Complete request transformation identity, including route budgets and encoder parameters. */
10
+ variantId: ImageVariantIdType;
11
+ fileId: DeepSeekFileIdType;
12
+ bytes: number;
13
+ createdAt: number;
14
+ expiresAt: number;
15
+ }
16
+ /** Candidate commit outcome when another process already published a reusable upload. */
17
+ export interface UploadIndexCommit {
18
+ record: DeepSeekUploadRecord;
19
+ accepted: boolean;
20
+ }
21
+ /**
22
+ * Derive a non-secret stable index namespace without persisting or logging the API key.
23
+ * @param baseURL - normalized provider endpoint namespace.
24
+ * @param apiKey - resolved credential used only as hash input.
25
+ * @returns branded SHA-256 namespace digest.
26
+ */
27
+ export declare function deepSeekFileScope(baseURL: string, apiKey: string): DeepSeekFileScopeType;
28
+ /** Atomic local index shared by every DeepSeek session in this DSH home. */
29
+ export declare class DeepSeekUploadIndex {
30
+ /** Absolute owner-private JSON index path. */
31
+ readonly path: string;
32
+ /**
33
+ * @param path - explicit test path; omission uses `DSH_HOME/llm-deepseek/files-v3.json`.
34
+ */
35
+ constructor(path?: string);
36
+ private load;
37
+ private save;
38
+ /**
39
+ * Read one reusable mapping.
40
+ * @param scope - endpoint/API-key namespace.
41
+ * @param variantId - complete request-image transformation identity.
42
+ * @param now - current Unix time in milliseconds.
43
+ * @param refreshMarginMs - remaining lifetime below which a mapping is not reused.
44
+ * @returns the mapping when it has enough lifetime remaining.
45
+ */
46
+ get(scope: DeepSeekFileScopeType, variantId: ImageVariantIdType, now: number, refreshMarginMs: number): Promise<DeepSeekUploadRecord | undefined>;
47
+ /**
48
+ * Publish a completed upload unless another process already published a reusable mapping.
49
+ * @param candidate - completed remote upload.
50
+ * @param now - current Unix time in milliseconds.
51
+ * @param refreshMarginMs - minimum reusable remaining lifetime.
52
+ * @returns the winning record and whether the candidate entered the index.
53
+ */
54
+ commit(candidate: DeepSeekUploadRecord, now: number, refreshMarginMs: number): Promise<UploadIndexCommit>;
55
+ /**
56
+ * Remove one exact mapping without deleting a concurrently installed successor.
57
+ * @param scope - endpoint/API-key namespace.
58
+ * @param variantId - complete request-image transformation identity.
59
+ * @param fileId - exact remote generation being invalidated.
60
+ */
61
+ remove(scope: DeepSeekFileScopeType, variantId: ImageVariantIdType, fileId: DeepSeekFileIdType): Promise<void>;
62
+ /**
63
+ * Remove every local mapping for one remote namespace.
64
+ * @param scope - endpoint/API-key namespace.
65
+ */
66
+ clear(scope: DeepSeekFileScopeType): Promise<void>;
67
+ }
68
+ //# sourceMappingURL=upload-index.d.ts.map
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.