@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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -2
  3. package/cordis.patch.yml +13 -0
  4. package/lib/assets/presets/analyst/en/IDENTITY.md +1 -0
  5. package/lib/assets/presets/analyst/en/RULES.md +8 -0
  6. package/lib/assets/presets/analyst/en/SOUL.md +5 -0
  7. package/lib/assets/presets/analyst/zh/IDENTITY.md +1 -0
  8. package/lib/assets/presets/analyst/zh/RULES.md +8 -0
  9. package/lib/assets/presets/analyst/zh/SOUL.md +5 -0
  10. package/lib/assets/presets/assistant/en/IDENTITY.md +1 -0
  11. package/lib/assets/presets/assistant/en/RULES.md +8 -0
  12. package/lib/assets/presets/assistant/en/SOUL.md +5 -0
  13. package/lib/assets/presets/assistant/zh/IDENTITY.md +1 -0
  14. package/lib/assets/presets/assistant/zh/RULES.md +8 -0
  15. package/lib/assets/presets/assistant/zh/SOUL.md +5 -0
  16. package/lib/assets/presets/coder/en/IDENTITY.md +1 -0
  17. package/lib/assets/presets/coder/en/RULES.md +8 -0
  18. package/lib/assets/presets/coder/en/SOUL.md +5 -0
  19. package/lib/assets/presets/coder/zh/IDENTITY.md +1 -0
  20. package/lib/assets/presets/coder/zh/RULES.md +8 -0
  21. package/lib/assets/presets/coder/zh/SOUL.md +5 -0
  22. package/lib/client.js +61 -0
  23. package/lib/dsh-build.json +6 -0
  24. package/lib/envinit-bootstrap.js +341 -0
  25. package/lib/index.js +1517 -0
  26. package/lib/interface-version.json +4 -0
  27. package/lib/types/atomic-write.d.ts +3 -0
  28. package/lib/types/atomic-write.d.ts.map +1 -0
  29. package/lib/types/base.d.ts +45 -0
  30. package/lib/types/base.d.ts.map +1 -0
  31. package/lib/types/client/IdentitySection.d.ts +29 -0
  32. package/lib/types/client/IdentitySection.d.ts.map +1 -0
  33. package/lib/types/client/api.d.ts +204 -0
  34. package/lib/types/client/api.d.ts.map +1 -0
  35. package/lib/types/client/index.d.ts +57 -0
  36. package/lib/types/client/index.d.ts.map +1 -0
  37. package/lib/types/documents.d.ts +65 -0
  38. package/lib/types/documents.d.ts.map +1 -0
  39. package/lib/types/envinit.d.ts +22 -0
  40. package/lib/types/envinit.d.ts.map +1 -0
  41. package/lib/types/gateway.d.ts +124 -0
  42. package/lib/types/gateway.d.ts.map +1 -0
  43. package/lib/types/index.d.ts +97 -0
  44. package/lib/types/index.d.ts.map +1 -0
  45. package/lib/types/interface_gate.d.ts +121 -0
  46. package/lib/types/interface_gate.d.ts.map +1 -0
  47. package/lib/types/log.d.ts +18 -0
  48. package/lib/types/log.d.ts.map +1 -0
  49. package/lib/types/paths.d.ts +45 -0
  50. package/lib/types/paths.d.ts.map +1 -0
  51. package/lib/types/presets.d.ts +201 -0
  52. package/lib/types/presets.d.ts.map +1 -0
  53. package/lib/types/session-freeze.d.ts +33 -0
  54. package/lib/types/session-freeze.d.ts.map +1 -0
  55. package/lib/types/state.d.ts +190 -0
  56. package/lib/types/state.d.ts.map +1 -0
  57. package/lib/types/versions.d.ts +19 -0
  58. package/lib/types/versions.d.ts.map +1 -0
  59. package/lib/types/volatile.d.ts +28 -0
  60. package/lib/types/volatile.d.ts.map +1 -0
  61. package/lib/types/wire.d.ts +86 -0
  62. package/lib/types/wire.d.ts.map +1 -0
  63. package/package.json +104 -3
