sqs-dsh-better-input 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 (40) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +218 -0
  3. package/assets/banner.png +0 -0
  4. package/cordis.patch.yml +6 -0
  5. package/lib/about.d.ts +65 -0
  6. package/lib/client/MicrophoneButton.d.ts +64 -0
  7. package/lib/client/OptimizeButton.d.ts +33 -0
  8. package/lib/client/VoiceRecognitionBar.d.ts +14 -0
  9. package/lib/client/index.d.ts +14 -0
  10. package/lib/client/settings-controller.d.ts +80 -0
  11. package/lib/client/settings.d.ts +15 -0
  12. package/lib/client/strings.d.ts +113 -0
  13. package/lib/client/templates-controller.d.ts +45 -0
  14. package/lib/client/templates-section.d.ts +17 -0
  15. package/lib/client/templates-source.d.ts +16 -0
  16. package/lib/client/voice-session.d.ts +35 -0
  17. package/lib/client/web-speech.d.ts +35 -0
  18. package/lib/client.d.ts +1 -0
  19. package/lib/client.js +2925 -0
  20. package/lib/client.js.map +1 -0
  21. package/lib/config.d.ts +100 -0
  22. package/lib/identity-CzaR1Taa.js +18 -0
  23. package/lib/identity-CzaR1Taa.js.map +1 -0
  24. package/lib/identity.d.ts +24 -0
  25. package/lib/index.d.ts +11 -0
  26. package/lib/index.js +920 -0
  27. package/lib/index.js.map +1 -0
  28. package/lib/polish/prompts.d.ts +37 -0
  29. package/lib/polish/service.d.ts +45 -0
  30. package/lib/remote-contract.d.ts +166 -0
  31. package/lib/remote.d.ts +56 -0
  32. package/lib/remote.js +226 -0
  33. package/lib/remote.js.map +1 -0
  34. package/lib/settings/store.d.ts +41 -0
  35. package/lib/templates/model.d.ts +30 -0
  36. package/lib/templates/store.d.ts +27 -0
  37. package/lib/typert.d.ts +107 -0
  38. package/lib/typert.js +468 -0
  39. package/lib/typert.js.map +1 -0
  40. package/package.json +116 -0
