dsh-agent-persona 0.1.0

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.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * What the browser half mounts: ctx.remote.$mount(RPC_REMOTE). The field set matches the shape that
3
+ * worked before this file was generated — an id per descriptor, a strict codec for the input, and an
4
+ * empty parameter list for the reads that take none.
5
+ */
6
+ export declare const RPC_REMOTE: {
7
+ package: string;
8
+ descriptors: {
9
+ id: string;
10
+ service: string;
11
+ namespace: string;
12
+ method: any;
13
+ invocation: {
14
+ kind: string;
15
+ };
16
+ parameters: any;
17
+ result: {
18
+ mode: string;
19
+ typeSymbol: string;
20
+ schema: {
21
+ parse: any;
22
+ };
23
+ };
24
+ }[];
25
+ };
package/lib/remote.js ADDED
@@ -0,0 +1,49 @@
1
+ // 该文件由 scripts/generate-remote.mjs 生成,请勿手改(改 src/endpoints.ts 后重新生成)。
2
+ const PKG = "dsh-agent-persona";
3
+ const codec = (typeSymbol, parse) => ({
4
+ mode: "strict",
5
+ typeSymbol: `${PKG}#${typeSymbol}`,
6
+ schema: { parse },
7
+ });
8
+ const passthrough = (value) => value;
9
+ const asInput = (value) => {
10
+ if (value === undefined || value === null)
11
+ return {};
12
+ if (typeof value !== "object" || Array.isArray(value))
13
+ throw new Error("input must be an object");
14
+ return value;
15
+ };
16
+ const withInput = () => [
17
+ { name: "input", wire: "input", source: "json", codec: codec("Input", asInput) },
18
+ ];
19
+ const method = (name, parameters) => ({
20
+ id: `${PKG}#agentPersona/${name}`,
21
+ service: "agentPersona",
22
+ namespace: "agentPersona",
23
+ method: name,
24
+ invocation: { kind: "direct" },
25
+ parameters,
26
+ result: codec("View", passthrough),
27
+ });
28
+ /**
29
+ * What the browser half mounts: ctx.remote.$mount(RPC_REMOTE). The field set matches the shape that
30
+ * worked before this file was generated — an id per descriptor, a strict codec for the input, and an
31
+ * empty parameter list for the reads that take none.
32
+ */
33
+ export const RPC_REMOTE = {
34
+ package: PKG,
35
+ descriptors: [
36
+ method("listPersonas", []),
37
+ method("savePersona", withInput()),
38
+ method("deletePersona", withInput()),
39
+ method("movePersona", withInput()),
40
+ method("duplicatePersona", withInput()),
41
+ method("reorderPersona", withInput()),
42
+ method("listTargets", []),
43
+ method("sessionHistory", withInput()),
44
+ method("sessionPrompt", withInput()),
45
+ method("tunePersona", withInput()),
46
+ method("listModels", []),
47
+ method("savePrefs", withInput()),
48
+ ],
49
+ };
@@ -0,0 +1,48 @@
1
+ import { z } from "zod";
2
+ export declare const TYPERT: {
3
+ package: string;
4
+ face: string;
5
+ schemas: any[];
6
+ model: {
7
+ services: {
8
+ tags: any[];
9
+ key: string;
10
+ exportName: string;
11
+ description: string;
12
+ summary: string;
13
+ jsDoc: string;
14
+ members: {
15
+ name: string;
16
+ kind: string;
17
+ signature: string;
18
+ }[];
19
+ types: any[];
20
+ }[];
21
+ events: any[];
22
+ objects: any[];
23
+ };
24
+ invocations: {
25
+ id: string;
26
+ service: string;
27
+ namespace: string;
28
+ method: string;
29
+ invocation: {
30
+ kind: string;
31
+ };
32
+ parameters: {
33
+ name: string;
34
+ wire: string;
35
+ source: string;
36
+ codec: {
37
+ mode: string;
38
+ typeSymbol: string;
39
+ schema: z.ZodUnknown;
40
+ };
41
+ }[];
42
+ result: {
43
+ mode: string;
44
+ typeSymbol: string;
45
+ schema: z.ZodUnknown;
46
+ };
47
+ }[];
48
+ };
package/lib/typert.js ADDED
@@ -0,0 +1,217 @@
1
+ // 该文件由 scripts/generate-remote.mjs 生成,请勿手改(改 src/endpoints.ts 后重新生成)。
2
+ import { z } from "zod";
3
+ const PKG = "dsh-agent-persona";
4
+ const direct = { kind: "direct" };
5
+ const jsonCodec = (typeSymbol) => ({
6
+ mode: "strict",
7
+ typeSymbol: `${PKG}#${typeSymbol}`,
8
+ schema: z.unknown(),
9
+ });
10
+ const result = (typeSymbol) => jsonCodec(typeSymbol);
11
+ export const TYPERT = {
12
+ package: PKG,
13
+ face: "host",
14
+ schemas: [],
15
+ model: {
16
+ services: [
17
+ {
18
+ tags: [],
19
+ key: "agentPersona",
20
+ exportName: "agentPersona",
21
+ description: "Workspace-scoped agent personas exposed through the host RPC service.",
22
+ summary: "Agent persona management service",
23
+ jsDoc: "The host service for listing, editing, matching, and tuning agent personas.",
24
+ members: [
25
+ { name: "listPersonas", kind: "method", signature: "(): Promise<unknown>" },
26
+ { name: "savePersona", kind: "method", signature: "(input: unknown): Promise<unknown>" },
27
+ { name: "deletePersona", kind: "method", signature: "(input: unknown): Promise<unknown>" },
28
+ { name: "movePersona", kind: "method", signature: "(input: unknown): Promise<unknown>" },
29
+ { name: "duplicatePersona", kind: "method", signature: "(input: unknown): Promise<unknown>" },
30
+ { name: "reorderPersona", kind: "method", signature: "(input: unknown): Promise<unknown>" },
31
+ { name: "listTargets", kind: "method", signature: "(): Promise<unknown>" },
32
+ { name: "sessionHistory", kind: "method", signature: "(input: unknown): Promise<unknown>" },
33
+ { name: "sessionPrompt", kind: "method", signature: "(input: unknown): Promise<unknown>" },
34
+ { name: "tunePersona", kind: "method", signature: "(input: unknown): Promise<unknown>" },
35
+ { name: "listModels", kind: "method", signature: "(): Promise<unknown>" },
36
+ { name: "savePrefs", kind: "method", signature: "(input: unknown): Promise<unknown>" },
37
+ ],
38
+ types: [],
39
+ },
40
+ ],
41
+ events: [],
42
+ objects: [],
43
+ },
44
+ invocations: [
45
+ {
46
+ id: `dsh-agent-persona#agentPersona/listPersonas`,
47
+ service: "agentPersona",
48
+ namespace: "agentPersona",
49
+ method: "listPersonas",
50
+ invocation: direct,
51
+ parameters: [],
52
+ result: result("Json"),
53
+ },
54
+ {
55
+ id: `dsh-agent-persona#agentPersona/savePersona`,
56
+ service: "agentPersona",
57
+ namespace: "agentPersona",
58
+ method: "savePersona",
59
+ invocation: direct,
60
+ parameters: [
61
+ {
62
+ name: "input",
63
+ wire: "input",
64
+ source: "json",
65
+ codec: jsonCodec("Json"),
66
+ },
67
+ ],
68
+ result: result("Json"),
69
+ },
70
+ {
71
+ id: `dsh-agent-persona#agentPersona/deletePersona`,
72
+ service: "agentPersona",
73
+ namespace: "agentPersona",
74
+ method: "deletePersona",
75
+ invocation: direct,
76
+ parameters: [
77
+ {
78
+ name: "input",
79
+ wire: "input",
80
+ source: "json",
81
+ codec: jsonCodec("Json"),
82
+ },
83
+ ],
84
+ result: result("Json"),
85
+ },
86
+ {
87
+ id: `dsh-agent-persona#agentPersona/movePersona`,
88
+ service: "agentPersona",
89
+ namespace: "agentPersona",
90
+ method: "movePersona",
91
+ invocation: direct,
92
+ parameters: [
93
+ {
94
+ name: "input",
95
+ wire: "input",
96
+ source: "json",
97
+ codec: jsonCodec("Json"),
98
+ },
99
+ ],
100
+ result: result("Json"),
101
+ },
102
+ {
103
+ id: `dsh-agent-persona#agentPersona/duplicatePersona`,
104
+ service: "agentPersona",
105
+ namespace: "agentPersona",
106
+ method: "duplicatePersona",
107
+ invocation: direct,
108
+ parameters: [
109
+ {
110
+ name: "input",
111
+ wire: "input",
112
+ source: "json",
113
+ codec: jsonCodec("Json"),
114
+ },
115
+ ],
116
+ result: result("Json"),
117
+ },
118
+ {
119
+ id: `dsh-agent-persona#agentPersona/reorderPersona`,
120
+ service: "agentPersona",
121
+ namespace: "agentPersona",
122
+ method: "reorderPersona",
123
+ invocation: direct,
124
+ parameters: [
125
+ {
126
+ name: "input",
127
+ wire: "input",
128
+ source: "json",
129
+ codec: jsonCodec("Json"),
130
+ },
131
+ ],
132
+ result: result("Json"),
133
+ },
134
+ {
135
+ id: `dsh-agent-persona#agentPersona/listTargets`,
136
+ service: "agentPersona",
137
+ namespace: "agentPersona",
138
+ method: "listTargets",
139
+ invocation: direct,
140
+ parameters: [],
141
+ result: result("Json"),
142
+ },
143
+ {
144
+ id: `dsh-agent-persona#agentPersona/sessionHistory`,
145
+ service: "agentPersona",
146
+ namespace: "agentPersona",
147
+ method: "sessionHistory",
148
+ invocation: direct,
149
+ parameters: [
150
+ {
151
+ name: "input",
152
+ wire: "input",
153
+ source: "json",
154
+ codec: jsonCodec("Json"),
155
+ },
156
+ ],
157
+ result: result("Json"),
158
+ },
159
+ {
160
+ id: `dsh-agent-persona#agentPersona/sessionPrompt`,
161
+ service: "agentPersona",
162
+ namespace: "agentPersona",
163
+ method: "sessionPrompt",
164
+ invocation: direct,
165
+ parameters: [
166
+ {
167
+ name: "input",
168
+ wire: "input",
169
+ source: "json",
170
+ codec: jsonCodec("Json"),
171
+ },
172
+ ],
173
+ result: result("Json"),
174
+ },
175
+ {
176
+ id: `dsh-agent-persona#agentPersona/tunePersona`,
177
+ service: "agentPersona",
178
+ namespace: "agentPersona",
179
+ method: "tunePersona",
180
+ invocation: direct,
181
+ parameters: [
182
+ {
183
+ name: "input",
184
+ wire: "input",
185
+ source: "json",
186
+ codec: jsonCodec("Json"),
187
+ },
188
+ ],
189
+ result: result("Json"),
190
+ },
191
+ {
192
+ id: `dsh-agent-persona#agentPersona/listModels`,
193
+ service: "agentPersona",
194
+ namespace: "agentPersona",
195
+ method: "listModels",
196
+ invocation: direct,
197
+ parameters: [],
198
+ result: result("Json"),
199
+ },
200
+ {
201
+ id: `dsh-agent-persona#agentPersona/savePrefs`,
202
+ service: "agentPersona",
203
+ namespace: "agentPersona",
204
+ method: "savePrefs",
205
+ invocation: direct,
206
+ parameters: [
207
+ {
208
+ name: "input",
209
+ wire: "input",
210
+ source: "json",
211
+ codec: jsonCodec("Json"),
212
+ },
213
+ ],
214
+ result: result("Json"),
215
+ },
216
+ ],
217
+ };
package/package.json ADDED
@@ -0,0 +1,104 @@
1
+ {
2
+ "name": "dsh-agent-persona",
3
+ "version": "0.1.0",
4
+ "description": "Workspace personas for DeepSeek Harness (DSH): create many system-prompt personas and scope each one by workspace path or session id (exact / prefix / regex / contains), managed from a Web settings page with Markdown editing and AI tuning.",
5
+ "type": "module",
6
+ "main": "lib/index.js",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./lib/index.d.ts",
10
+ "default": "./lib/index.js"
11
+ },
12
+ "./client": {
13
+ "default": "./lib/client.js"
14
+ },
15
+ "./cordis.patch.yml": "./cordis.patch.yml",
16
+ "./package.json": "./package.json",
17
+ "./remote": {
18
+ "types": "./lib/remote.d.ts",
19
+ "default": "./lib/remote.js"
20
+ },
21
+ "./typert": {
22
+ "types": "./lib/typert.d.ts",
23
+ "default": "./lib/typert.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "lib",
28
+ "cordis.patch.yml",
29
+ "scripts/install.sh",
30
+ "scripts/install.ps1",
31
+ "README.md",
32
+ "README_EN.md",
33
+ "CHANGELOG.md",
34
+ "LICENSE"
35
+ ],
36
+ "keywords": [
37
+ "dsh",
38
+ "deepseek-harness",
39
+ "plugin",
40
+ "persona",
41
+ "system-prompt",
42
+ "workspace",
43
+ "settings-panel"
44
+ ],
45
+ "author": "awoodwhale <woodwhale@qq.com>",
46
+ "license": "Apache-2.0",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/awoodwhale/dsh-agent-persona.git"
50
+ },
51
+ "homepage": "https://github.com/awoodwhale/dsh-agent-persona#readme",
52
+ "bugs": {
53
+ "url": "https://github.com/awoodwhale/dsh-agent-persona/issues"
54
+ },
55
+ "engines": {
56
+ "node": "^22.19.0 || >=24.0.0"
57
+ },
58
+ "publishConfig": {
59
+ "access": "public"
60
+ },
61
+ "scripts": {
62
+ "build": "npm run generate:remote && tsc -p tsconfig.json && esbuild src/client.ts --bundle --format=iife --platform=browser --target=es2020 --outfile=lib/client.js --log-level=warning",
63
+ "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.client.json",
64
+ "test": "node test/personas.test.mjs && node test/client-helpers.test.mjs && node scripts/generate-remote.mjs --check",
65
+ "prepare": "npm run build",
66
+ "generate:remote": "node scripts/generate-remote.mjs"
67
+ },
68
+ "dsh": {
69
+ "bundle": {
70
+ "patch": "./cordis.patch.yml"
71
+ },
72
+ "client": {
73
+ "platform": "web",
74
+ "inject": [
75
+ "@deepseek-ai/dsh-api-remotes",
76
+ "@deepseek-ai/dsh-client-connection",
77
+ "@deepseek-ai/dsh-client-ui-settings",
78
+ "@deepseek-ai/dsh-client-ui-slots"
79
+ ]
80
+ },
81
+ "compatibility": {
82
+ "dshReleases": {
83
+ "0.1.5-rc.1": "compatible",
84
+ "0.1.5-rc.2": "compatible"
85
+ }
86
+ }
87
+ },
88
+ "peerDependencies": {
89
+ "@deepseek-ai/cordis": "^4.0.2",
90
+ "@deepseek-ai/dsh-api-remotes": ">=0.1.5-rc.1",
91
+ "@deepseek-ai/dsh-client-connection": ">=0.1.5-rc.1",
92
+ "@deepseek-ai/dsh-client-ui-primitives": ">=0.1.5-rc.1",
93
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.5-rc.1",
94
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.5-rc.1",
95
+ "@deepseek-ai/dsh-typert-protocol": ">=0.1.5-rc.1",
96
+ "react": "^18.3.1",
97
+ "zod": "^4.0.0"
98
+ },
99
+ "devDependencies": {
100
+ "esbuild": "^0.28.2",
101
+ "typescript": "^7.0.2"
102
+ },
103
+ "types": "lib/index.d.ts"
104
+ }
@@ -0,0 +1,30 @@
1
+ # Install dsh-workspace-persona into a DSH profile (Windows).
2
+ #
3
+ # pwsh -File scripts/install.ps1
4
+ # pwsh -File scripts/install.ps1 -Profile my-profile
5
+ # pwsh -File scripts/install.ps1 -Profile web -Target .
6
+ param(
7
+ [string]$Profile = "web",
8
+ [string]$Target = "dsh-workspace-persona"
9
+ )
10
+
11
+ $ErrorActionPreference = "Stop"
12
+
13
+ if (-not (Get-Command dsh -ErrorAction SilentlyContinue)) {
14
+ Write-Error "dsh not found on PATH — install DeepSeek Harness first."
15
+ }
16
+
17
+ Write-Host "==> dsh plugin --profile $Profile add $Target"
18
+ & dsh plugin --profile $Profile add $Target
19
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
20
+
21
+ Write-Host @"
22
+
23
+ Installed. ``dsh.profile.bundles`` is read at STARTUP, so restart the host now:
24
+
25
+ dsh web
26
+
27
+ Then verify:
28
+ Get-Content "`$env:DSH_HOME\workspace-persona.state.json"
29
+ # Web -> 设置 -> 工作区人设
30
+ "@
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env bash
2
+ # Install dsh-workspace-persona into a DSH profile.
3
+ #
4
+ # bash scripts/install.sh # default profile: web
5
+ # bash scripts/install.sh my-profile # explicit profile
6
+ # bash scripts/install.sh web . # install this checkout (dev mode)
7
+ set -euo pipefail
8
+
9
+ PROFILE="${1:-web}"
10
+ TARGET="${2:-dsh-workspace-persona}"
11
+
12
+ if ! command -v dsh >/dev/null 2>&1; then
13
+ echo "dsh not found on PATH — install DeepSeek Harness first." >&2
14
+ exit 1
15
+ fi
16
+
17
+ echo "==> dsh plugin --profile ${PROFILE} add ${TARGET}"
18
+ dsh plugin --profile "${PROFILE}" add "${TARGET}"
19
+
20
+ cat <<'TIP'
21
+
22
+ Installed. `dsh.profile.bundles` is read at STARTUP, so restart the host now:
23
+
24
+ dsh web # or stop the running one and start it again
25
+
26
+ Then verify:
27
+ cat "$DSH_HOME/workspace-persona.state.json" # load heartbeat of the host half
28
+ # Web → 设置 → 工作区人设
29
+ TIP