@@ -0,0 +1,4 @@
1
+ {
2
+ "baseVersion": "0.5.2",
3
+ "interfaceVersion": 4
4
+ }
@@ -0,0 +1,3 @@
1
+ /** Write `text` to `path` through a sibling temp file, then rename it into place. */
2
+ export declare function writeFileAtomically(path: string, text: string): void;
3
+ //# sourceMappingURL=atomic-write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atomic-write.d.ts","sourceRoot":"","sources":["../../src/atomic-write.ts"],"names":[],"mappings":"AAaA,qFAAqF;AACrF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAapE"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The base half of this plugin's startup: load the family framework, judge the interface generation,
3
+ * and hand back a data-home resolver.
4
+ *
5
+ * The base is NEVER statically imported (a value import would throw before the inlined bootstrap ran);
6
+ * it is loaded through the vendored bootstrap and every member is read off the loaded module. Nothing
7
+ * here throws, and nothing here refuses the mount: a base that is absent, older, or from another
8
+ * interface generation answers `undefined`, and the identity mechanism itself — the prompt section and
9
+ * the waterfall filter — does not depend on the base at all. The caller then resolves the data home
10
+ * with `paths.ts`'s deliberate mirror.
11
+ *
12
+ * `undefined` (rather than a degraded runtime) is the family contract the base-swap proof asserts:
13
+ * an OLDER interface generation must be WITHHELD, and the proof drives exactly this entry point
14
+ * (`loadCompat`) with a swapped base module to see that.
15
+ *
16
+ * @module @avantf/dsh-identity/base
17
+ */
18
+ import type { DataHomeInput } from '@avantf/dsh-plugin-base';
19
+ import type { IdentityLogger } from './log.js';
20
+ /** The framework's module shape; `import type` only — the value is always loaded dynamically. */
21
+ type BaseModule = typeof import('@avantf/dsh-plugin-base');
22
+ /** What the rest of the plugin needs from the base: the module and a data-home resolver. */
23
+ export interface IdentityBase {
24
+ /** The loaded base, always usable (an unusable one answers `undefined` from {@link loadBase}). */
25
+ readonly module: BaseModule;
26
+ /** Resolve the family data root through the base's own rule. */
27
+ dataHome(input: DataHomeInput): string;
28
+ }
29
+ export interface LoadBaseOptions {
30
+ readonly log?: IdentityLogger;
31
+ /**
32
+ * Test/proof seam: the already-loaded base module to judge and use, INSTEAD of resolving one through
33
+ * the bootstrap. `prove-base-swap.mjs` drives the built loader with a swapped base this way.
34
+ */
35
+ readonly framework?: BaseModule;
36
+ }
37
+ /**
38
+ * Load (once per process) the base half.
39
+ *
40
+ * Never rejects. `undefined` means "use this plugin's own data-home mirror" — an absent base, or one
41
+ * whose interface generation is not the one this build was written for.
42
+ */
43
+ export declare function loadBase(options?: LoadBaseOptions): Promise<IdentityBase | undefined>;
44
+ export {};
45
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAG5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAM9C,iGAAiG;AACjG,KAAK,UAAU,GAAG,cAAc,yBAAyB,CAAC,CAAA;AAY1D,4FAA4F;AAC5F,MAAM,WAAW,YAAY;IAC3B,kGAAkG;IAClG,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAAA;CACvC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,CAAC,EAAE,cAAc,CAAA;IAC7B;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,CAAA;CAChC;AAkCD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAEzF"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The identity page: the switch, the three editors, and the preset library.
3
+ *
4
+ * It is rendered inside `settings.section`, so the ONLY prop the slot hands it is `close`; everything
5
+ * else is fetched through the callbacks `index.ts` built. Two rules shape the code:
6
+ *
7
+ * - the SWITCH is the host's config form (`configForms.get('avantf-identity')`), so writing it lands
8
+ * in the profile patch and hot-reloads the row exactly like a native setting; the page does not
9
+ * keep a second copy of that value;
10
+ * - the FILES go through this plugin's own Remote, and every write says "takes effect next turn"
11
+ * rather than pretending to be live.
12
+ *
13
+ * Styles use design tokens with hardcoded fallbacks (`var(--dsw-alias-…, #hex)`), so a token that a
14
+ * future theme renames degrades to a sane inherited colour instead of an invisible one.
15
+ *
16
+ * @module @avantf/dsh-identity/client/IdentitySection
17
+ */
18
+ import { type ReactNode } from 'react';
19
+ import type { ConfigFormLike, IdentityRemote } from './api.js';
20
+ export interface IdentitySectionProps {
21
+ readonly close: () => void;
22
+ readonly t: (key: string, params?: Record<string, unknown>) => string;
23
+ readonly getRemote: () => IdentityRemote | undefined;
24
+ readonly whenMounted: () => Promise<void>;
25
+ readonly getConfigForm: () => ConfigFormLike | undefined;
26
+ readonly locale: () => string;
27
+ }
28
+ export declare function IdentitySection(props: IdentitySectionProps): ReactNode;
29
+ //# sourceMappingURL=IdentitySection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IdentitySection.d.ts","sourceRoot":"","sources":["../../../src/client/IdentitySection.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAwD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC5F,OAAO,KAAK,EAAE,cAAc,EAAY,cAAc,EAAc,MAAM,UAAU,CAAA;AAEpF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAA;IAC1B,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAA;IACrE,QAAQ,CAAC,SAAS,EAAE,MAAM,cAAc,GAAG,SAAS,CAAA;IACpD,QAAQ,CAAC,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACzC,QAAQ,CAAC,aAAa,EAAE,MAAM,cAAc,GAAG,SAAS,CAAA;IACxD,QAAQ,CAAC,MAAM,EAAE,MAAM,MAAM,CAAA;CAC9B;AA8HD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,SAAS,CAgVtE"}
@@ -0,0 +1,204 @@
1
+ /**
2
+ * The browser half's view of the host Remote face.
3
+ *
4
+ * Declared structurally, not imported: no installed dsh ships a `ui-slots` / `ui-settings` package the
5
+ * plugin can type against (the browser shell seeds them into the module table), and importing one
6
+ * would add a peer this plugin does not need. These are the shapes `src/wire.ts` declares on the wire;
7
+ * the host's `strict` codec drops anything it does not name, so a field missing here shows up as a
8
+ * missing field, not as a crash.
9
+ *
10
+ * @module @avantf/dsh-identity/client/api
11
+ */
12
+ /** One identity file's status (no text). */
13
+ export interface FileStatus {
14
+ readonly name: string;
15
+ readonly file: string;
16
+ readonly path: string;
17
+ readonly present: boolean;
18
+ readonly bytes: number;
19
+ }
20
+ /** One identity file with its text. */
21
+ export interface FileText {
22
+ readonly name: string;
23
+ readonly file: string;
24
+ readonly text: string;
25
+ readonly present: boolean;
26
+ readonly bytes: number;
27
+ }
28
+ export interface PresetSummary {
29
+ readonly id: string;
30
+ readonly locales: readonly string[];
31
+ readonly active: boolean;
32
+ }
33
+ /** The header's one call. */
34
+ export interface StatusView {
35
+ readonly enabled: boolean;
36
+ readonly profile: string;
37
+ readonly dataHome: string;
38
+ readonly identityDir: string;
39
+ readonly presetsDir: string;
40
+ readonly fileCount: number;
41
+ readonly totalBytes: number;
42
+ readonly maxBytes: number;
43
+ readonly interpolate: boolean;
44
+ readonly replaceScope: string;
45
+ readonly drop: readonly string[];
46
+ readonly fallbackToNative: boolean;
47
+ readonly activePreset: string;
48
+ readonly activeLocale: string;
49
+ /** Whether the effective identity differs from what the active preset ships. */
50
+ readonly hasLocalEdit: boolean;
51
+ readonly locale: string;
52
+ readonly localeSource: string;
53
+ readonly files: readonly FileStatus[];
54
+ readonly presets: readonly PresetSummary[];
55
+ }
56
+ export interface ProfileView {
57
+ readonly profile: string;
58
+ readonly identityDir: string;
59
+ readonly totalBytes: number;
60
+ readonly files: readonly FileText[];
61
+ }
62
+ export interface PresetView {
63
+ readonly found: boolean;
64
+ readonly id: string;
65
+ readonly requestedLocale: string;
66
+ readonly resolvedLocale: string;
67
+ readonly fellBack: boolean;
68
+ readonly files: readonly FileText[];
69
+ }
70
+ export interface WriteResult {
71
+ readonly ok: boolean;
72
+ readonly error?: string;
73
+ readonly resolvedLocale?: string;
74
+ readonly fellBack?: boolean;
75
+ readonly files?: readonly string[];
76
+ }
77
+ /** The host's `avantfIdentity` namespace, as the page calls it. */
78
+ export interface IdentityRemote {
79
+ status(args: {
80
+ locale?: string;
81
+ }): Promise<StatusView>;
82
+ /** No parameters on the wire: the host method takes none (see `directNoArgs` in `wire.ts`). */
83
+ listPresets(): Promise<{
84
+ readonly presets: readonly PresetSummary[];
85
+ }>;
86
+ /** No parameters on the wire: the host method takes none (see `directNoArgs` in `wire.ts`). */
87
+ readProfile(): Promise<ProfileView>;
88
+ writeProfileFile(args: {
89
+ name: string;
90
+ text: string;
91
+ }): Promise<WriteResult>;
92
+ /** Give this profile an identity to start from when it has none (the switch's first enable). */
93
+ ensureProfile(args: {
94
+ locale?: string;
95
+ }): Promise<WriteResult>;
96
+ applyPreset(args: {
97
+ id: string;
98
+ locale?: string;
99
+ }): Promise<WriteResult>;
100
+ /** Drop this profile's own version of `id` and put the preset's text back in force. */
101
+ resetToPreset(args: {
102
+ id: string;
103
+ locale?: string;
104
+ }): Promise<WriteResult>;
105
+ saveAsPreset(args: {
106
+ id: string;
107
+ locale?: string;
108
+ }): Promise<WriteResult>;
109
+ readPreset(args: {
110
+ id: string;
111
+ locale?: string;
112
+ }): Promise<PresetView>;
113
+ writePresetFile(args: {
114
+ id: string;
115
+ name: string;
116
+ text: string;
117
+ locale?: string;
118
+ }): Promise<WriteResult>;
119
+ deletePreset(args: {
120
+ id: string;
121
+ }): Promise<WriteResult>;
122
+ }
123
+ /**
124
+ * The slice of `ctx.configForms` this page uses.
125
+ *
126
+ * Read through `ctx.get('configForms')` at USE time rather than declared in the client plugin's
127
+ * `inject`: a composition that never loaded the settings domain must still register the page (it says
128
+ * "the switch is unavailable" instead of leaving a pending entry and failing the boot audit).
129
+ */
130
+ export interface ConfigFormLike {
131
+ getSnapshot(): ConfigFormSnapshot;
132
+ subscribe(listener: () => void): () => void;
133
+ set(field: string, value: unknown): Promise<boolean>;
134
+ }
135
+ export interface ConfigFormSnapshot {
136
+ readonly value?: {
137
+ readonly enabled?: boolean;
138
+ readonly activePreset?: string;
139
+ readonly activeLocale?: string;
140
+ };
141
+ }
142
+ /**
143
+ * The settings domain SERVICE, which is what `ctx.get('configForms')` returns.
144
+ *
145
+ * The service is not a form: `getSnapshot`/`subscribe`/`set` live on `service.get(entryId)`, keyed by the
146
+ * PROFILE ROW id. Reading the service as if it were a form throws `next.subscribe is not a function`
147
+ * inside the page's effect — and a throw in an effect makes React tear the subtree down, so the settings
148
+ * pane goes blank while its nav entry (rendered from `label`) stays. That is measured behaviour in a real
149
+ * browser, not a hypothetical, which is why the hop below exists and is guarded.
150
+ */
151
+ export interface ConfigFormsLike {
152
+ get(entryId: string): ConfigFormLike | undefined;
153
+ }
154
+ /**
155
+ * Resolve one profile entry's config form out of the settings domain service.
156
+ *
157
+ * Deliberately total: an absent service, a service with no `get`, a `get` that throws, or a `get` that
158
+ * answers something without `subscribe` all return `undefined`, so the page reports "the settings form is
159
+ * not ready" instead of throwing inside an effect and blanking the pane.
160
+ *
161
+ * @param service - whatever `ctx.get('configForms')` answered.
162
+ * @param entryId - the profile row id, which is also the settings namespace.
163
+ * @returns the entry's form, or undefined when this deployment cannot supply one.
164
+ */
165
+ export declare function resolveConfigForm(service: unknown, entryId: string): ConfigFormLike | undefined;
166
+ /**
167
+ * The Remote methods this page calls, in the order the wire face declares them.
168
+ *
169
+ * Kept as a list because the transport ENVELOPE has to be peeled per call (see {@link wrapRemote}),
170
+ * and a wrapper that names the methods explicitly cannot silently miss a new one: the compatibility
171
+ * gate already pins this exact set on the host side.
172
+ */
173
+ export declare const REMOTE_METHODS: readonly ["status", "listPresets", "readProfile", "writeProfileFile", "ensureProfile", "applyPreset", "resetToPreset", "saveAsPreset", "readPreset", "writePresetFile", "deletePreset"];
174
+ /** A transport failure, so the page's own `catch` shows the host's reason. */
175
+ export declare class RemoteCallError extends Error {
176
+ }
177
+ /**
178
+ * Peel the TRANSPORT envelope, exactly once.
179
+ *
180
+ * The Remote proxy does not answer the host's return value; it answers `{ ok, value }` around it —
181
+ * measured in the browser, where the page received `ok, value` and nothing else, so `status.drop` was
182
+ * `undefined` and the render threw. Exactly ONE layer is peeled on purpose: this plugin's own write
183
+ * results (`WriteResult`) carry an `ok` of their own, and a generic two-layer unwrap would eat that
184
+ * and lose `error`/`files`.
185
+ *
186
+ * A bare payload (no boolean `ok` + `value`) passes through untouched, and a write result is therefore
187
+ * never mistaken for an envelope.
188
+ *
189
+ * @param result - whatever the proxy answered.
190
+ * @returns the host's return value.
191
+ * @throws RemoteCallError when the transport itself failed.
192
+ */
193
+ export declare function unwrapRemote<T>(result: unknown): T;
194
+ /**
195
+ * Wrap the raw Remote proxy so every call answers the host's payload rather than its envelope.
196
+ *
197
+ * The page keeps calling `remote.status(...)` and checking `result.ok` on a WRITE exactly as before;
198
+ * the envelope stays a transport detail on one line here instead of at twelve call sites.
199
+ *
200
+ * @param raw - the namespace read back from `ctx.get('remote.avantfIdentity')`.
201
+ * @returns the same face, envelope-free, or undefined when the namespace is absent.
202
+ */
203
+ export declare function wrapRemote<T extends object>(raw: T | undefined): T | undefined;
204
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/client/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,4CAA4C;AAC5C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,uCAAuC;AACvC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,M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MAAM,IAAI,CAAA;IAC3C,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACrD;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACf,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;QAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;QAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAC/B,CAAA;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAA;CACjD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAS/F;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,yLAYjB,CAAA;AAEV,8EAA8E;AAC9E,qBAAa,eAAgB,SAAQ,KAAK;CAAG;AAE7C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,CAAC,CAelD;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAmB9E"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * `@avantf/dsh-identity` — the browser half: ONE settings-panel page.
3
+ *
4
+ * `settings.section` is the settings panel's own extension point (declared by
5
+ * `dsh-client-ui-settings-general`'s `SettingsRoot`): registering one entry yields "a nav item on the
6
+ * left, a pane on the right". The id must be NEW — reusing `general`/`models`/`plugins`/`agent-presets`
7
+ * would render into another plugin's slot — so this page owns `identity` at order 25, after `account`.
8
+ *
9
+ * `inject` is `['remote', 'slots', 'locale']` and NOTHING dotted: `remote.avantfIdentity` only exists
10
+ * after this half mounts its own contribution, so a dotted entry would leave this client plugin
11
+ * pending forever and the startup audit throws (the accident the sibling trees recorded).
12
+ *
13
+ * @module @avantf/dsh-identity/client
14
+ */
15
+ import { type ReactNode } from 'react';
16
+ /** Cordis plugin name; matches the host half and the profile row. */
17
+ export declare const name = "avantf-identity";
18
+ /** Required client services; the Remote namespace itself is intentionally absent (see above). */
19
+ export declare const inject: string[];
20
+ /** The slice of the client Context this half uses, declared structurally (see `api.ts`). */
21
+ interface ClientContext {
22
+ effect(callback: () => (() => void) | void, label?: string): void;
23
+ logger: {
24
+ error(message: string): void;
25
+ };
26
+ locale: {
27
+ register(namespace: string, dictionaries: Record<'zh' | 'en', Record<string, string>>): () => void;
28
+ bind(namespace: string): (key: string, params?: Record<string, unknown>) => string;
29
+ /**
30
+ * The locale face's own reader. The service IS the face (`bind` + `getSnapshot`/`subscribe`), so this
31
+ * is the method name: `snapshot()` does not exist, and reading it silently resolved every preset to
32
+ * English while dsh was showing Chinese (the service never threw, it simply had no such member).
33
+ */
34
+ getSnapshot(): {
35
+ readonly active?: string;
36
+ };
37
+ };
38
+ remote: {
39
+ $mount(contribution: unknown): Promise<unknown>;
40
+ };
41
+ get(name: string): unknown;
42
+ slots: {
43
+ inject(name: string, register: () => (() => void) | void): void;
44
+ register(options: {
45
+ name: string;
46
+ id: string;
47
+ order: number;
48
+ locale: string;
49
+ label: () => string;
50
+ }, component: (props: {
51
+ close: () => void;
52
+ }) => ReactNode): () => void;
53
+ };
54
+ }
55
+ export declare function apply(ctx: ClientContext): void;
56
+ export {};
57
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAK1D,qEAAqE;AACrE,eAAO,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zF,SAAS,EAAE,CAAC,KAAK,EAAE;YAAE,KAAK,EAAE,MAAM,IAAI,CAAA;SAAE,KAAK,SAAS,GACrD,MAAM,IAAI,CAAA;KACd,CAAA;CACF;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAsF9C"}
@@ -0,0 +1,65 @@
1
+ import type { IdentityLogger } from './log.js';
2
+ import { type IdentityFileName } from './paths.js';
3
+ /** One file's state, as the settings page reports it. */
4
+ export interface DocumentStatus {
5
+ readonly name: IdentityFileName;
6
+ readonly file: string;
7
+ readonly path: string;
8
+ readonly present: boolean;
9
+ readonly bytes: number;
10
+ }
11
+ /** One file's content, as the settings page reads it. */
12
+ export interface DocumentText {
13
+ readonly name: IdentityFileName;
14
+ readonly file: string;
15
+ readonly text: string;
16
+ readonly present: boolean;
17
+ readonly bytes: number;
18
+ }
19
+ /** `IDENTITY` → `IDENTITY.md`. */
20
+ export declare function fileNameOf(name: string): string;
21
+ /** The rendered text of one identity directory, plus its per-file provenance. */
22
+ export declare class IdentityDocuments {
23
+ private readonly dir;
24
+ private readonly options;
25
+ private readonly cache;
26
+ constructor(dir: string, options?: {
27
+ readonly logger?: IdentityLogger;
28
+ readonly maxBytes: () => number;
29
+ });
30
+ /** The directory the three files live in. */
31
+ get directory(): string;
32
+ /** One file's path. */
33
+ pathOf(name: IdentityFileName): string;
34
+ /**
35
+ * Read one file, or `''` when it is absent or unreadable.
36
+ *
37
+ * Cached on `(mtimeMs, size)`: the two together are what a text editor changes, and the stat is an
38
+ * order of magnitude cheaper than the read for the tens-of-KB files this holds.
39
+ */
40
+ read(name: IdentityFileName): string;
41
+ /** Every file's text, in render order. */
42
+ readAll(): DocumentText[];
43
+ /** Every file's presence and size, without rendering. */
44
+ status(): DocumentStatus[];
45
+ /**
46
+ * The prompt text: the non-empty bodies joined by one blank line, the rules part under its own
47
+ * heading (see {@link RULES_HEADING}), truncated to `maxBytes` (when it is positive) with a visible
48
+ * notice appended and a warning naming the files that overflowed.
49
+ */
50
+ render(): string;
51
+ /** Total rendered-model bytes across the three files, without truncation. */
52
+ bytes(): number;
53
+ /** Drop the read cache, so the next read comes from disk. Called after every write. */
54
+ invalidate(): void;
55
+ /**
56
+ * Write one file atomically, so an assembly reading concurrently sees either the old text or the new
57
+ * one, never a half-written file. The write itself is `writeFileAtomically`'s (shared with the preset
58
+ * writers); the cache is dropped here, in a `finally`, so a failed write cannot leave it serving text
59
+ * that is no longer on disk.
60
+ */
61
+ write(name: IdentityFileName, text: string): void;
62
+ /** The identity directory itself; exported so a caller need not re-derive it. */
63
+ get root(): string;
64
+ }
65
+ //# sourceMappingURL=documents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/documents.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElE,yDAAyD;AACzD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAA;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAA;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAQD,kCAAkC;AAClC,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAoBD,iFAAiF;AACjF,qBAAa,iBAAiB;IAI1B,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ1B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA0C;gBAG7C,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,MAAM,CAAA;KAA0B;IAGzH,6CAA6C;IAC7C,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,uBAAuB;IACvB,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM;IAItC;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM;IAepC,0CAA0C;IAC1C,OAAO,IAAI,YAAY,EAAE;IAOzB,yDAAyD;IACzD,MAAM,IAAI,cAAc,EAAE;IAa1B;;;;OAIG;IACH,MAAM,IAAI,MAAM;IA0BhB,6EAA6E;IAC7E,KAAK,IAAI,MAAM;IAIf,uFAAuF;IACvF,UAAU,IAAI,IAAI;IAIlB;;;;;OAKG;IACH,KAAK,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAYjD,iFAAiF;IACjF,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The built loader entry the base-swap proof drives.
3
+ *
4
+ * `scripts/prove-base-swap.mjs` looks for `lib/envinit.js` and calls `loadCompat` (or `loadEnvinit`)
5
+ * with a SWAPPED base module, then asserts the interface-generation asymmetry: a NEWER generation is
6
+ * accepted, an OLDER one is withheld (`undefined`) with the "shared capabilities are NOT used"
7
+ * warning, and neither ever throws.
8
+ *
9
+ * It is a thin alias over {@link loadBase} rather than a second loader: mission and mem grew a large
10
+ * envinit because they provision binaries and models, and identity has nothing to provision — the one
11
+ * thing this tree needs from the base is the family data-home rule. Keeping the alias means the
12
+ * proven artifact and the runtime artifact cannot drift.
13
+ *
14
+ * @module @avantf/dsh-identity/envinit
15
+ */
16
+ import { type IdentityBase, type LoadBaseOptions } from './base.js';
17
+ export type { IdentityBase, LoadBaseOptions };
18
+ /** The base loader, under the name the base-swap proof looks for. */
19
+ export declare function loadCompat(options?: LoadBaseOptions): Promise<IdentityBase | undefined>;
20
+ /** Alias kept for symmetry with the sibling trees' `loadEnvinit` entry point. */
21
+ export declare const loadEnvinit: typeof loadCompat;
22
+ //# sourceMappingURL=envinit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envinit.d.ts","sourceRoot":"","sources":["../../src/envinit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAY,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAA;AAE7E,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,CAAA;AAE7C,qEAAqE;AACrE,wBAAgB,UAAU,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAE3F;AAED,iFAAiF;AACjF,eAAO,MAAM,WAAW,mBAAa,CAAA"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * The host face of this plugin's Remote namespace: everything the settings page calls.
3
+ *
4
+ * `TypertRemoteService` publishes the Cordis service AND binds it as a Remote namespace, so the
5
+ * browser half reaches these methods through `ctx.get('remote.avantfIdentity')` after `$mount` — never
6
+ * through a dotted `inject` entry, which would leave the client plugin's entry pending forever (see
7
+ * `src/client/index.ts`).
8
+ *
9
+ * Every method answers a plan-shaped value; none of them throws. A Remote call has no caller identity,
10
+ * so the ONLY argument that varies per call is the locale the browser is showing — the page passes it,
11
+ * and a headless caller falls back to the host's `locale` setting namespace, then to English.
12
+ *
13
+ * @module @avantf/dsh-identity/gateway
14
+ */
15
+ import type { Context } from '@deepseek-ai/cordis';
16
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
17
+ import type { IdentityLogger } from './log.js';
18
+ import type { IdentitySettings, IdentityState, IdentityStatusView } from './state.js';
19
+ /** The profile entry id this plugin's Config lives under (the settings namespace a write targets). */
20
+ export declare const ENTRY_ID = "avantf-identity";
21
+ /** What a Remote call may carry when it wants a specific language: the browser's active locale. */
22
+ interface LocaleArg {
23
+ readonly locale?: string;
24
+ }
25
+ /** One write's answer, mirroring `writeResultSchema`. */
26
+ interface WriteResult {
27
+ readonly ok: boolean;
28
+ readonly error?: string;
29
+ readonly resolvedLocale?: string;
30
+ readonly fellBack?: boolean;
31
+ readonly files?: readonly string[];
32
+ }
33
+ export declare class IdentityGateway extends TypertRemoteService {
34
+ private readonly state;
35
+ private readonly settings;
36
+ private readonly log;
37
+ constructor(ctx: Context, state: IdentityState, settings: () => IdentitySettings, log: IdentityLogger);
38
+ /** The settings page's ONE entry point: the header, the three file slots, and the preset library. */
39
+ status(args: LocaleArg): IdentityStatusView;
40
+ /** The preset library, with the active one marked. */
41
+ listPresets(): {
42
+ readonly presets: IdentityStatusView['presets'];
43
+ };
44
+ /** The three files of the effective identity, with their text. */
45
+ readProfile(): ReturnType<IdentityState['readProfile']>;
46
+ /** Write one effective-identity file. The next assembly reads it; nothing else is touched. */
47
+ writeProfileFile(args: {
48
+ name: string;
49
+ text: string;
50
+ }): WriteResult;
51
+ /**
52
+ * Materialize an identity for the current profile when it has none: the switch's FIRST enable calls
53
+ * this, so turning the identity on produces something to edit instead of three empty editors over a
54
+ * prompt that still says `harness:identity` (the first run releases the preset LIBRARY only).
55
+ *
56
+ * A no-op once any file carries text — it never overwrites what the user wrote — and a reported error,
57
+ * never a silent nothing, when the library is empty.
58
+ */
59
+ ensureProfile(args: LocaleArg): Promise<WriteResult>;
60
+ /**
61
+ * Switch to a preset, then record which preset/locale is in force.
62
+ *
63
+ * The identity being LEFT is named to the state, which files its current content away under that id
64
+ * before the write — that is what makes coming back to it restore the user's own text instead of the
65
+ * library's. Leaving an identity that no preset owns is refused (see `IdentityState.applyPreset`).
66
+ */
67
+ applyPreset(args: {
68
+ id: string;
69
+ locale?: string;
70
+ }): Promise<WriteResult>;
71
+ /**
72
+ * Drop this profile's own version of `id` and put the library preset's text back in force — the way
73
+ * out of a customized identity. Destructive by intent; the page confirms it.
74
+ */
75
+ resetToPreset(args: {
76
+ id: string;
77
+ locale?: string;
78
+ }): Promise<WriteResult>;
79
+ /** Save the effective identity as a new preset under the locale the caller is showing. */
80
+ saveAsPreset(args: {
81
+ id: string;
82
+ locale?: string;
83
+ }): WriteResult;
84
+ /** Read one preset (English fallback when the requested locale has no directory). */
85
+ readPreset(args: {
86
+ id: string;
87
+ locale?: string;
88
+ }): ReturnType<IdentityState['readPreset']>;
89
+ /** Write one preset file. Never touches the effective identity (the page says so out loud). */
90
+ writePresetFile(args: {
91
+ id: string;
92
+ name: string;
93
+ text: string;
94
+ locale?: string;
95
+ }): WriteResult;
96
+ /**
97
+ * Delete one preset from the library (and, with it, this profile's version of it).
98
+ *
99
+ * Deleting the identity that is IN FORCE also forgets it: the effective files stay where they are, but
100
+ * their id is gone, so the state must treat them as unowned from here on — otherwise the next switch
101
+ * would file them away under a name the dropdown no longer shows.
102
+ */
103
+ deletePreset(args: {
104
+ id: string;
105
+ }): Promise<WriteResult>;
106
+ /**
107
+ * Record which preset/locale is in force, so a later language change can offer "apply it again in
108
+ * `<new language>`" WITHOUT ever rewriting the user's files. Best-effort: a host whose settings
109
+ * service is absent or read-only mounts and works, it just cannot remember this.
110
+ */
111
+ private remember;
112
+ /**
113
+ * The language to apply in: the caller's own (UI-triggered applies always carry it), else the host's
114
+ * explicit `locale` preference, else English.
115
+ *
116
+ * The browser's `locale` service exists only on the CLIENT half, so a headless caller reads the same
117
+ * preference through the settings projection — the field `dsh-client-locale` writes only when a user
118
+ * has explicitly chosen a language, which is exactly the "no browser to delegate to" case.
119
+ */
120
+ private localeInfo;
121
+ private hostLocale;
122
+ }
123
+ export {};
124
+ //# sourceMappingURL=gateway.d.ts.map
@@ -0,0 +1 @@
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