@chatcode/chatcode-cli 3.0.4 → 3.0.5-rc.2

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 (148) hide show
  1. package/README.i18n.yaml +6 -6
  2. package/README.md +10 -4
  3. package/README.zh.md +10 -4
  4. package/lib/bin.js +23 -9
  5. package/lib/{command-errors-Ca64Lgba.js → command-errors-CsRCh0gk.js} +12 -12
  6. package/lib/{command-trees-CVc4Xu_z.js → command-trees-CD_43rxX.js} +2 -2
  7. package/lib/{component-identity-6aEut5Yt.js → component-identity-DGA2-TeB.js} +3 -3
  8. package/lib/{dump-config-ZzrfvtnX.js → dump-config-D8kXfdTs.js} +1 -1
  9. package/lib/dump-config-DuCc-QB7.js +2 -0
  10. package/lib/{dump-config-schema-BlO-eZ-J.js → dump-config-schema-CtZbroi6.js} +2 -2
  11. package/lib/{extension-events-C7MUpqVE.js → extension-events-D0BjYRqT.js} +21 -21
  12. package/lib/{host-access-CLbyAGT5.js → host-access-DLJjuR07.js} +1 -1
  13. package/lib/{keymap-82JwLLHe.js → keymap-C4cs2IBN.js} +2 -2
  14. package/lib/{plugin-BlQlWIR5.js → plugin-CGtTByud.js} +801 -456
  15. package/lib/{plugin-BZdazFXS.js → plugin-CYw-MBRn.js} +1 -1
  16. package/lib/{profile-boot-B0aEEQIR.js → profile-boot-CffsubnV.js} +7 -7
  17. package/lib/profile-boot.js +1 -1
  18. package/lib/{scenes-BNS0ZFyQ.js → scenes-CbAGK5Uy.js} +3 -3
  19. package/lib/{settings-sections-CXH24cu5.js → settings-sections-DYKDa04e.js} +3 -3
  20. package/lib/{statusBarSettings-BAMzn8fX.js → statusBarSettings-T1m8xad4.js} +3 -3
  21. package/lib/{themes-DXUIvP7m.js → themes-BY2ui1Dv.js} +12 -12
  22. package/lib/tui-compat-command-trees.js +1 -1
  23. package/lib/tui-compat-extensions.js +3 -3
  24. package/lib/tui-compat-plugin-host.js +5 -5
  25. package/lib/tui-compat-scenes.js +1 -1
  26. package/lib/tui-compat-settings-sections.js +1 -1
  27. package/lib/tui-compat-working-activity.js +1 -1
  28. package/lib/tui-compat-workspaces.js +1 -1
  29. package/lib/tui-compat.js +7 -7
  30. package/lib/types/bin.d.ts +9 -0
  31. package/lib/types/tui-compat.d.ts +1 -1
  32. package/lib/types/web-instance-process.d.ts +20 -0
  33. package/lib/{web-instance-DbP7IHPv.js → web-instance-D_Ppi2Zo.js} +176 -14
  34. package/lib/{web-instance-B0jec7cq.js → web-instance-amvCJWnq.js} +1 -1
  35. package/lib/{workspaces-CUJXNU5W.js → workspaces-D5VKbESy.js} +2 -2
  36. package/package.json +30 -31
  37. package/runtime/manifest.json +2 -2
  38. package/runtime/node_modules/@deepseek-ai/dsh-agent-default-model/lib/index.js +7 -3
  39. package/runtime/node_modules/@deepseek-ai/dsh-agent-instructions/lib/index.js +169 -11
  40. package/runtime/node_modules/@deepseek-ai/dsh-agent-instructions/lib/types/files.d.ts +25 -0
  41. package/runtime/node_modules/@deepseek-ai/dsh-agent-instructions/lib/types/rules.d.ts +25 -0
  42. package/runtime/node_modules/@deepseek-ai/dsh-agent-instructions/package.json +5 -2
  43. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/client.js +11 -3
  44. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/contract/snapshot.d.ts +1 -0
  45. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/assistant-stream.d.ts +2 -0
  46. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/assistant-stream.js +4 -0
  47. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/session.js +10 -3
  48. package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/index.js +32 -11
  49. package/runtime/node_modules/@deepseek-ai/dsh-atomic-write/lib/index.js +62 -11
  50. package/runtime/node_modules/@deepseek-ai/dsh-atomic-write/lib/types/darwin-lock.d.ts +7 -0
  51. package/runtime/node_modules/@deepseek-ai/dsh-atomic-write/lib/types/index.d.ts +7 -2
  52. package/runtime/node_modules/@deepseek-ai/dsh-atomic-write/lib/types/linux-lock.d.ts +1 -1
  53. package/runtime/node_modules/@deepseek-ai/dsh-client-locale/lib/client.js +7 -7
  54. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/lib/client.js +62 -62
  55. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-approval/lib/client.js +10 -10
  56. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-attachment/lib/client.js +49 -49
  57. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/client.js +204 -204
  58. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-commands/lib/client.js +16 -16
  59. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +159 -157
  60. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/service.d.ts +4 -2
  61. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-cordis/lib/client.js +74 -74
  62. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/client.js +129 -123
  63. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/index.js +19 -14
  64. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/types/changes.d.ts +2 -2
  65. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/types/client/Deliverables.d.ts +1 -2
  66. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/types/client/locales.d.ts +2 -1
  67. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/types/client/present-open.d.ts +1 -1
  68. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-deliverables/package.json +2 -4
  69. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/lib/client.js +39 -39
  70. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-goal/lib/client.js +16 -16
  71. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/lib/client.js +23 -23
  72. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-jobs/lib/client.js +37 -37
  73. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-layout/lib/client.js +9 -9
  74. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/lib/client.js +12 -12
  75. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/client.js +119 -32
  76. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/types/client/catalog.d.ts +13 -0
  77. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/types/client/directory.d.ts +2 -0
  78. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/types/client/effort-preferences.d.ts +20 -0
  79. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/types/client/slots.d.ts +2 -1
  80. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/lib/client.js +8 -8
  81. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/lib/client.js +18 -18
  82. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-plan/lib/client.js +22 -22
  83. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/lib/client.js +128 -128
  84. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-schedule/lib/client.js +182 -182
  85. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/client.js +130 -130
  86. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +50 -50
  87. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/client.js +88 -88
  88. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/lib/client.js +36 -36
  89. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/client.js +13 -13
  90. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-subagent/lib/client.js +27 -27
  91. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-shortcuts/lib/client.js +42 -42
  92. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +44 -44
  93. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-browser/lib/client.js +25 -25
  94. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/client.excel.js +9 -9
  95. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/client.js +70 -70
  96. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/client.pdf.js +9 -9
  97. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/lib/client.js +18 -18
  98. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/lib/client.js +26 -26
  99. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-terminal/lib/client.js +16 -16
  100. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-terminal/lib/client.terminal.js +11 -11
  101. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-skill/lib/client.js +20 -20
  102. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-subagent/lib/client.js +37 -37
  103. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/client.js +27 -27
  104. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-tool/lib/client.js +95 -95
  105. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-trajectory/lib/client.js +197 -197
  106. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-user-questions/lib/client.js +49 -49
  107. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/lib/client.js +24 -24
  108. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/client.js +656 -152
  109. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/ArchivedSessions.d.ts +9 -2
  110. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/locales.d.ts +46 -0
  111. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/session-actions/DeleteSession.d.ts +9 -10
  112. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/session-actions/deletion.d.ts +57 -0
  113. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/package.json +2 -0
  114. package/runtime/node_modules/@deepseek-ai/dsh-experimental-client-ui-agent-team/lib/client.js +32 -32
  115. package/runtime/node_modules/@deepseek-ai/dsh-experimental-client-ui-voice-input/lib/client.js +24 -24
  116. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/index.js +899 -453
  117. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/adapter.d.ts +4 -20
  118. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/chat-completions/adapter.d.ts +8 -0
  119. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/chat-completions/serialize.d.ts +10 -0
  120. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/chat-completions/sse.d.ts +24 -0
  121. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/chat-completions/translate.d.ts +37 -0
  122. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/chat-completions/types.d.ts +159 -0
  123. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/file-store.d.ts +3 -0
  124. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/files-api.d.ts +4 -0
  125. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/index.d.ts +1 -0
  126. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocol-adapter.d.ts +41 -0
  127. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocol.d.ts +35 -0
  128. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/transport.d.ts +2 -1
  129. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/types.d.ts +2 -2
  130. package/runtime/node_modules/@deepseek-ai/dsh-mcp-client/lib/index.js +5 -4
  131. package/runtime/node_modules/@deepseek-ai/dsh-session-log-export/lib/client.js +4 -4
  132. package/runtime/node_modules/@deepseek-ai/dsh-session-log-export/lib/index.js +1 -1
  133. package/runtime/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/lib/index.js +2 -2
  134. package/runtime/node_modules/@deepseek-ai/dsh-skill-filesystem/lib/index.js +33 -9
  135. package/runtime/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/api-catalog.js +12 -10
  136. package/runtime/node_modules/@deepseek-ai/dsh-workspace-changes/lib/index.js +208 -39
  137. package/runtime/node_modules/@deepseek-ai/dsh-workspace-changes/lib/types/archive.d.ts +47 -0
  138. package/runtime/node_modules/@deepseek-ai/dsh-workspace-changes/lib/types/archive.js +129 -0
  139. package/runtime/node_modules/@deepseek-ai/dsh-workspace-changes/lib/types/index.d.ts +2 -0
  140. package/runtime/node_modules/@deepseek-ai/dsh-workspace-changes/lib/types/index.js +31 -8
  141. package/runtime/node_modules/@deepseek-ai/dsh-workspace-changes/lib/types/recorder.d.ts +7 -2
  142. package/runtime/node_modules/@deepseek-ai/dsh-workspace-changes/lib/types/recorder.js +35 -19
  143. package/runtime/node_modules/@deepseek-ai/dsh-workspace-changes/lib/types/types.d.ts +11 -10
  144. package/runtime/node_modules/@deepseek-ai/dsh-workspace-changes/package.json +1 -0
  145. package/scripts/link-embedded-runtime.mjs +1 -1
  146. package/lib/dump-config-CDixiJNt.js +0 -2
  147. package/lib/{home-migration-BjDmRwBB.js → home-migration-lRjtl2fP.js} +1 -1
  148. package/lib/{startup-diagnostics-C_hRCp-q.js → startup-diagnostics-4mLHYTFc.js} +1 -1
