@morlay/dsh-session-mode 0.0.8 → 0.0.9
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 +7 -11
- package/dist/catalog-DWxIg3qw.mjs +131 -0
- package/dist/catalog-K5cESbqA.cjs +136 -0
- package/dist/catalog-remote-B7ZgYqun.cjs +28 -0
- package/dist/{catalog-remote-B-NMi_vS.mjs → catalog-remote-KXJjDaN6.mjs} +1 -5
- package/dist/client.cjs +61 -16357
- package/dist/client.d.cts +3 -326
- package/dist/client.d.mts +3 -326
- package/dist/client.mjs +1612 -0
- package/dist/index.cjs +635 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +45 -169
- package/dist/rows.cjs +85 -0
- package/dist/rows.mjs +2 -5
- package/dist/shared-DX2Giyh3.mjs +5 -0
- package/dist/shared-sy45ixVR.cjs +16 -0
- package/dist/testing.cjs +6 -0
- package/dist/testing.d.mts +35 -0
- package/dist/testing.mjs +3 -0
- package/package.json +72 -60
- package/src/client/BundleConfigPage.tsx +12 -11
- package/src/client/SessionModeSeat.tsx +1 -1
- package/src/client/bundle-config.ts +1 -1
- package/src/client/bundle-locales.ts +4 -2
- package/src/client/index.ts +8 -12
- package/src/client/llm-directory.ts +7 -4
- package/src/index.ts +4 -1
- package/src/mode-sources.ts +11 -8
- package/src/modes.ts +6 -5
- package/src/scope.ts +74 -65
- package/src/testing.ts +3 -0
- package/dist/index.d.cts +0 -146
- package/dist/rows.d.cts +0 -11
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as SessionModeCatalog } from "./catalog-DWxIg3qw.mjs";
|
|
2
|
+
import { n as SESSION_MODE_PATH, t as POLICY_NAMES } from "./shared-DX2Giyh3.mjs";
|
|
2
3
|
import { Service } from "@deepseek-ai/cordis";
|
|
3
4
|
import { ReasoningEffortId } from "@deepseek-ai/dsh-llm";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
import z$1 from "@deepseek-ai/schemastery";
|
|
6
|
-
import { Remote, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
7
7
|
import { PERSONA_PREFIX_SECTION, PERSONA_SUFFIX_SECTION } from "@deepseek-ai/dsh-system-prompt";
|
|
8
8
|
//#region src/modes.ts
|
|
9
9
|
function derivedSkills(mode) {
|
|
@@ -81,8 +81,8 @@ const modeSchema = z$1.object({
|
|
|
81
81
|
en: "Whether the skill catalog applies (the official `skill-catalog` injection). The default derives it from this mode's own tool lists: it applies when `(empty allowTools ? every tool : allowTools) − denyTools` contains `skill`; `false` drops the official `skill-catalog` injection (`skill` tool visibility still belongs to `allowTools`)."
|
|
82
82
|
})),
|
|
83
83
|
runtimeContext: z$1.boolean().default(true).description(localized({
|
|
84
|
-
zh: "
|
|
85
|
-
en: "Whether the runtime snapshot
|
|
84
|
+
zh: "是否要动态快照(文件沙箱策略、审批策略)与时钟注入(`standard` 那类 preset 声明的 `time-context`)。",
|
|
85
|
+
en: "Whether the runtime snapshot (sandbox and approval policy) and the clock injection (`time-context`, declared by presets such as `standard`) apply."
|
|
86
86
|
})),
|
|
87
87
|
defaultModel: modelSchema.default(null).description(localized({
|
|
88
88
|
zh: "这个模式的默认模型;不设就跟全局默认模型。只在会话还没有模型事实时接管。",
|
|
@@ -122,134 +122,6 @@ function configProblem(config) {
|
|
|
122
122
|
if (partial.length > 0) return `session-mode: mode(s) ${partial.join(", ")} declare \`defaultModel\` without both \`provider\` and \`model\``;
|
|
123
123
|
}
|
|
124
124
|
//#endregion
|
|
125
|
-
//#region src/catalog.ts
|
|
126
|
-
var __create = Object.create;
|
|
127
|
-
var __defProp = Object.defineProperty;
|
|
128
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
129
|
-
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
130
|
-
var __typeError = (msg) => {
|
|
131
|
-
throw TypeError(msg);
|
|
132
|
-
};
|
|
133
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
134
|
-
enumerable: true,
|
|
135
|
-
configurable: true,
|
|
136
|
-
writable: true,
|
|
137
|
-
value
|
|
138
|
-
}) : obj[key] = value;
|
|
139
|
-
var __name = (target, value) => __defProp(target, "name", {
|
|
140
|
-
value,
|
|
141
|
-
configurable: true
|
|
142
|
-
});
|
|
143
|
-
var __decoratorStart = (base) => [
|
|
144
|
-
,
|
|
145
|
-
,
|
|
146
|
-
,
|
|
147
|
-
__create(base?.[__knownSymbol("metadata")] ?? null)
|
|
148
|
-
];
|
|
149
|
-
var __decoratorStrings = [
|
|
150
|
-
"class",
|
|
151
|
-
"method",
|
|
152
|
-
"getter",
|
|
153
|
-
"setter",
|
|
154
|
-
"accessor",
|
|
155
|
-
"field",
|
|
156
|
-
"value",
|
|
157
|
-
"get",
|
|
158
|
-
"set"
|
|
159
|
-
];
|
|
160
|
-
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
161
|
-
var __decoratorContext = (kind, name, done, metadata, fns) => ({
|
|
162
|
-
kind: __decoratorStrings[kind],
|
|
163
|
-
name,
|
|
164
|
-
metadata,
|
|
165
|
-
addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null))
|
|
166
|
-
});
|
|
167
|
-
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
|
168
|
-
var __runInitializers = (array, flags, self, value) => {
|
|
169
|
-
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
|
|
170
|
-
return value;
|
|
171
|
-
};
|
|
172
|
-
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
173
|
-
var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
|
|
174
|
-
var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
|
|
175
|
-
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
176
|
-
var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : {
|
|
177
|
-
get [name]() {
|
|
178
|
-
return __privateGet(this, extra);
|
|
179
|
-
},
|
|
180
|
-
set [name](x) {
|
|
181
|
-
return __privateSet(this, extra, x);
|
|
182
|
-
}
|
|
183
|
-
}, name));
|
|
184
|
-
k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
|
185
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
186
|
-
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
|
187
|
-
if (k) {
|
|
188
|
-
ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
|
|
189
|
-
if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
190
|
-
if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
|
|
191
|
-
}
|
|
192
|
-
it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : {
|
|
193
|
-
get: desc.get,
|
|
194
|
-
set: desc.set
|
|
195
|
-
} : target, ctx), done._ = 1;
|
|
196
|
-
if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
|
|
197
|
-
else if (typeof it !== "object" || it === null) __typeError("Object expected");
|
|
198
|
-
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
|
199
|
-
}
|
|
200
|
-
return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
201
|
-
};
|
|
202
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
203
|
-
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError("Cannot use the \"in\" operator on this value") : member.has(obj);
|
|
204
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
205
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
206
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
207
|
-
var _remoteExportList_dec;
|
|
208
|
-
var _a;
|
|
209
|
-
var _init;
|
|
210
|
-
function cwdOf(agent) {
|
|
211
|
-
const cwd = agent.session?.header?.cwd;
|
|
212
|
-
return typeof cwd === "string" ? cwd : void 0;
|
|
213
|
-
}
|
|
214
|
-
var SessionModeCatalog = class extends (_a = TypertRemoteService, _remoteExportList_dec = [Remote("list")], _a) {
|
|
215
|
-
/**
|
|
216
|
-
* @param ctx - owning context (the `session-mode` row).
|
|
217
|
-
*/
|
|
218
|
-
constructor(ctx) {
|
|
219
|
-
super(ctx, CATALOG_NS);
|
|
220
|
-
__runInitializers(_init, 5, this);
|
|
221
|
-
}
|
|
222
|
-
async remoteExportList() {
|
|
223
|
-
return {
|
|
224
|
-
tools: this.toolNames(),
|
|
225
|
-
skills: await this.skillNames()
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
toolNames() {
|
|
229
|
-
const tools = this.ctx.get("tools");
|
|
230
|
-
if (tools === void 0) return [];
|
|
231
|
-
const names = new Set(tools.schemas().map((schema) => String(schema.name)));
|
|
232
|
-
for (const agent of this.agents()) for (const schema of tools.schemas(agent)) names.add(String(schema.name));
|
|
233
|
-
return [...names];
|
|
234
|
-
}
|
|
235
|
-
async skillNames() {
|
|
236
|
-
const skills = this.ctx.get("skills");
|
|
237
|
-
if (skills === void 0) return [];
|
|
238
|
-
const names = new Set((await skills.list()).map((row) => row.name));
|
|
239
|
-
for (const agent of this.agents()) for (const row of await skills.list({
|
|
240
|
-
scope: agent,
|
|
241
|
-
cwd: cwdOf(agent)
|
|
242
|
-
})) names.add(row.name);
|
|
243
|
-
return [...names];
|
|
244
|
-
}
|
|
245
|
-
agents() {
|
|
246
|
-
return this.ctx.get("agents")?.list() ?? [];
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
_init = __decoratorStart(_a);
|
|
250
|
-
__decorateElement(_init, 1, "remoteExportList", _remoteExportList_dec, SessionModeCatalog);
|
|
251
|
-
__decoratorMetadata(_init, SessionModeCatalog);
|
|
252
|
-
//#endregion
|
|
253
125
|
//#region src/persona.ts
|
|
254
126
|
const PREFIX_ORDER = "DEPLOYMENT_PERSONA_PREFIX";
|
|
255
127
|
const SUFFIX_ORDER = "DEPLOYMENT_PERSONA_SUFFIX";
|
|
@@ -355,40 +227,6 @@ var SessionScope = class {
|
|
|
355
227
|
tools: result.tools.filter((tool) => denialOf(gate, tool.name) === void 0)
|
|
356
228
|
};
|
|
357
229
|
});
|
|
358
|
-
ctx.on("agent/pre-step", async (payload, next) => {
|
|
359
|
-
const decision = await next();
|
|
360
|
-
if (decision.kind !== "enter") return decision;
|
|
361
|
-
const applied = this.applied.get(payload.agent);
|
|
362
|
-
if (applied === void 0) return decision;
|
|
363
|
-
let changed = false;
|
|
364
|
-
const kept = [];
|
|
365
|
-
for (const message of decision.messages) {
|
|
366
|
-
const kind = kindOf(message);
|
|
367
|
-
if (kind === "agent-instructions") {
|
|
368
|
-
if (applied.instructions) kept.push(message);
|
|
369
|
-
else changed = true;
|
|
370
|
-
continue;
|
|
371
|
-
}
|
|
372
|
-
if (kind === "skill-catalog") {
|
|
373
|
-
if (!applied.skills) {
|
|
374
|
-
changed = true;
|
|
375
|
-
continue;
|
|
376
|
-
}
|
|
377
|
-
const narrowed = applied.skillGate === void 0 ? void 0 : narrowCatalog(message, applied.skillGate, (line) => this.ctx.logger.warn(`session-mode: ${line}`));
|
|
378
|
-
if (narrowed === void 0) kept.push(message);
|
|
379
|
-
else {
|
|
380
|
-
changed = true;
|
|
381
|
-
kept.push(narrowed);
|
|
382
|
-
}
|
|
383
|
-
continue;
|
|
384
|
-
}
|
|
385
|
-
kept.push(message);
|
|
386
|
-
}
|
|
387
|
-
return changed ? {
|
|
388
|
-
...decision,
|
|
389
|
-
messages: kept
|
|
390
|
-
} : decision;
|
|
391
|
-
}, { prepend: true });
|
|
392
230
|
}
|
|
393
231
|
apply(agent, definition) {
|
|
394
232
|
const previous = this.applied.get(agent);
|
|
@@ -397,6 +235,15 @@ var SessionScope = class {
|
|
|
397
235
|
const skillGate = gateOfNames(definition.allowSkills, definition.denySkills);
|
|
398
236
|
const dispose = agent.ctx.effect(() => {
|
|
399
237
|
const stoppers = [];
|
|
238
|
+
stoppers.push(agent.ctx.on("agent/pre-step", async (_payload, next) => {
|
|
239
|
+
const decision = await next();
|
|
240
|
+
if (decision.kind !== "enter") return decision;
|
|
241
|
+
const kept = this.suppress(decision.messages, definition, skillGate);
|
|
242
|
+
return kept === void 0 ? decision : {
|
|
243
|
+
...decision,
|
|
244
|
+
messages: kept
|
|
245
|
+
};
|
|
246
|
+
}, { prepend: true }));
|
|
400
247
|
if (definition.runtimeContext === false) stoppers.push(agent.ctx.systemPrompt.suppressRuntimeContext());
|
|
401
248
|
const fiber = agent.ctx.inject(["tools"], (scope) => {
|
|
402
249
|
if (gate === void 0 && skillGate === void 0) return;
|
|
@@ -415,12 +262,41 @@ var SessionScope = class {
|
|
|
415
262
|
this.channel()?.setInstructions(agent, definition.instructions);
|
|
416
263
|
this.applied.set(agent, {
|
|
417
264
|
gate,
|
|
418
|
-
skillGate,
|
|
419
|
-
instructions: definition.instructions,
|
|
420
|
-
skills: definition.skills,
|
|
421
265
|
dispose
|
|
422
266
|
});
|
|
423
267
|
}
|
|
268
|
+
suppress(messages, definition, skillGate) {
|
|
269
|
+
let changed = false;
|
|
270
|
+
const kept = [];
|
|
271
|
+
for (const message of messages) {
|
|
272
|
+
const kind = kindOf(message);
|
|
273
|
+
if (kind === "agent-instructions") {
|
|
274
|
+
if (definition.instructions) kept.push(message);
|
|
275
|
+
else changed = true;
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
if (kind === "skill-catalog") {
|
|
279
|
+
if (!definition.skills) {
|
|
280
|
+
changed = true;
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
const narrowed = skillGate === void 0 ? void 0 : narrowCatalog(message, skillGate, (line) => this.ctx.logger.warn(`session-mode: ${line}`));
|
|
284
|
+
if (narrowed === void 0) kept.push(message);
|
|
285
|
+
else {
|
|
286
|
+
changed = true;
|
|
287
|
+
kept.push(narrowed);
|
|
288
|
+
}
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
if (kind === "time-context") {
|
|
292
|
+
if (definition.runtimeContext) kept.push(message);
|
|
293
|
+
else changed = true;
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
kept.push(message);
|
|
297
|
+
}
|
|
298
|
+
return changed ? kept : void 0;
|
|
299
|
+
}
|
|
424
300
|
channel() {
|
|
425
301
|
try {
|
|
426
302
|
return this.ctx.get("contextAssembler");
|
package/dist/rows.cjs
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/mode-sources.ts
|
|
3
|
+
const CODING_PERSONA = { prefix: ["你是一个经验丰富的编程专家,YAGNI 是你的编程哲学,PDCA 是你的行为规范。", "全程用中文(专有名词除外),包括但不限于思考,回答,工具描述,subagent 提示词;思考不要陷入重复循环,一旦循环立即退出;思考聚焦需求理解与方案设计,不预演具体代码实现,正确性由验证环节确认。"].join("\n") };
|
|
4
|
+
const CHAT_PERSONA = { prefix: "你是一个助手。全程用中文(专有名词除外),包括但不限于思考,回答,工具描述;思考不要陷入重复循环,一旦循环立即退出。" };
|
|
5
|
+
const NOOP_MODE_ID = "noop";
|
|
6
|
+
const DEFAULT_MODE = "coding";
|
|
7
|
+
const MODE_SOURCES = [
|
|
8
|
+
{
|
|
9
|
+
id: "coding",
|
|
10
|
+
name: "编码模式",
|
|
11
|
+
description: "功能完整的编码 Agent:文件、Shell、检索、联网等工具常驻,其余用法说明按需加载。",
|
|
12
|
+
persona: CODING_PERSONA,
|
|
13
|
+
role: ["main", "subagent"],
|
|
14
|
+
denyTools: ["load_workspace_dependencies"],
|
|
15
|
+
denySkills: [
|
|
16
|
+
"office-docx",
|
|
17
|
+
"office-pptx",
|
|
18
|
+
"office-xlsx"
|
|
19
|
+
],
|
|
20
|
+
denyPolicies: ["fs/edit-intent", "fs/write-intent"]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "chat",
|
|
24
|
+
name: "对话模式",
|
|
25
|
+
description: "只做对话:提问与联网(搜索、抓取)三件工具,不注入系统提示词、工作区指令与技能目录。",
|
|
26
|
+
persona: CHAT_PERSONA,
|
|
27
|
+
role: ["main"],
|
|
28
|
+
allowTools: [
|
|
29
|
+
"ask_user_question",
|
|
30
|
+
"web_search",
|
|
31
|
+
"web_fetch"
|
|
32
|
+
],
|
|
33
|
+
instructions: false,
|
|
34
|
+
runtimeContext: false
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: NOOP_MODE_ID,
|
|
38
|
+
name: "原样模式",
|
|
39
|
+
description: "与上游一致:不加人格提示词、不收窄工具与技能、policy 规则全开、官方注入面照旧。",
|
|
40
|
+
role: ["main", "subagent"]
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/rows.ts
|
|
45
|
+
function list(values) {
|
|
46
|
+
return values === void 0 || values.length === 0 ? void 0 : [...values];
|
|
47
|
+
}
|
|
48
|
+
function modeConfig(source) {
|
|
49
|
+
const presetsOnly = list(source.presetsOnly);
|
|
50
|
+
const allowTools = list(source.allowTools);
|
|
51
|
+
const denyTools = list(source.denyTools);
|
|
52
|
+
const allowSkills = list(source.allowSkills);
|
|
53
|
+
const denySkills = list(source.denySkills);
|
|
54
|
+
const allowPolicies = list(source.allowPolicies);
|
|
55
|
+
const denyPolicies = list(source.denyPolicies);
|
|
56
|
+
return {
|
|
57
|
+
...presetsOnly === void 0 ? {} : { presetsOnly },
|
|
58
|
+
name: source.name,
|
|
59
|
+
description: source.description,
|
|
60
|
+
...source.role === void 0 ? {} : { role: [...source.role] },
|
|
61
|
+
...source.persona === void 0 ? {} : { persona: { ...source.persona } },
|
|
62
|
+
...allowTools === void 0 ? {} : { allowTools },
|
|
63
|
+
...denyTools === void 0 ? {} : { denyTools },
|
|
64
|
+
...allowSkills === void 0 ? {} : { allowSkills },
|
|
65
|
+
...denySkills === void 0 ? {} : { denySkills },
|
|
66
|
+
...allowPolicies === void 0 ? {} : { allowPolicies },
|
|
67
|
+
...denyPolicies === void 0 ? {} : { denyPolicies },
|
|
68
|
+
...source.instructions === void 0 ? {} : { instructions: source.instructions },
|
|
69
|
+
...source.skills === void 0 ? {} : { skills: source.skills },
|
|
70
|
+
...source.runtimeContext === void 0 ? {} : { runtimeContext: source.runtimeContext },
|
|
71
|
+
...source.defaultModel === void 0 ? {} : { defaultModel: { ...source.defaultModel } }
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function sessionModeRows() {
|
|
75
|
+
return [{ insert: [{
|
|
76
|
+
id: "session-mode",
|
|
77
|
+
name: "@morlay/dsh-session-mode",
|
|
78
|
+
config: {
|
|
79
|
+
default: DEFAULT_MODE,
|
|
80
|
+
modes: Object.fromEntries(MODE_SOURCES.map((source) => [source.id, modeConfig(source)]))
|
|
81
|
+
}
|
|
82
|
+
}] }];
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
exports.sessionModeRows = sessionModeRows;
|
package/dist/rows.mjs
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
//#region src/mode-sources.ts
|
|
2
|
-
const CODING_PERSONA = {
|
|
3
|
-
prefix: ["你是一个经验丰富的编程专家,YAGNI 是你的编程哲学,PDCA 是你的行为规范。", "全程用中文(专有名词除外),包括但不限于思考,回答,工具描述,subagent 提示词;思考不要陷入重复循环,一旦循环立即退出;思考聚焦需求理解与方案设计,不预演具体代码实现,正确性由验证环节确认。"].join("\n"),
|
|
4
|
-
suffix: "你的工作目录在 `{{cwd}}`"
|
|
5
|
-
};
|
|
2
|
+
const CODING_PERSONA = { prefix: ["你是一个经验丰富的编程专家,YAGNI 是你的编程哲学,PDCA 是你的行为规范。", "全程用中文(专有名词除外),包括但不限于思考,回答,工具描述,subagent 提示词;思考不要陷入重复循环,一旦循环立即退出;思考聚焦需求理解与方案设计,不预演具体代码实现,正确性由验证环节确认。"].join("\n") };
|
|
6
3
|
const CHAT_PERSONA = { prefix: "你是一个助手。全程用中文(专有名词除外),包括但不限于思考,回答,工具描述;思考不要陷入重复循环,一旦循环立即退出。" };
|
|
7
4
|
const NOOP_MODE_ID = "noop";
|
|
8
5
|
const DEFAULT_MODE = "coding";
|
|
@@ -19,7 +16,7 @@ const MODE_SOURCES = [
|
|
|
19
16
|
"office-pptx",
|
|
20
17
|
"office-xlsx"
|
|
21
18
|
],
|
|
22
|
-
denyPolicies: ["fs/edit-intent"]
|
|
19
|
+
denyPolicies: ["fs/edit-intent", "fs/write-intent"]
|
|
23
20
|
},
|
|
24
21
|
{
|
|
25
22
|
id: "chat",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/shared.ts
|
|
2
|
+
const SESSION_MODE_PATH = "/session-mode";
|
|
3
|
+
const POLICY_NAMES = ["fs/write-intent", "fs/edit-intent"];
|
|
4
|
+
//#endregion
|
|
5
|
+
Object.defineProperty(exports, "POLICY_NAMES", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return POLICY_NAMES;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "SESSION_MODE_PATH", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function() {
|
|
14
|
+
return SESSION_MODE_PATH;
|
|
15
|
+
}
|
|
16
|
+
});
|
package/dist/testing.cjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_catalog_remote = require("./catalog-remote-B7ZgYqun.cjs");
|
|
3
|
+
const require_catalog = require("./catalog-K5cESbqA.cjs");
|
|
4
|
+
exports.CATALOG_NS = require_catalog_remote.CATALOG_NS;
|
|
5
|
+
exports.SESSION_MODE_CATALOG_REMOTE = require_catalog_remote.SESSION_MODE_CATALOG_REMOTE;
|
|
6
|
+
exports.SessionModeCatalog = require_catalog.SessionModeCatalog;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import { RemoteResult, TypertRemoteContribution, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
3
|
+
//#region src/catalog-remote.d.ts
|
|
4
|
+
export declare const CATALOG_NS = "sessionModeCatalog";
|
|
5
|
+
interface SessionModeCatalogValue {
|
|
6
|
+
readonly tools: readonly string[];
|
|
7
|
+
readonly skills: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
interface SessionModeCatalogRemote {
|
|
10
|
+
list: () => Promise<RemoteResult<SessionModeCatalogValue>>;
|
|
11
|
+
}
|
|
12
|
+
declare module "@deepseek-ai/dsh-typert-protocol" {
|
|
13
|
+
interface TypertRemoteNamespaceMap {
|
|
14
|
+
sessionModeCatalog: SessionModeCatalogRemote;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export declare const SESSION_MODE_CATALOG_REMOTE: TypertRemoteContribution;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/catalog.d.ts
|
|
20
|
+
export declare class SessionModeCatalog extends TypertRemoteService {
|
|
21
|
+
/**
|
|
22
|
+
* @param ctx - owning context (the `session-mode` row).
|
|
23
|
+
*/
|
|
24
|
+
constructor(ctx: Context);
|
|
25
|
+
/**
|
|
26
|
+
* List the tool and skill names this deployment currently shows.
|
|
27
|
+
* @returns tool names from the tool registry, and skill names from the skill registry.
|
|
28
|
+
*/
|
|
29
|
+
remoteExportList(): Promise<SessionModeCatalogValue>;
|
|
30
|
+
private toolNames;
|
|
31
|
+
private skillNames;
|
|
32
|
+
private agents;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export {};
|
package/dist/testing.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morlay/dsh-session-mode",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Session modes for dsh: coding / chat as data — a mode is a persona plus its tool lists, its upstream policy lists, its instruction / skill-catalog / runtime-context switches and an optional default model. The host applies the current mode to each session, and the chip in the composer sits beside the official agent-preset entry, which stays.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -22,80 +22,92 @@
|
|
|
22
22
|
],
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
25
|
-
".":
|
|
26
|
-
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.mts",
|
|
27
|
+
"default": "./dist/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"./rows": {
|
|
30
|
+
"types": "./dist/rows.d.mts",
|
|
31
|
+
"default": "./dist/rows.mjs"
|
|
32
|
+
},
|
|
33
|
+
"./testing": {
|
|
34
|
+
"types": "./dist/testing.d.mts",
|
|
35
|
+
"default": "./dist/testing.mjs"
|
|
36
|
+
},
|
|
27
37
|
"./package.json": "./package.json",
|
|
28
38
|
"./client": {
|
|
29
|
-
"types": "./dist/client.d.
|
|
30
|
-
"
|
|
39
|
+
"types": "./dist/client.d.mts",
|
|
40
|
+
"import": "./dist/client.mjs",
|
|
41
|
+
"default": "./dist/client.mjs"
|
|
31
42
|
},
|
|
32
43
|
"./locale/*.json": "./locale/*.json"
|
|
33
44
|
},
|
|
34
45
|
"dependencies": {
|
|
35
|
-
"
|
|
36
|
-
"zod": "4.6.5"
|
|
46
|
+
"zod": "4.4.3"
|
|
37
47
|
},
|
|
38
48
|
"devDependencies": {
|
|
39
|
-
"@deepseek-ai/cordis": "4.0.
|
|
40
|
-
"@deepseek-ai/cordis-plugin-group": "1.0.
|
|
41
|
-
"@deepseek-ai/cordis-plugin-include": "1.0.
|
|
42
|
-
"@deepseek-ai/cordis-plugin-loader": "1.0.
|
|
43
|
-
"@deepseek-ai/cosmokit": "1.8.
|
|
44
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
45
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.
|
|
46
|
-
"@deepseek-ai/dsh-agent-preset-registry": "0.2.
|
|
47
|
-
"@deepseek-ai/dsh-api-
|
|
48
|
-
"@deepseek-ai/dsh-
|
|
49
|
-
"@deepseek-ai/dsh-client-
|
|
50
|
-
"@deepseek-ai/dsh-client-
|
|
51
|
-
"@deepseek-ai/dsh-client-ui-
|
|
52
|
-
"@deepseek-ai/dsh-client-ui-
|
|
53
|
-
"@deepseek-ai/dsh-client-ui-
|
|
54
|
-
"@deepseek-ai/dsh-client-ui-
|
|
55
|
-
"@deepseek-ai/dsh-client-ui-
|
|
56
|
-
"@deepseek-ai/dsh-
|
|
57
|
-
"@deepseek-ai/dsh-fs": "0.2.
|
|
58
|
-
"@deepseek-ai/dsh-fs-
|
|
59
|
-
"@deepseek-ai/dsh-
|
|
60
|
-
"@deepseek-ai/dsh-
|
|
61
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
62
|
-
"@deepseek-ai/dsh-
|
|
63
|
-
"@deepseek-ai/dsh-skill": "0.2.
|
|
64
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.
|
|
65
|
-
"@deepseek-ai/dsh-
|
|
66
|
-
"@deepseek-ai/dsh-
|
|
67
|
-
"@deepseek-ai/dsh-
|
|
68
|
-
"@morlay/dsh-client-ui-primitives": "0.0.8",
|
|
69
|
-
"@morlay/dsh-context-assembler": "0.0.6",
|
|
49
|
+
"@deepseek-ai/cordis": "4.0.5-alpha.2",
|
|
50
|
+
"@deepseek-ai/cordis-plugin-group": "1.0.5-alpha.2",
|
|
51
|
+
"@deepseek-ai/cordis-plugin-include": "1.0.10-alpha.2",
|
|
52
|
+
"@deepseek-ai/cordis-plugin-loader": "1.0.6-alpha.2",
|
|
53
|
+
"@deepseek-ai/cosmokit": "1.8.6-alpha.2",
|
|
54
|
+
"@deepseek-ai/dsh-agent": "0.2.1-alpha.5",
|
|
55
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.1-alpha.5",
|
|
56
|
+
"@deepseek-ai/dsh-agent-preset-registry": "0.2.1-alpha.5",
|
|
57
|
+
"@deepseek-ai/dsh-api-session-controller": "0.2.1-alpha.5",
|
|
58
|
+
"@deepseek-ai/dsh-client-locale": "0.2.1-alpha.5",
|
|
59
|
+
"@deepseek-ai/dsh-client-store": "0.2.1-alpha.5",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.2.1-alpha.5",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": "0.2.1-alpha.5",
|
|
62
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.1-alpha.5",
|
|
63
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.1-alpha.5",
|
|
64
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.2.1-alpha.5",
|
|
65
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.1-alpha.5",
|
|
66
|
+
"@deepseek-ai/dsh-fs": "0.2.1-alpha.5",
|
|
67
|
+
"@deepseek-ai/dsh-fs-local": "0.2.1-alpha.5",
|
|
68
|
+
"@deepseek-ai/dsh-fs-observation-policy": "0.2.1-alpha.5",
|
|
69
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.5",
|
|
70
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.5",
|
|
71
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.5",
|
|
72
|
+
"@deepseek-ai/dsh-settings": "0.2.1-alpha.5",
|
|
73
|
+
"@deepseek-ai/dsh-skill": "0.2.1-alpha.5",
|
|
74
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.5",
|
|
75
|
+
"@deepseek-ai/dsh-tools": "0.2.1-alpha.5",
|
|
76
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.1-alpha.5",
|
|
77
|
+
"@deepseek-ai/dsh-working-directory": "0.2.1-alpha.5",
|
|
70
78
|
"@testing-library/react": "^16.3.0",
|
|
71
79
|
"@types/js-yaml": "^4.0.9",
|
|
72
80
|
"@types/react": "~18.3.1",
|
|
73
81
|
"js-yaml": "^4.1.0",
|
|
74
|
-
"react": "^18.2.0",
|
|
75
82
|
"react-dom": "^18.2.0"
|
|
76
83
|
},
|
|
77
84
|
"peerDependencies": {
|
|
78
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
79
|
-
"@deepseek-ai/cosmokit": "^1.8.
|
|
80
|
-
"@deepseek-ai/dsh-agent": "^0.2.
|
|
81
|
-
"@deepseek-ai/dsh-agent-preset-registry": "^0.2.
|
|
82
|
-
"@deepseek-ai/dsh-api-
|
|
83
|
-
"@deepseek-ai/dsh-
|
|
84
|
-
"@deepseek-ai/dsh-client-
|
|
85
|
-
"@deepseek-ai/dsh-client-
|
|
86
|
-
"@deepseek-ai/dsh-client-ui-
|
|
87
|
-
"@deepseek-ai/dsh-client-ui-
|
|
88
|
-
"@deepseek-ai/dsh-client-ui-
|
|
89
|
-
"@deepseek-ai/dsh-client-ui-
|
|
90
|
-
"@deepseek-ai/dsh-
|
|
91
|
-
"@deepseek-ai/dsh-
|
|
92
|
-
"@deepseek-ai/dsh-
|
|
93
|
-
"@deepseek-ai/dsh-session
|
|
94
|
-
"@deepseek-ai/dsh-
|
|
95
|
-
"@deepseek-ai/dsh-
|
|
96
|
-
"@deepseek-ai/dsh-
|
|
97
|
-
"@deepseek-ai/dsh-
|
|
98
|
-
"@deepseek-ai/
|
|
85
|
+
"@deepseek-ai/cordis": "^4.0.5-alpha.2",
|
|
86
|
+
"@deepseek-ai/cosmokit": "^1.8.6-alpha.2",
|
|
87
|
+
"@deepseek-ai/dsh-agent": "^0.2.1-alpha.5",
|
|
88
|
+
"@deepseek-ai/dsh-agent-preset-registry": "^0.2.1-alpha.5",
|
|
89
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.1-alpha.5",
|
|
90
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.2.1-alpha.5",
|
|
91
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.1-alpha.5",
|
|
92
|
+
"@deepseek-ai/dsh-client-store": "^0.2.1-alpha.5",
|
|
93
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.2.1-alpha.5",
|
|
94
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": "^0.2.1-alpha.5",
|
|
95
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.2.1-alpha.5",
|
|
96
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.2.1-alpha.5",
|
|
97
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.1-alpha.5",
|
|
98
|
+
"@deepseek-ai/dsh-fs": "^0.2.1-alpha.5",
|
|
99
|
+
"@deepseek-ai/dsh-llm": "^0.2.1-alpha.5",
|
|
100
|
+
"@deepseek-ai/dsh-session": "^0.2.1-alpha.5",
|
|
101
|
+
"@deepseek-ai/dsh-session-projection": "^0.2.1-alpha.5",
|
|
102
|
+
"@deepseek-ai/dsh-skill": "^0.2.1-alpha.5",
|
|
103
|
+
"@deepseek-ai/dsh-system-prompt": "^0.2.1-alpha.5",
|
|
104
|
+
"@deepseek-ai/dsh-tool-skill": "0.2.1-alpha.5",
|
|
105
|
+
"@deepseek-ai/dsh-tools": "^0.2.1-alpha.5",
|
|
106
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.2.1-alpha.5",
|
|
107
|
+
"@deepseek-ai/schemastery": "^3.18.5-alpha.2",
|
|
108
|
+
"@morlay/dsh-client-ui-primitives": "0.0.9",
|
|
109
|
+
"@morlay/dsh-context-assembler": "0.0.7",
|
|
110
|
+
"react": "^18.2.0"
|
|
99
111
|
},
|
|
100
112
|
"dsh": {
|
|
101
113
|
"client": {
|
|
@@ -28,9 +28,9 @@ import {
|
|
|
28
28
|
TagInput,
|
|
29
29
|
Text,
|
|
30
30
|
type SettingsFormLabels,
|
|
31
|
-
} from "@morlay/dsh-client-ui-primitives
|
|
31
|
+
} from "@morlay/dsh-client-ui-primitives";
|
|
32
32
|
import type { InjectFace, PropsLocale, PropsRuntime } from "@deepseek-ai/dsh-client-ui-slots";
|
|
33
|
-
import type { SchemaFormState } from "@morlay/dsh-client-ui-primitives
|
|
33
|
+
import type { SchemaFormState } from "@morlay/dsh-client-ui-primitives";
|
|
34
34
|
import {
|
|
35
35
|
SESSION_MODE_NS,
|
|
36
36
|
projectBundleConfig,
|
|
@@ -137,7 +137,9 @@ export function BundleConfigPage(props: BundleConfigPageProps): ReactNode {
|
|
|
137
137
|
label={t("default.label")}
|
|
138
138
|
hint={t("default.hint")}
|
|
139
139
|
layout="inline"
|
|
140
|
-
{...(state.defaultMode.invalid === undefined
|
|
140
|
+
{...(state.defaultMode.invalid === undefined
|
|
141
|
+
? {}
|
|
142
|
+
: { invalid: state.defaultMode.invalid })}
|
|
141
143
|
data-field="default"
|
|
142
144
|
data-control="choice"
|
|
143
145
|
>
|
|
@@ -308,12 +310,7 @@ function ModeCard({
|
|
|
308
310
|
}): ReactNode {
|
|
309
311
|
const hasModel = mode.model !== undefined;
|
|
310
312
|
return (
|
|
311
|
-
<Stack
|
|
312
|
-
boxed
|
|
313
|
-
pad="card"
|
|
314
|
-
data-mode={mode.id}
|
|
315
|
-
data-deletable={mode.deletable ? "true" : "false"}
|
|
316
|
-
>
|
|
313
|
+
<Stack boxed pad="card" data-mode={mode.id} data-deletable={mode.deletable ? "true" : "false"}>
|
|
317
314
|
<DisclosureRow
|
|
318
315
|
icon={<IconAgentPresetOutlineRegular />}
|
|
319
316
|
title={mode.title}
|
|
@@ -329,7 +326,9 @@ function ModeCard({
|
|
|
329
326
|
{mode.id}
|
|
330
327
|
</Text>
|
|
331
328
|
<Row gap={8} push>
|
|
332
|
-
<Text as="span" size="sm" tone="tertiary">
|
|
329
|
+
<Text as="span" size="sm" tone="tertiary">
|
|
330
|
+
{mode.summary}
|
|
331
|
+
</Text>
|
|
333
332
|
{mode.deletable ? (
|
|
334
333
|
<IconButton
|
|
335
334
|
size="sm"
|
|
@@ -357,7 +356,9 @@ function ModeCard({
|
|
|
357
356
|
{mode.groups.map((group) => (
|
|
358
357
|
<Stack key={group.key} gap={0} data-group={group.key}>
|
|
359
358
|
<Row gap={8} justify="between">
|
|
360
|
-
<Text size="sm" tone="secondary" weight="strong">
|
|
359
|
+
<Text size="sm" tone="secondary" weight="strong">
|
|
360
|
+
{group.label}
|
|
361
|
+
</Text>
|
|
361
362
|
</Row>
|
|
362
363
|
{group.key === "model" ? (
|
|
363
364
|
<>
|