@shuind/dsh-codex-harness 0.2.21 → 0.2.32-dsh-v0.2.2-rc.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 +121 -0
- package/README.md +48 -38
- package/RELEASE.md +61 -0
- package/assets/codex.svg +5 -0
- package/cordis.patch.yml +150 -6
- package/docs/preset-library.md +39 -23
- package/docs/tool-policy-benchmark.json +310 -0
- package/docs/tool-policy.md +144 -0
- package/lib/client.js +1639 -111
- package/lib/compaction.js +17 -2
- package/lib/index.js +799 -188
- package/lib/installer.js +50 -6
- package/lib/preferences.js +111 -0
- package/lib/tool-policy.js +2235 -0
- package/lib/typert.js +57 -10
- package/lib/types/activity.d.ts +1 -1
- package/lib/types/activity.js +50 -14
- package/lib/types/client/activity.d.ts +33 -9
- package/lib/types/client/desktop.d.ts +43 -0
- package/lib/types/client/desktop.js +121 -0
- package/lib/types/client/entry.d.ts +10 -0
- package/lib/types/client/entry.js +12 -0
- package/lib/types/client/index.d.ts +109 -19
- package/lib/types/client/index.js +21 -40
- package/lib/types/client/policy-drafts.d.ts +25 -0
- package/lib/types/client/policy-drafts.js +47 -0
- package/lib/types/client/preset-copy.d.ts +1 -0
- package/lib/types/client/preset-copy.js +2 -0
- package/lib/types/client/preset-manager.d.ts +12 -2
- package/lib/types/client/preset-manager.js +70 -25
- package/lib/types/client/preset-requests.d.ts +12 -0
- package/lib/types/client/preset-requests.js +101 -0
- package/lib/types/client/session.d.ts +6 -0
- package/lib/types/client/session.js +9 -0
- package/lib/types/client/tool-policy.d.ts +120 -0
- package/lib/types/client/tool-policy.js +394 -0
- package/lib/types/compaction.d.ts +3 -3
- package/lib/types/compaction.js +6 -2
- package/lib/types/desktop-preset.d.ts +20 -0
- package/lib/types/desktop-preset.js +39 -0
- package/lib/types/exec.d.ts +4 -0
- package/lib/types/exec.js +192 -66
- package/lib/types/host-settings.d.ts +4 -0
- package/lib/types/host-settings.js +13 -0
- package/lib/types/index.d.ts +20 -2
- package/lib/types/index.js +181 -68
- package/lib/types/installer.js +11 -2
- package/lib/types/preferences.d.ts +11 -0
- package/lib/types/preferences.js +16 -0
- package/lib/types/preset-editor-remote.d.ts +2 -0
- package/lib/types/preset-editor-remote.js +6 -2
- package/lib/types/preset-editor.d.ts +12 -7
- package/lib/types/preset-editor.js +43 -13
- package/lib/types/preset-prompt-catalog-schema.d.ts +16 -0
- package/lib/types/preset-prompt-catalog-schema.js +11 -0
- package/lib/types/preset-prompt-catalog.d.ts +21 -0
- package/lib/types/preset-prompt-catalog.js +192 -0
- package/lib/types/preset-prompt-contract.d.ts +22 -0
- package/lib/types/preset-prompt-contract.js +3 -0
- package/lib/types/preset-tool-catalog-schema.d.ts +38 -0
- package/lib/types/preset-tool-catalog-schema.js +28 -0
- package/lib/types/preset-tool-catalog.d.ts +5 -0
- package/lib/types/preset-tool-catalog.js +51 -0
- package/lib/types/prompt-sections.d.ts +1 -1
- package/lib/types/prompt-sections.js +9 -3
- package/lib/types/prompt.js +4 -2
- package/lib/types/remote.js +23 -8
- package/lib/types/settings.d.ts +3 -3
- package/lib/types/settings.js +3 -3
- package/lib/types/tool-capabilities.d.ts +32 -0
- package/lib/types/tool-capabilities.js +42 -0
- package/lib/types/tool-policy-contract.d.ts +60 -0
- package/lib/types/tool-policy-contract.js +26 -0
- package/lib/types/tool-policy.d.ts +171 -0
- package/lib/types/tool-policy.js +367 -0
- package/lib/types/typert.host.d.ts +2 -2
- package/lib/types/typert.host.js +12 -2
- package/locale/en.json +6 -0
- package/locale/tool-policy/en.json +6 -0
- package/locale/tool-policy/zh.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +375 -299
- package/scripts/benchmark-tool-policy.mjs +186 -0
- package/scripts/build-preset.mjs +19 -0
- package/scripts/clean-build.mjs +11 -0
- package/src/activity-types.ts +7 -0
- package/src/activity.ts +158 -0
- package/src/client/activity.ts +82 -0
- package/src/client/desktop.tsx +162 -0
- package/src/client/entry.tsx +16 -0
- package/src/client/index.tsx +972 -0
- package/src/client/policy-drafts.ts +56 -0
- package/src/client/preset-copy.ts +83 -0
- package/src/client/preset-manager.tsx +281 -0
- package/src/client/preset-requests.ts +113 -0
- package/src/client/session.ts +11 -0
- package/src/client/tool-policy.tsx +380 -0
- package/src/compact-command.ts +112 -0
- package/src/compaction.ts +190 -0
- package/src/context.ts +15 -0
- package/src/desktop-preset.ts +55 -0
- package/src/exec.ts +570 -0
- package/src/host-settings.ts +17 -0
- package/src/index.ts +1097 -0
- package/src/installer.ts +172 -0
- package/src/invariant.ts +34 -0
- package/src/patch.ts +258 -0
- package/src/preferences.ts +17 -0
- package/src/preset-contract.ts +85 -0
- package/src/preset-editor-remote.ts +41 -0
- package/src/preset-editor.ts +502 -0
- package/src/preset-prompt-catalog-schema.ts +10 -0
- package/src/preset-prompt-catalog.ts +191 -0
- package/src/preset-prompt-contract.ts +21 -0
- package/src/preset-tool-catalog-schema.ts +28 -0
- package/src/preset-tool-catalog.ts +51 -0
- package/src/prompt-sections.ts +33 -0
- package/src/prompt.ts +62 -0
- package/src/remote.ts +748 -0
- package/src/settings.ts +79 -0
- package/src/tool-capabilities.ts +76 -0
- package/src/tool-policy-contract.ts +76 -0
- package/src/tool-policy.ts +388 -0
- package/src/typert.host.ts +119 -0
- package/tsconfig.json +29 -0
- package/tsdown.config.ts +110 -0
- package/lib/types/preset-templates.d.ts +0 -36
- package/lib/types/preset-templates.js +0 -12
|
@@ -4,6 +4,9 @@ import { dirname, isAbsolute, relative, resolve } from 'node:path';
|
|
|
4
4
|
import { Remote, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
5
5
|
import { isMap, isScalar, isSeq, parseDocument, Scalar, YAMLMap } from 'yaml';
|
|
6
6
|
import { DEFAULT_CODEX_PERSONA, DEFAULT_CODEX_SYSTEM_PROMPT, DEFAULT_DSH_CORE_SOURCE_PROMPT, DEFAULT_DSH_CORE_WEB_PROMPT } from "./prompt.js";
|
|
7
|
+
import { readHostSettings } from "./host-settings.js";
|
|
8
|
+
import { readPresetToolCatalog } from "./preset-tool-catalog.js";
|
|
9
|
+
import { readPresetPromptCatalog } from "./preset-prompt-catalog.js";
|
|
7
10
|
let atomicWriteModule;
|
|
8
11
|
function loadAtomicWrite() {
|
|
9
12
|
return atomicWriteModule ??= import('@deepseek-ai/dsh-atomic-write');
|
|
@@ -66,10 +69,10 @@ function promptFields(doc) {
|
|
|
66
69
|
function visit(sequence, parents = []) {
|
|
67
70
|
if (!isSeq(sequence))
|
|
68
71
|
return;
|
|
69
|
-
for (const row of sequence.items) {
|
|
72
|
+
for (const [index, row] of sequence.items.entries()) {
|
|
70
73
|
if (!isMap(row) || row.get('disabled') === true)
|
|
71
74
|
continue;
|
|
72
|
-
const path = [...parents, String(row.get('id'))];
|
|
75
|
+
const path = [...parents, String(row.get('id') ?? `row:${index}`)];
|
|
73
76
|
const config = row.get('config', true);
|
|
74
77
|
if (isSeq(config)) {
|
|
75
78
|
visit(config, path);
|
|
@@ -392,13 +395,14 @@ async function assertWithinRoot(path, roots) {
|
|
|
392
395
|
export class CodexPresetEditor extends TypertRemoteService {
|
|
393
396
|
static inject = ['agentPresets', 'settings'];
|
|
394
397
|
agentPresets;
|
|
398
|
+
toolContext;
|
|
395
399
|
sharedSettings;
|
|
396
400
|
indexed;
|
|
397
401
|
constructor(ctx, _config) {
|
|
398
402
|
super(ctx, 'codexPresetEditor');
|
|
403
|
+
this.toolContext = ctx;
|
|
399
404
|
this.agentPresets = ctx.get('agentPresets');
|
|
400
|
-
|
|
401
|
-
this.sharedSettings = () => settings?.get('codex') ?? {};
|
|
405
|
+
this.sharedSettings = () => readHostSettings(ctx, 'codex') ?? {};
|
|
402
406
|
}
|
|
403
407
|
async catalog() {
|
|
404
408
|
if (this.agentPresets.list) {
|
|
@@ -406,16 +410,24 @@ export class CodexPresetEditor extends TypertRemoteService {
|
|
|
406
410
|
this.indexed = new Map(rows.map(row => [row.id, row]));
|
|
407
411
|
return { presets: rows.filter(row => row.broken === undefined).map(row => ({
|
|
408
412
|
id: row.id, name: row.name || row.id, description: row.description ?? '',
|
|
409
|
-
editable: row.trust === 'user', isDefault: row.id === this.agentPresets.defaultId,
|
|
410
|
-
})), authorable: this.agentPresets.authorable ?? false, excludedCount: rows.filter(row => row.broken !== undefined).length };
|
|
413
|
+
editable: !!row.path && row.trust === 'user', isDefault: row.id === this.agentPresets.defaultId,
|
|
414
|
+
})), authorable: !!this.agentPresets.copy && !!this.agentPresets.remove && (this.agentPresets.authorable ?? false), excludedCount: rows.filter(row => row.broken !== undefined).length };
|
|
411
415
|
}
|
|
416
|
+
if (!this.agentPresets.remoteExportList)
|
|
417
|
+
throw new Error('preset-catalog-unavailable');
|
|
412
418
|
const roster = await this.agentPresets.remoteExportList();
|
|
413
419
|
// Listing must not read/resolve every composition: each host read rescans roots.
|
|
414
420
|
const presets = roster.presets.filter(row => row.broken === undefined).map(row => ({
|
|
415
421
|
id: row.id, name: row.name || row.id, description: row.description ?? '',
|
|
416
422
|
editable: row.trust === 'user', isDefault: row.isDefault,
|
|
417
423
|
}));
|
|
418
|
-
return { presets, authorable: roster.authorable, excludedCount: roster.presets.length - presets.length };
|
|
424
|
+
return { presets, authorable: !!this.agentPresets.copy && !!this.agentPresets.remove && (roster.authorable ?? false), excludedCount: roster.presets.length - presets.length };
|
|
425
|
+
}
|
|
426
|
+
async tools(id) {
|
|
427
|
+
return readPresetToolCatalog(this.toolContext, id);
|
|
428
|
+
}
|
|
429
|
+
async prompts(id) {
|
|
430
|
+
return readPresetPromptCatalog(this.toolContext, id);
|
|
419
431
|
}
|
|
420
432
|
async read(id) {
|
|
421
433
|
// The catalog owns path discovery. Re-read the selected files on every cache
|
|
@@ -424,16 +436,27 @@ export class CodexPresetEditor extends TypertRemoteService {
|
|
|
424
436
|
const preset = cached ?? await this.preset(id);
|
|
425
437
|
if (preset.broken !== undefined)
|
|
426
438
|
throw new Error('invalid-preset');
|
|
427
|
-
|
|
439
|
+
// Native registries expose declarations, not editable filesystem locations.
|
|
440
|
+
const inline = preset.path === undefined ? await this.agentPresets.readDocument(id) : undefined;
|
|
441
|
+
const [composition, metadata] = preset.path === undefined
|
|
442
|
+
? [inline.content, undefined]
|
|
443
|
+
: await Promise.all([readFile(preset.path, 'utf8'), optionalFile(resolve(dirname(preset.path), 'preset.yml'))]);
|
|
428
444
|
const meta = metadata ? yaml(metadata) : undefined;
|
|
429
|
-
|
|
445
|
+
if (inline) {
|
|
446
|
+
const doc = yaml(composition);
|
|
447
|
+
// Native declarations allow empty lists and rows without filesystem-era ids.
|
|
448
|
+
if (!isSeq(doc.contents) || doc.contents.items.some(row => !isMap(row) || typeof row.get('name') !== 'string'))
|
|
449
|
+
throw new Error('invalid-preset-yaml');
|
|
450
|
+
}
|
|
451
|
+
else
|
|
452
|
+
validateComposition(composition);
|
|
430
453
|
const codex = supportsCodex(composition);
|
|
431
454
|
const prompt = codex ? explicitPrompt(composition) : undefined;
|
|
432
455
|
const shared = this.sharedSettings?.() ?? {};
|
|
433
456
|
const promptSections = readPromptSections(composition, shared);
|
|
434
457
|
for (const field of promptFields(yaml(composition))) {
|
|
435
458
|
const reference = promptFile(field.node);
|
|
436
|
-
if (!reference)
|
|
459
|
+
if (!reference || preset.path === undefined)
|
|
437
460
|
continue;
|
|
438
461
|
const section = promptSections.find(section => section.id === field.id);
|
|
439
462
|
try {
|
|
@@ -449,12 +472,17 @@ export class CodexPresetEditor extends TypertRemoteService {
|
|
|
449
472
|
}
|
|
450
473
|
catch { /* Unavailable references remain visible and read-only, with their expression intact. */ }
|
|
451
474
|
}
|
|
452
|
-
|
|
475
|
+
if (inline)
|
|
476
|
+
for (const section of promptSections)
|
|
477
|
+
section.editable = false;
|
|
478
|
+
return { id, name: String(meta?.get('name') ?? inline?.name ?? preset.name ?? id), description: String(meta?.get('description') ?? inline?.description ?? preset.description ?? ''),
|
|
453
479
|
systemPrompt: prompt ?? shared.systemPrompt ?? DEFAULT_CODEX_SYSTEM_PROMPT, inheritPrompt: prompt === undefined,
|
|
454
|
-
revision: revision(composition, metadata), editable: preset.trust === 'user', codex,
|
|
480
|
+
revision: revision(composition, metadata), editable: !!preset.path && preset.trust === 'user', codex,
|
|
455
481
|
codexOptions: readCodexPresetOptions(composition), composition, promptSections };
|
|
456
482
|
}
|
|
457
483
|
async create(rawInput) {
|
|
484
|
+
if (!this.agentPresets.copy || !this.agentPresets.remove)
|
|
485
|
+
throw new Error('preset-registry-read-only: this host does not support preset copies');
|
|
458
486
|
const input = validate(rawInput);
|
|
459
487
|
await this.preset(input.sourceId);
|
|
460
488
|
const id = `codex-${randomUUID().slice(0, 12)}`;
|
|
@@ -479,6 +507,8 @@ export class CodexPresetEditor extends TypertRemoteService {
|
|
|
479
507
|
async update(rawInput) {
|
|
480
508
|
const input = validate(rawInput);
|
|
481
509
|
const preset = await this.preset(input.id);
|
|
510
|
+
if (preset.path === undefined)
|
|
511
|
+
throw new Error('preset-registry-read-only: this host exposes presets for viewing only');
|
|
482
512
|
if (preset.trust !== 'user')
|
|
483
513
|
throw new Error('built-in presets cannot be edited here');
|
|
484
514
|
const composition = resolve(preset.path);
|
|
@@ -551,7 +581,7 @@ function markRemoteMethod(methodName) {
|
|
|
551
581
|
for (const initializer of initializers)
|
|
552
582
|
initializer.call(receiver);
|
|
553
583
|
}
|
|
554
|
-
for (const method of ['read', 'update', 'catalog', 'create'])
|
|
584
|
+
for (const method of ['read', 'update', 'catalog', 'create', 'tools', 'prompts'])
|
|
555
585
|
markRemoteMethod(method);
|
|
556
586
|
export default CodexPresetEditor;
|
|
557
587
|
//# sourceMappingURL=preset-editor.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Same strict codec for current and legacy Remote contracts. */
|
|
3
|
+
export declare const presetPromptCatalogSchema: z.ZodObject<{
|
|
4
|
+
preset: z.ZodString;
|
|
5
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
label: z.ZodString;
|
|
8
|
+
text: z.ZodString;
|
|
9
|
+
editable: z.ZodBoolean;
|
|
10
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
complete: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
interpolate: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
//# sourceMappingURL=preset-prompt-catalog-schema.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Same strict codec for current and legacy Remote contracts. */
|
|
3
|
+
export const presetPromptCatalogSchema = z.object({
|
|
4
|
+
preset: z.string(),
|
|
5
|
+
sections: z.array(z.object({
|
|
6
|
+
name: z.string(), label: z.string(), text: z.string().max(1_000_000), editable: z.boolean(),
|
|
7
|
+
order: z.number().finite().optional(), complete: z.boolean().optional(), interpolate: z.boolean().optional(),
|
|
8
|
+
reason: z.string().optional(),
|
|
9
|
+
})).max(200),
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=preset-prompt-catalog-schema.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { ScopeKey } from '@deepseek-ai/dsh-scope';
|
|
3
|
+
import type { PromptSection } from '@deepseek-ai/dsh-system-prompt';
|
|
4
|
+
import type { PresetPromptCatalog, PresetPromptName, PresetPromptOverride } from './preset-prompt-contract.ts';
|
|
5
|
+
export interface PresetPromptProbe {
|
|
6
|
+
readonly catalog: PresetPromptCatalog;
|
|
7
|
+
readonly scope: ScopeKey;
|
|
8
|
+
readonly modules: string;
|
|
9
|
+
readonly definitions: ReadonlyMap<PresetPromptName, PromptSection>;
|
|
10
|
+
}
|
|
11
|
+
export interface PreparedPromptOverride {
|
|
12
|
+
readonly scope: ScopeKey;
|
|
13
|
+
readonly modules: string;
|
|
14
|
+
readonly sections: readonly PromptSection[];
|
|
15
|
+
}
|
|
16
|
+
/** The opaque scope identity is retained only for runtime revision validation, not sent over RPC. */
|
|
17
|
+
export declare function probePresetPrompts(ctx: Context, preset: string, expectedScope?: ScopeKey): Promise<PresetPromptProbe>;
|
|
18
|
+
export declare function readPresetPromptCatalog(ctx: Context, preset: string): Promise<PresetPromptCatalog>;
|
|
19
|
+
export declare function preparePromptOverrides(probe: PresetPromptProbe, overrides: readonly PresetPromptOverride[]): PreparedPromptOverride;
|
|
20
|
+
export declare function matchesPromptRevision(ctx: Context, preset: string, prepared: PreparedPromptOverride): boolean;
|
|
21
|
+
//# sourceMappingURL=preset-prompt-catalog.d.ts.map
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/** Public, read-only preset prompt discovery. No private registry, Agent, or JS/YAML evaluation. */
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { createScope } from '@deepseek-ai/dsh-scope';
|
|
4
|
+
import { PERSONA_PREFIX_SECTION, PERSONA_SUFFIX_SECTION } from '@deepseek-ai/dsh-system-prompt';
|
|
5
|
+
import { isMap, isScalar, isSeq, parseDocument, YAMLMap } from 'yaml';
|
|
6
|
+
function literal(map, key) {
|
|
7
|
+
const node = map.get(key, true);
|
|
8
|
+
return isScalar(node) && !node.tag ? node.value : undefined;
|
|
9
|
+
}
|
|
10
|
+
/** Native Persona's public source owns these exact names/placements/complete semantics. */
|
|
11
|
+
function candidates(content, placement) {
|
|
12
|
+
const doc = parseDocument(content, { strict: true, uniqueKeys: true });
|
|
13
|
+
if (doc.errors.length || !isSeq(doc.contents))
|
|
14
|
+
throw new Error('invalid-preset-prompt-declaration');
|
|
15
|
+
const found = [];
|
|
16
|
+
const readonly = [];
|
|
17
|
+
function visit(rows, parent = '', conditionalParent = false, isolatedParent = false) {
|
|
18
|
+
if (!isSeq(rows))
|
|
19
|
+
return;
|
|
20
|
+
for (const [index, row] of rows.items.entries()) {
|
|
21
|
+
if (!isMap(row) || literal(row, 'disabled') === true)
|
|
22
|
+
continue;
|
|
23
|
+
const module = literal(row, 'name');
|
|
24
|
+
const path = `${parent}/${String(literal(row, 'id') ?? index)}`;
|
|
25
|
+
const conditionalRow = conditionalParent || row.has('disabled') && literal(row, 'disabled') === undefined;
|
|
26
|
+
const isolation = row.get('isolate', true);
|
|
27
|
+
const isolated = isolatedParent || row.has('isolate') && (!isMap(isolation) || isolation.has('systemPrompt'));
|
|
28
|
+
let config = row.get('config', true);
|
|
29
|
+
if (isSeq(config)) {
|
|
30
|
+
visit(config, path, conditionalRow, isolated);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (config === undefined && module === '@shuind/dsh-codex-harness')
|
|
34
|
+
config = new YAMLMap();
|
|
35
|
+
if (typeof module !== 'string' || !isMap(config))
|
|
36
|
+
continue;
|
|
37
|
+
if (module === '@deepseek-ai/dsh-persona') {
|
|
38
|
+
const completeNode = config.get('complete', true);
|
|
39
|
+
const complete = literal(config, 'complete');
|
|
40
|
+
const uncertain = conditionalRow || completeNode !== undefined && typeof complete !== 'boolean';
|
|
41
|
+
for (const [key, name, order, label] of [
|
|
42
|
+
['prefix', PERSONA_PREFIX_SECTION, placement('DEPLOYMENT_PERSONA_PREFIX'), 'Persona'],
|
|
43
|
+
['suffix', PERSONA_SUFFIX_SECTION, placement('DEPLOYMENT_PERSONA_SUFFIX'), 'Persona · suffix'],
|
|
44
|
+
]) {
|
|
45
|
+
const text = literal(config, key);
|
|
46
|
+
const missingSuffix = key === 'suffix' && !config.has(key);
|
|
47
|
+
// Native Persona validates prefix/suffix to strings at mount, then
|
|
48
|
+
// registers static text. A !!js declaration is never evaluated here;
|
|
49
|
+
// its actual registered text is read by assemble and marker-verified.
|
|
50
|
+
const reason = isolated ? 'isolated-prompt-registry' : uncertain ? 'dynamic-declaration' : undefined;
|
|
51
|
+
found.push({ name, label, module, order, complete: key === 'prefix' && complete === true, interpolate: true,
|
|
52
|
+
...(typeof text === 'string' ? { literal: text } : missingSuffix ? { literal: '' } : {}),
|
|
53
|
+
...(reason === undefined ? {} : { reason }) });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else if (module === '@shuind/dsh-codex-harness' && literal(config, 'codexCore') !== false) {
|
|
57
|
+
found.push({ name: 'codex:base', label: 'Codex 操作提示词', module, order: 10, complete: false, interpolate: true,
|
|
58
|
+
...(isolated ? { reason: 'isolated-prompt-registry' } : conditionalRow || config.has('codexCore') && literal(config, 'codexCore') === undefined ? { reason: 'dynamic-declaration' } : {}) });
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// Unknown field-to-section mappings are not editable just because their
|
|
62
|
+
// spelling resembles a prompt. Never return a !!js expression as prose.
|
|
63
|
+
for (const key of ['prefix', 'suffix', 'text', 'section', 'prompt', 'systemPrompt', 'instructions']) {
|
|
64
|
+
if (!config.has(key) || module === '@deepseek-ai/dsh-plan-mode')
|
|
65
|
+
continue;
|
|
66
|
+
const text = literal(config, key);
|
|
67
|
+
readonly.push({ name: `declaration:${path}:${key}`, label: `${module} · ${key}`,
|
|
68
|
+
text: typeof text === 'string' ? text : '', editable: false,
|
|
69
|
+
reason: typeof text === 'string' ? 'unknown-section-contract' : 'dynamic-declaration' });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
visit(doc.contents);
|
|
75
|
+
return { found, readonly };
|
|
76
|
+
}
|
|
77
|
+
function moduleSignature(rows) {
|
|
78
|
+
return JSON.stringify(rows.map(row => [row.moduleName, row.baseUrl ?? '', row.useHostBase]));
|
|
79
|
+
}
|
|
80
|
+
/** The opaque scope identity is retained only for runtime revision validation, not sent over RPC. */
|
|
81
|
+
export async function probePresetPrompts(ctx, preset, expectedScope) {
|
|
82
|
+
if (typeof preset !== 'string' || !preset.trim() || preset.length > 256)
|
|
83
|
+
throw new Error('invalid-preset-id');
|
|
84
|
+
const registry = ctx.get('agentPresets');
|
|
85
|
+
const prompt = ctx.get('systemPrompt');
|
|
86
|
+
if (registry === undefined || prompt === undefined || typeof registry.acquireScope !== 'function'
|
|
87
|
+
|| typeof registry.readDocument !== 'function' || typeof registry.inspectCompositions !== 'function') {
|
|
88
|
+
throw new Error('preset-prompt-catalog-unavailable');
|
|
89
|
+
}
|
|
90
|
+
const document = await registry.readDocument(preset);
|
|
91
|
+
const lease = await registry.acquireScope(preset);
|
|
92
|
+
let view;
|
|
93
|
+
try {
|
|
94
|
+
if (expectedScope !== undefined && lease.key !== expectedScope)
|
|
95
|
+
throw new Error('preset-prompt-revision-mismatch');
|
|
96
|
+
const key = {};
|
|
97
|
+
view = createScope(ctx, key, { parent: lease.key });
|
|
98
|
+
const inspection = registry.inspectCompositions(view.ctx);
|
|
99
|
+
if (inspection.length !== 1 || inspection[0]?.id !== preset)
|
|
100
|
+
throw new Error('preset-prompt-revision-unavailable');
|
|
101
|
+
const modules = moduleSignature(inspection[0].modules);
|
|
102
|
+
const active = new Set(inspection[0].modules.map(row => row.moduleName));
|
|
103
|
+
const declared = candidates(document.content, name => prompt.getSectionOrder(name));
|
|
104
|
+
const definitions = new Map();
|
|
105
|
+
const sections = [];
|
|
106
|
+
// Show the actual effective original, including legacy own-plugin rewrites.
|
|
107
|
+
// Only marker validation suppresses those rewrites; no model runs here.
|
|
108
|
+
let baseline;
|
|
109
|
+
try {
|
|
110
|
+
baseline = await prompt.assemble({ scope: key });
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return { scope: lease.key, modules, definitions, catalog: { preset, sections: [
|
|
114
|
+
...declared.found.map(row => ({ name: row.name, label: row.label, text: row.literal ?? '', editable: false, reason: 'assembly-unavailable' })),
|
|
115
|
+
...declared.readonly,
|
|
116
|
+
].slice(0, 200) } };
|
|
117
|
+
}
|
|
118
|
+
const seen = new Set();
|
|
119
|
+
for (const row of declared.found) {
|
|
120
|
+
if (seen.has(row.name))
|
|
121
|
+
continue;
|
|
122
|
+
seen.add(row.name);
|
|
123
|
+
const actual = baseline.sections.find(section => section.name === row.name);
|
|
124
|
+
let reason = row.reason
|
|
125
|
+
?? (!active.has(row.module) ? 'inactive-contribution' : undefined)
|
|
126
|
+
?? (declared.found.filter(candidate => candidate.name === row.name).length !== 1 ? 'ambiguous-contribution' : undefined)
|
|
127
|
+
?? (actual === undefined ? 'not-effective-or-complete-suppressed' : undefined);
|
|
128
|
+
if (reason === undefined && row.complete && (baseline.sections.length !== 1 || baseline.sections[0]?.name !== row.name))
|
|
129
|
+
reason = 'complete-contract-mismatch';
|
|
130
|
+
if (reason === undefined) {
|
|
131
|
+
const marker = `preset-prompt-probe:${randomUUID()}`;
|
|
132
|
+
const undo = view.ctx.get('systemPrompt').section({ name: row.name, order: row.order, complete: row.complete,
|
|
133
|
+
interpolate: row.interpolate, text: marker });
|
|
134
|
+
try {
|
|
135
|
+
const probed = await prompt.assemble({ scope: key, codexPresetPromptProbe: true });
|
|
136
|
+
if (probed.sections.find(section => section.name === row.name)?.text !== marker
|
|
137
|
+
|| JSON.stringify(probed.sections.map(section => section.name)) !== JSON.stringify(baseline.sections.map(section => section.name))
|
|
138
|
+
|| row.complete && (probed.sections.length !== 1 || probed.sections[0]?.name !== row.name))
|
|
139
|
+
reason = 'not-directly-overridable';
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
reason = 'not-directly-overridable';
|
|
143
|
+
}
|
|
144
|
+
finally {
|
|
145
|
+
undo();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const text = actual?.text ?? row.literal ?? '';
|
|
149
|
+
if (text.length > 1_000_000)
|
|
150
|
+
reason = 'prompt-too-large';
|
|
151
|
+
sections.push({ name: row.name, label: row.label, text: text.slice(0, 1_000_000), editable: reason === undefined,
|
|
152
|
+
order: row.order, complete: row.complete, interpolate: row.interpolate,
|
|
153
|
+
...(reason === undefined ? {} : { reason }) });
|
|
154
|
+
if (reason === undefined)
|
|
155
|
+
definitions.set(row.name, { name: row.name, order: row.order, complete: row.complete,
|
|
156
|
+
interpolate: row.interpolate, text });
|
|
157
|
+
}
|
|
158
|
+
for (const row of baseline.sections) {
|
|
159
|
+
if (!seen.has(row.name))
|
|
160
|
+
sections.push({ name: row.name, label: row.name, text: row.text.slice(0, 1_000_000), editable: false, reason: 'unknown-or-host-owned-section' });
|
|
161
|
+
}
|
|
162
|
+
sections.push(...declared.readonly);
|
|
163
|
+
if ((await registry.readDocument(preset)).content !== document.content)
|
|
164
|
+
throw new Error('preset-prompt-revision-mismatch');
|
|
165
|
+
return { scope: lease.key, modules, definitions, catalog: { preset, sections: sections.slice(0, 200) } };
|
|
166
|
+
}
|
|
167
|
+
finally {
|
|
168
|
+
try {
|
|
169
|
+
await view?.dispose();
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
await lease[Symbol.asyncDispose]();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
export async function readPresetPromptCatalog(ctx, preset) {
|
|
177
|
+
return (await probePresetPrompts(ctx, preset)).catalog;
|
|
178
|
+
}
|
|
179
|
+
export function preparePromptOverrides(probe, overrides) {
|
|
180
|
+
const sections = overrides.map(override => {
|
|
181
|
+
const original = probe.definitions.get(override.name);
|
|
182
|
+
if (original === undefined)
|
|
183
|
+
throw new Error(`unsupported-preset-prompt-override: ${override.name}`);
|
|
184
|
+
return { ...original, text: override.text };
|
|
185
|
+
});
|
|
186
|
+
return { scope: probe.scope, modules: probe.modules, sections };
|
|
187
|
+
}
|
|
188
|
+
export function matchesPromptRevision(ctx, preset, prepared) {
|
|
189
|
+
const inspection = ctx.get('agentPresets')?.inspectCompositions(ctx);
|
|
190
|
+
return inspection?.length === 1 && inspection[0]?.id === preset && moduleSignature(inspection[0].modules) === prepared.modules;
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=preset-prompt-catalog.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Client-safe current-preset prompt catalog; editable targets have reviewed native contracts. */
|
|
2
|
+
export declare const PRESET_PROMPT_NAMES: readonly ["deployment:persona-prefix", "deployment:persona-suffix", "codex:base"];
|
|
3
|
+
export type PresetPromptName = typeof PRESET_PROMPT_NAMES[number];
|
|
4
|
+
export interface PresetPromptOverride {
|
|
5
|
+
readonly name: PresetPromptName;
|
|
6
|
+
readonly text: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PresetPromptEntry {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
readonly text: string;
|
|
12
|
+
readonly editable: boolean;
|
|
13
|
+
readonly order?: number;
|
|
14
|
+
readonly complete?: boolean;
|
|
15
|
+
readonly interpolate?: boolean;
|
|
16
|
+
readonly reason?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface PresetPromptCatalog {
|
|
19
|
+
readonly preset: string;
|
|
20
|
+
readonly sections: readonly PresetPromptEntry[];
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=preset-prompt-contract.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Shared wire codec; no Host service or browser side effects. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const presetToolCatalogSchema: z.ZodObject<{
|
|
4
|
+
preset: z.ZodString;
|
|
5
|
+
registeredOnly: z.ZodLiteral<true>;
|
|
6
|
+
legacyCapabilities: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
terminalToolsEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
planToolEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
patchToolEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
}, z.core.$strip>>;
|
|
11
|
+
tools: z.ZodArray<z.ZodObject<{
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
description: z.ZodString;
|
|
14
|
+
conditional: z.ZodBoolean;
|
|
15
|
+
codexTool: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
capability: z.ZodEnum<{
|
|
17
|
+
terminalToolsEnabled: "terminalToolsEnabled";
|
|
18
|
+
planToolEnabled: "planToolEnabled";
|
|
19
|
+
patchToolEnabled: "patchToolEnabled";
|
|
20
|
+
}>;
|
|
21
|
+
presetEnabled: z.ZodBoolean;
|
|
22
|
+
presetOverridesLegacy: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
replacements: z.ZodArray<z.ZodObject<{
|
|
25
|
+
action: z.ZodEnum<{
|
|
26
|
+
"codex-exec": "codex-exec";
|
|
27
|
+
"codex-plan": "codex-plan";
|
|
28
|
+
}>;
|
|
29
|
+
tools: z.ZodArray<z.ZodString>;
|
|
30
|
+
available: z.ZodBoolean;
|
|
31
|
+
reason: z.ZodOptional<z.ZodEnum<{
|
|
32
|
+
conditional: "conditional";
|
|
33
|
+
"target-exists": "target-exists";
|
|
34
|
+
}>>;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
//# sourceMappingURL=preset-tool-catalog-schema.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Shared wire codec; no Host service or browser side effects. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export const presetToolCatalogSchema = z.object({
|
|
4
|
+
preset: z.string(),
|
|
5
|
+
registeredOnly: z.literal(true),
|
|
6
|
+
legacyCapabilities: z.object({
|
|
7
|
+
terminalToolsEnabled: z.boolean().optional(),
|
|
8
|
+
planToolEnabled: z.boolean().optional(),
|
|
9
|
+
patchToolEnabled: z.boolean().optional(),
|
|
10
|
+
}).optional(),
|
|
11
|
+
tools: z.array(z.object({
|
|
12
|
+
name: z.string(),
|
|
13
|
+
description: z.string(),
|
|
14
|
+
conditional: z.boolean(),
|
|
15
|
+
codexTool: z.object({
|
|
16
|
+
capability: z.enum(['terminalToolsEnabled', 'planToolEnabled', 'patchToolEnabled']),
|
|
17
|
+
presetEnabled: z.boolean(),
|
|
18
|
+
presetOverridesLegacy: z.boolean().optional(),
|
|
19
|
+
}).optional(),
|
|
20
|
+
replacements: z.array(z.object({
|
|
21
|
+
action: z.enum(['codex-exec', 'codex-plan']),
|
|
22
|
+
tools: z.array(z.string()),
|
|
23
|
+
available: z.boolean(),
|
|
24
|
+
reason: z.enum(['conditional', 'target-exists']).optional(),
|
|
25
|
+
})),
|
|
26
|
+
})),
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=preset-tool-catalog-schema.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Read-only capability inventory for a preset; never creates an Agent or evaluates `when`. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import type { PresetToolCatalog } from './tool-policy-contract.ts';
|
|
4
|
+
export declare function readPresetToolCatalog(ctx: Context, preset: string): Promise<PresetToolCatalog>;
|
|
5
|
+
//# sourceMappingURL=preset-tool-catalog.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createScope } from '@deepseek-ai/dsh-scope';
|
|
2
|
+
import { codexToolMetadata, readLegacyCapabilities } from "./tool-capabilities.js";
|
|
3
|
+
export async function readPresetToolCatalog(ctx, preset) {
|
|
4
|
+
if (typeof preset !== 'string' || !preset.trim() || preset.length > 256)
|
|
5
|
+
throw new Error('invalid-preset-id');
|
|
6
|
+
const registry = ctx.get('agentPresets');
|
|
7
|
+
const tools = ctx.get('tools');
|
|
8
|
+
if (registry === undefined || typeof registry.acquireScope !== 'function' || tools === undefined) {
|
|
9
|
+
throw new Error('preset-tool-catalog-unavailable');
|
|
10
|
+
}
|
|
11
|
+
const lease = await registry.acquireScope(preset);
|
|
12
|
+
let view;
|
|
13
|
+
try {
|
|
14
|
+
// A child view applies inherited masks exactly as an Agent would, but has no
|
|
15
|
+
// Agent driver, session, model selection, or initialization callbacks.
|
|
16
|
+
const key = {};
|
|
17
|
+
view = createScope(ctx, key, { parent: lease.key });
|
|
18
|
+
const definitions = tools.definitions(key);
|
|
19
|
+
const names = new Set(definitions.map(tool => tool.name));
|
|
20
|
+
return {
|
|
21
|
+
preset,
|
|
22
|
+
registeredOnly: true,
|
|
23
|
+
legacyCapabilities: readLegacyCapabilities(ctx),
|
|
24
|
+
tools: definitions.map(definition => {
|
|
25
|
+
const conditional = tools.executable(definition.name, key) !== definition;
|
|
26
|
+
const replacements = [];
|
|
27
|
+
const action = definition.name === 'bash' || definition.name === 'pwsh' ? 'codex-exec'
|
|
28
|
+
: definition.name === 'todo_write' ? 'codex-plan' : undefined;
|
|
29
|
+
if (action !== undefined) {
|
|
30
|
+
const targets = action === 'codex-exec' ? ['exec_command', 'write_stdin'] : ['update_plan'];
|
|
31
|
+
const reason = conditional ? 'conditional'
|
|
32
|
+
: targets.some(target => names.has(target)) ? 'target-exists' : undefined;
|
|
33
|
+
replacements.push({ action, tools: targets, available: reason === undefined,
|
|
34
|
+
...(reason === undefined ? {} : { reason }) });
|
|
35
|
+
}
|
|
36
|
+
const codexTool = codexToolMetadata(definition);
|
|
37
|
+
return { name: definition.name, description: definition.description.slice(0, 300), conditional, replacements,
|
|
38
|
+
...(codexTool === undefined ? {} : { codexTool }) };
|
|
39
|
+
}).sort((a, b) => a.name.localeCompare(b.name, 'en')),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
try {
|
|
44
|
+
await view?.dispose();
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
await lease[Symbol.asyncDispose]();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=preset-tool-catalog.js.map
|
|
@@ -10,6 +10,6 @@ export declare const Config: z<Config>;
|
|
|
10
10
|
export declare const name = "preset-prompt-sections";
|
|
11
11
|
export declare const inject: string[];
|
|
12
12
|
/** Override only existing sections; dynamic runtime context and tool guidance remain host-owned. */
|
|
13
|
-
export declare function applyPromptSections(assembly:
|
|
13
|
+
export declare function applyPromptSections<T extends Pick<PromptAssembly, 'sections' | 'contexts' | 'variables'>>(assembly: T, config: Config, protectedNames?: ReadonlySet<string>): T;
|
|
14
14
|
export declare function apply(ctx: Context, config: Config): void;
|
|
15
15
|
//# sourceMappingURL=prompt-sections.d.ts.map
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import z from '@deepseek-ai/schemastery';
|
|
2
|
+
import { hasPresetPromptOverride } from "./tool-capabilities.js";
|
|
2
3
|
export const Config = z.object({ persona: z.string(), harnessSourcePrompt: z.string(), webSurfacePrompt: z.string() });
|
|
3
4
|
export const name = 'preset-prompt-sections';
|
|
4
5
|
export const inject = ['systemPrompt'];
|
|
5
6
|
/** Override only existing sections; dynamic runtime context and tool guidance remain host-owned. */
|
|
6
|
-
export function applyPromptSections(assembly, config) {
|
|
7
|
+
export function applyPromptSections(assembly, config, protectedNames) {
|
|
7
8
|
const variables = { ...assembly.variables };
|
|
8
9
|
variables.sourceRoot ??= assembly.sections.find(s => s.name === 'harness:source')?.text.match(/^The DeepSeek Harness implementation checkout is at (.+?)\. The checkout location/u)?.[1];
|
|
9
10
|
variables.webUrl ??= assembly.sections.find(s => s.name === 'app:web-surface')?.text.match(/^You are interacting with the user through the DeepSeek Harness Web GUI at (.+?)\. When/u)?.[1];
|
|
10
11
|
const values = {
|
|
11
12
|
'deployment:persona': config.persona,
|
|
13
|
+
'deployment:persona-prefix': config.persona,
|
|
12
14
|
'harness:source': config.harnessSourcePrompt,
|
|
13
15
|
'app:web-surface': config.webSurfacePrompt,
|
|
14
16
|
};
|
|
15
17
|
return { ...assembly, sections: assembly.sections.map(section => {
|
|
16
|
-
const text = values[section.name];
|
|
18
|
+
const text = protectedNames?.has(section.name) ? undefined : values[section.name];
|
|
17
19
|
return text === undefined ? section : { ...section, text: text.replace(/\{\{([\w.-]+)\}\}/g, (whole, key) => variables[key] ?? whole) };
|
|
18
20
|
}) };
|
|
19
21
|
}
|
|
20
22
|
export function apply(ctx, config) {
|
|
21
|
-
ctx.on('system-prompt/assemble', async (_assembly,
|
|
23
|
+
ctx.on('system-prompt/assemble', async (_assembly, context, next) => {
|
|
24
|
+
const protectedNames = new Set(['deployment:persona-prefix', 'deployment:persona-suffix', 'codex:base']
|
|
25
|
+
.filter(name => hasPresetPromptOverride(ctx, context, name)));
|
|
26
|
+
return applyPromptSections(await next(), config, protectedNames);
|
|
27
|
+
});
|
|
22
28
|
}
|
|
23
29
|
//# sourceMappingURL=prompt-sections.js.map
|
package/lib/types/prompt.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Default plugin-owned Codex operating prompt. */
|
|
2
2
|
export const DEFAULT_CODEX_SYSTEM_PROMPT = String.raw `## General
|
|
3
3
|
|
|
4
|
-
-
|
|
4
|
+
- Follow the current tool catalog, not assumptions from another Codex client. For unknown paths, use the available list/search tools instead of guessing and reuse the returned paths. If only shell search is available, prefer rg or rg --files.
|
|
5
5
|
|
|
6
6
|
## Editing constraints
|
|
7
7
|
|
|
@@ -17,6 +17,8 @@ export const DEFAULT_CODEX_SYSTEM_PROMPT = String.raw `## General
|
|
|
17
17
|
## dsh session
|
|
18
18
|
|
|
19
19
|
- The user and you share one workspace. Inspect the repository and every applicable AGENTS.md before editing.
|
|
20
|
+
- For Harness APIs, first load the relevant Harness skill. When Inspect tools are available, start with cordis_inspect_list, then query the provider's directory before an exact Service contract. Reuse returned names; Inspect is read-only.
|
|
21
|
+
- A not-found path or unknown Service is a discovery error: check the file list or Service directory before retrying. Preserve actual failures; do not hide them or bypass permission denials.
|
|
20
22
|
|
|
21
23
|
## Task execution
|
|
22
24
|
|
|
@@ -38,7 +40,7 @@ export const DEFAULT_CODEX_SYSTEM_PROMPT = String.raw `## General
|
|
|
38
40
|
/** Default deployment Persona template used by the Codex preset. */
|
|
39
41
|
export const DEFAULT_CODEX_PERSONA = String.raw `You are Codex, a coding agent based on the {{model}} model. Your working directory is {{cwd}}.`;
|
|
40
42
|
/** Default DSH Core source-checkout guidance template. */
|
|
41
|
-
export const DEFAULT_DSH_CORE_SOURCE_PROMPT = String.raw `The DeepSeek Harness implementation checkout is at {{sourceRoot}}. The checkout location and current working directory are separate values and may differ; never infer the working directory from this path. Use pwd to determine the current working directory. Use this checkout only to inspect or extend DSH itself.`;
|
|
43
|
+
export const DEFAULT_DSH_CORE_SOURCE_PROMPT = String.raw `The DeepSeek Harness implementation checkout is at {{sourceRoot}}. The checkout location and current working directory are separate values and may differ; never infer the working directory from this path. Use pwd to determine the current working directory. Use this checkout only to inspect or extend DSH itself. If the supplied path is inside app.asar, treat it as a packaged runtime rather than a source checkout. Discover the installed packageDir via Inspect and read its README and package.json exports; do not assume src or individual lib/types filenames exist. Use Host file-read tools for app.asar; native shell search and glob cannot traverse it.`;
|
|
42
44
|
/** Default DSH Web runtime guidance template. */
|
|
43
45
|
export const DEFAULT_DSH_CORE_WEB_PROMPT = [
|
|
44
46
|
'You are interacting with the user through the DeepSeek Harness Web GUI at {{webUrl}}.',
|