@struktur/app 2.6.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/AGENTS.md +117 -0
- package/LICENSE +110 -0
- package/README.md +127 -0
- package/assets/icon.iconset/icon_128x128.png +0 -0
- package/assets/icon.iconset/icon_128x128@2x.png +0 -0
- package/assets/icon.iconset/icon_16x16.png +0 -0
- package/assets/icon.iconset/icon_16x16@2x.png +0 -0
- package/assets/icon.iconset/icon_256x256.png +0 -0
- package/assets/icon.iconset/icon_256x256@2x.png +0 -0
- package/assets/icon.iconset/icon_32x32.png +0 -0
- package/assets/icon.iconset/icon_32x32@2x.png +0 -0
- package/assets/icon.iconset/icon_512x512.png +0 -0
- package/assets/icon.iconset/icon_512x512@2x.png +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Info.plist +18 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/MacOS/bspatch +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/MacOS/bun +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/MacOS/launcher +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/MacOS/libNativeWrapper.dylib +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/MacOS/libasar.dylib +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/MacOS/zig-zstd +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/AppIcon.icns +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/app/bun/index.js +231552 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/app/views/main/index.html +45 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/app/views/main/index.js +35 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/build.json +1 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/main.js +164 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/version.json +1 -0
- package/electrobun.config.ts +30 -0
- package/package.json +29 -0
- package/src/bun/index.ts +23 -0
- package/src/main/index.html +45 -0
- package/src/main/index.ts +48 -0
- package/src/shared/types.ts +307 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RPC Type Definitions for Struktur App
|
|
3
|
+
*
|
|
4
|
+
* These types define the typed RPC interface between the main Bun process
|
|
5
|
+
* and the webview. They enable type-safe communication for:
|
|
6
|
+
* - Secure storage operations (API keys via SDK auth)
|
|
7
|
+
* - Configuration management (aliases, default model)
|
|
8
|
+
* - File system operations (file picking, reading)
|
|
9
|
+
* - Window management
|
|
10
|
+
* - Native OS integrations
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { type RPCSchema } from "electrobun/bun";
|
|
14
|
+
|
|
15
|
+
// =============================================================================
|
|
16
|
+
// RPC Type Definition
|
|
17
|
+
// =============================================================================
|
|
18
|
+
|
|
19
|
+
export type StrukturAppRPC = {
|
|
20
|
+
// Functions that execute in the main Bun process
|
|
21
|
+
bun: RPCSchema<{
|
|
22
|
+
requests: {
|
|
23
|
+
// Secure Storage Operations (via @struktur/sdk)
|
|
24
|
+
/**
|
|
25
|
+
* Store API tokens securely using SDK auth system
|
|
26
|
+
* Uses macOS Keychain when available, file-based otherwise
|
|
27
|
+
*/
|
|
28
|
+
storeApiKeys: {
|
|
29
|
+
params: {
|
|
30
|
+
keys: Array<{
|
|
31
|
+
provider: string;
|
|
32
|
+
apiKey: string;
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
response: {
|
|
36
|
+
success: boolean;
|
|
37
|
+
stored?: Array<{
|
|
38
|
+
provider: string;
|
|
39
|
+
storage: "keychain" | "file";
|
|
40
|
+
}>;
|
|
41
|
+
error?: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Retrieve stored API tokens
|
|
47
|
+
*/
|
|
48
|
+
retrieveApiKeys: {
|
|
49
|
+
params: {
|
|
50
|
+
providers: string[];
|
|
51
|
+
};
|
|
52
|
+
response: {
|
|
53
|
+
keys: Array<{
|
|
54
|
+
provider: string;
|
|
55
|
+
apiKey: string;
|
|
56
|
+
}>;
|
|
57
|
+
error?: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Check if API tokens exist for given providers
|
|
63
|
+
*/
|
|
64
|
+
hasStoredKeys: {
|
|
65
|
+
params: {
|
|
66
|
+
providers: string[];
|
|
67
|
+
};
|
|
68
|
+
response: {
|
|
69
|
+
hasKeys: boolean;
|
|
70
|
+
providers: string[];
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Clear all stored API tokens
|
|
76
|
+
*/
|
|
77
|
+
clearApiKeys: {
|
|
78
|
+
params: {};
|
|
79
|
+
response: {
|
|
80
|
+
success: boolean;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// Configuration Management
|
|
85
|
+
/**
|
|
86
|
+
* Get the default model from config
|
|
87
|
+
*/
|
|
88
|
+
getDefaultModel: {
|
|
89
|
+
params: {};
|
|
90
|
+
response: {
|
|
91
|
+
model: string | null;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Set the default model
|
|
97
|
+
*/
|
|
98
|
+
setDefaultModel: {
|
|
99
|
+
params: {
|
|
100
|
+
model: string;
|
|
101
|
+
};
|
|
102
|
+
response: {
|
|
103
|
+
success: boolean;
|
|
104
|
+
model?: string;
|
|
105
|
+
error?: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* List all model aliases
|
|
111
|
+
*/
|
|
112
|
+
listAliases: {
|
|
113
|
+
params: {};
|
|
114
|
+
response: {
|
|
115
|
+
aliases: Record<string, string>;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Create or update a model alias
|
|
121
|
+
*/
|
|
122
|
+
setAlias: {
|
|
123
|
+
params: {
|
|
124
|
+
alias: string;
|
|
125
|
+
model: string;
|
|
126
|
+
};
|
|
127
|
+
response: {
|
|
128
|
+
success: boolean;
|
|
129
|
+
error?: string;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Delete a model alias
|
|
135
|
+
*/
|
|
136
|
+
deleteAlias: {
|
|
137
|
+
params: {
|
|
138
|
+
alias: string;
|
|
139
|
+
};
|
|
140
|
+
response: {
|
|
141
|
+
success: boolean;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// File System Operations
|
|
146
|
+
/**
|
|
147
|
+
* Open native file picker dialog
|
|
148
|
+
*/
|
|
149
|
+
pickFiles: {
|
|
150
|
+
params: {
|
|
151
|
+
multiple?: boolean;
|
|
152
|
+
filters?: Array<{
|
|
153
|
+
name: string;
|
|
154
|
+
extensions: string[];
|
|
155
|
+
}>;
|
|
156
|
+
};
|
|
157
|
+
response: {
|
|
158
|
+
files: Array<{
|
|
159
|
+
path: string;
|
|
160
|
+
name: string;
|
|
161
|
+
size: number;
|
|
162
|
+
}>;
|
|
163
|
+
canceled: boolean;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Read file as ArrayBuffer for processing
|
|
169
|
+
*/
|
|
170
|
+
readFile: {
|
|
171
|
+
params: {
|
|
172
|
+
path: string;
|
|
173
|
+
};
|
|
174
|
+
response: {
|
|
175
|
+
data: ArrayBuffer;
|
|
176
|
+
error?: string;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// Window Management
|
|
181
|
+
/**
|
|
182
|
+
* Get current window state
|
|
183
|
+
*/
|
|
184
|
+
getWindowState: {
|
|
185
|
+
params: {};
|
|
186
|
+
response: {
|
|
187
|
+
isMaximized: boolean;
|
|
188
|
+
isMinimized: boolean;
|
|
189
|
+
isFocused: boolean;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Show native save dialog
|
|
195
|
+
*/
|
|
196
|
+
showSaveDialog: {
|
|
197
|
+
params: {
|
|
198
|
+
defaultPath?: string;
|
|
199
|
+
filters?: Array<{
|
|
200
|
+
name: string;
|
|
201
|
+
extensions: string[];
|
|
202
|
+
}>;
|
|
203
|
+
};
|
|
204
|
+
response: {
|
|
205
|
+
path: string | null;
|
|
206
|
+
canceled: boolean;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
// Application Info
|
|
211
|
+
/**
|
|
212
|
+
* Get app version and system info
|
|
213
|
+
*/
|
|
214
|
+
getAppInfo: {
|
|
215
|
+
params: {};
|
|
216
|
+
response: {
|
|
217
|
+
version: string;
|
|
218
|
+
platform: string;
|
|
219
|
+
arch: string;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
messages: {
|
|
225
|
+
// One-way messages (no response expected)
|
|
226
|
+
/**
|
|
227
|
+
* Log message from webview to main process
|
|
228
|
+
*/
|
|
229
|
+
log: {
|
|
230
|
+
level: "debug" | "info" | "warn" | "error";
|
|
231
|
+
message: string;
|
|
232
|
+
context?: Record<string, unknown>;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Window state changed
|
|
237
|
+
*/
|
|
238
|
+
windowStateChanged: {
|
|
239
|
+
state: "maximized" | "minimized" | "restored" | "focused" | "blurred";
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Notify that extraction process started/completed
|
|
244
|
+
*/
|
|
245
|
+
extractionProgress: {
|
|
246
|
+
status: "started" | "completed" | "failed";
|
|
247
|
+
id: string;
|
|
248
|
+
progress?: number;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
}>;
|
|
252
|
+
|
|
253
|
+
// Functions that execute in the webview/browser context
|
|
254
|
+
webview: RPCSchema<{
|
|
255
|
+
requests: {
|
|
256
|
+
/**
|
|
257
|
+
* Request webview to update its configuration
|
|
258
|
+
*/
|
|
259
|
+
updateConfig: {
|
|
260
|
+
params: {
|
|
261
|
+
theme?: "light" | "dark" | "system";
|
|
262
|
+
zoom?: number;
|
|
263
|
+
};
|
|
264
|
+
response: {
|
|
265
|
+
success: boolean;
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Request webview to show a notification
|
|
271
|
+
*/
|
|
272
|
+
showNotification: {
|
|
273
|
+
params: {
|
|
274
|
+
title: string;
|
|
275
|
+
body: string;
|
|
276
|
+
type?: "info" | "success" | "warning" | "error";
|
|
277
|
+
};
|
|
278
|
+
response: {
|
|
279
|
+
success: boolean;
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
messages: {
|
|
285
|
+
/**
|
|
286
|
+
* Notify webview that API keys were updated
|
|
287
|
+
*/
|
|
288
|
+
apiKeysUpdated: {
|
|
289
|
+
providers: string[];
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Notify webview that a file was dropped on the app
|
|
294
|
+
*/
|
|
295
|
+
fileDropped: {
|
|
296
|
+
paths: string[];
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Deep link opened (e.g., struktur://open?file=...)
|
|
301
|
+
*/
|
|
302
|
+
deepLinkOpened: {
|
|
303
|
+
url: string;
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
}>;
|
|
307
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"declarationMap": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"outDir": "./dist",
|
|
17
|
+
"rootDir": ".",
|
|
18
|
+
"baseUrl": ".",
|
|
19
|
+
"paths": {
|
|
20
|
+
"@/*": ["./src/*"],
|
|
21
|
+
"@shared/*": ["./src/shared/*"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"include": ["src/**/*"],
|
|
25
|
+
"exclude": ["node_modules", "dist", "build"]
|
|
26
|
+
}
|