@avantf/dsh-identity 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/README.md +117 -2
- package/cordis.patch.yml +13 -0
- package/lib/assets/presets/analyst/en/IDENTITY.md +1 -0
- package/lib/assets/presets/analyst/en/RULES.md +8 -0
- package/lib/assets/presets/analyst/en/SOUL.md +5 -0
- package/lib/assets/presets/analyst/zh/IDENTITY.md +1 -0
- package/lib/assets/presets/analyst/zh/RULES.md +8 -0
- package/lib/assets/presets/analyst/zh/SOUL.md +5 -0
- package/lib/assets/presets/assistant/en/IDENTITY.md +1 -0
- package/lib/assets/presets/assistant/en/RULES.md +8 -0
- package/lib/assets/presets/assistant/en/SOUL.md +5 -0
- package/lib/assets/presets/assistant/zh/IDENTITY.md +1 -0
- package/lib/assets/presets/assistant/zh/RULES.md +8 -0
- package/lib/assets/presets/assistant/zh/SOUL.md +5 -0
- package/lib/assets/presets/coder/en/IDENTITY.md +1 -0
- package/lib/assets/presets/coder/en/RULES.md +8 -0
- package/lib/assets/presets/coder/en/SOUL.md +5 -0
- package/lib/assets/presets/coder/zh/IDENTITY.md +1 -0
- package/lib/assets/presets/coder/zh/RULES.md +8 -0
- package/lib/assets/presets/coder/zh/SOUL.md +5 -0
- package/lib/client.js +61 -0
- package/lib/dsh-build.json +6 -0
- package/lib/envinit-bootstrap.js +341 -0
- package/lib/index.js +1517 -0
- package/lib/interface-version.json +4 -0
- package/lib/types/atomic-write.d.ts +3 -0
- package/lib/types/atomic-write.d.ts.map +1 -0
- package/lib/types/base.d.ts +45 -0
- package/lib/types/base.d.ts.map +1 -0
- package/lib/types/client/IdentitySection.d.ts +29 -0
- package/lib/types/client/IdentitySection.d.ts.map +1 -0
- package/lib/types/client/api.d.ts +204 -0
- package/lib/types/client/api.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +57 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/documents.d.ts +65 -0
- package/lib/types/documents.d.ts.map +1 -0
- package/lib/types/envinit.d.ts +22 -0
- package/lib/types/envinit.d.ts.map +1 -0
- package/lib/types/gateway.d.ts +124 -0
- package/lib/types/gateway.d.ts.map +1 -0
- package/lib/types/index.d.ts +97 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/interface_gate.d.ts +121 -0
- package/lib/types/interface_gate.d.ts.map +1 -0
- package/lib/types/log.d.ts +18 -0
- package/lib/types/log.d.ts.map +1 -0
- package/lib/types/paths.d.ts +45 -0
- package/lib/types/paths.d.ts.map +1 -0
- package/lib/types/presets.d.ts +201 -0
- package/lib/types/presets.d.ts.map +1 -0
- package/lib/types/session-freeze.d.ts +33 -0
- package/lib/types/session-freeze.d.ts.map +1 -0
- package/lib/types/state.d.ts +190 -0
- package/lib/types/state.d.ts.map +1 -0
- package/lib/types/versions.d.ts +19 -0
- package/lib/types/versions.d.ts.map +1 -0
- package/lib/types/volatile.d.ts +28 -0
- package/lib/types/volatile.d.ts.map +1 -0
- package/lib/types/wire.d.ts +86 -0
- package/lib/types/wire.d.ts.map +1 -0
- package/package.json +104 -3
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { IdentityDocuments, type DocumentStatus, type DocumentText } from './documents.js';
|
|
2
|
+
import type { IdentityLogger } from './log.js';
|
|
3
|
+
import { type PresetFileText, type ProfileSeed } from './presets.js';
|
|
4
|
+
/** One live snapshot of the plugin's Config, read at the moment of use. */
|
|
5
|
+
export interface IdentitySettings {
|
|
6
|
+
readonly enabled: boolean;
|
|
7
|
+
readonly interpolate: boolean;
|
|
8
|
+
readonly replaceScope: 'session' | 'all';
|
|
9
|
+
readonly drop: readonly string[];
|
|
10
|
+
readonly maxBytes: number;
|
|
11
|
+
readonly profile: string;
|
|
12
|
+
readonly dataHome: string;
|
|
13
|
+
readonly activePreset: string;
|
|
14
|
+
readonly activeLocale: string;
|
|
15
|
+
}
|
|
16
|
+
/** The `status` result: the wire schema in `wire.ts` is the authority; this mirrors it locally. */
|
|
17
|
+
export interface IdentityStatusView {
|
|
18
|
+
readonly enabled: boolean;
|
|
19
|
+
readonly profile: string;
|
|
20
|
+
readonly dataHome: string;
|
|
21
|
+
readonly identityDir: string;
|
|
22
|
+
readonly presetsDir: string;
|
|
23
|
+
readonly fileCount: number;
|
|
24
|
+
readonly totalBytes: number;
|
|
25
|
+
readonly maxBytes: number;
|
|
26
|
+
readonly interpolate: boolean;
|
|
27
|
+
readonly replaceScope: string;
|
|
28
|
+
readonly drop: readonly string[];
|
|
29
|
+
readonly fallbackToNative: boolean;
|
|
30
|
+
readonly activePreset: string;
|
|
31
|
+
readonly activeLocale: string;
|
|
32
|
+
/** Whether the effective identity differs from what the active preset ships. */
|
|
33
|
+
readonly hasLocalEdit: boolean;
|
|
34
|
+
readonly locale: string;
|
|
35
|
+
readonly localeSource: string;
|
|
36
|
+
readonly files: readonly DocumentStatus[];
|
|
37
|
+
readonly presets: readonly {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly locales: readonly string[];
|
|
40
|
+
readonly active: boolean;
|
|
41
|
+
}[];
|
|
42
|
+
}
|
|
43
|
+
/** The config the state's own reads need; the gateway owns the write side. */
|
|
44
|
+
export interface IdentityStateOptions {
|
|
45
|
+
readonly dataHome: string;
|
|
46
|
+
readonly profile: () => string;
|
|
47
|
+
readonly maxBytes: () => number;
|
|
48
|
+
readonly version: string;
|
|
49
|
+
readonly assetsDir?: string;
|
|
50
|
+
readonly logger?: IdentityLogger;
|
|
51
|
+
}
|
|
52
|
+
export declare class IdentityState {
|
|
53
|
+
private readonly options;
|
|
54
|
+
private dataHomeValue;
|
|
55
|
+
private documentsCache?;
|
|
56
|
+
constructor(options: IdentityStateOptions);
|
|
57
|
+
/** The data home currently in force. */
|
|
58
|
+
get dataHome(): string;
|
|
59
|
+
/** `<data home>/identity`. */
|
|
60
|
+
get root(): string;
|
|
61
|
+
/** The profile whose identity is effective (the profile context's name, or the configured one). */
|
|
62
|
+
get profile(): string;
|
|
63
|
+
/** `profiles/<profile>/` — the ONE source of the effective identity. */
|
|
64
|
+
get profileDir(): string;
|
|
65
|
+
/** `presets/`. */
|
|
66
|
+
get presetsDir(): string;
|
|
67
|
+
/** The three files of the effective identity (recreated when the data home or profile moves). */
|
|
68
|
+
get documents(): IdentityDocuments;
|
|
69
|
+
/** Point the state at the base's answer. A different root drops the cached reader. */
|
|
70
|
+
setDataHome(next: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* The section text: the rendered files when the switch is on, `''` when it is off. `''` is what
|
|
73
|
+
* makes "off" byte-identical to native — the empty section is dropped by `renderPrompt`, and the
|
|
74
|
+
* waterfall removes it as well.
|
|
75
|
+
*/
|
|
76
|
+
sectionText(enabled: boolean): string;
|
|
77
|
+
/** Release the built-in presets (missing-only). Never throws. */
|
|
78
|
+
provision(assetsDir?: string): {
|
|
79
|
+
readonly copied: readonly string[];
|
|
80
|
+
readonly skipped: readonly string[];
|
|
81
|
+
};
|
|
82
|
+
/** Every preset on disk, marking the one this profile is currently using. */
|
|
83
|
+
presetSummaries(activePreset: string): {
|
|
84
|
+
readonly id: string;
|
|
85
|
+
readonly locales: readonly string[];
|
|
86
|
+
readonly active: boolean;
|
|
87
|
+
}[];
|
|
88
|
+
/** The effective identity's three files, with their text. */
|
|
89
|
+
readProfile(): {
|
|
90
|
+
readonly profile: string;
|
|
91
|
+
readonly identityDir: string;
|
|
92
|
+
readonly totalBytes: number;
|
|
93
|
+
readonly files: readonly DocumentText[];
|
|
94
|
+
};
|
|
95
|
+
/** Write one effective-identity file. Answers an error string instead of throwing. */
|
|
96
|
+
writeProfileFile(name: string, text: string): {
|
|
97
|
+
readonly ok: boolean;
|
|
98
|
+
readonly error?: string;
|
|
99
|
+
};
|
|
100
|
+
/** Read one preset with locale fallback; `undefined` when the preset or its English copy is absent. */
|
|
101
|
+
readPreset(id: string, locale: string): {
|
|
102
|
+
readonly found: boolean;
|
|
103
|
+
readonly id: string;
|
|
104
|
+
readonly requestedLocale: string;
|
|
105
|
+
readonly resolvedLocale: string;
|
|
106
|
+
readonly fellBack: boolean;
|
|
107
|
+
readonly files: readonly PresetFileText[];
|
|
108
|
+
};
|
|
109
|
+
/** Write one preset file in one locale. */
|
|
110
|
+
writePresetFile(id: string, name: string, text: string, locale: string): {
|
|
111
|
+
readonly ok: boolean;
|
|
112
|
+
readonly error?: string;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Switch the effective identity to `id`.
|
|
116
|
+
*
|
|
117
|
+
* `previousId` is the identity being LEFT (the caller's live `activePreset`): its current content is
|
|
118
|
+
* filed away under that id FIRST, so coming back to it later restores what the user wrote instead of
|
|
119
|
+
* the library's factory text. The incoming identity is then taken from this profile's own version when
|
|
120
|
+
* one exists, and from the library preset otherwise.
|
|
121
|
+
*
|
|
122
|
+
* `previousId === ''` with a non-empty effective identity means the user hand-wrote content that no
|
|
123
|
+
* identity owns: switching away would leave it nowhere to come back to, so it is REFUSED with an
|
|
124
|
+
* explanation rather than silently destroyed.
|
|
125
|
+
*/
|
|
126
|
+
applyPreset(id: string, locale: string, previousId?: string): {
|
|
127
|
+
readonly ok: boolean;
|
|
128
|
+
readonly error?: string;
|
|
129
|
+
readonly resolvedLocale?: string;
|
|
130
|
+
readonly fellBack?: boolean;
|
|
131
|
+
readonly files?: readonly string[];
|
|
132
|
+
readonly restoredEdit?: boolean;
|
|
133
|
+
};
|
|
134
|
+
/** Discard this profile's own version of `id` and put the library preset's text back in force. */
|
|
135
|
+
resetToPreset(id: string, locale: string): {
|
|
136
|
+
readonly ok: boolean;
|
|
137
|
+
readonly error?: string;
|
|
138
|
+
readonly resolvedLocale?: string;
|
|
139
|
+
readonly fellBack?: boolean;
|
|
140
|
+
readonly files?: readonly string[];
|
|
141
|
+
readonly dropped?: boolean;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Write a library preset's text into the effective identity and shape the answer both callers return.
|
|
145
|
+
*
|
|
146
|
+
* Always invalidates the reader: the write went behind its back, and a stale cache would keep serving
|
|
147
|
+
* the old identity until the mtime happened to move.
|
|
148
|
+
*/
|
|
149
|
+
private fromLibraryPreset;
|
|
150
|
+
/**
|
|
151
|
+
* Whether the effective identity differs from what preset `id` ships in `locale`.
|
|
152
|
+
* @param effectiveFiles - the effective files already read, when the caller has them.
|
|
153
|
+
*/
|
|
154
|
+
hasLocalEdit(id: string, locale: string, effectiveFiles?: readonly DocumentText[]): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Materialize an effective identity for THIS profile when it has none — what the switch's first
|
|
157
|
+
* enable asks the host for (see `presets.seedProfileIfEmpty`). Never overwrites the user's files.
|
|
158
|
+
*/
|
|
159
|
+
ensureProfile(locale: string): ProfileSeed;
|
|
160
|
+
/** Save the effective identity as a new preset. */
|
|
161
|
+
saveAsPreset(id: string, locale: string): {
|
|
162
|
+
readonly ok: boolean;
|
|
163
|
+
readonly error?: string;
|
|
164
|
+
readonly files?: readonly string[];
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Delete one preset from the library.
|
|
168
|
+
*
|
|
169
|
+
* This profile's own version of it goes too: once the identity is out of the dropdown, that version
|
|
170
|
+
* is unreachable — keeping it would only leave a shadow that a future release could resurrect.
|
|
171
|
+
*/
|
|
172
|
+
deletePreset(id: string): {
|
|
173
|
+
readonly ok: boolean;
|
|
174
|
+
readonly error?: string;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* The header's one call: everything the settings page renders above the editors.
|
|
178
|
+
*
|
|
179
|
+
* The three effective files are read ONCE here and reused for both the status rows and the
|
|
180
|
+
* "you have your own version" comparison — reading them a second time was pure work, and this call
|
|
181
|
+
* also walks the preset library (see `presetSummaries`).
|
|
182
|
+
*/
|
|
183
|
+
status(settings: IdentitySettings, locale: {
|
|
184
|
+
readonly locale: string;
|
|
185
|
+
readonly source: string;
|
|
186
|
+
}): IdentityStatusView;
|
|
187
|
+
/** The preset locale directory (read-only accessor for diagnostics and tests). */
|
|
188
|
+
pres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C,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE;IAU3N;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAOzB;;;OAGG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,SAAS,YAAY,EAAE,GAAG,OAAO;IAI3F;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW;IAa1C,mDAAmD;IACnD,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE;IAY/H;;;;;OAKG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAU3E;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,kBAAkB;IAkCpH,kFAAkF;IAClF,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAG9C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Packages released in lockstep with dsh, so their version says which dsh this build was made for.
|
|
3
|
+
*
|
|
4
|
+
* This must list every `@deepseek-ai/dsh-*` entry `scripts/link-dsh.mjs` bakes into
|
|
5
|
+
* `lib/dsh-build.json`, not just the ones the plugin imports at runtime: `scripts/lib/pack-plugin.mjs`
|
|
6
|
+
* fails the release in BOTH directions (a listed package that is not baked, and a baked package that
|
|
7
|
+
* is not listed), because a missing entry would make the compatibility gate fall back to the peer
|
|
8
|
+
* range's floor — a lower bound the artifact tolerates, which says nothing about the dsh `tsc` actually
|
|
9
|
+
* compiled against.
|
|
10
|
+
*
|
|
11
|
+
* Identity imports `dsh-system-prompt` (the mechanism and `PERSONA_PREFIX_SECTION`) and
|
|
12
|
+
* `dsh-typert-protocol` (the Remote face) at runtime; `dsh-scope` is the mechanism spec's
|
|
13
|
+
* `createScope`, and `dsh-tools` is linked only because the release gate requires a baked version for
|
|
14
|
+
* it. A version mismatch is a WARNING, never a refusal: only a PROVEN host break refuses a mount.
|
|
15
|
+
*
|
|
16
|
+
* @module @avantf/dsh-identity/versions
|
|
17
|
+
*/
|
|
18
|
+
export declare const VERSION_PACKAGES: readonly string[];
|
|
19
|
+
//# sourceMappingURL=versions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/versions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAK7C,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading one Config field.
|
|
3
|
+
*
|
|
4
|
+
* The plugin's settings fields are `schemastery` `.volatile()` references, because that is what makes
|
|
5
|
+
* the host project them into a live settings form which writes back to the profile patch and hot-reloads
|
|
6
|
+
* the row (see the spec §3.4). A volatile field is READ through `.get()`: the field itself is a stable
|
|
7
|
+
* reference whose value the runtime swaps, so a captured `config.enabled` would be a snapshot and the
|
|
8
|
+
* switch would appear to do nothing until a restart.
|
|
9
|
+
*
|
|
10
|
+
* The seam is deliberate: a test (and the mount smoke) mounts the plugin with a PLAIN config object.
|
|
11
|
+
* Accepting both shapes here is what keeps "read the live value" and "mountable with a literal" from
|
|
12
|
+
* being two different code paths.
|
|
13
|
+
*
|
|
14
|
+
* @module @avantf/dsh-identity/volatile
|
|
15
|
+
*/
|
|
16
|
+
/** A field that is either a live reference or a plain value. */
|
|
17
|
+
export type MaybeVolatile<T> = T | {
|
|
18
|
+
get(): T;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Read one Config field, whatever shape it arrived in.
|
|
22
|
+
*
|
|
23
|
+
* `fallback` covers the three "no value" spellings a live reference can produce: an absent field, a
|
|
24
|
+
* `get()` that answers `undefined`, and a `get()` that throws (a torn-down runtime must not break the
|
|
25
|
+
* prompt assembly it is describing).
|
|
26
|
+
*/
|
|
27
|
+
export declare function volatileValue<T>(field: MaybeVolatile<T | undefined> | undefined, fallback: T): T;
|
|
28
|
+
//# sourceMappingURL=volatile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"volatile.d.ts","sourceRoot":"","sources":["../../src/volatile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,gEAAgE;AAChE,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,GAAG,IAAI,CAAC,CAAA;CAAE,CAAA;AAE/C;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAYhG"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-written Typert wire faces (host and client): the generator only runs inside the harness
|
|
3
|
+
* workspace, and both halves import this one module so the two faces cannot drift.
|
|
4
|
+
* @module @avantf/dsh-identity/wire
|
|
5
|
+
*/
|
|
6
|
+
import * as z from 'zod';
|
|
7
|
+
import type { InvocationDescriptor } from '@deepseek-ai/dsh-typert-protocol';
|
|
8
|
+
export declare const PACKAGE = "@avantf/dsh-identity";
|
|
9
|
+
/** The Cordis service key that doubles as the Remote namespace. */
|
|
10
|
+
export declare const NAMESPACE = "avantfIdentity";
|
|
11
|
+
/** The methods the browser half may call; every field it sends must be declared here. */
|
|
12
|
+
export declare const descriptors: readonly InvocationDescriptor[];
|
|
13
|
+
/**
|
|
14
|
+
* The settings page's ONE entry point: everything the header renders, so a page load is one call.
|
|
15
|
+
* Every field is declared — a strict codec drops what it does not name.
|
|
16
|
+
*/
|
|
17
|
+
export declare const statusResultSchema: z.ZodObject<{
|
|
18
|
+
enabled: z.ZodBoolean;
|
|
19
|
+
profile: z.ZodString;
|
|
20
|
+
dataHome: z.ZodString;
|
|
21
|
+
identityDir: z.ZodString;
|
|
22
|
+
presetsDir: z.ZodString;
|
|
23
|
+
fileCount: z.ZodNumber;
|
|
24
|
+
totalBytes: z.ZodNumber;
|
|
25
|
+
maxBytes: z.ZodNumber;
|
|
26
|
+
interpolate: z.ZodBoolean;
|
|
27
|
+
replaceScope: z.ZodString;
|
|
28
|
+
drop: z.ZodArray<z.ZodString>;
|
|
29
|
+
fallbackToNative: z.ZodBoolean;
|
|
30
|
+
activePreset: z.ZodString;
|
|
31
|
+
activeLocale: z.ZodString;
|
|
32
|
+
hasLocalEdit: z.ZodBoolean;
|
|
33
|
+
locale: z.ZodString;
|
|
34
|
+
localeSource: z.ZodString;
|
|
35
|
+
files: z.ZodArray<z.ZodObject<{
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
file: z.ZodString;
|
|
38
|
+
path: z.ZodString;
|
|
39
|
+
present: z.ZodBoolean;
|
|
40
|
+
bytes: z.ZodNumber;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
presets: z.ZodArray<z.ZodObject<{
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
locales: z.ZodArray<z.ZodString>;
|
|
45
|
+
active: z.ZodBoolean;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export declare const profileResultSchema: z.ZodObject<{
|
|
49
|
+
profile: z.ZodString;
|
|
50
|
+
identityDir: z.ZodString;
|
|
51
|
+
totalBytes: z.ZodNumber;
|
|
52
|
+
files: z.ZodArray<z.ZodObject<{
|
|
53
|
+
name: z.ZodString;
|
|
54
|
+
file: z.ZodString;
|
|
55
|
+
text: z.ZodString;
|
|
56
|
+
present: z.ZodBoolean;
|
|
57
|
+
bytes: z.ZodNumber;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export declare const presetResultSchema: z.ZodObject<{
|
|
61
|
+
found: z.ZodBoolean;
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
requestedLocale: z.ZodString;
|
|
64
|
+
resolvedLocale: z.ZodString;
|
|
65
|
+
fellBack: z.ZodBoolean;
|
|
66
|
+
files: z.ZodArray<z.ZodObject<{
|
|
67
|
+
name: z.ZodString;
|
|
68
|
+
file: z.ZodString;
|
|
69
|
+
text: z.ZodString;
|
|
70
|
+
present: z.ZodBoolean;
|
|
71
|
+
bytes: z.ZodNumber;
|
|
72
|
+
}, z.core.$strip>>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
/** The answer to every write/delete action: `ok`, plus what the page needs to explain a refusal. */
|
|
75
|
+
export declare const writeResultSchema: z.ZodObject<{
|
|
76
|
+
ok: z.ZodBoolean;
|
|
77
|
+
error: z.ZodOptional<z.ZodString>;
|
|
78
|
+
resolvedLocale: z.ZodOptional<z.ZodString>;
|
|
79
|
+
fellBack: z.ZodOptional<z.ZodBoolean>;
|
|
80
|
+
files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
/** The host face: schemas plus the service model, registered through `ctx.typert.register()`. */
|
|
83
|
+
export declare const hostContribution: never;
|
|
84
|
+
/** The client face: the same descriptors, mounted through `ctx.remote.$mount()`. */
|
|
85
|
+
export declare const clientContribution: never;
|
|
86
|
+
//# sourceMappingURL=wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../src/wire.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAE5E,eAAO,MAAM,OAAO,yBAAyB,CAAA;AAE7C,mEAAmE;AACnE,eAAO,MAAM,SAAS,mBAAmB,CAAA;AA0EzC,yFAAyF;AACzF,eAAO,MAAM,WAAW,EAAE,SAAS,oBAAoB,EAYtD,CAAA;AA2BD;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoB7B,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;iBAK9B,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;iBAO7B,CAAA;AAEF,oGAAoG;AACpG,eAAO,MAAM,iBAAiB;;;;;;iBAM5B,CAAA;AAyDF,iGAAiG;AACjG,eAAO,MAAM,gBAAgB,EAMxB,KAAK,CAAA;AAEV,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,EAG1B,KAAK,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,107 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avantf/dsh-identity",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "DSH native Cordis plugin: the harness identity section of the system prompt is replaced by three editable profile files (IDENTITY / SOUL / RULES), with multi-lingual built-in presets and a settings page",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/types/index.d.ts",
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json",
|
|
14
|
+
"./client": {
|
|
15
|
+
"types": "./lib/types/client/index.d.ts",
|
|
16
|
+
"default": "./lib/client.js"
|
|
17
|
+
},
|
|
18
|
+
"./cordis.patch.yml": "./cordis.patch.yml"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"lib/index.js",
|
|
22
|
+
"lib/client.js",
|
|
23
|
+
"lib/envinit-bootstrap.js",
|
|
24
|
+
"lib/dsh-build.json",
|
|
25
|
+
"lib/types",
|
|
26
|
+
"lib/assets",
|
|
27
|
+
"README.md",
|
|
28
|
+
"lib/interface-version.json",
|
|
29
|
+
"cordis.patch.yml"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22.15.0 <23 || >=23.11.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
36
|
+
"@deepseek-ai/dsh-scope": "^0.1.5-rc.2 || ^0.1.7-rc.2 || ^0.2.0-rc.2",
|
|
37
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.5-rc.2 || ^0.1.7-rc.2 || ^0.2.0-rc.2",
|
|
38
|
+
"@deepseek-ai/dsh-tools": "^0.1.5-rc.2 || ^0.1.7-rc.2 || ^0.2.0-rc.2",
|
|
39
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.5-rc.2 || ^0.1.7-rc.2 || ^0.2.0-rc.2",
|
|
40
|
+
"@deepseek-ai/schemastery": "^3.18.2",
|
|
41
|
+
"zod": ">=4.4.3 <5"
|
|
42
|
+
},
|
|
43
|
+
"peerDependenciesMeta": {
|
|
44
|
+
"@deepseek-ai/cordis": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
|
+
"@deepseek-ai/dsh-scope": {
|
|
48
|
+
"optional": true
|
|
49
|
+
},
|
|
50
|
+
"@deepseek-ai/dsh-system-prompt": {
|
|
51
|
+
"optional": true
|
|
52
|
+
},
|
|
53
|
+
"@deepseek-ai/dsh-tools": {
|
|
54
|
+
"optional": true
|
|
55
|
+
},
|
|
56
|
+
"@deepseek-ai/dsh-typert-protocol": {
|
|
57
|
+
"optional": true
|
|
58
|
+
},
|
|
59
|
+
"@deepseek-ai/schemastery": {
|
|
60
|
+
"optional": true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@avantf/dsh-plugin-base": ">=0.3.0 <1.0.0"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@avantf/dsh-plugin-base": ">=0.3.0 <1.0.0",
|
|
68
|
+
"@types/node": "^22.0.0",
|
|
69
|
+
"@types/react": "^18.3.12",
|
|
70
|
+
"@types/react-dom": "^18.3.1",
|
|
71
|
+
"esbuild": "0.25.0",
|
|
72
|
+
"react": "18.3.1",
|
|
73
|
+
"react-dom": "18.3.1",
|
|
74
|
+
"typescript": "^5.5.0",
|
|
75
|
+
"vitest": "^2.1.0",
|
|
76
|
+
"zod": "4.6.5"
|
|
77
|
+
},
|
|
78
|
+
"license": "MIT",
|
|
79
|
+
"publishConfig": {
|
|
80
|
+
"access": "public",
|
|
81
|
+
"registry": "https://registry.npmjs.org"
|
|
82
|
+
},
|
|
83
|
+
"repository": {
|
|
84
|
+
"type": "git",
|
|
85
|
+
"url": "git@gitee.com:ffeng86/dsh-plugins.git",
|
|
86
|
+
"directory": "identity/packages/plugin"
|
|
87
|
+
},
|
|
88
|
+
"author": "qunqi.ff",
|
|
89
|
+
"dsh": {
|
|
90
|
+
"bundle": {
|
|
91
|
+
"patch": "./cordis.patch.yml"
|
|
92
|
+
},
|
|
93
|
+
"client": {
|
|
94
|
+
"inject": [
|
|
95
|
+
"@deepseek-ai/dsh-client-ui-settings-general",
|
|
96
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
97
|
+
"@deepseek-ai/dsh-api-remotes"
|
|
98
|
+
],
|
|
99
|
+
"platform": "web"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"scripts": {
|
|
103
|
+
"build": "node ../../scripts/build.mjs",
|
|
104
|
+
"typecheck": "node ../../scripts/typecheck.mjs",
|
|
105
|
+
"test": "vitest run"
|
|
106
|
+
}
|
|
6
107
|
}
|