dsh-context-redline 0.1.0 → 0.1.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 +21 -1
- package/README.md +6 -4
- package/README.zh.md +6 -4
- package/UPSTREAM.md +8 -0
- package/lib/client.js +17 -17
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +25 -19
- package/package.json +32 -34
package/lib/index.d.ts
CHANGED
|
@@ -880,6 +880,6 @@ export declare const Config: z$1<Schemastery.ObjectS<NoInfer<{
|
|
|
880
880
|
//#region src/host/index.d.ts
|
|
881
881
|
export declare const name = "dsh-context-redline";
|
|
882
882
|
export declare const inject: string[];
|
|
883
|
-
export declare function apply(ctx: Context, config: Config): void
|
|
883
|
+
export declare function apply(ctx: Context, config: Config): Promise<void>;
|
|
884
884
|
//#endregion
|
|
885
885
|
export type { ActivityDay, ActivityState, Category, ContextActivity, ContextEventRecord, ContextHeaders, ContextTimeline, ContextTimelineDetail, HeaderRecord, HeaderTool, HeadersState, PlatformBalance, PlatformBalanceEntry, RequestRecord, Snapshot, SurfaceNode, TimelineCounts, TimelineLast, TimelineState };
|
package/lib/index.js
CHANGED
|
@@ -2732,7 +2732,7 @@ function failure(code, message) {
|
|
|
2732
2732
|
* registration rides the injected fiber: either service unloading withdraws
|
|
2733
2733
|
* the route and closes the gate.
|
|
2734
2734
|
*/
|
|
2735
|
-
function watchDetailChannel(ctx, bounds) {
|
|
2735
|
+
function watchDetailChannel(ctx, bounds, timeline) {
|
|
2736
2736
|
const gate = { live: false };
|
|
2737
2737
|
ctx.inject(["connection", "sessions"], (c) => {
|
|
2738
2738
|
const connection = c.get("connection");
|
|
@@ -2740,7 +2740,6 @@ function watchDetailChannel(ctx, bounds) {
|
|
|
2740
2740
|
const register = typeof connection?.fetch?.register === "function" ? connection.fetch.register.bind(connection.fetch) : void 0;
|
|
2741
2741
|
const getSession = typeof sessions?.get === "function" ? sessions.get.bind(sessions) : void 0;
|
|
2742
2742
|
if (register === void 0 || getSession === void 0) return;
|
|
2743
|
-
const projections = ctx.sessionProjections;
|
|
2744
2743
|
const handler = async (request) => {
|
|
2745
2744
|
let sessionId;
|
|
2746
2745
|
try {
|
|
@@ -2753,7 +2752,7 @@ function watchDetailChannel(ctx, bounds) {
|
|
|
2753
2752
|
try {
|
|
2754
2753
|
const session = getSession(sessionId);
|
|
2755
2754
|
if (session !== void 0 && session !== null) {
|
|
2756
|
-
const state =
|
|
2755
|
+
const state = timeline.stateOf(session);
|
|
2757
2756
|
if (state === void 0) return reply$1({
|
|
2758
2757
|
ok: true,
|
|
2759
2758
|
value: null
|
|
@@ -2821,7 +2820,7 @@ function watchDetailChannel(ctx, bounds) {
|
|
|
2821
2820
|
* than loading API contracts it cannot satisfy.
|
|
2822
2821
|
*/
|
|
2823
2822
|
/** The oldest supported dsh release (see the note above). */
|
|
2824
|
-
const BASELINE_DSH_VERSION = "0.2.
|
|
2823
|
+
const BASELINE_DSH_VERSION = "0.2.2-rc.1";
|
|
2825
2824
|
/**
|
|
2826
2825
|
* Release-channel rank at an equal X.Y.Z: a final release outranks its
|
|
2827
2826
|
* release candidates, which outrank betas, which outrank alphas
|
|
@@ -3416,6 +3415,11 @@ function createFallbackActivityDefinition() {
|
|
|
3416
3415
|
return fallbackDefinition("redlineActivity", redlineActivitySchema, { days: {} });
|
|
3417
3416
|
}
|
|
3418
3417
|
//#endregion
|
|
3418
|
+
//#region src/host/redline-model-selection.ts
|
|
3419
|
+
function currentModelSelection(agent) {
|
|
3420
|
+
return agent.model === void 0 ? agent.options : agent.model.current();
|
|
3421
|
+
}
|
|
3422
|
+
//#endregion
|
|
3419
3423
|
//#region src/shared/redline-errors.ts
|
|
3420
3424
|
/**
|
|
3421
3425
|
* The stable error-code table shared by BOTH halves — the plugin's outward
|
|
@@ -5118,8 +5122,8 @@ function createRedlineSessionControl(ctx) {
|
|
|
5118
5122
|
handles.set(request.carrierId, handle);
|
|
5119
5123
|
agent = handle.agent;
|
|
5120
5124
|
}
|
|
5121
|
-
const actual = agent
|
|
5122
|
-
if (actual === void 0 || actual.provider !== request.agentOptions.provider || actual.model !== request.agentOptions.model || actual.reasoningEffort !== request.agentOptions.reasoningEffort || request.agentOptions.maxTokens !== void 0 &&
|
|
5125
|
+
const actual = currentModelSelection(agent);
|
|
5126
|
+
if (actual === void 0 || actual.provider !== request.agentOptions.provider || actual.model !== request.agentOptions.model || actual.reasoningEffort !== request.agentOptions.reasoningEffort || request.agentOptions.maxTokens !== void 0 && agent.options?.maxTokens !== request.agentOptions.maxTokens) return {
|
|
5123
5127
|
ok: false,
|
|
5124
5128
|
state: "unknown",
|
|
5125
5129
|
cause: "carrier-config-mismatch"
|
|
@@ -5961,16 +5965,17 @@ function fixedCarrierIds(operationId) {
|
|
|
5961
5965
|
};
|
|
5962
5966
|
}
|
|
5963
5967
|
function confirmedConfigOf(ctx, agent) {
|
|
5964
|
-
const
|
|
5965
|
-
const
|
|
5968
|
+
const selection = currentModelSelection(agent);
|
|
5969
|
+
const provider = selection?.provider;
|
|
5970
|
+
const model = selection?.model;
|
|
5966
5971
|
const presets = ctx.get("agentPresets");
|
|
5967
|
-
const preset =
|
|
5968
|
-
if (provider === void 0 || model === void 0 || preset === void 0) return null;
|
|
5972
|
+
const preset = typeof presets?.presetForSession === "function" && agent.session !== void 0 ? presets.presetForSession(agent.session) : agent.ctx !== void 0 && typeof presets?.composedPreset === "function" ? presets.composedPreset(agent.ctx) : agent.session?.header?.agentPreset;
|
|
5973
|
+
if (provider === void 0 || model === void 0 || preset === void 0 || preset === null) return null;
|
|
5969
5974
|
return {
|
|
5970
5975
|
agentPreset: preset,
|
|
5971
5976
|
provider,
|
|
5972
5977
|
model,
|
|
5973
|
-
reasoningEffort:
|
|
5978
|
+
reasoningEffort: selection?.reasoningEffort ?? "not-specified",
|
|
5974
5979
|
inheritedFrom: "source-session-explicit-config"
|
|
5975
5980
|
};
|
|
5976
5981
|
}
|
|
@@ -6799,23 +6804,24 @@ function detectHarnessVersion(ctx, resolveUrl = resolveRunningModule, pluginRoot
|
|
|
6799
6804
|
//#region src/host/index.ts
|
|
6800
6805
|
const name = "dsh-context-redline";
|
|
6801
6806
|
const inject = ["sessionProjections"];
|
|
6802
|
-
function apply(ctx, config) {
|
|
6807
|
+
async function apply(ctx, config) {
|
|
6803
6808
|
watchCarrierRecovery(ctx);
|
|
6804
6809
|
watchRedlineChannel(ctx);
|
|
6805
6810
|
watchBalanceChannel(ctx);
|
|
6806
6811
|
const harnessVersion = detectHarnessVersion(ctx);
|
|
6807
6812
|
if (harnessVersion !== void 0 && !meetsBaseline(harnessVersion)) {
|
|
6808
|
-
ctx.sessionProjections.register(createFallbackTimelineDefinition(harnessVersion));
|
|
6809
|
-
ctx.sessionProjections.register(createFallbackHeadersDefinition());
|
|
6810
|
-
ctx.sessionProjections.register(createFallbackActivityDefinition());
|
|
6813
|
+
await ctx.sessionProjections.register(createFallbackTimelineDefinition(harnessVersion));
|
|
6814
|
+
await ctx.sessionProjections.register(createFallbackHeadersDefinition());
|
|
6815
|
+
await ctx.sessionProjections.register(createFallbackActivityDefinition());
|
|
6811
6816
|
return;
|
|
6812
6817
|
}
|
|
6813
6818
|
const attribution = createToolAttribution(ctx);
|
|
6814
6819
|
watchStepIdentity(ctx);
|
|
6815
|
-
|
|
6816
|
-
ctx.sessionProjections.register(createContextTimelineDefinition(config, () => gate.live));
|
|
6817
|
-
ctx.sessionProjections.register(createContextHeadersDefinition((name) => attribution.ownerOf(name)));
|
|
6818
|
-
ctx.sessionProjections.register(createContextActivityDefinition());
|
|
6820
|
+
let gate = { live: false };
|
|
6821
|
+
const timeline = await ctx.sessionProjections.register(createContextTimelineDefinition(config, () => gate.live));
|
|
6822
|
+
await ctx.sessionProjections.register(createContextHeadersDefinition((name) => attribution.ownerOf(name)));
|
|
6823
|
+
await ctx.sessionProjections.register(createContextActivityDefinition());
|
|
6824
|
+
gate = watchDetailChannel(ctx, resolveBounds(config), timeline);
|
|
6819
6825
|
watchActivityBackfill(ctx);
|
|
6820
6826
|
}
|
|
6821
6827
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-context-redline",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "上下文批改 (Context Redline) — review, edit, or delete the context a model will receive; open a zero-history ordinary session with the confirmed content; and return its bound result verbatim to the source session. Independent fork of dsh-context (Apache-2.0 portions; provenance in UPSTREAM.md).",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"repository": {
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"type": "module",
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": "
|
|
20
|
-
"dsh": ">=0.2.
|
|
19
|
+
"node": ">=24.9.0",
|
|
20
|
+
"dsh": ">=0.2.2-rc.1 <0.3.0-0"
|
|
21
21
|
},
|
|
22
22
|
"main": "lib/index.js",
|
|
23
23
|
"types": "lib/index.d.ts",
|
|
@@ -46,17 +46,6 @@
|
|
|
46
46
|
"NOTICE",
|
|
47
47
|
"UPSTREAM.md"
|
|
48
48
|
],
|
|
49
|
-
"scripts": {
|
|
50
|
-
"build": "tsdown",
|
|
51
|
-
"prepack": "pnpm run build",
|
|
52
|
-
"pack:check": "pnpm pack --dry-run",
|
|
53
|
-
"typecheck": "tsc --noEmit",
|
|
54
|
-
"lint": "oxlint",
|
|
55
|
-
"namespace-contract": "node scripts/namespace-contract.mjs",
|
|
56
|
-
"test": "vitest run --project edit --project channel --project client-logic --project client-ui",
|
|
57
|
-
"test:upstream": "vitest run --project host --project client",
|
|
58
|
-
"verify": "pnpm run typecheck && pnpm run lint && node scripts/check-docs.mjs && pnpm run namespace-contract && node scripts/css-closure.mjs && node scripts/i18n-orphans.mjs && pnpm run build && pnpm run test"
|
|
59
|
-
},
|
|
60
49
|
"dsh": {
|
|
61
50
|
"manifestVersion": 1,
|
|
62
51
|
"bundle": {
|
|
@@ -86,15 +75,15 @@
|
|
|
86
75
|
],
|
|
87
76
|
"license": "MIT AND Apache-2.0",
|
|
88
77
|
"dependencies": {
|
|
89
|
-
"zod": "
|
|
78
|
+
"zod": "4.4.3"
|
|
90
79
|
},
|
|
91
80
|
"peerDependencies": {
|
|
92
|
-
"@deepseek-ai/cordis": ">=4.0
|
|
93
|
-
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.
|
|
94
|
-
"@deepseek-ai/dsh-llm": ">=0.2.
|
|
95
|
-
"@deepseek-ai/dsh-session": ">=0.2.
|
|
96
|
-
"@deepseek-ai/dsh-settings": ">=0.2.
|
|
97
|
-
"@deepseek-ai/schemastery": ">=3.
|
|
81
|
+
"@deepseek-ai/cordis": ">=4.1.0 <5.0.0",
|
|
82
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.2-rc.1 <0.3.0-0",
|
|
83
|
+
"@deepseek-ai/dsh-llm": ">=0.2.2-rc.1 <0.3.0-0",
|
|
84
|
+
"@deepseek-ai/dsh-session": ">=0.2.2-rc.1 <0.3.0-0",
|
|
85
|
+
"@deepseek-ai/dsh-settings": ">=0.2.2-rc.1 <0.3.0-0",
|
|
86
|
+
"@deepseek-ai/schemastery": ">=3.19.0 <4.0.0",
|
|
98
87
|
"react": "^18.3.1",
|
|
99
88
|
"react-dom": "^18.3.1"
|
|
100
89
|
},
|
|
@@ -110,17 +99,17 @@
|
|
|
110
99
|
}
|
|
111
100
|
},
|
|
112
101
|
"devDependencies": {
|
|
113
|
-
"@deepseek-ai/cordis": "4.0
|
|
114
|
-
"@deepseek-ai/dsh-client-store": "0.2.
|
|
115
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.2.
|
|
116
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
117
|
-
"@deepseek-ai/dsh-scope": "0.2.
|
|
118
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
119
|
-
"@deepseek-ai/dsh-session-projection": "0.2.
|
|
120
|
-
"@deepseek-ai/dsh-settings": "0.2.
|
|
121
|
-
"@deepseek-ai/dsh-util-code-language": "0.2.
|
|
122
|
-
"@deepseek-ai/dsh-util-workspace-path": "0.2.
|
|
123
|
-
"@deepseek-ai/schemastery": "3.
|
|
102
|
+
"@deepseek-ai/cordis": "4.1.0",
|
|
103
|
+
"@deepseek-ai/dsh-client-store": "0.2.2-rc.1",
|
|
104
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.2-rc.1",
|
|
105
|
+
"@deepseek-ai/dsh-llm": "0.2.2-rc.1",
|
|
106
|
+
"@deepseek-ai/dsh-scope": "0.2.2-rc.1",
|
|
107
|
+
"@deepseek-ai/dsh-session": "0.2.2-rc.1",
|
|
108
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-rc.1",
|
|
109
|
+
"@deepseek-ai/dsh-settings": "0.2.2-rc.1",
|
|
110
|
+
"@deepseek-ai/dsh-util-code-language": "0.2.2-rc.1",
|
|
111
|
+
"@deepseek-ai/dsh-util-workspace-path": "0.2.2-rc.1",
|
|
112
|
+
"@deepseek-ai/schemastery": "3.19.0",
|
|
124
113
|
"@opencode-ai/models": "^0.0.93",
|
|
125
114
|
"@shikijs/langs": "^4.3.1",
|
|
126
115
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
@@ -160,5 +149,14 @@
|
|
|
160
149
|
"vitest": "^4.1.11",
|
|
161
150
|
"zustand": "^5.0.0"
|
|
162
151
|
},
|
|
163
|
-
"
|
|
164
|
-
|
|
152
|
+
"scripts": {
|
|
153
|
+
"build": "tsdown",
|
|
154
|
+
"pack:check": "pnpm pack --dry-run",
|
|
155
|
+
"typecheck": "tsc --noEmit",
|
|
156
|
+
"lint": "oxlint",
|
|
157
|
+
"namespace-contract": "node scripts/namespace-contract.mjs",
|
|
158
|
+
"test": "vitest run --project edit --project channel --project client-logic --project client-ui",
|
|
159
|
+
"test:upstream": "vitest run --project host --project client",
|
|
160
|
+
"verify": "pnpm run typecheck && pnpm run lint && node scripts/check-docs.mjs && pnpm run namespace-contract && node scripts/css-closure.mjs && node scripts/i18n-orphans.mjs && pnpm run build && pnpm run test"
|
|
161
|
+
}
|
|
162
|
+
}
|