package/lib/remote.js ADDED
@@ -0,0 +1,226 @@
1
+ import { n as PACKAGE_NAME } from "./identity-CzaR1Taa.js";
2
+ //#region src/remote.ts
3
+ /**
4
+ * Build one strict codec for the CLIENT face.
5
+ *
6
+ * The client face exists only to describe the wire shape to
7
+ * `ctx.remote.$mount`; the actual byte validation happens on the Host. This is
8
+ * not an assumption — it is how dsh 0.1.7 is wired:
9
+ *
10
+ * - `@deepseek-ai/dsh-api-gateway/lib/index.js` (Host) is the ONLY place that
11
+ * runs `codec.create().parse(value)`. Validation lives in `decode()`.
12
+ * - `…/lib/client.js` contains ZERO `.create()` calls. Its `$mount` path only
13
+ * calls `requireStrictCodecs`, which inspects `codec.mode === 'strict'` and
14
+ * never reads `typeSymbol` or invokes the factory. `prepareInvocation()`
15
+ * forwards raw argument values straight to the RPC carrier.
16
+ *
17
+ * So materializing a real schema in the browser is pure dead weight: it pulls
18
+ * all of zod (~280 KB) into `lib/client.js` for a factory that is never called.
19
+ * The `create()` here is therefore lazy AND schema-free — it never imports zod.
20
+ *
21
+ * The eager `import { …Schema } from './remote-contract.js'` that used to sit
22
+ * at the top of this file was the single value-reachability edge that dragged
23
+ * zod into the browser bundle, because `src/client/index.ts` needs
24
+ * `TYPERT_REMOTE` as a value.
25
+ *
26
+ * The placeholder satisfies `TypertSchema` ({ parse(value) }) structurally, so
27
+ * the client face still typechecks. It is unreachable at runtime; if a future
28
+ * dsh ever validates on the client, `parse` throws loudly instead of silently
29
+ * accepting bad bytes. The Host manifest in `typert.ts` keeps the real zod
30
+ * schemas.
31
+ */
32
+ function codec(typeSymbol) {
33
+ return {
34
+ mode: "strict",
35
+ typeSymbol,
36
+ create: () => ({ parse(value) {
37
+ throw new Error(`sqs-dsh-better-input: client-face codec ${typeSymbol} was materialized. The client must never validate wire bytes (the Host does). If this fires, the client-face descriptor is being used for validation it should not own.`);
38
+ } })
39
+ };
40
+ }
41
+ /** Type symbol for one of this plugin's own wire types. */
42
+ const symbol = (name) => `${PACKAGE_NAME}#${name}`;
43
+ /** The client-face Typert manifest; mirrors the Host face in `typert.ts`. */
44
+ const TYPERT_REMOTE = {
45
+ package: PACKAGE_NAME,
46
+ descriptors: [
47
+ {
48
+ id: `${PACKAGE_NAME}#betterInput/getSettings`,
49
+ service: "BetterInputPolish",
50
+ namespace: "betterInput",
51
+ method: "getSettings",
52
+ invocation: { kind: "direct" },
53
+ parameters: [],
54
+ result: codec(symbol("BetterInputSettingsView"))
55
+ },
56
+ {
57
+ id: `${PACKAGE_NAME}#betterInput/updateSettings`,
58
+ service: "BetterInputPolish",
59
+ namespace: "betterInput",
60
+ method: "updateSettings",
61
+ invocation: { kind: "direct" },
62
+ parameters: [{
63
+ name: "patch",
64
+ wire: "patch",
65
+ source: "json",
66
+ codec: codec(symbol("BetterInputSettingsPatch"))
67
+ }],
68
+ cancellation: { parameter: "signal" },
69
+ result: codec(symbol("BetterInputSettingsView"))
70
+ },
71
+ {
72
+ id: `${PACKAGE_NAME}#betterInput/listRoutes`,
73
+ service: "BetterInputPolish",
74
+ namespace: "betterInput",
75
+ method: "listRoutes",
76
+ invocation: { kind: "direct" },
77
+ parameters: [],
78
+ result: codec(symbol("PolishRoute[]"))
79
+ },
80
+ {
81
+ id: `${PACKAGE_NAME}#betterInput/resolveModelEfforts`,
82
+ service: "BetterInputPolish",
83
+ namespace: "betterInput",
84
+ method: "resolveModelEfforts",
85
+ invocation: { kind: "direct" },
86
+ parameters: [{
87
+ name: "provider",
88
+ wire: "provider",
89
+ source: "json",
90
+ codec: codec("string")
91
+ }, {
92
+ name: "model",
93
+ wire: "model",
94
+ source: "json",
95
+ codec: codec("string")
96
+ }],
97
+ result: codec(symbol("ResolveModelEffortsResult"))
98
+ },
99
+ {
100
+ id: `${PACKAGE_NAME}#betterInput/getAbout`,
101
+ service: "BetterInputPolish",
102
+ namespace: "betterInput",
103
+ method: "getAbout",
104
+ invocation: { kind: "direct" },
105
+ parameters: [],
106
+ result: codec(symbol("AboutInfo"))
107
+ },
108
+ {
109
+ id: `${PACKAGE_NAME}#betterInput/checkForUpdate`,
110
+ service: "BetterInputPolish",
111
+ namespace: "betterInput",
112
+ method: "checkForUpdate",
113
+ invocation: { kind: "direct" },
114
+ parameters: [],
115
+ cancellation: { parameter: "signal" },
116
+ result: codec(symbol("UpdateCheckResult"))
117
+ },
118
+ {
119
+ id: `${PACKAGE_NAME}#betterInput/polish`,
120
+ service: "BetterInputPolish",
121
+ namespace: "betterInput",
122
+ method: "polish",
123
+ invocation: { kind: "direct" },
124
+ parameters: [
125
+ {
126
+ name: "transcript",
127
+ wire: "transcript",
128
+ source: "json",
129
+ codec: codec("string")
130
+ },
131
+ {
132
+ name: "provider",
133
+ wire: "provider",
134
+ source: "json",
135
+ codec: codec("string")
136
+ },
137
+ {
138
+ name: "model",
139
+ wire: "model",
140
+ source: "json",
141
+ codec: codec("string")
142
+ }
143
+ ],
144
+ cancellation: { parameter: "signal" },
145
+ result: codec("string")
146
+ },
147
+ {
148
+ id: `${PACKAGE_NAME}#betterInput/optimize`,
149
+ service: "BetterInputPolish",
150
+ namespace: "betterInput",
151
+ method: "optimize",
152
+ invocation: { kind: "direct" },
153
+ parameters: [
154
+ {
155
+ name: "text",
156
+ wire: "text",
157
+ source: "json",
158
+ codec: codec("string")
159
+ },
160
+ {
161
+ name: "provider",
162
+ wire: "provider",
163
+ source: "json",
164
+ codec: codec("string")
165
+ },
166
+ {
167
+ name: "model",
168
+ wire: "model",
169
+ source: "json",
170
+ codec: codec("string")
171
+ },
172
+ {
173
+ name: "context",
174
+ wire: "context",
175
+ source: "json",
176
+ codec: codec("string")
177
+ }
178
+ ],
179
+ cancellation: { parameter: "signal" },
180
+ result: codec("string")
181
+ },
182
+ {
183
+ id: `${PACKAGE_NAME}#betterInput/templatesList`,
184
+ service: "BetterInputPolish",
185
+ namespace: "betterInput",
186
+ method: "templatesList",
187
+ invocation: { kind: "direct" },
188
+ parameters: [],
189
+ result: codec(symbol("TemplateListResult"))
190
+ },
191
+ {
192
+ id: `${PACKAGE_NAME}#betterInput/templatesSave`,
193
+ service: "BetterInputPolish",
194
+ namespace: "betterInput",
195
+ method: "templatesSave",
196
+ invocation: { kind: "direct" },
197
+ parameters: [{
198
+ name: "template",
199
+ wire: "template",
200
+ source: "json",
201
+ codec: codec(symbol("TemplateInput"))
202
+ }],
203
+ cancellation: { parameter: "signal" },
204
+ result: codec(symbol("TemplateSaveResult"))
205
+ },
206
+ {
207
+ id: `${PACKAGE_NAME}#betterInput/templatesRemove`,
208
+ service: "BetterInputPolish",
209
+ namespace: "betterInput",
210
+ method: "templatesRemove",
211
+ invocation: { kind: "direct" },
212
+ parameters: [{
213
+ name: "id",
214
+ wire: "id",
215
+ source: "json",
216
+ codec: codec("string")
217
+ }],
218
+ cancellation: { parameter: "signal" },
219
+ result: codec(symbol("TemplateRemoveResult"))
220
+ }
221
+ ]
222
+ };
223
+ //#endregion
224
+ export { TYPERT_REMOTE, TYPERT_REMOTE as default };
225
+
226
+ //# sourceMappingURL=remote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.js","names":[],"sources":["../src/remote.ts"],"sourcesContent":["import type { RemoteResult, TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol'\nimport type { ClientRemote } from '@deepseek-ai/dsh-api-remotes/client'\nimport type { AboutInfoWire, BetterInputSettingsPatch, BetterInputSettingsView, PolishRoute, ReasoningEffortInfo, TemplateInputWire, TemplateWire, UpdateCheckResultWire } from './remote-contract.js'\nimport { PACKAGE_NAME } from './identity.js'\n\nexport type BetterInputRemote = ClientRemote['betterInput']\n\ndeclare module '@deepseek-ai/dsh-typert-protocol' {\n interface TypertRemoteNamespace$betterInput {\n getSettings: () => Promise<RemoteResult<BetterInputSettingsView>>\n updateSettings: (patch: BetterInputSettingsPatch, signal?: AbortSignal) => Promise<RemoteResult<BetterInputSettingsView>>\n listRoutes: () => Promise<RemoteResult<PolishRoute[]>>\n resolveModelEfforts: (provider: string, model: string) => Promise<RemoteResult<{ efforts: readonly ReasoningEffortInfo[]; defaultEffort?: string }>>\n getAbout: () => Promise<RemoteResult<AboutInfoWire>>\n checkForUpdate: (signal?: AbortSignal) => Promise<RemoteResult<UpdateCheckResultWire>>\n polish: (transcript: string, provider: string, model: string, signal?: AbortSignal) => Promise<RemoteResult<string>>\n optimize: (text: string, provider: string, model: string, context: string, signal?: AbortSignal) => Promise<RemoteResult<string>>\n templatesList: () => Promise<RemoteResult<{ templates: TemplateWire[] }>>\n templatesSave: (template: TemplateInputWire, signal?: AbortSignal) => Promise<RemoteResult<{ template: TemplateWire }>>\n templatesRemove: (id: string, signal?: AbortSignal) => Promise<RemoteResult<{ removed: boolean }>>\n }\n\n interface TypertRemoteMap {\n 'betterInput/getSettings': () => Promise<RemoteResult<BetterInputSettingsView>>\n 'betterInput/updateSettings': (patch: BetterInputSettingsPatch, signal?: AbortSignal) => Promise<RemoteResult<BetterInputSettingsView>>\n 'betterInput/listRoutes': () => Promise<RemoteResult<PolishRoute[]>>\n 'betterInput/resolveModelEfforts': (provider: string, model: string) => Promise<RemoteResult<{ efforts: readonly ReasoningEffortInfo[]; defaultEffort?: string }>>\n 'betterInput/getAbout': () => Promise<RemoteResult<AboutInfoWire>>\n 'betterInput/checkForUpdate': (signal?: AbortSignal) => Promise<RemoteResult<UpdateCheckResultWire>>\n 'betterInput/polish': (transcript: string, provider: string, model: string, signal?: AbortSignal) => Promise<RemoteResult<string>>\n 'betterInput/optimize': (text: string, provider: string, model: string, context: string, signal?: AbortSignal) => Promise<RemoteResult<string>>\n 'betterInput/templatesList': () => Promise<RemoteResult<{ templates: TemplateWire[] }>>\n 'betterInput/templatesSave': (template: TemplateInputWire, signal?: AbortSignal) => Promise<RemoteResult<{ template: TemplateWire }>>\n 'betterInput/templatesRemove': (id: string, signal?: AbortSignal) => Promise<RemoteResult<{ removed: boolean }>>\n }\n\n interface TypertRemoteNamespaceMap {\n betterInput: TypertRemoteNamespace$betterInput\n }\n}\n\n/**\n * Build one strict codec for the CLIENT face.\n *\n * The client face exists only to describe the wire shape to\n * `ctx.remote.$mount`; the actual byte validation happens on the Host. This is\n * not an assumption — it is how dsh 0.1.7 is wired:\n *\n * - `@deepseek-ai/dsh-api-gateway/lib/index.js` (Host) is the ONLY place that\n * runs `codec.create().parse(value)`. Validation lives in `decode()`.\n * - `…/lib/client.js` contains ZERO `.create()` calls. Its `$mount` path only\n * calls `requireStrictCodecs`, which inspects `codec.mode === 'strict'` and\n * never reads `typeSymbol` or invokes the factory. `prepareInvocation()`\n * forwards raw argument values straight to the RPC carrier.\n *\n * So materializing a real schema in the browser is pure dead weight: it pulls\n * all of zod (~280 KB) into `lib/client.js` for a factory that is never called.\n * The `create()` here is therefore lazy AND schema-free — it never imports zod.\n *\n * The eager `import { …Schema } from './remote-contract.js'` that used to sit\n * at the top of this file was the single value-reachability edge that dragged\n * zod into the browser bundle, because `src/client/index.ts` needs\n * `TYPERT_REMOTE` as a value.\n *\n * The placeholder satisfies `TypertSchema` ({ parse(value) }) structurally, so\n * the client face still typechecks. It is unreachable at runtime; if a future\n * dsh ever validates on the client, `parse` throws loudly instead of silently\n * accepting bad bytes. The Host manifest in `typert.ts` keeps the real zod\n * schemas.\n */\nfunction codec(typeSymbol: string) {\n return {\n mode: 'strict' as const,\n typeSymbol,\n create: () => ({\n parse(value: unknown): unknown {\n throw new Error(\n `sqs-dsh-better-input: client-face codec ${typeSymbol} was materialized. ` +\n 'The client must never validate wire bytes (the Host does). ' +\n 'If this fires, the client-face descriptor is being used for validation it should not own.'\n )\n }\n })\n }\n}\n\n/** Type symbol for one of this plugin's own wire types. */\nconst symbol = (name: string): string => `${PACKAGE_NAME}#${name}`\n\n/** The client-face Typert manifest; mirrors the Host face in `typert.ts`. */\nexport const TYPERT_REMOTE: TypertRemoteContribution = {\n package: PACKAGE_NAME,\n descriptors: [\n {\n id: `${PACKAGE_NAME}#betterInput/getSettings`,\n service: 'BetterInputPolish',\n namespace: 'betterInput',\n method: 'getSettings',\n invocation: { kind: 'direct' },\n parameters: [],\n result: codec(symbol('BetterInputSettingsView'))\n },\n {\n id: `${PACKAGE_NAME}#betterInput/updateSettings`,\n service: 'BetterInputPolish',\n namespace: 'betterInput',\n method: 'updateSettings',\n invocation: { kind: 'direct' },\n parameters: [{\n name: 'patch',\n wire: 'patch',\n source: 'json',\n codec: codec(symbol('BetterInputSettingsPatch'))\n }],\n cancellation: { parameter: 'signal' },\n result: codec(symbol('BetterInputSettingsView'))\n },\n {\n id: `${PACKAGE_NAME}#betterInput/listRoutes`,\n service: 'BetterInputPolish',\n namespace: 'betterInput',\n method: 'listRoutes',\n invocation: { kind: 'direct' },\n parameters: [],\n result: codec(symbol('PolishRoute[]'))\n },\n {\n id: `${PACKAGE_NAME}#betterInput/resolveModelEfforts`,\n service: 'BetterInputPolish',\n namespace: 'betterInput',\n method: 'resolveModelEfforts',\n invocation: { kind: 'direct' },\n parameters: [\n { name: 'provider', wire: 'provider', source: 'json', codec: codec('string') },\n { name: 'model', wire: 'model', source: 'json', codec: codec('string') }\n ],\n result: codec(symbol('ResolveModelEffortsResult'))\n },\n {\n id: `${PACKAGE_NAME}#betterInput/getAbout`,\n service: 'BetterInputPolish',\n namespace: 'betterInput',\n method: 'getAbout',\n invocation: { kind: 'direct' },\n parameters: [],\n result: codec(symbol('AboutInfo'))\n },\n {\n id: `${PACKAGE_NAME}#betterInput/checkForUpdate`,\n service: 'BetterInputPolish',\n namespace: 'betterInput',\n method: 'checkForUpdate',\n invocation: { kind: 'direct' },\n parameters: [],\n cancellation: { parameter: 'signal' },\n result: codec(symbol('UpdateCheckResult'))\n },\n {\n id: `${PACKAGE_NAME}#betterInput/polish`,\n service: 'BetterInputPolish',\n namespace: 'betterInput',\n method: 'polish',\n invocation: { kind: 'direct' },\n parameters: [\n { name: 'transcript', wire: 'transcript', source: 'json', codec: codec('string') },\n { name: 'provider', wire: 'provider', source: 'json', codec: codec('string') },\n { name: 'model', wire: 'model', source: 'json', codec: codec('string') }\n ],\n cancellation: { parameter: 'signal' },\n result: codec('string')\n },\n {\n id: `${PACKAGE_NAME}#betterInput/optimize`,\n service: 'BetterInputPolish',\n namespace: 'betterInput',\n method: 'optimize',\n invocation: { kind: 'direct' },\n parameters: [\n { name: 'text', wire: 'text', source: 'json', codec: codec('string') },\n { name: 'provider', wire: 'provider', source: 'json', codec: codec('string') },\n { name: 'model', wire: 'model', source: 'json', codec: codec('string') },\n { name: 'context', wire: 'context', source: 'json', codec: codec('string') }\n ],\n cancellation: { parameter: 'signal' },\n result: codec('string')\n },\n {\n id: `${PACKAGE_NAME}#betterInput/templatesList`,\n service: 'BetterInputPolish',\n namespace: 'betterInput',\n method: 'templatesList',\n invocation: { kind: 'direct' },\n parameters: [],\n result: codec(symbol('TemplateListResult'))\n },\n {\n id: `${PACKAGE_NAME}#betterInput/templatesSave`,\n service: 'BetterInputPolish',\n namespace: 'betterInput',\n method: 'templatesSave',\n invocation: { kind: 'direct' },\n parameters: [{\n name: 'template',\n wire: 'template',\n source: 'json',\n codec: codec(symbol('TemplateInput'))\n }],\n cancellation: { parameter: 'signal' },\n result: codec(symbol('TemplateSaveResult'))\n },\n {\n id: `${PACKAGE_NAME}#betterInput/templatesRemove`,\n service: 'BetterInputPolish',\n namespace: 'betterInput',\n method: 'templatesRemove',\n invocation: { kind: 'direct' },\n parameters: [{ name: 'id', wire: 'id', source: 'json', codec: codec('string') }],\n cancellation: { parameter: 'signal' },\n result: codec(symbol('TemplateRemoveResult'))\n }\n ]\n}\n\nexport default TYPERT_REMOTE\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,SAAS,MAAM,YAAoB;CACjC,OAAO;EACL,MAAM;EACN;EACA,eAAe,EACb,MAAM,OAAyB;GAC7B,MAAM,IAAI,MACR,2CAA2C,WAAW,wKAGxD;EACF,EACF;CACF;AACF;;AAGA,MAAM,UAAU,SAAyB,GAAG,aAAa,GAAG;;AAG5D,MAAa,gBAA0C;CACrD,SAAS;CACT,aAAa;EACX;GACE,IAAI,GAAG,aAAa;GACpB,SAAS;GACT,WAAW;GACX,QAAQ;GACR,YAAY,EAAE,MAAM,SAAS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pB,SAAS;GACT,WAAW;GACX,QAAQ;GACR,YAAY,EAAE,MAAM,SAAS;GAC7B,YAAY,CAAC;IAAE,MAAM;IAAM,MAAM;IAAM,QAAQ;IAAQ,OAAO,MAAM,QAAQ;GAAE,CAAC;GAC/E,cAAc,EAAE,WAAW,SAAS;GACpC,QAAQ,MAAM,OAAO,sBAAsB,CAAC;EAC9C;CACF;AACF"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Host-side JSON file storage for the plugin's own settings.
3
+ *
4
+ * Location: `~/.dsh/sqs-dsh-better-input/settings.json`.
5
+ *
6
+ * dsh 0.1.7 replaced the old per-plugin `settings.register(namespace, schema)`
7
+ * API with a Loader-entry configuration model (`SettingsForms`, addressed by
8
+ * profile entry id with revision CAS). That model is built for schema-declared
9
+ * plugin *Config* in the composition, not for a plugin's own runtime knobs, and
10
+ * it changes shape between releases.
11
+ *
12
+ * This plugin therefore owns its settings in a plain JSON document, exactly like
13
+ * the template library. That keeps it independent of the settings API churn,
14
+ * keeps writes atomic, and keeps the settings page a normal `settings.section`
15
+ * slot (which is unchanged in 0.1.7).
16
+ */
17
+ import { type BetterInputSettings } from '../config.js';
18
+ export declare function defaultSettingsFilePath(): string;
19
+ /**
20
+ * Coerce an untrusted stored document into a complete settings object. Every
21
+ * field falls back to its default, so a partially written or hand-edited file
22
+ * still yields a usable value instead of throwing.
23
+ */
24
+ export declare function normalizeSettings(raw: unknown): BetterInputSettings;
25
+ export declare class SettingsStore {
26
+ private readonly filePath;
27
+ private cache;
28
+ private persistChain;
29
+ constructor(filePath?: string);
30
+ /** Read the current settings, falling back to defaults when absent/corrupt. */
31
+ load(): Promise<BetterInputSettings>;
32
+ /**
33
+ * Merge a patch into the stored settings and persist. Validates the merged
34
+ * document first, so an out-of-range value never reaches disk.
35
+ */
36
+ merge(patch: Partial<BetterInputSettings>): Promise<BetterInputSettings>;
37
+ private quarantineCorruptFile;
38
+ private persist;
39
+ /** Write via temp file + rename so a crash never leaves a half-written file. */
40
+ private writeAtomic;
41
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Prompt template data model shared by the host store and the Typert layer.
3
+ * A template is a plain text snippet the user stores once and later inserts
4
+ * from the input box via the `/` trigger source.
5
+ */
6
+ export type BetterInputTemplate = {
7
+ readonly id: string;
8
+ readonly name: string;
9
+ readonly description: string;
10
+ readonly content: string;
11
+ readonly tags: readonly string[];
12
+ readonly createdAt: number;
13
+ readonly updatedAt: number;
14
+ };
15
+ export type TemplateInput = {
16
+ readonly id?: string;
17
+ readonly name: string;
18
+ readonly description?: string;
19
+ readonly content: string;
20
+ readonly tags?: readonly string[];
21
+ };
22
+ export declare const MAX_TEMPLATE_COUNT = 200;
23
+ export declare const MAX_TEMPLATE_NAME_LENGTH = 60;
24
+ export declare const MAX_TEMPLATE_DESCRIPTION_LENGTH = 200;
25
+ export declare const MAX_TEMPLATE_CONTENT_LENGTH = 8000;
26
+ export declare const MAX_TEMPLATE_TAGS = 8;
27
+ export declare const MAX_TEMPLATE_TAG_LENGTH = 20;
28
+ /** Trim, drop empties, dedupe case-insensitively, cap count and length. */
29
+ export declare function normalizeTags(tags: readonly string[]): string[];
30
+ export declare function validateTemplateInput(input: TemplateInput): void;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Host-side JSON file storage for prompt templates.
3
+ *
4
+ * Location: `~/.dsh/sqs-dsh-better-input/templates.json`. The plugin ships as a flat
5
+ * bundle under node_modules, so anything stored next to the package would be
6
+ * wiped on update — the only durable, dependency-free location is the user's
7
+ * home directory (Node builtins only).
8
+ *
9
+ * Writes are serialized through a promise chain and performed atomically
10
+ * (temp file + rename). A corrupt file is quarantined aside once with a
11
+ * warning instead of failing every subsequent call.
12
+ */
13
+ import { type BetterInputTemplate, type TemplateInput } from './model.js';
14
+ export declare function defaultTemplatesFilePath(): string;
15
+ export declare class TemplateStore {
16
+ private readonly filePath;
17
+ private cache;
18
+ private persistChain;
19
+ constructor(filePath?: string);
20
+ list(): Promise<readonly BetterInputTemplate[]>;
21
+ save(input: TemplateInput): Promise<BetterInputTemplate>;
22
+ remove(id: string): Promise<boolean>;
23
+ private load;
24
+ private quarantineCorruptFile;
25
+ private persist;
26
+ private writeAtomic;
27
+ }
@@ -0,0 +1,107 @@
1
+ /**
2
+ * The Host-side Typert manifest. It must mirror `TYPERT_REMOTE` (the client
3
+ * face) method-for-method; a mismatch is rejected at the boundary.
4
+ */
5
+ export declare const TYPERT: {
6
+ package: string;
7
+ face: string;
8
+ schemas: never[];
9
+ invocations: ({
10
+ id: string;
11
+ service: string;
12
+ namespace: string;
13
+ method: string;
14
+ invocation: {
15
+ kind: string;
16
+ };
17
+ parameters: {
18
+ name: string;
19
+ wire: string;
20
+ source: string;
21
+ codec: {
22
+ mode: "strict";
23
+ typeSymbol: string;
24
+ create: () => {
25
+ parse(value: unknown): unknown;
26
+ };
27
+ };
28
+ }[];
29
+ cancellation: {
30
+ parameter: string;
31
+ };
32
+ result: {
33
+ mode: "strict";
34
+ typeSymbol: string;
35
+ create: () => {
36
+ parse(value: unknown): unknown;
37
+ };
38
+ };
39
+ } | {
40
+ id: string;
41
+ service: string;
42
+ namespace: string;
43
+ method: string;
44
+ invocation: {
45
+ kind: string;
46
+ };
47
+ parameters: {
48
+ name: string;
49
+ wire: string;
50
+ source: string;
51
+ codec: {
52
+ mode: "strict";
53
+ typeSymbol: string;
54
+ create: () => {
55
+ parse(value: unknown): unknown;
56
+ };
57
+ };
58
+ }[];
59
+ result: {
60
+ mode: "strict";
61
+ typeSymbol: string;
62
+ create: () => {
63
+ parse(value: unknown): unknown;
64
+ };
65
+ };
66
+ cancellation?: undefined;
67
+ })[];
68
+ /**
69
+ * The typed-registry model block.
70
+ *
71
+ * This is REQUIRED by dsh 0.1.7's typert loader, not optional metadata:
72
+ * `validateTypertManifest` reads `manifest.model` and demands an object whose
73
+ * `services` / `events` / `objects` are arrays (see `dsh-typert-loader/lib/index.js`
74
+ * :89-92, and `requireObject` at :119-122). A missing `model` fails the whole
75
+ * entry with "typert-loader: <pkg> TYPERT.model must be an object", the entry
76
+ * never activates, and the browser web boot then refuses to render the UI.
77
+ *
78
+ * Removing the file-input / OCR feature dropped this block by accident in
79
+ * 0.1.0-0.1.2 (`convertFile` and `ConvertFileResult` were the only intended
80
+ * deletions). Keep `model` in sync with `invocations` above and with the
81
+ * service surface in `polish/service.ts`.
82
+ */
83
+ model: {
84
+ services: {
85
+ description: string;
86
+ summary: string;
87
+ tags: never[];
88
+ jsDoc: string;
89
+ key: string;
90
+ exportName: string;
91
+ members: {
92
+ kind: string;
93
+ name: string;
94
+ signature: string;
95
+ summary: string;
96
+ jsDoc: string;
97
+ }[];
98
+ types: {
99
+ name: string;
100
+ declaration: string;
101
+ }[];
102
+ }[];
103
+ events: never[];
104
+ objects: never[];
105
+ };
106
+ };
107
+ export default TYPERT;