@@ -1,24 +1,8 @@
1
- /** Direct Messages transport with one cancellable lifecycle per model request. */
2
- import { LlmAdapter } from '@deepseek-ai/dsh-llm';
3
- import type { GenerateOptions, PreparedAdapterCall, StreamChunk } from '@deepseek-ai/dsh-llm';
4
- import type { DeepSeekAdapterOptions, DeepSeekConnectionOptions as Connection } from './types.ts';
1
+ import type { DeepSeekAdapterOptions, DeepSeekConnectionOptions } from './types.ts';
2
+ import { DeepSeekProtocolAdapter } from './protocol-adapter.ts';
5
3
  /** DeepSeek provider using Messages content and native thinking replay. */
6
- export declare class DeepSeekAdapter<C extends Connection = Connection> extends LlmAdapter {
7
- private readonly dependencies;
8
- private readonly files;
9
- private readonly imageAccess;
4
+ export declare class DeepSeekAdapter<C extends DeepSeekConnectionOptions = DeepSeekConnectionOptions> extends DeepSeekProtocolAdapter<C> {
5
+ /** @param dependencies - request-local configuration, credentials, and Host services. */
10
6
  constructor(dependencies: DeepSeekAdapterOptions<C>);
11
- providerInfo(provider: string): {
12
- id: string;
13
- name: string;
14
- };
15
- providerRetryPolicy(_provider: string): import("@deepseek-ai/dsh-llm").ResolvedRetryPolicy;
16
- listModels(provider: string): Promise<never[] | import("@deepseek-ai/dsh-llm").LlmModelInfo[]>;
17
- resolveModel(provider: string, model: string, _signal?: AbortSignal): Promise<import("@deepseek-ai/dsh-llm").LlmResolvedModelInfo>;
18
- imageRequestPricing(_provider: string, model: string): import("@deepseek-ai/dsh-llm").LlmImageRequestPricing;
19
- prepareCall(provider: string, model: string, _signal?: AbortSignal): Promise<PreparedAdapterCall>;
20
- stream(options: GenerateOptions): AsyncIterable<StreamChunk>;
21
- private generate;
22
- private request;
23
7
  }
24
8
  //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { DeepSeekProtocolAdapter } from '../protocol-adapter.ts';
2
+ import type { DeepSeekAdapterOptions, DeepSeekConnectionOptions } from '../types.ts';
3
+ /** DeepSeek OpenAI-compatible transport with raw reasoning replay and Files recovery. */
4
+ export declare class DeepSeekChatCompletionsAdapter<C extends DeepSeekConnectionOptions = DeepSeekConnectionOptions> extends DeepSeekProtocolAdapter<C> {
5
+ /** @param dependencies - explicit API root, request authentication, defaults, and Host services. */
6
+ constructor(dependencies: DeepSeekAdapterOptions<C>);
7
+ }
8
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { serialize as serializeMessages } from '../serialize.ts';
2
+ import type { WireRequest } from './types.ts';
3
+ /**
4
+ * Serialize prepared history without rewriting durable reasoning or tool arguments.
5
+ * Tool-result images follow their complete consecutive tool-result group in a user message.
6
+ * @param args - request, validated connection, prepared history/images, access resolver, replay reporter, and Files ids.
7
+ * @returns a streaming Chat Completions request with usage enabled.
8
+ */
9
+ export declare function serialize(...args: Parameters<typeof serializeMessages>): WireRequest;
10
+ //# sourceMappingURL=serialize.d.ts.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Decode an SSE byte stream into event `data` payloads. Framing — chunk
3
+ * reassembly, UTF-8/CRLF/BOM handling, comment and non-data field skipping,
4
+ * multi-`data:` joining — is `eventsource-parser`'s. Comments are reported
5
+ * only through an optional transport-activity callback. This module keeps the
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
12
+ */
13
+ /** The terminal payload DeepSeek (and OpenAI) send after the last chunk. */
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>;
24
+ //# sourceMappingURL=sse.d.ts.map
@@ -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,159 @@
1
+ /** DeepSeek Chat Completions request and streaming response types. */
2
+ /** Request body for `POST {baseURL}/chat/completions`. */
3
+ export type WireRequest = {
4
+ model: string;
5
+ messages: WireMessage[];
6
+ stream: true;
7
+ stream_options: {
8
+ include_usage: true;
9
+ };
10
+ /** Thinking-mode toggle (top level, NOT inside extra_body on the wire). */
11
+ thinking?: {
12
+ type: 'enabled' | 'disabled';
13
+ };
14
+ /** Thinking effort (official levels). */
15
+ reasoning_effort?: 'low' | 'high' | 'max';
16
+ tools?: WireTool[];
17
+ temperature?: number;
18
+ max_tokens?: number;
19
+ /**
20
+ * Stop sequences (OpenAI `stop`): generation halts as soon as the model
21
+ * produces any one of these strings. Mapped from `GenerateOptions.stop`.
22
+ */
23
+ stop?: string[];
24
+ };
25
+ /** System-role message: a single string of instructions. */
26
+ export type WireSystemMessage = {
27
+ role: 'system';
28
+ content: string;
29
+ };
30
+ /** Text part inside a multimodal user message. */
31
+ export type WireTextContentPart = {
32
+ type: 'text';
33
+ text: string;
34
+ };
35
+ /** Files API reference inside a multimodal user message. */
36
+ export type WireFileContentPart = {
37
+ type: 'file';
38
+ file_id: string;
39
+ };
40
+ /** Inline base64 data URL inside a multimodal user message. */
41
+ export type WireImageUrlContentPart = {
42
+ type: 'image_url';
43
+ image_url: {
44
+ url: string;
45
+ };
46
+ };
47
+ /** One image representation accepted by a multimodal user message. */
48
+ export type WireImageContentPart = WireFileContentPart | WireImageUrlContentPart;
49
+ /** Ordered input part accepted by a multimodal user message. */
50
+ export type WireUserContentPart = WireTextContentPart | WireImageContentPart;
51
+ /** User-role message: text-only string or ordered multimodal input. */
52
+ export type WireUserMessage = {
53
+ role: 'user';
54
+ content: string | WireUserContentPart[];
55
+ };
56
+ /** Tool-role message: the result of one tool call, keyed by its call id. */
57
+ export type WireToolMessage = {
58
+ role: 'tool';
59
+ tool_call_id: string;
60
+ content: string;
61
+ };
62
+ /** One entry of the request `messages` array, discriminated on `role`. */
63
+ export type WireMessage = WireSystemMessage | WireUserMessage | WireAssistantMessage | WireToolMessage;
64
+ /** Assistant history retains empty-string content on tool-only and reasoning-only turns. */
65
+ export type WireAssistantMessage = {
66
+ role: 'assistant';
67
+ content: string;
68
+ /** Exact reasoning text replayed on every reasoning-carrying assistant turn. */
69
+ reasoning_content?: string;
70
+ tool_calls?: WireToolCall[];
71
+ };
72
+ /** A completed tool call replayed on an assistant history message; `arguments` is the raw JSON string. */
73
+ export type WireToolCall = {
74
+ id: string;
75
+ type: 'function';
76
+ function: {
77
+ name: string;
78
+ arguments: string;
79
+ };
80
+ };
81
+ /** One entry of the request `tools` array; `parameters` is a JSON Schema object. */
82
+ export type WireTool = {
83
+ type: 'function';
84
+ function: {
85
+ name: string;
86
+ description: string;
87
+ parameters: Record<string, unknown>;
88
+ };
89
+ };
90
+ /** One parsed SSE `data:` payload (a chat.completion.chunk). */
91
+ export type WireChunk = {
92
+ choices?: WireChoice[];
93
+ /** Arrives attached to the finish chunk and/or as a trailing usage-only chunk. */
94
+ usage?: WireUsage | null;
95
+ };
96
+ /** One streamed choice (requests always ask for a single one); `finish_reason` is non-null only on its terminal chunk. */
97
+ export type WireChoice = {
98
+ delta?: WireDelta;
99
+ finish_reason?: string | null;
100
+ };
101
+ /** The incremental content of one streamed choice; any subset of fields may be present per chunk. */
102
+ export type WireDelta = {
103
+ role?: string;
104
+ /** Visible text. Null/empty on reasoning/tool-call chunks. */
105
+ content?: string | null;
106
+ /**
107
+ * Thinking-mode CoT. The FIRST chunk carries an empty string (must not
108
+ * open a reasoning block); absent entirely in non-thinking mode.
109
+ */
110
+ reasoning_content?: string | null;
111
+ tool_calls?: WireToolCallDelta[];
112
+ };
113
+ /** A streamed fragment of one tool call; fragments sharing an `index` concatenate into one call. */
114
+ export type WireToolCallDelta = {
115
+ /** Disambiguates parallel tool calls; stable across a call's deltas. */
116
+ index: number;
117
+ /**
118
+ * Carried by the first delta of each call. Gateways observed in the wild
119
+ * repeat it on continuation deltas as `''` or `null`; both mean "unchanged".
120
+ */
121
+ id?: string | null;
122
+ type?: 'function';
123
+ function?: {
124
+ /** Carried by the first delta of each call, with the same `''`/`null` repetition as {@link WireToolCallDelta.id}. */
125
+ name?: string | null;
126
+ /** Argument JSON fragment (concatenate across deltas). */
127
+ arguments?: string | null;
128
+ };
129
+ };
130
+ /**
131
+ * Wire token accounting. `prompt_tokens` INCLUDES cache hits (it equals
132
+ * `prompt_cache_hit_tokens + prompt_cache_miss_tokens`); `mapUsage` subtracts
133
+ * them to keep the harness convention of disjoint counts.
134
+ * `prompt_tokens_details.cached_tokens` is the OpenAI-compat spelling of the
135
+ * hit count.
136
+ */
137
+ export type WireUsage = {
138
+ prompt_tokens: number;
139
+ completion_tokens: number;
140
+ /** Provider-reported aggregate across prompt and completion tokens. */
141
+ total_tokens?: number;
142
+ prompt_cache_hit_tokens?: number;
143
+ prompt_cache_miss_tokens?: number;
144
+ prompt_tokens_details?: {
145
+ cached_tokens?: number;
146
+ };
147
+ completion_tokens_details?: {
148
+ reasoning_tokens?: number;
149
+ };
150
+ };
151
+ /** Non-2xx error body. */
152
+ export type WireError = {
153
+ error?: {
154
+ message?: string;
155
+ type?: string;
156
+ code?: string;
157
+ };
158
+ };
159
+ //# sourceMappingURL=types.d.ts.map
@@ -23,12 +23,15 @@ export interface DeepSeekFileReference {
23
23
  uploaded: boolean;
24
24
  }
25
25
  interface FileStoreOptions {
26
+ /** Files dialect; omission retains the existing Messages namespace. */
27
+ protocol?: 'messages' | 'chat-completions';
26
28
  index?: DeepSeekUploadIndex;
27
29
  now?: () => number;
28
30
  fetch?: typeof fetch;
29
31
  }
30
32
  /** User-scoped durable file-id reuse for the DeepSeek route. */
31
33
  export declare class DeepSeekFileStore {
34
+ private readonly protocol;
32
35
  private readonly index;
33
36
  private readonly now;
34
37
  private readonly fetchImpl;
@@ -46,6 +46,8 @@ export declare class DeepSeekFilesError extends LlmError {
46
46
  */
47
47
  export declare function isFilesQuotaError(error: unknown): error is DeepSeekFilesError;
48
48
  interface FilesApiOptions {
49
+ /** API dialect; omission retains Messages. */
50
+ protocol?: 'messages' | 'chat-completions';
49
51
  baseURL: string;
50
52
  /** Provider-resolved authentication headers for this endpoint. */
51
53
  headers: Readonly<Record<string, string>>;
@@ -53,6 +55,7 @@ interface FilesApiOptions {
53
55
  }
54
56
  /** Direct Files client retaining the configured URL root and refusing redirects before credentials can leave its origin. */
55
57
  export declare class DeepSeekFilesClient {
58
+ private readonly protocol;
56
59
  private readonly baseURL;
57
60
  private readonly authHeaders;
58
61
  private readonly fetchImpl;
@@ -60,6 +63,7 @@ export declare class DeepSeekFilesClient {
60
63
  * @param options - endpoint, authentication headers, and optional test transport.
61
64
  */
62
65
  constructor(options: FilesApiOptions);
66
+ private parseFile;
63
67
  private request;
64
68
  /**
65
69
  * Upload one image with an explicit expiry.
@@ -3,6 +3,7 @@ export { deepSeekConfigFields, Config, plainOptions, resolveAdapterOptions, PUBL
3
3
  export type { Options, ResolvedDeepSeekOptions } from './config.ts';
4
4
  export { DEFAULT_CONTEXT_WINDOW, DEFAULT_FILE_EXPIRY_SECONDS, DEFAULT_FILE_QUOTA_CLEANUP_BATCH, DEFAULT_FILE_REFRESH_MARGIN_SECONDS, DEFAULT_FILES_API_TIMEOUT_MS, DEFAULT_IMAGE_OFFLOAD_BYTE_QUANTUM, DEFAULT_IMAGE_OFFLOAD_COUNT_QUANTUM, DEFAULT_INLINE_IMAGE_OFFLOAD_BYTE_QUANTUM, DEFAULT_MAX_INLINE_REQUEST_IMAGE_BYTES, DEFAULT_MAX_TOKENS, DEFAULT_STREAM_IDLE_TIMEOUT_MS, } from './defaults.ts';
5
5
  export { DeepSeekAdapter } from './adapter.ts';
6
+ export { DeepSeekChatCompletionsAdapter } from './chat-completions/adapter.ts';
6
7
  export type { DeepSeekRequestAuth, DeepSeekAdapterOptions, DeepSeekCatalogModel, DeepSeekConnectionOptions } from './types.ts';
7
8
  export { DEFAULT_LOW_DETAIL_IMAGE_PIXEL_BUDGET, DEFAULT_MAX_IMAGES_PER_REQUEST, DEFAULT_MAX_REQUEST_FILES_BYTES, DEFAULT_REQUEST_IMAGE_MAX_BYTES, REQUEST_IMAGE_MAX_DIMENSION, deepSeekImageRequestPricing, resolveRequestImageMaxBytes, resolveRequestImageTarget, } from './request-pricing.ts';
8
9
  export { deepSeekImageTokens, deepSeekRequestImageDimensions } from './image-tokens.ts';
@@ -0,0 +1,41 @@
1
+ /** Shared cancellation, image recovery, authentication, and delivery lifecycle for DeepSeek protocols. */
2
+ import { LlmAdapter } from '@deepseek-ai/dsh-llm';
3
+ import type { GenerateOptions, PreparedAdapterCall, StreamChunk } from '@deepseek-ai/dsh-llm';
4
+ import type { DeepSeekAdapterOptions, DeepSeekConnectionOptions as Connection } from './types.ts';
5
+ import type { DeepSeekProtocol } from './protocol.ts';
6
+ /** Provider adapter with protocol-independent request ownership and image recovery. */
7
+ export declare class DeepSeekProtocolAdapter<C extends Connection = Connection> extends LlmAdapter {
8
+ private readonly dependencies;
9
+ private readonly protocol;
10
+ private readonly files;
11
+ private readonly imageAccess;
12
+ /**
13
+ * @param dependencies - request-local configuration, authentication, and Host services.
14
+ * @param protocol - serializer, resource URLs, and stream decoder.
15
+ */
16
+ constructor(dependencies: DeepSeekAdapterOptions<C>, protocol: DeepSeekProtocol);
17
+ providerInfo(provider: string): {
18
+ id: string;
19
+ name: string;
20
+ };
21
+ providerRetryPolicy(_provider: string): import("@deepseek-ai/dsh-llm").ResolvedRetryPolicy;
22
+ listModels(provider: string): Promise<never[] | import("@deepseek-ai/dsh-llm").LlmModelInfo[]>;
23
+ resolveModel(provider: string, model: string, _signal?: AbortSignal): Promise<{
24
+ context?: import("@deepseek-ai/dsh-llm").LlmModelContext;
25
+ defaultMaxTokens?: number;
26
+ reasoning?: import("@deepseek-ai/dsh-llm").LlmModelReasoningInfo;
27
+ systemPromptUpdate?: import("@deepseek-ai/dsh-llm").SystemPromptUpdate;
28
+ provider: string;
29
+ id: string;
30
+ name: string;
31
+ description?: string;
32
+ inputModalities?: readonly import("@deepseek-ai/dsh-llm").ModelModality[];
33
+ }>;
34
+ imageRequestPricing(_provider: string, model: string): import("@deepseek-ai/dsh-llm").LlmImageRequestPricing;
35
+ prepareCall(provider: string, model: string, _signal?: AbortSignal): Promise<PreparedAdapterCall>;
36
+ stream(options: GenerateOptions): AsyncIterable<StreamChunk>;
37
+ private describe;
38
+ private generate;
39
+ private request;
40
+ }
41
+ //# sourceMappingURL=protocol-adapter.d.ts.map
@@ -0,0 +1,35 @@
1
+ /** Wire-specific operations used by the shared DeepSeek request lifecycle. */
2
+ import type { StreamChunk } from '@deepseek-ai/dsh-llm';
3
+ import type { DeepSeekLlmApiExtensionRequest } from '@deepseek-ai/dsh-deepseek-llm-api-extensions';
4
+ import type { serialize } from './serialize.ts';
5
+ /** Serialization and transport rules for one DeepSeek API dialect. */
6
+ export interface DeepSeekProtocol {
7
+ /** API family included in transport diagnostics. */
8
+ readonly name: string;
9
+ /** Files API dialect and upload-cache namespace. */
10
+ readonly files: 'messages' | 'chat-completions';
11
+ /**
12
+ * Resolve the model endpoint.
13
+ * @param baseURL - configured API root.
14
+ * @returns the model request URL.
15
+ */
16
+ endpoint(baseURL: string): string;
17
+ /**
18
+ * Serialize one request and its protocol-specific headers.
19
+ * @param args - prepared request inputs shared with the Messages serializer.
20
+ * @returns the request body and protocol headers.
21
+ */
22
+ prepare(...args: Parameters<typeof serialize>): {
23
+ body: DeepSeekLlmApiExtensionRequest['body'];
24
+ headers: Readonly<Record<string, string>>;
25
+ };
26
+ /**
27
+ * Convert provider bytes to Harness chunks, preserving terminal ordering.
28
+ * @param stream - provider response bytes.
29
+ * @param activity - notification for each received SSE frame.
30
+ * @param model - requested model id for response replay.
31
+ * @returns the decoded chunks.
32
+ */
33
+ translate(stream: ReadableStream<BufferSource>, activity: () => void, model: string): AsyncIterable<StreamChunk>;
34
+ }
35
+ //# sourceMappingURL=protocol.d.ts.map
@@ -9,7 +9,8 @@ export declare function providerErrorDetail(raw: unknown): string;
9
9
  * @param raw - decoded response or in-band error event.
10
10
  * @param status - HTTP status when the error preceded streaming.
11
11
  * @param headers - response headers for retry delay and request identity.
12
+ * @param protocol - API family used in fallback diagnostics; defaults to Messages.
12
13
  * @returns a stable error consumed by LlmRuntime and llm-retry.
13
14
  */
14
- export declare function providerError(raw: unknown, status: number | undefined, headers?: Headers): LlmError;
15
+ export declare function providerError(raw: unknown, status: number | undefined, headers?: Headers, protocol?: string): LlmError;
15
16
  //# sourceMappingURL=transport.d.ts.map
@@ -1,4 +1,4 @@
1
- /** Model catalog and request-local dependencies for DeepSeek Messages. */
1
+ /** Model catalog and request-local dependencies for DeepSeek transports. */
2
2
  import type { LlmModelInfo, ModelModality, SystemPromptUpdate, ToolUpdate, ResolvedRetryPolicy, ImageAttachmentAccess } from '@deepseek-ai/dsh-llm';
3
3
  import type { AttachmentStore, ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
4
4
  import type { AnonymousUserId } from '@deepseek-ai/dsh-anonymous-user-id';
@@ -47,7 +47,7 @@ export interface DeepSeekCatalogModel {
47
47
  * makes a configuration change reach the next request without re-registration.
48
48
  */
49
49
  export interface DeepSeekConnectionOptions {
50
- /** Messages API root; custom paths remain unchanged. */
50
+ /** API root for the selected adapter; custom paths remain unchanged. */
51
51
  baseURL: string;
52
52
  /** Request defaults applied to every call (thinking mode, effort). */
53
53
  defaults: RequestDefaults;
@@ -19,13 +19,14 @@ import { assertSupportedJsonSchema } from "@deepseek-ai/dsh-tools";
19
19
  */
20
20
  /**
21
21
  * The subprocess seam's scrubbed parent env (credential-shaped and stale
22
- * `DSH_*` names dropped), plus the spec's explicit env. The MCP SDK owns the
23
- * actual spawn, so this transport shares the scrub definition rather than the
24
- * spawn path.
22
+ * `DSH_*` names dropped), without pnpm's inherited package-manager version
23
+ * control, plus the spec's explicit env. The MCP SDK owns the actual spawn.
25
24
  */
26
25
  function buildChildEnv(extra) {
26
+ const env = scrubbedParentEnv();
27
+ for (const key of Object.keys(env)) if (/^npm_config_manage[-_]package[-_]manager[-_]versions$/iu.test(key)) Reflect.deleteProperty(env, key);
27
28
  return {
28
- ...scrubbedParentEnv(),
29
+ ...env,
29
30
  ...extra
30
31
  };
31
32
  }
@@ -20,7 +20,7 @@ window.__ModuleLoader__.load({
20
20
  * @returns one safe browser download filename.
21
21
  */
22
22
  function sessionLogZipFilename(sessionId) {
23
- return `dsh-session-${String(sessionId).replace(/[^A-Za-z0-9_-]/g, "_")}.zip`;
23
+ return `cco-session-${String(sessionId).replace(/[^A-Za-z0-9_-]/g, "_")}.zip`;
24
24
  }
25
25
  /**
26
26
  * Hand a Host download route to the browser download manager, which resolves it
@@ -169,8 +169,8 @@ window.__ModuleLoader__.load({
169
169
  });
170
170
  }
171
171
  //#endregion
172
- //#region \0dsh-css:/Users/shiguifeng/IdeaProjects/chonggou/deepseek-harness/packages/session-query/session-log-export/src/client/HeaderAction.module.css.mjs
173
- const css = ".HfnF4a_moreButton{width:28px;color:var(--dsw-alias-label-secondary);flex:none;padding:0}.HfnF4a_moreButton svg{width:15px;height:15px}";
172
+ //#region \0dsh-css:/Users/shiguifeng/IdeaProjects/chonggou/chatcode-cli-harness/packages/session-query/session-log-export/src/client/HeaderAction.module.css.mjs
173
+ const css = ".yAiIdG_moreButton{width:28px;color:var(--dsw-alias-label-secondary);flex:none;padding:0}.yAiIdG_moreButton svg{width:15px;height:15px}";
174
174
  const tagId = "@deepseek-ai/dsh-session-log-export/HeaderAction.module.css";
175
175
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
176
176
  const tag = document.createElement("style");
@@ -179,7 +179,7 @@ window.__ModuleLoader__.load({
179
179
  tag.textContent = css;
180
180
  document.head.appendChild(tag);
181
181
  }
182
- var HeaderAction_module_css_default = { "moreButton": "HfnF4a_moreButton" };
182
+ var HeaderAction_module_css_default = { "moreButton": "yAiIdG_moreButton" };
183
183
  //#endregion
184
184
  //#region lib/types/client/HeaderAction.js
185
185
  /**
@@ -245,7 +245,7 @@ function safeSessionIdSegment(id) {
245
245
  * @returns the attachment filename for the session's export archive.
246
246
  */
247
247
  function sessionLogZipFilename(sessionId) {
248
- return `dsh-session-${safeSessionIdSegment(sessionId)}.zip`;
248
+ return `cco-session-${safeSessionIdSegment(sessionId)}.zip`;
249
249
  }
250
250
  /**
251
251
  * Yield the export entries in zip order: the preloaded root log first, then
@@ -2653,12 +2653,12 @@ var JsonlSessionPersistence = class extends SessionPersistence {
2653
2653
  } finally {
2654
2654
  await marker.close();
2655
2655
  }
2656
- await this.syncDirPosix(dir);
2656
+ if (process.platform !== "win32") await this.syncDirPosix(dir);
2657
2657
  for (const entry of await readdir(dir)) if (entry !== "session.lock" && entry !== DELETED_FILENAME) await rm(join(dir, entry), {
2658
2658
  recursive: true,
2659
2659
  force: true
2660
2660
  });
2661
- await this.syncDirPosix(dir);
2661
+ if (process.platform !== "win32") await this.syncDirPosix(dir);
2662
2662
  }
2663
2663
  for (const id of claimed) {
2664
2664
  this.coldLogMemo.delete(id);
@@ -119,7 +119,7 @@ var FileSystemSkillProvider = class {
119
119
  */
120
120
  async get(candidate, options) {
121
121
  const locator = candidate.locator;
122
- const parsed = await parseSkillFile(locator.path, this.ctx, options.signal, candidate.source === "bundled");
122
+ const parsed = await parseSkillFile(locator.path, this.ctx, options.signal, candidate.source === "bundled", locator.commandName);
123
123
  if (parsed === void 0) return void 0;
124
124
  return {
125
125
  name: parsed.name,
@@ -161,6 +161,12 @@ var FileSystemSkillProvider = class {
161
161
  source: "project-chatcode",
162
162
  rank: PROJECT_CHATCODE_RANK,
163
163
  projectRoot
164
+ }, {
165
+ path: join(projectRoot, ".chatcode-cli/commands"),
166
+ source: "project-chatcode",
167
+ rank: 101,
168
+ projectRoot,
169
+ commands: true
164
170
  }, {
165
171
  path: join(projectRoot, ".dsh/skills"),
166
172
  source: "project-dsh",
@@ -183,6 +189,11 @@ var FileSystemSkillProvider = class {
183
189
  source: "user-dsh",
184
190
  rank: USER_DSH_RANK,
185
191
  skipSystem: true
192
+ }, {
193
+ path: join(this.dshHome, "commands"),
194
+ source: "user-dsh",
195
+ rank: 401,
196
+ commands: true
186
197
  }, {
187
198
  path: join(this.agentsHome, "skills"),
188
199
  source: "user-agents",
@@ -593,15 +604,19 @@ async function discoverRoot(root, ctx, provider) {
593
604
  const entries = await listSkillRootEntries(root, ctx);
594
605
  for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
595
606
  if (root.skipSystem && entry.name === ".system") continue;
596
- const locator = entry.type === "directory" ? {
607
+ const location = entry.type === "directory" ? {
597
608
  path: join(entry.path, "SKILL.md"),
598
609
  directory: entry.path
599
610
  } : entry.type === "file" && entry.name.endsWith(".md") ? {
600
611
  path: entry.path,
601
612
  directory: root.path
602
613
  } : void 0;
603
- if (locator === void 0) continue;
604
- const parsed = await parseSkillFile(locator.path, ctx, void 0, root.trustedHost === true);
614
+ if (location === void 0) continue;
615
+ const locator = {
616
+ ...location,
617
+ ...root.commands === true ? { commandName: entry.name.replace(/\.md$/, "") } : {}
618
+ };
619
+ const parsed = await parseSkillFile(locator.path, ctx, void 0, root.trustedHost === true, locator.commandName);
605
620
  if (parsed === void 0) continue;
606
621
  skills.push({
607
622
  name: parsed.name,
@@ -671,13 +686,18 @@ async function listSkillRootEntriesFromNode(root, ctx) {
671
686
  }
672
687
  return result;
673
688
  }
674
- async function parseSkillFile(path, ctx, signal, trustedHost = false) {
689
+ async function parseSkillFile(path, ctx, signal, trustedHost = false, commandName) {
675
690
  const raw = await readSkillText(ctx, path, signal, trustedHost);
676
691
  signal?.throwIfAborted();
677
692
  if (raw === void 0) return;
678
693
  let parsed;
679
694
  try {
680
- parsed = parseFrontmatter(raw.content);
695
+ const content = raw.content.replace(/^\uFEFF/, "");
696
+ parsed = parseFrontmatter(content);
697
+ if (commandName !== void 0 && parsed === void 0 && !/^---\r?\n/.test(content)) parsed = {
698
+ data: {},
699
+ body: content
700
+ };
681
701
  } catch (error) {
682
702
  ctx.logger.warn(`skill file ${path} ignored: invalid YAML frontmatter: ${errorMessage(error)}`);
683
703
  return;
@@ -686,8 +706,8 @@ async function parseSkillFile(path, ctx, signal, trustedHost = false) {
686
706
  ctx.logger.warn(`skill file ${path} ignored: missing YAML frontmatter`);
687
707
  return;
688
708
  }
689
- const name = stringField(parsed.data, "name");
690
- const description = stringField(parsed.data, "description");
709
+ const name = "name" in parsed.data ? stringField(parsed.data, "name") : commandName;
710
+ const description = "description" in parsed.data || commandName === void 0 ? stringField(parsed.data, "description") : parsed.body.trim().split(/\r?\n/)[0]?.replace(/^#+\s*/, "").trim() || commandName;
691
711
  if (name === void 0 || description === void 0) {
692
712
  ctx.logger.warn(`skill file ${path} ignored: frontmatter requires name and description`);
693
713
  return;
@@ -795,7 +815,11 @@ function parseFrontmatter(raw) {
795
815
  const closing = findClosingFrontmatter(raw, start);
796
816
  if (closing === void 0) return void 0;
797
817
  const parsed = parse(raw.slice(start, closing.start));
798
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
818
+ if (parsed === null) return {
819
+ data: {},
820
+ body: raw.slice(closing.bodyStart)
821
+ };
822
+ if (typeof parsed !== "object" || Array.isArray(parsed)) return void 0;
799
823
  return {
800
824
  data: parsed,
801
825
  body: raw.slice(closing.bodyStart)