dsh-context 0.68.0 → 0.68.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/README.md +3 -1
- package/lib/client.js +9 -8
- package/lib/index.d.ts +8 -0
- package/lib/index.js +46 -5
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -233,6 +233,10 @@ interface PluginSettings {
|
|
|
233
233
|
insightsEntry: InsightsEntry;
|
|
234
234
|
defaultDurationCurve: DefaultDurationCurve;
|
|
235
235
|
fleetTab: FleetTab;
|
|
236
|
+
/** Free text joined ahead of the harness's assembled system prompt; empty disables. */
|
|
237
|
+
promptPrefix: string;
|
|
238
|
+
/** Free text joined behind the harness's assembled system prompt; empty disables. */
|
|
239
|
+
promptSuffix: string;
|
|
236
240
|
}
|
|
237
241
|
interface Snapshot {
|
|
238
242
|
ok: boolean;
|
|
@@ -563,6 +567,8 @@ export declare const Config: z$1<Schemastery.ObjectS<NoInfer<{
|
|
|
563
567
|
insightsEntry: z$1<"hide" | "show", "hide" | "show", "defined">;
|
|
564
568
|
defaultDurationCurve: z$1<"hide" | "show", "hide" | "show", "defined">;
|
|
565
569
|
fleetTab: z$1<"hide" | "show", "hide" | "show", "defined">;
|
|
570
|
+
promptPrefix: z$1<string, string, "defined">;
|
|
571
|
+
promptSuffix: z$1<string, string, "defined">;
|
|
566
572
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
567
573
|
maxRequestSteps: z$1<number, number, "defined">;
|
|
568
574
|
maxKeptTurns: z$1<number, number, "defined">;
|
|
@@ -579,6 +585,8 @@ export declare const Config: z$1<Schemastery.ObjectS<NoInfer<{
|
|
|
579
585
|
insightsEntry: z$1<"hide" | "show", "hide" | "show", "defined">;
|
|
580
586
|
defaultDurationCurve: z$1<"hide" | "show", "hide" | "show", "defined">;
|
|
581
587
|
fleetTab: z$1<"hide" | "show", "hide" | "show", "defined">;
|
|
588
|
+
promptPrefix: z$1<string, string, "defined">;
|
|
589
|
+
promptSuffix: z$1<string, string, "defined">;
|
|
582
590
|
}>>, "plain">;
|
|
583
591
|
//#endregion
|
|
584
592
|
//#region src/host/index.d.ts
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* dsh-context v0.68.
|
|
2
|
+
* dsh-context v0.68.1
|
|
3
3
|
* A DeepSeek Harness plugin for context insight and management, with context dashboard and context command, for understanding how the context is made of, and how it evolves.
|
|
4
4
|
* @author bowenliang123
|
|
5
5
|
* @license Apache-2.0
|
|
6
6
|
* @homepage https://github.com/bowenliang123/dsh-context
|
|
7
|
-
* @built 2026-10-
|
|
8
|
-
* @commit
|
|
9
|
-
* @commit-date 2026-10-
|
|
7
|
+
* @built 2026-10-11T13:11:54+00:00
|
|
8
|
+
* @commit 2c8095c34da3
|
|
9
|
+
* @commit-date 2026-10-11T21:08:45+08:00
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { createRequire } from "node:module";
|
|
@@ -1558,7 +1558,9 @@ const Config = z$1.object({
|
|
|
1558
1558
|
]).default("count").loose()),
|
|
1559
1559
|
insightsEntry: volatileField(z$1.union(["show", "hide"]).default("show").loose()),
|
|
1560
1560
|
defaultDurationCurve: volatileField(z$1.union(["show", "hide"]).default("show").loose()),
|
|
1561
|
-
fleetTab: volatileField(z$1.union(["show", "hide"]).default("show").loose())
|
|
1561
|
+
fleetTab: volatileField(z$1.union(["show", "hide"]).default("show").loose()),
|
|
1562
|
+
promptPrefix: volatileField(z$1.string().default("").loose()),
|
|
1563
|
+
promptSuffix: volatileField(z$1.string().default("").loose())
|
|
1562
1564
|
});
|
|
1563
1565
|
function resolveBounds(config) {
|
|
1564
1566
|
const resolved = Config(config ?? {});
|
|
@@ -2970,6 +2972,44 @@ function watchFleetChannel(ctx, coldReads = makeColdReadGate()) {
|
|
|
2970
2972
|
});
|
|
2971
2973
|
}
|
|
2972
2974
|
//#endregion
|
|
2975
|
+
//#region src/host/promptInjection.ts
|
|
2976
|
+
function liveText(value) {
|
|
2977
|
+
if (value !== null && typeof value === "object" && typeof value.get === "function") {
|
|
2978
|
+
const get = value.get;
|
|
2979
|
+
return () => {
|
|
2980
|
+
const text = get();
|
|
2981
|
+
return typeof text === "string" ? text : "";
|
|
2982
|
+
};
|
|
2983
|
+
}
|
|
2984
|
+
const text = typeof value === "string" ? value : "";
|
|
2985
|
+
return () => text;
|
|
2986
|
+
}
|
|
2987
|
+
function sectionText(read) {
|
|
2988
|
+
return () => {
|
|
2989
|
+
const text = read();
|
|
2990
|
+
return text.trim().length === 0 ? "" : text;
|
|
2991
|
+
};
|
|
2992
|
+
}
|
|
2993
|
+
const ORDER_CLEARANCE = 1e3;
|
|
2994
|
+
function watchPromptInjection(ctx, config) {
|
|
2995
|
+
ctx.inject(["systemPrompt"], (inner) => {
|
|
2996
|
+
const systemPrompt = inner.systemPrompt;
|
|
2997
|
+
if (systemPrompt === null || systemPrompt === void 0 || typeof systemPrompt.section !== "function" || typeof systemPrompt.getSectionOrder !== "function") return;
|
|
2998
|
+
systemPrompt.section({
|
|
2999
|
+
name: "dsh-context:prompt-prefix",
|
|
3000
|
+
order: systemPrompt.getSectionOrder("HARNESS_IDENTITY") - ORDER_CLEARANCE,
|
|
3001
|
+
text: sectionText(liveText(config.promptPrefix)),
|
|
3002
|
+
interpolate: false
|
|
3003
|
+
});
|
|
3004
|
+
systemPrompt.section({
|
|
3005
|
+
name: "dsh-context:prompt-suffix",
|
|
3006
|
+
order: systemPrompt.getSectionOrder("DEPLOYMENT_PERSONA_SUFFIX") + ORDER_CLEARANCE,
|
|
3007
|
+
text: sectionText(liveText(config.promptSuffix)),
|
|
3008
|
+
interpolate: false
|
|
3009
|
+
});
|
|
3010
|
+
});
|
|
3011
|
+
}
|
|
3012
|
+
//#endregion
|
|
2973
3013
|
//#region src/host/stepIdentity.ts
|
|
2974
3014
|
const MINTED_ID_PREFIX = "dshctx-";
|
|
2975
3015
|
function lacksId(message) {
|
|
@@ -3241,6 +3281,7 @@ function apply(ctx, config) {
|
|
|
3241
3281
|
ctx.sessionProjections.register(createContextHeadersDefinition((name) => attribution.ownerOf(name)));
|
|
3242
3282
|
ctx.sessionProjections.register(createContextActivityDefinition());
|
|
3243
3283
|
watchActivityBackfill(ctx, coldReads);
|
|
3284
|
+
watchPromptInjection(ctx, config);
|
|
3244
3285
|
}
|
|
3245
3286
|
//#endregion
|
|
3246
3287
|
export { Config, apply, inject, name };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-context",
|
|
3
|
-
"version": "0.68.
|
|
3
|
+
"version": "0.68.1",
|
|
4
4
|
"description": "A DeepSeek Harness plugin for context insight and management, with context dashboard and context command, for understanding how the context is made of, and how it evolves.",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"author": "bowenliang123",
|