dsh-output-styles 0.5.0 → 0.6.1
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/CHANGELOG.md +15 -0
- package/README.es.md +1 -0
- package/README.hi.md +1 -0
- package/README.md +2 -0
- package/README.pt.md +1 -0
- package/README.zh.md +1 -0
- package/docs/COEXISTENCE.md +62 -0
- package/lib/index.js +83 -26
- package/lib/types/coexist.d.ts +49 -0
- package/lib/types/coexist.d.ts.map +1 -0
- package/lib/types/config.d.ts +9 -0
- package/lib/types/config.d.ts.map +1 -1
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/runtime.d.ts.map +1 -1
- package/package.json +14 -2
- package/src/coexist.ts +68 -0
- package/src/config.ts +11 -0
- package/src/index.ts +2 -0
- package/src/runtime.ts +39 -28
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ All notable changes to this project are documented in this file. The format
|
|
|
4
4
|
follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the
|
|
5
5
|
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.6.1] - 2026-08-27
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Declare the web-client inject packages (`@deepseek-ai/dsh-api-remotes`,
|
|
12
|
+
`@deepseek-ai/dsh-client-locale`, `@deepseek-ai/dsh-client-runtime`,
|
|
13
|
+
`@deepseek-ai/dsh-client-ui-commands`) as optional peerDependencies so the
|
|
14
|
+
bundle composition is explicit and standalone installs stay clean.
|
|
15
|
+
|
|
16
|
+
## [0.6.0] - 2026-08-26
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- 与核心 outputStyles 共存/降级策略:探测 + 免重复注入 + 可运行检测。
|
|
21
|
+
|
|
7
22
|
## [0.5.0] - 2026-08-23
|
|
8
23
|
|
|
9
24
|
### Added
|
package/README.es.md
CHANGED
|
@@ -112,6 +112,7 @@ Todos los parámetros son campos Schemastery `Config` (modificables desde cordis
|
|
|
112
112
|
| `watchStyles` | `true` | Recargar la librería cuando un archivo de estilo cambia en disco |
|
|
113
113
|
| `rules` | `[]` | Reglas de render por sesión/herramienta: `[{ match: { tool?, contentType?, session? }, style, priority? }]` |
|
|
114
114
|
| `enableExport` | `true` | Registrar el comando `/export` (exportación de sesión Markdown/HTML, consciente del renderer; `--save` escribe con aprobación) |
|
|
115
|
+
| `respectCoreOutputStyles` | `true` | Al detectar un servicio core `outputStyles`, omitir la inyección de prompt de este plugin (mantener hot-switch / rules / export) |
|
|
115
116
|
|
|
116
117
|
## Tools & surfaces
|
|
117
118
|
|
package/README.hi.md
CHANGED
|
@@ -112,6 +112,7 @@ flowchart LR
|
|
|
112
112
|
| `watchStyles` | `true` | डिस्क पर शैली फ़ाइल बदलने पर पुस्तकालय फिर से लोड करें |
|
|
113
113
|
| `rules` | `[]` | प्रति-सत्र/प्रति-टूल रेंडर नियम: `[{ match: { tool?, contentType?, session? }, style, priority? }]` |
|
|
114
114
|
| `enableExport` | `true` | `/export` कमांड पंजीकृत करें (Markdown/HTML सत्र निर्यात, रेंडरर-जागरूक; `--save` स्वीकृति से लिखता है) |
|
|
115
|
+
| `respectCoreOutputStyles` | `true` | कोर `outputStyles` सेवा का पता चलने पर इस प्लगइन का prompt इंजेक्शन छोड़ें (hot-switch / rules / export बनाए रखें) |
|
|
115
116
|
|
|
116
117
|
## Tools & surfaces
|
|
117
118
|
|
package/README.md
CHANGED
|
@@ -113,6 +113,7 @@ All tunables are Schemastery `Config` fields (changeable from cordis.yml). Inval
|
|
|
113
113
|
| `watchStyles` | `true` | Reload the library when a style file changes on disk |
|
|
114
114
|
| `rules` | `[]` | Per-session/per-tool render rules: `[{ match: { tool?, contentType?, session? }, style, priority? }]` |
|
|
115
115
|
| `enableExport` | `true` | Register the `/export` command (Markdown/HTML session export, renderer-aware; `--save` writes with approval) |
|
|
116
|
+
| `respectCoreOutputStyles` | `true` | When a core `outputStyles` service is detected, skip this plugin's prompt injection (keep hot-switch / rules / export) |
|
|
116
117
|
|
|
117
118
|
## Tools & surfaces
|
|
118
119
|
|
|
@@ -198,6 +199,7 @@ Screened against the DSH ecosystem before development (2026-08 snapshot): no `st
|
|
|
198
199
|
|
|
199
200
|
## Known limitations
|
|
200
201
|
|
|
202
|
+
- **Core coexistence.** If a first-party `outputStyles` capability lands, this plugin detects its `outputStyles` service and degrades to the incremental surface (hot-switch, rules, `/export`) while leaving prompt injection to the core — see [`docs/COEXISTENCE.md`](docs/COEXISTENCE.md) and the exported `detectCoreOutputStyles` / `coexistenceReport` functions.
|
|
201
203
|
- **Main conversation only.** Styles apply to the main conversation; subagent sessions keep their own prompts (matching Claude Code).
|
|
202
204
|
- **Truncation.** Style bodies longer than `maxStyleChars` are truncated with a marker.
|
|
203
205
|
- **Skipped style files.** A bad style file is skipped with a warning and never breaks the profile.
|
package/README.pt.md
CHANGED
|
@@ -112,6 +112,7 @@ Todos os parâmetros são campos Schemastery `Config` (alteráveis pelo cordis.y
|
|
|
112
112
|
| `watchStyles` | `true` | Recarregar a biblioteca quando um arquivo de estilo muda em disco |
|
|
113
113
|
| `rules` | `[]` | Regras de render por sessão/ferramenta: `[{ match: { tool?, contentType?, session? }, style, priority? }]` |
|
|
114
114
|
| `enableExport` | `true` | Registrar o comando `/export` (exportação de sessão Markdown/HTML, ciente do renderer; `--save` escreve com aprovação) |
|
|
115
|
+
| `respectCoreOutputStyles` | `true` | Ao detectar um serviço core `outputStyles`, omitir a injeção de prompt deste plugin (manter hot-switch / rules / export) |
|
|
115
116
|
|
|
116
117
|
## Tools & surfaces
|
|
117
118
|
|
package/README.zh.md
CHANGED
|
@@ -112,6 +112,7 @@ flowchart LR
|
|
|
112
112
|
| `watchStyles` | `true` | 风格文件在磁盘上变化时重载库 |
|
|
113
113
|
| `rules` | `[]` | 按会话/按工具渲染规则:`[{ match: { tool?, contentType?, session? }, style, priority? }]` |
|
|
114
114
|
| `enableExport` | `true` | 注册 `/export` 命令(Markdown/HTML 会话导出,感知渲染器;`--save` 经审批写入) |
|
|
115
|
+
| `respectCoreOutputStyles` | `true` | 检测到核心 `outputStyles` 服务时跳过本插件的提示词注入(保留热切换 / rules / export) |
|
|
115
116
|
|
|
116
117
|
## Tools & surfaces
|
|
117
118
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Coexistence with a core `outputStyles` capability
|
|
2
|
+
|
|
3
|
+
`dsh-output-styles` is the standalone Claude Code `outputStyles`-equivalent. If
|
|
4
|
+
DeepSeek Harness ships a first-party `outputStyles` feature, the two would
|
|
5
|
+
otherwise both inject an output-style directive into the system prompt. This
|
|
6
|
+
plugin ships a coexistence policy that detects the core capability and degrades
|
|
7
|
+
to the incremental surface it uniquely adds.
|
|
8
|
+
|
|
9
|
+
## Detection
|
|
10
|
+
|
|
11
|
+
The core capability is detected through its reserved service seam, not by name
|
|
12
|
+
guessing. A core implementation publishes the `outputStyles` service; the plugin
|
|
13
|
+
probes it at mount:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { detectCoreOutputStyles } from 'dsh-output-styles'
|
|
17
|
+
|
|
18
|
+
// ctx is the plugin-scoped Cordis context.
|
|
19
|
+
const coreActive = detectCoreOutputStyles(ctx)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- **Core absent** → `standalone` mode: the plugin injects the style section
|
|
23
|
+
(`systemPrompt.section('output-style:selection')` plus the
|
|
24
|
+
`system-prompt/assemble` waterfall for `keep-coding-instructions: false`).
|
|
25
|
+
- **Core present** → `degraded` mode: prompt injection is left to the core, and
|
|
26
|
+
the plugin keeps only hot-switch (`/style`), rules, and `/export`.
|
|
27
|
+
|
|
28
|
+
## Runnable verification
|
|
29
|
+
|
|
30
|
+
`coexistenceReport` is the runnable check for one composition:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { coexistenceReport } from 'dsh-output-styles'
|
|
34
|
+
|
|
35
|
+
const report = coexistenceReport(ctx)
|
|
36
|
+
// report = { coreActive, mode: 'standalone' | 'degraded',
|
|
37
|
+
// promptInjection: 'enabled' | 'disabled', retained, disabled }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
It is also covered by the test suite (`tests/coexist.spec.ts`), which mounts the
|
|
41
|
+
plugin with a fake `outputStyles` service and asserts the injected section is
|
|
42
|
+
absent while `/style` and the renderer registry stay active.
|
|
43
|
+
|
|
44
|
+
## Forcing injection
|
|
45
|
+
|
|
46
|
+
A deployment that wants this plugin to keep injecting regardless of the core can
|
|
47
|
+
set `respectCoreOutputStyles: false` in `cordis.yml`. The default is `true`
|
|
48
|
+
(honor the core and avoid duplicate injection).
|
|
49
|
+
|
|
50
|
+
## Degraded surface
|
|
51
|
+
|
|
52
|
+
In `degraded` mode the plugin still contributes:
|
|
53
|
+
|
|
54
|
+
- **Hot-switch** — `/style` listing/selection, per-session persistence over the
|
|
55
|
+
`output_style` domain, and the `style` session projection.
|
|
56
|
+
- **Rules** — the `output.render.*` renderer registry, the
|
|
57
|
+
`output.render/before` waterfall, and per-session/per-tool rules.
|
|
58
|
+
- **Export** — `/export` (Markdown / sanitized HTML) through the renderer
|
|
59
|
+
pipeline, with approval-gated `--save`.
|
|
60
|
+
|
|
61
|
+
Only the two prompt-injection registrations (the prompt section and the
|
|
62
|
+
`system-prompt/assemble` waterfall) are skipped.
|
package/lib/index.js
CHANGED
|
@@ -38,7 +38,8 @@ const Config = z.object({
|
|
|
38
38
|
style: z.string().min(1),
|
|
39
39
|
priority: z.number().required(false)
|
|
40
40
|
})).default([]),
|
|
41
|
-
enableExport: z.boolean().default(true)
|
|
41
|
+
enableExport: z.boolean().default(true),
|
|
42
|
+
respectCoreOutputStyles: z.boolean().default(true)
|
|
42
43
|
});
|
|
43
44
|
/**
|
|
44
45
|
* Resolve the same defaults for direct callers that bypass the Cordis Loader,
|
|
@@ -75,7 +76,59 @@ function resolveConfig(config, defaultStylesDir) {
|
|
|
75
76
|
...rule,
|
|
76
77
|
priority: rule.priority ?? 0
|
|
77
78
|
})),
|
|
78
|
-
enableExport: config.enableExport ?? true
|
|
79
|
+
enableExport: config.enableExport ?? true,
|
|
80
|
+
respectCoreOutputStyles: config.respectCoreOutputStyles ?? true
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region lib/types/coexist.js
|
|
85
|
+
/**
|
|
86
|
+
* Coexistence with a core `outputStyles` capability.
|
|
87
|
+
*
|
|
88
|
+
* If DeepSeek Harness ever ships a first-party `outputStyles` feature, this
|
|
89
|
+
* plugin's system-prompt injection would duplicate it. The coexistence policy
|
|
90
|
+
* detects the core capability through its reserved service seam and, when it
|
|
91
|
+
* is present, degrades to the incremental surface this plugin uniquely adds —
|
|
92
|
+
* runtime hot-switch, per-session/per-tool rules, and `/export` — while
|
|
93
|
+
* leaving prompt injection entirely to the core.
|
|
94
|
+
*
|
|
95
|
+
* Detection is a service probe, not a name guess: a core implementation
|
|
96
|
+
* publishes the `outputStyles` service; when that seam is absent the plugin
|
|
97
|
+
* runs standalone (injecting the style section itself).
|
|
98
|
+
* @module dsh-output-styles/coexist
|
|
99
|
+
*/
|
|
100
|
+
/** The reserved service name a core `outputStyles` capability publishes. */
|
|
101
|
+
const CORE_OUTPUT_STYLES_SERVICE = "outputStyles";
|
|
102
|
+
/**
|
|
103
|
+
* Probe whether a core `outputStyles` capability is composed.
|
|
104
|
+
* @param ctx - the plugin-scoped context.
|
|
105
|
+
* @returns true when the core `outputStyles` service seam is present.
|
|
106
|
+
*/
|
|
107
|
+
function detectCoreOutputStyles(ctx) {
|
|
108
|
+
return ctx.get(CORE_OUTPUT_STYLES_SERVICE) !== void 0;
|
|
109
|
+
}
|
|
110
|
+
/** The incremental surfaces that survive coexistence in either mode. */
|
|
111
|
+
const RETAINED = [
|
|
112
|
+
"hot-switch",
|
|
113
|
+
"rules",
|
|
114
|
+
"export"
|
|
115
|
+
];
|
|
116
|
+
/**
|
|
117
|
+
* Compute the coexistence report for one composition. Respecting the core is
|
|
118
|
+
* the default (`respectCore` true); a deployment can force standalone mode by
|
|
119
|
+
* setting `respectCoreOutputStyles: false`.
|
|
120
|
+
* @param ctx - the plugin-scoped context.
|
|
121
|
+
* @param respectCore - whether to honor a detected core capability (default true).
|
|
122
|
+
* @returns the coexistence report.
|
|
123
|
+
*/
|
|
124
|
+
function coexistenceReport(ctx, respectCore = true) {
|
|
125
|
+
const coreActive = respectCore && detectCoreOutputStyles(ctx);
|
|
126
|
+
return {
|
|
127
|
+
coreActive,
|
|
128
|
+
mode: coreActive ? "degraded" : "standalone",
|
|
129
|
+
promptInjection: coreActive ? "disabled" : "enabled",
|
|
130
|
+
retained: [...RETAINED],
|
|
131
|
+
disabled: coreActive ? ["system-prompt injection"] : []
|
|
79
132
|
};
|
|
80
133
|
}
|
|
81
134
|
//#endregion
|
|
@@ -619,6 +672,8 @@ async function apply(ctx, config) {
|
|
|
619
672
|
const storageDomain = ctx.get("storageDomain");
|
|
620
673
|
if (storageDomain === void 0) throw new Error("dsh-output-styles: the \"storageDomain\" service declared by inject is unavailable — mount the storage facility (see README) or declare the inject");
|
|
621
674
|
const resolved = resolveConfig(config, DEFAULT_STYLES_DIR);
|
|
675
|
+
const coreActive = resolved.respectCoreOutputStyles && detectCoreOutputStyles(ctx);
|
|
676
|
+
if (coreActive) ctx.logger.info("dsh-output-styles: core outputStyles detected — degrading to hot-switch + rules + export (no prompt injection)");
|
|
622
677
|
const styles = loadStyleLibrary(resolved.stylesDirs, { compatJson: resolved.compatJson }, (message) => {
|
|
623
678
|
ctx.logger.warn(`dsh-output-styles: ${message}`);
|
|
624
679
|
});
|
|
@@ -673,31 +728,33 @@ async function apply(ctx, config) {
|
|
|
673
728
|
if (value.style !== "" && !runtime.styles.has(value.style)) throw new Error(`dsh-output-styles: settings outputStyle "${value.style}" names no style (available: ${[...runtime.styles.keys()].join(", ") || "none"})`);
|
|
674
729
|
}
|
|
675
730
|
});
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
731
|
+
if (!coreActive) {
|
|
732
|
+
ctx.systemPrompt.section({
|
|
733
|
+
name: STYLE_SECTION_NAME,
|
|
734
|
+
order: resolved.sectionOrder,
|
|
735
|
+
text: (context) => {
|
|
736
|
+
const agent = context.agent;
|
|
737
|
+
if (agent === void 0) return "";
|
|
738
|
+
const style = runtime.effectiveStyle(agent.session.id);
|
|
739
|
+
if (style === void 0 || !style.keepCodingInstructions) return "";
|
|
740
|
+
return runtime.promptText(agent.session.id);
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
ctx.on("system-prompt/assemble", async (_assembly, context, next) => {
|
|
744
|
+
const out = await next();
|
|
680
745
|
const agent = context.agent;
|
|
681
|
-
if (agent === void 0) return
|
|
746
|
+
if (agent === void 0) return out;
|
|
682
747
|
const style = runtime.effectiveStyle(agent.session.id);
|
|
683
|
-
if (style === void 0 ||
|
|
684
|
-
return
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
return {
|
|
694
|
-
...out,
|
|
695
|
-
sections: [{
|
|
696
|
-
name: STYLE_SECTION_NAME,
|
|
697
|
-
text: runtime.promptText(agent.session.id)
|
|
698
|
-
}]
|
|
699
|
-
};
|
|
700
|
-
});
|
|
748
|
+
if (style === void 0 || style.keepCodingInstructions) return out;
|
|
749
|
+
return {
|
|
750
|
+
...out,
|
|
751
|
+
sections: [{
|
|
752
|
+
name: STYLE_SECTION_NAME,
|
|
753
|
+
text: runtime.promptText(agent.session.id)
|
|
754
|
+
}]
|
|
755
|
+
};
|
|
756
|
+
});
|
|
757
|
+
}
|
|
701
758
|
ctx.inject(["commands"], (commandCtx) => {
|
|
702
759
|
commandCtx.commands.register({
|
|
703
760
|
name: STYLE_COMMAND,
|
|
@@ -951,4 +1008,4 @@ const name = "dsh-output-styles";
|
|
|
951
1008
|
*/
|
|
952
1009
|
const inject = ["systemPrompt", "storageDomain"];
|
|
953
1010
|
//#endregion
|
|
954
|
-
export { Config, DEFAULT_STYLES_DIR, EMPTY_STYLE_STATE, OFF, OUTPUT_STYLE_DOMAIN, OutputStyleRuntime, PACKAGE_NAME, STYLE_COMMAND, STYLE_NAME_RE, STYLE_SECTION_NAME, STYLE_SOURCE, apply, applyStyleEvent, inject, installInvariant, isValidStyleName, loadStyleLibrary, name, parseStyleInput, resolveConfig, styleFoldStateSchema, styleSelectionSchema, styleSelectionViewSchema, truncateStyle };
|
|
1011
|
+
export { CORE_OUTPUT_STYLES_SERVICE, Config, DEFAULT_STYLES_DIR, EMPTY_STYLE_STATE, OFF, OUTPUT_STYLE_DOMAIN, OutputStyleRuntime, PACKAGE_NAME, STYLE_COMMAND, STYLE_NAME_RE, STYLE_SECTION_NAME, STYLE_SOURCE, apply, applyStyleEvent, coexistenceReport, detectCoreOutputStyles, inject, installInvariant, isValidStyleName, loadStyleLibrary, name, parseStyleInput, resolveConfig, styleFoldStateSchema, styleSelectionSchema, styleSelectionViewSchema, truncateStyle };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coexistence with a core `outputStyles` capability.
|
|
3
|
+
*
|
|
4
|
+
* If DeepSeek Harness ever ships a first-party `outputStyles` feature, this
|
|
5
|
+
* plugin's system-prompt injection would duplicate it. The coexistence policy
|
|
6
|
+
* detects the core capability through its reserved service seam and, when it
|
|
7
|
+
* is present, degrades to the incremental surface this plugin uniquely adds —
|
|
8
|
+
* runtime hot-switch, per-session/per-tool rules, and `/export` — while
|
|
9
|
+
* leaving prompt injection entirely to the core.
|
|
10
|
+
*
|
|
11
|
+
* Detection is a service probe, not a name guess: a core implementation
|
|
12
|
+
* publishes the `outputStyles` service; when that seam is absent the plugin
|
|
13
|
+
* runs standalone (injecting the style section itself).
|
|
14
|
+
* @module dsh-output-styles/coexist
|
|
15
|
+
*/
|
|
16
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
17
|
+
/** The reserved service name a core `outputStyles` capability publishes. */
|
|
18
|
+
export declare const CORE_OUTPUT_STYLES_SERVICE = "outputStyles";
|
|
19
|
+
/**
|
|
20
|
+
* Probe whether a core `outputStyles` capability is composed.
|
|
21
|
+
* @param ctx - the plugin-scoped context.
|
|
22
|
+
* @returns true when the core `outputStyles` service seam is present.
|
|
23
|
+
*/
|
|
24
|
+
export declare function detectCoreOutputStyles(ctx: Context): boolean;
|
|
25
|
+
/** The coexistence mode: standalone owns injection; degraded leaves it to core. */
|
|
26
|
+
export type CoexistenceMode = 'standalone' | 'degraded';
|
|
27
|
+
/** A runnable coexistence check: what this plugin contributes under the current composition. */
|
|
28
|
+
export interface CoexistenceReport {
|
|
29
|
+
/** Whether a core `outputStyles` capability was detected. */
|
|
30
|
+
readonly coreActive: boolean;
|
|
31
|
+
/** The effective coexistence mode. */
|
|
32
|
+
readonly mode: CoexistenceMode;
|
|
33
|
+
/** Whether this plugin injects the style system-prompt section. */
|
|
34
|
+
readonly promptInjection: 'enabled' | 'disabled';
|
|
35
|
+
/** The incremental surfaces this plugin always retains. */
|
|
36
|
+
readonly retained: readonly string[];
|
|
37
|
+
/** What this plugin disabled to avoid duplicating the core. */
|
|
38
|
+
readonly disabled: readonly string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Compute the coexistence report for one composition. Respecting the core is
|
|
42
|
+
* the default (`respectCore` true); a deployment can force standalone mode by
|
|
43
|
+
* setting `respectCoreOutputStyles: false`.
|
|
44
|
+
* @param ctx - the plugin-scoped context.
|
|
45
|
+
* @param respectCore - whether to honor a detected core capability (default true).
|
|
46
|
+
* @returns the coexistence report.
|
|
47
|
+
*/
|
|
48
|
+
export declare function coexistenceReport(ctx: Context, respectCore?: boolean): CoexistenceReport;
|
|
49
|
+
//# sourceMappingURL=coexist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coexist.d.ts","sourceRoot":"","sources":["../../src/coexist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,4EAA4E;AAC5E,eAAO,MAAM,0BAA0B,iBAAiB,CAAA;AAExD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAE5D;AAED,mFAAmF;AACnF,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,UAAU,CAAA;AAEvD,gGAAgG;AAChG,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,sCAAsC;IACtC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,eAAe,EAAE,SAAS,GAAG,UAAU,CAAA;IAChD,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CACrC;AAKD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,UAAO,GAAG,iBAAiB,CASrF"}
|
package/lib/types/config.d.ts
CHANGED
|
@@ -59,6 +59,13 @@ export interface Config {
|
|
|
59
59
|
rules?: StyleRuleConfig[];
|
|
60
60
|
/** Register the `/export` command (Markdown/HTML session-export, renderer-aware). */
|
|
61
61
|
enableExport?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Honor a detected core `outputStyles` capability: when true (default) and
|
|
64
|
+
* the core service is composed, this plugin skips its own system-prompt
|
|
65
|
+
* injection (hot-switch / rules / export stay active). Set false to always
|
|
66
|
+
* inject regardless.
|
|
67
|
+
*/
|
|
68
|
+
respectCoreOutputStyles?: boolean;
|
|
62
69
|
}
|
|
63
70
|
/** Configuration after defaults have been resolved. */
|
|
64
71
|
export interface ResolvedConfig {
|
|
@@ -90,6 +97,8 @@ export interface ResolvedConfig {
|
|
|
90
97
|
}>;
|
|
91
98
|
/** Whether the `/export` command registers. */
|
|
92
99
|
enableExport: boolean;
|
|
100
|
+
/** Whether a detected core `outputStyles` capability disables prompt injection. */
|
|
101
|
+
respectCoreOutputStyles: boolean;
|
|
93
102
|
}
|
|
94
103
|
/** Loader-visible configuration schema and defaults. */
|
|
95
104
|
export declare const Config: z<Config>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAGxC,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,iEAAiE;IACjE,KAAK,EAAE;QACL,6CAA6C;QAC7C,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,oCAAoC;QACpC,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAA;QAC1C,uEAAuE;QACvE,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,yFAAyF;IACzF,KAAK,EAAE,MAAM,CAAA;IACb,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,gEAAgE;AAChE,MAAM,WAAW,MAAM;IACrB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC7B,gGAAgG;IAChG,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,6GAA6G;IAC7G,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,4GAA4G;IAC5G,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,sGAAsG;IACtG,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,wEAAwE;IACxE,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,2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B;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC;AAED,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC7B,sGAAsG;IACtG,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAA;IACrB,6EAA6E;IAC7E,YAAY,EAAE,MAAM,CAAA;IACpB,kEAAkE;IAClE,UAAU,EAAE,OAAO,CAAA;IACnB,oEAAoE;IACpE,YAAY,EAAE,MAAM,CAAA;IACpB,+CAA+C;IAC/C,gBAAgB,EAAE,MAAM,CAAA;IACxB,4DAA4D;IAC5D,eAAe,EAAE,OAAO,CAAA;IACxB,yDAAyD;IACzD,WAAW,EAAE,OAAO,CAAA;IACpB,kEAAkE;IAClE,KAAK,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACzI,+CAA+C;IAC/C,YAAY,EAAE,OAAO,CAAA;IACrB,mFAAmF;IACnF,uBAAuB,EAAE,OAAO,CAAA;CACjC;AAED,wDAAwD;AACxD,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,CAoB3B,CAAA;AAEF;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,cAAc,CAsCtF"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export declare const name = "dsh-output-styles";
|
|
|
18
18
|
export declare const inject: string[];
|
|
19
19
|
export { Config, resolveConfig } from './config.js';
|
|
20
20
|
export type { ResolvedConfig } from './config.js';
|
|
21
|
+
export { CORE_OUTPUT_STYLES_SERVICE, coexistenceReport, detectCoreOutputStyles } from './coexist.js';
|
|
22
|
+
export type { CoexistenceMode, CoexistenceReport } from './coexist.js';
|
|
21
23
|
export { apply, DEFAULT_STYLES_DIR, OutputStyleRuntime, STYLE_SECTION_NAME } from './runtime.js';
|
|
22
24
|
export { applyStyleEvent, EMPTY_STYLE_STATE, parseStyleInput, STYLE_COMMAND, } from './style-command.js';
|
|
23
25
|
export type { StyleFoldState, StyleInput } from './style-command.js';
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,6DAA6D;AAC7D,eAAO,MAAM,IAAI,sBAAsB,CAAA;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,UAAoC,CAAA;AAEvD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAChG,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,aAAa,GACd,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,aAAa,GACd,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EACL,GAAG,EACH,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,YAAY,CAAA;AACnB,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACjF,OAA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,MAAM,gBAAgB,CAAA;AAC/D,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAG3F,mBAAmB,YAAY,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAKlE,OAAO,KAAK,EAAE,MAAM,EAA2B,MAAM,iCAAiC,CAAA;AAGtF,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAKlE,OAAO,KAAK,EAAE,MAAM,EAA2B,MAAM,iCAAiC,CAAA;AAGtF,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,aAAa,CAAA;AAGxD,OAAO,EAAmC,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEtF,OAAO,EAAE,mBAAmB,EAAgE,KAAK,cAAc,EAA2B,MAAM,YAAY,CAAA;AAI5J,kGAAkG;AAClG,eAAO,MAAM,kBAAkB,QAAwD,CAAA;AAEvF,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,2BAA2B,CAAA;AAQ1D;;;;;;GAMG;AACH,qBAAa,kBAAkB;IAqB3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IApBzB,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,WAAW,CAAyB;IAE5C,OAA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EAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;CACvH;AAED,yFAAyF;AACzF,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG,sBAAsB,GAAG,iBAAiB,GAAG,oBAAoB,CAAA;AAEtH,sFAAsF;AACtF,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEzF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAClC,EAAE,EAAE,gBAAgB,GAAG,SAAS,EAChC,QAAQ,EAAE,cAAc,GAAG,SAAS,EACpC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAoD3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-output-styles",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Claude Code outputStyles-equivalent runtime output-style switching for DeepSeek Harness",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -133,15 +133,24 @@
|
|
|
133
133
|
},
|
|
134
134
|
"peerDependencies": {
|
|
135
135
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
136
|
+
"@deepseek-ai/dsh-commands": "0.1.1-rc.2",
|
|
136
137
|
"@deepseek-ai/dsh-fs": ">=0.1.0-rc.8 <0.2.0",
|
|
137
138
|
"@deepseek-ai/dsh-session": ">=0.1.0-rc.8 <0.2.0",
|
|
138
139
|
"@deepseek-ai/dsh-session-projection": ">=0.1.1-rc.2 <0.2.0",
|
|
139
140
|
"@deepseek-ai/dsh-settings": ">=0.1.0-rc.8 <0.2.0",
|
|
140
141
|
"@deepseek-ai/dsh-storage-domain": ">=0.1.0-rc.8 <0.2.0",
|
|
142
|
+
"@deepseek-ai/dsh-system-prompt": "0.1.1-rc.2",
|
|
141
143
|
"@deepseek-ai/dsh-user-approval": ">=0.1.0-rc.8 <0.2.0",
|
|
142
|
-
"@deepseek-ai/schemastery": "^3.18.1"
|
|
144
|
+
"@deepseek-ai/schemastery": "^3.18.1",
|
|
145
|
+
"@deepseek-ai/dsh-api-remotes": ">=0.1.1-rc.2 <0.2.0",
|
|
146
|
+
"@deepseek-ai/dsh-client-locale": ">=0.1.1-rc.2 <0.2.0",
|
|
147
|
+
"@deepseek-ai/dsh-client-runtime": ">=0.1.1-rc.2 <0.2.0",
|
|
148
|
+
"@deepseek-ai/dsh-client-ui-commands": ">=0.1.1-rc.2 <0.2.0"
|
|
143
149
|
},
|
|
144
150
|
"peerDependenciesMeta": {
|
|
151
|
+
"@deepseek-ai/dsh-commands": {
|
|
152
|
+
"optional": true
|
|
153
|
+
},
|
|
145
154
|
"@deepseek-ai/dsh-fs": {
|
|
146
155
|
"optional": true
|
|
147
156
|
},
|
|
@@ -151,6 +160,9 @@
|
|
|
151
160
|
"@deepseek-ai/dsh-settings": {
|
|
152
161
|
"optional": true
|
|
153
162
|
},
|
|
163
|
+
"@deepseek-ai/dsh-system-prompt": {
|
|
164
|
+
"optional": true
|
|
165
|
+
},
|
|
154
166
|
"@deepseek-ai/dsh-api-remotes": {
|
|
155
167
|
"optional": true
|
|
156
168
|
},
|
package/src/coexist.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coexistence with a core `outputStyles` capability.
|
|
3
|
+
*
|
|
4
|
+
* If DeepSeek Harness ever ships a first-party `outputStyles` feature, this
|
|
5
|
+
* plugin's system-prompt injection would duplicate it. The coexistence policy
|
|
6
|
+
* detects the core capability through its reserved service seam and, when it
|
|
7
|
+
* is present, degrades to the incremental surface this plugin uniquely adds —
|
|
8
|
+
* runtime hot-switch, per-session/per-tool rules, and `/export` — while
|
|
9
|
+
* leaving prompt injection entirely to the core.
|
|
10
|
+
*
|
|
11
|
+
* Detection is a service probe, not a name guess: a core implementation
|
|
12
|
+
* publishes the `outputStyles` service; when that seam is absent the plugin
|
|
13
|
+
* runs standalone (injecting the style section itself).
|
|
14
|
+
* @module dsh-output-styles/coexist
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
18
|
+
|
|
19
|
+
/** The reserved service name a core `outputStyles` capability publishes. */
|
|
20
|
+
export const CORE_OUTPUT_STYLES_SERVICE = 'outputStyles'
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Probe whether a core `outputStyles` capability is composed.
|
|
24
|
+
* @param ctx - the plugin-scoped context.
|
|
25
|
+
* @returns true when the core `outputStyles` service seam is present.
|
|
26
|
+
*/
|
|
27
|
+
export function detectCoreOutputStyles(ctx: Context): boolean {
|
|
28
|
+
return ctx.get(CORE_OUTPUT_STYLES_SERVICE) !== undefined
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The coexistence mode: standalone owns injection; degraded leaves it to core. */
|
|
32
|
+
export type CoexistenceMode = 'standalone' | 'degraded'
|
|
33
|
+
|
|
34
|
+
/** A runnable coexistence check: what this plugin contributes under the current composition. */
|
|
35
|
+
export interface CoexistenceReport {
|
|
36
|
+
/** Whether a core `outputStyles` capability was detected. */
|
|
37
|
+
readonly coreActive: boolean
|
|
38
|
+
/** The effective coexistence mode. */
|
|
39
|
+
readonly mode: CoexistenceMode
|
|
40
|
+
/** Whether this plugin injects the style system-prompt section. */
|
|
41
|
+
readonly promptInjection: 'enabled' | 'disabled'
|
|
42
|
+
/** The incremental surfaces this plugin always retains. */
|
|
43
|
+
readonly retained: readonly string[]
|
|
44
|
+
/** What this plugin disabled to avoid duplicating the core. */
|
|
45
|
+
readonly disabled: readonly string[]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The incremental surfaces that survive coexistence in either mode. */
|
|
49
|
+
const RETAINED = ['hot-switch', 'rules', 'export'] as const
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Compute the coexistence report for one composition. Respecting the core is
|
|
53
|
+
* the default (`respectCore` true); a deployment can force standalone mode by
|
|
54
|
+
* setting `respectCoreOutputStyles: false`.
|
|
55
|
+
* @param ctx - the plugin-scoped context.
|
|
56
|
+
* @param respectCore - whether to honor a detected core capability (default true).
|
|
57
|
+
* @returns the coexistence report.
|
|
58
|
+
*/
|
|
59
|
+
export function coexistenceReport(ctx: Context, respectCore = true): CoexistenceReport {
|
|
60
|
+
const coreActive = respectCore && detectCoreOutputStyles(ctx)
|
|
61
|
+
return {
|
|
62
|
+
coreActive,
|
|
63
|
+
mode: coreActive ? 'degraded' : 'standalone',
|
|
64
|
+
promptInjection: coreActive ? 'disabled' : 'enabled',
|
|
65
|
+
retained: [...RETAINED],
|
|
66
|
+
disabled: coreActive ? ['system-prompt injection'] : [],
|
|
67
|
+
}
|
|
68
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -63,6 +63,13 @@ export interface Config {
|
|
|
63
63
|
rules?: StyleRuleConfig[]
|
|
64
64
|
/** Register the `/export` command (Markdown/HTML session-export, renderer-aware). */
|
|
65
65
|
enableExport?: boolean
|
|
66
|
+
/**
|
|
67
|
+
* Honor a detected core `outputStyles` capability: when true (default) and
|
|
68
|
+
* the core service is composed, this plugin skips its own system-prompt
|
|
69
|
+
* injection (hot-switch / rules / export stay active). Set false to always
|
|
70
|
+
* inject regardless.
|
|
71
|
+
*/
|
|
72
|
+
respectCoreOutputStyles?: boolean
|
|
66
73
|
}
|
|
67
74
|
|
|
68
75
|
/** Configuration after defaults have been resolved. */
|
|
@@ -87,6 +94,8 @@ export interface ResolvedConfig {
|
|
|
87
94
|
rules: Array<{ match: { tool?: string; contentType?: 'text' | 'markdown' | 'html'; session?: string }; style: string; priority: number }>
|
|
88
95
|
/** Whether the `/export` command registers. */
|
|
89
96
|
enableExport: boolean
|
|
97
|
+
/** Whether a detected core `outputStyles` capability disables prompt injection. */
|
|
98
|
+
respectCoreOutputStyles: boolean
|
|
90
99
|
}
|
|
91
100
|
|
|
92
101
|
/** Loader-visible configuration schema and defaults. */
|
|
@@ -109,6 +118,7 @@ export const Config: z<Config> = z.object({
|
|
|
109
118
|
priority: z.number().required(false),
|
|
110
119
|
})).default([]),
|
|
111
120
|
enableExport: z.boolean().default(true),
|
|
121
|
+
respectCoreOutputStyles: z.boolean().default(true),
|
|
112
122
|
})
|
|
113
123
|
|
|
114
124
|
/**
|
|
@@ -155,5 +165,6 @@ export function resolveConfig(config: Config, defaultStylesDir: string): Resolve
|
|
|
155
165
|
watchStyles: config.watchStyles ?? true,
|
|
156
166
|
rules: (config.rules ?? []).map(rule => ({ ...rule, priority: rule.priority ?? 0 })),
|
|
157
167
|
enableExport: config.enableExport ?? true,
|
|
168
|
+
respectCoreOutputStyles: config.respectCoreOutputStyles ?? true,
|
|
158
169
|
}
|
|
159
170
|
}
|
package/src/index.ts
CHANGED
|
@@ -21,6 +21,8 @@ export const inject = ['systemPrompt', 'storageDomain']
|
|
|
21
21
|
|
|
22
22
|
export { Config, resolveConfig } from './config.ts'
|
|
23
23
|
export type { ResolvedConfig } from './config.ts'
|
|
24
|
+
export { CORE_OUTPUT_STYLES_SERVICE, coexistenceReport, detectCoreOutputStyles } from './coexist.ts'
|
|
25
|
+
export type { CoexistenceMode, CoexistenceReport } from './coexist.ts'
|
|
24
26
|
export { apply, DEFAULT_STYLES_DIR, OutputStyleRuntime, STYLE_SECTION_NAME } from './runtime.ts'
|
|
25
27
|
export {
|
|
26
28
|
applyStyleEvent,
|
package/src/runtime.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type { Domain, DomainFacility, KvTable } from '@deepseek-ai/dsh-storage-d
|
|
|
20
20
|
import z from '@deepseek-ai/schemastery'
|
|
21
21
|
import { installSettingsSection, settingsNamespace } from '@deepseek-ai/dsh-settings'
|
|
22
22
|
import { resolveConfig, type Config } from './config.ts'
|
|
23
|
+
import { detectCoreOutputStyles } from './coexist.ts'
|
|
23
24
|
import { installInvariant, PACKAGE_NAME, type InvariantFacts, type InvariantRegistry } from './invariant.ts'
|
|
24
25
|
import { loadStyleLibrary, truncateStyle, type OutputStyle } from './style-library.ts'
|
|
25
26
|
import { applyStyleEvent, EMPTY_STYLE_STATE, parseStyleInput, STYLE_COMMAND, type StyleFoldState } from './style-command.ts'
|
|
@@ -265,6 +266,14 @@ export async function apply(ctx: Context, config: Config): Promise<void> {
|
|
|
265
266
|
)
|
|
266
267
|
}
|
|
267
268
|
const resolved = resolveConfig(config, DEFAULT_STYLES_DIR)
|
|
269
|
+
// Coexistence with a core outputStyles capability: when it is composed (and
|
|
270
|
+
// respectCoreOutputStyles is true), prompt injection belongs to the core —
|
|
271
|
+
// this plugin keeps hot-switch / rules / export and skips the two injections
|
|
272
|
+
// below to avoid double-injecting a style directive.
|
|
273
|
+
const coreActive = resolved.respectCoreOutputStyles && detectCoreOutputStyles(ctx)
|
|
274
|
+
if (coreActive) {
|
|
275
|
+
ctx.logger.info('dsh-output-styles: core outputStyles detected — degrading to hot-switch + rules + export (no prompt injection)')
|
|
276
|
+
}
|
|
268
277
|
const styles = loadStyleLibrary(
|
|
269
278
|
resolved.stylesDirs,
|
|
270
279
|
{ compatJson: resolved.compatJson },
|
|
@@ -348,36 +357,38 @@ export async function apply(ctx: Context, config: Config): Promise<void> {
|
|
|
348
357
|
},
|
|
349
358
|
)
|
|
350
359
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
360
|
+
if (!coreActive) {
|
|
361
|
+
ctx.systemPrompt.section({
|
|
362
|
+
name: STYLE_SECTION_NAME,
|
|
363
|
+
order: resolved.sectionOrder,
|
|
364
|
+
text: (context: AssembleContext) => {
|
|
365
|
+
const agent = context.agent
|
|
366
|
+
if (agent === undefined) return ''
|
|
367
|
+
const style = runtime.effectiveStyle(agent.session.id)
|
|
368
|
+
// A keep-coding-instructions: false style owns the whole prompt: the
|
|
369
|
+
// assembly waterfall below rebuilds the section list, so this section
|
|
370
|
+
// stays silent instead of double-injecting.
|
|
371
|
+
if (style === undefined || !style.keepCodingInstructions) return ''
|
|
372
|
+
return runtime.promptText(agent.session.id)
|
|
373
|
+
},
|
|
374
|
+
})
|
|
375
|
+
|
|
376
|
+
// Claude Code keep-coding-instructions: false — the active style replaces
|
|
377
|
+
// the whole system prompt. The waterfall runs after downstream
|
|
378
|
+
// contributions resolve (tools, contexts, and variables still assemble),
|
|
379
|
+
// then swaps in a single style section.
|
|
380
|
+
ctx.on('system-prompt/assemble', async (_assembly: PromptAssembly, context: AssembleContext, next) => {
|
|
381
|
+
const out = await next()
|
|
355
382
|
const agent = context.agent
|
|
356
|
-
if (agent === undefined) return
|
|
383
|
+
if (agent === undefined) return out
|
|
357
384
|
const style = runtime.effectiveStyle(agent.session.id)
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
// Claude Code keep-coding-instructions: false — the active style replaces
|
|
367
|
-
// the whole system prompt. The waterfall runs after downstream
|
|
368
|
-
// contributions resolve (tools, contexts, and variables still assemble),
|
|
369
|
-
// then swaps in a single style section.
|
|
370
|
-
ctx.on('system-prompt/assemble', async (_assembly: PromptAssembly, context: AssembleContext, next) => {
|
|
371
|
-
const out = await next()
|
|
372
|
-
const agent = context.agent
|
|
373
|
-
if (agent === undefined) return out
|
|
374
|
-
const style = runtime.effectiveStyle(agent.session.id)
|
|
375
|
-
if (style === undefined || style.keepCodingInstructions) return out
|
|
376
|
-
return {
|
|
377
|
-
...out,
|
|
378
|
-
sections: [{ name: STYLE_SECTION_NAME, text: runtime.promptText(agent.session.id) }],
|
|
379
|
-
}
|
|
380
|
-
})
|
|
385
|
+
if (style === undefined || style.keepCodingInstructions) return out
|
|
386
|
+
return {
|
|
387
|
+
...out,
|
|
388
|
+
sections: [{ name: STYLE_SECTION_NAME, text: runtime.promptText(agent.session.id) }],
|
|
389
|
+
}
|
|
390
|
+
})
|
|
391
|
+
}
|
|
381
392
|
|
|
382
393
|
// The /style command: the one write path a web client uses. The child
|
|
383
394
|
// activates only when a command registry is composed (headless assemblies
|