pith-ui 0.1.4 → 0.2.0-app.2

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 (41) hide show
  1. package/AI.md +21 -7
  2. package/API.md +263 -262
  3. package/APP-API.md +2023 -0
  4. package/APP.md +141 -0
  5. package/README.md +35 -4
  6. package/dist/app/files.d.ts +68 -0
  7. package/dist/app/files.d.ts.map +1 -0
  8. package/dist/app/files.js +177 -0
  9. package/dist/app/files.js.map +1 -0
  10. package/dist/app/index.d.ts +57 -0
  11. package/dist/app/index.d.ts.map +1 -0
  12. package/dist/app/index.js +300 -0
  13. package/dist/app/index.js.map +1 -0
  14. package/dist/app/internal.d.ts +31 -0
  15. package/dist/app/internal.d.ts.map +1 -0
  16. package/dist/app/internal.js +2 -0
  17. package/dist/app/internal.js.map +1 -0
  18. package/dist/app/resources.d.ts +89 -0
  19. package/dist/app/resources.d.ts.map +1 -0
  20. package/dist/app/resources.js +190 -0
  21. package/dist/app/resources.js.map +1 -0
  22. package/dist/app/session.d.ts +14 -0
  23. package/dist/app/session.d.ts.map +1 -0
  24. package/dist/app/session.js +12 -0
  25. package/dist/app/session.js.map +1 -0
  26. package/dist/app/settings.d.ts +109 -0
  27. package/dist/app/settings.d.ts.map +1 -0
  28. package/dist/app/settings.js +283 -0
  29. package/dist/app/settings.js.map +1 -0
  30. package/dist/app/workspace.d.ts +232 -0
  31. package/dist/app/workspace.d.ts.map +1 -0
  32. package/dist/app/workspace.js +413 -0
  33. package/dist/app/workspace.js.map +1 -0
  34. package/dist/forms/actions.d.ts +1 -0
  35. package/dist/forms/actions.d.ts.map +1 -1
  36. package/dist/forms/actions.js +3 -2
  37. package/dist/forms/actions.js.map +1 -1
  38. package/dist/styles.css +4 -1
  39. package/dist/tasks/runtime.js +2 -2
  40. package/dist/tasks/runtime.js.map +1 -1
  41. package/package.json +42 -8
@@ -0,0 +1,300 @@
1
+ import { createWorkspaceShell } from '../workspace.js';
2
+ import { createSDKDialogElements, createFeatureDialogFrame } from '../forms/dialog-frame.js';
3
+ import { installImageViewer } from '../content/image-viewer.js';
4
+ import { setAppearance } from '../theme.js';
5
+ import { createWorkspaceScene } from './workspace.js';
6
+ import { createSettingsScene } from './settings.js';
7
+ import { createResourcesScene } from './resources.js';
8
+ import { createFilesScene } from './files.js';
9
+ export { formatCost } from '../files/systems.js';
10
+ export { thinkingLabel } from '../forms/model-editor.js';
11
+ let sequence = 0;
12
+ const resultOf = async (action) => {
13
+ try {
14
+ return await action() || { ok: true };
15
+ }
16
+ catch (error) {
17
+ return { ok: false, error: error instanceof Error ? error.message : String(error) };
18
+ }
19
+ };
20
+ /** The only DOM argument is the application mount. Scenes return semantic ports. */
21
+ export function createApplication(mount, options = {}) {
22
+ const idPrefix = `pui-app-${++sequence}-`;
23
+ let destroyed = false, appearance = options.appearance ?? 'system', lastModal = false;
24
+ const disposals = [];
25
+ const fixed = new Map();
26
+ const fixedOpenings = new Map();
27
+ let openingSequence = 0;
28
+ const brand = document.createElement('span');
29
+ brand.className = 'pui-app-brand';
30
+ const brandData = options.brand ?? { name: 'Pith' };
31
+ if (brandData.mark) {
32
+ const image = document.createElement('img');
33
+ image.className = 'pui-app-brand-image';
34
+ image.src = brandData.mark.src;
35
+ image.alt = brandData.mark.alt;
36
+ brand.append(image);
37
+ }
38
+ const wordmark = document.createElement('span');
39
+ wordmark.textContent = brandData.name;
40
+ if (brandData.qualifier) {
41
+ const suffix = document.createElement('span');
42
+ suffix.className = 'pui-brand-light';
43
+ suffix.textContent = ' ' + brandData.qualifier;
44
+ wordmark.append(suffix);
45
+ }
46
+ brand.append(wordmark);
47
+ const shell = createWorkspaceShell({ brand, prefix: idPrefix, composer: {
48
+ onSubmit: options.workspace?.onSubmit,
49
+ onStop: options.workspace?.onStop,
50
+ onInput: options.workspace?.onInput,
51
+ onModel: () => options.workspace?.onAction?.('model'),
52
+ onAttach: () => workspace.pickImages(),
53
+ onImages: options.workspace?.onImages,
54
+ onThinkingChange: options.workspace?.onThinkingChange,
55
+ }, onBusyAction: key => options.workspace?.onBusyAction?.(key),
56
+ onSearch: query => workspace.search(query),
57
+ onDialogClose(name) { fixed.get(name)?.release(); changed(); },
58
+ });
59
+ mount.replaceChildren(shell.element);
60
+ const themeRoot = mount.ownerDocument.documentElement;
61
+ setAppearance(themeRoot, appearance);
62
+ const media = matchMedia('(prefers-color-scheme: dark)');
63
+ const brandMarkSource = () => (appearance === 'dark' || appearance === 'system' && media.matches) && brandData.mark?.darkSrc ? brandData.mark.darkSrc : brandData.mark?.src || '';
64
+ const syncTheme = () => {
65
+ themeRoot.dataset.theme = appearance === 'system' ? media.matches ? 'dark' : 'light' : appearance;
66
+ const source = brandMarkSource();
67
+ for (const image of shell.element.querySelectorAll('.pui-app-brand-image'))
68
+ if (image.getAttribute('src') !== source)
69
+ image.setAttribute('src', source);
70
+ };
71
+ media.addEventListener('change', syncTheme);
72
+ disposals.push(() => media.removeEventListener('change', syncTheme));
73
+ syncTheme();
74
+ const sdk = createSDKDialogElements({ idPrefix });
75
+ shell.element.append(sdk.dialog, sdk.oauthDialog);
76
+ const feature = createFeatureDialogFrame({ dialog: sdk.dialog, content: sdk.content, titleId: idPrefix + 'sdk-title', errorId: idPrefix + 'sdk-error', onClose: () => changed() });
77
+ const oauth = createFeatureDialogFrame({ dialog: sdk.oauthDialog, content: sdk.oauthContent, titleId: idPrefix + 'oauth-title', errorId: idPrefix + 'oauth-frame-error', onClose: () => changed() });
78
+ const frameOpenings = new Map();
79
+ const frameOwners = new Map();
80
+ const images = installImageViewer(shell.part('image-dialog'), { triggerRoot: shell.element });
81
+ const read = () => Object.freeze({ hasModal: !destroyed && !!shell.element.querySelector('dialog[open]'), appearance });
82
+ function notify(callback) {
83
+ try {
84
+ callback?.();
85
+ }
86
+ catch (error) {
87
+ const message = error instanceof Error ? error.message : String(error);
88
+ try {
89
+ (options.onError ?? options.workspace?.onError)?.(message);
90
+ }
91
+ catch { }
92
+ }
93
+ }
94
+ function changed() {
95
+ const modal = read().hasModal;
96
+ if (lastModal === modal)
97
+ return;
98
+ lastModal = modal;
99
+ notify(() => options.onUIStateChange?.(read()));
100
+ }
101
+ // Image zoom and native dialog dismissal also participate in the same modal
102
+ // state; this observer is UI-local and never starts business work or polling.
103
+ const observer = new MutationObserver(changed);
104
+ observer.observe(shell.element, { subtree: true, attributes: true, attributeFilter: ['open'] });
105
+ const copyText = (text) => resultOf(async () => {
106
+ if (destroyed)
107
+ return { ok: false, error: 'Application has been destroyed.' };
108
+ if (options.host?.copyText)
109
+ return options.host.copyText(text);
110
+ await navigator.clipboard.writeText(text);
111
+ return { ok: true };
112
+ });
113
+ const openExternal = (value) => resultOf(async () => {
114
+ if (destroyed)
115
+ return { ok: false, error: 'Application has been destroyed.' };
116
+ const url = new URL(value);
117
+ if (!['http:', 'https:'].includes(url.protocol))
118
+ return { ok: false, error: 'Unsupported external link.' };
119
+ if (options.host?.openExternal)
120
+ return options.host.openExternal(url.href);
121
+ window.open(url.href, '_blank', 'noopener,noreferrer');
122
+ return { ok: true };
123
+ });
124
+ const frameOpen = (frame, title, content, onClose) => {
125
+ const opening = ++openingSequence;
126
+ frameOpenings.set(frame, opening);
127
+ let alive = !destroyed;
128
+ const release = (deferNotify = false) => {
129
+ if (!alive)
130
+ return;
131
+ alive = false;
132
+ if (frameOwners.get(frame) === release)
133
+ frameOwners.delete(frame);
134
+ try {
135
+ content.destroy();
136
+ }
137
+ finally {
138
+ if (deferNotify)
139
+ queueMicrotask(() => notify(onClose));
140
+ else
141
+ notify(onClose);
142
+ }
143
+ };
144
+ // Native dismissal clears the frame synchronously. Notify the host after
145
+ // that clear so a new opening from onClose cannot be erased by the old one.
146
+ const guarded = { element: content.element, destroy: () => release(true) };
147
+ const isOpen = () => alive && !destroyed && frameOwners.get(frame) === release && frame.isOpen();
148
+ const close = () => { if (!alive)
149
+ return; if (frameOwners.get(frame) !== release) {
150
+ release();
151
+ return;
152
+ } try {
153
+ frame.close();
154
+ }
155
+ finally {
156
+ try {
157
+ release();
158
+ }
159
+ finally {
160
+ changed();
161
+ }
162
+ } };
163
+ if (alive) {
164
+ frameOwners.get(frame)?.();
165
+ if (destroyed || frameOpenings.get(frame) !== opening)
166
+ release();
167
+ else {
168
+ frameOwners.set(frame, release);
169
+ frame.open({ title, body: guarded });
170
+ changed();
171
+ }
172
+ }
173
+ else
174
+ content.destroy();
175
+ return { isOpen, close, destroy: close, fail(message) { if (isOpen())
176
+ frame.fail(message); } };
177
+ };
178
+ const environment = {
179
+ idPrefix, productName: [brandData.name, brandData.qualifier].filter(Boolean).join(' '), brandMarkSource, part: shell.part, copyText, openExternal, hasModal: () => read().hasModal, changed, notifyClose: notify,
180
+ openImage: image => { if (!destroyed) {
181
+ images.open(image);
182
+ changed();
183
+ } },
184
+ closeImage() { images.close(); changed(); },
185
+ openDialog(name, content, onClose) {
186
+ const opening = ++openingSequence;
187
+ fixedOpenings.set(name, opening);
188
+ let alive = !destroyed;
189
+ const dialog = shell.part(name + '-dialog');
190
+ const release = () => {
191
+ if (!alive)
192
+ return;
193
+ alive = false;
194
+ if (fixed.get(name)?.content === content)
195
+ fixed.delete(name);
196
+ try {
197
+ content.destroy();
198
+ }
199
+ finally {
200
+ notify(onClose);
201
+ }
202
+ };
203
+ const isOpen = () => alive && !destroyed && fixed.get(name)?.content === content && dialog.open;
204
+ const close = () => { if (!alive || fixed.get(name)?.content !== content)
205
+ return; try {
206
+ shell.closeDialog(name);
207
+ }
208
+ finally {
209
+ try {
210
+ release();
211
+ }
212
+ finally {
213
+ changed();
214
+ }
215
+ } };
216
+ if (alive) {
217
+ fixed.get(name)?.release();
218
+ if (destroyed || fixedOpenings.get(name) !== opening)
219
+ release();
220
+ else {
221
+ fixed.set(name, { content, release });
222
+ shell.part(name + '-content').replaceChildren(content.element);
223
+ shell.openDialog(name);
224
+ changed();
225
+ }
226
+ }
227
+ else
228
+ content.destroy();
229
+ return { isOpen, close, destroy: close, fail(message) {
230
+ if (!isOpen())
231
+ return;
232
+ const error = content.element.querySelector('[data-dialog-error]') ?? content.element.querySelector('.pui-form-error[role="alert"]');
233
+ if (error)
234
+ error.textContent = message;
235
+ } };
236
+ },
237
+ openFeature: (title, content, onClose) => frameOpen(feature, title, content, onClose),
238
+ openOAuth: (title, content, onClose) => frameOpen(oauth, title, content, onClose),
239
+ };
240
+ const workspace = createWorkspaceScene(environment, shell, options.workspace ?? {}, brandData);
241
+ const settings = createSettingsScene(environment), resources = createResourcesScene(environment), files = createFilesScene(environment);
242
+ const downloads = new Map();
243
+ return {
244
+ workspace, settings, resources, files, read,
245
+ setAppearance(next) { if (destroyed)
246
+ return; appearance = next; setAppearance(themeRoot, next); syncTheme(); notify(() => options.onUIStateChange?.(read())); },
247
+ async downloadFile({ blob, name }) {
248
+ if (destroyed)
249
+ return { ok: false, error: 'Application has been destroyed.' };
250
+ const url = URL.createObjectURL(blob);
251
+ const link = document.createElement('a');
252
+ try {
253
+ link.href = url;
254
+ link.download = name;
255
+ shell.element.append(link);
256
+ link.click();
257
+ return { ok: true };
258
+ }
259
+ catch (error) {
260
+ return { ok: false, error: error instanceof Error ? error.message : String(error) };
261
+ }
262
+ finally {
263
+ link.remove();
264
+ if (destroyed)
265
+ URL.revokeObjectURL(url);
266
+ else
267
+ downloads.set(url, setTimeout(() => { URL.revokeObjectURL(url); downloads.delete(url); }, 30_000));
268
+ }
269
+ },
270
+ destroy() {
271
+ if (destroyed)
272
+ return;
273
+ destroyed = true;
274
+ observer.disconnect();
275
+ disposals.splice(0).forEach(dispose => dispose());
276
+ workspace.destroy();
277
+ settings.destroy();
278
+ resources.destroy();
279
+ files.destroy();
280
+ for (const owner of [...fixed.values()])
281
+ owner.release();
282
+ fixed.clear();
283
+ for (const release of [...frameOwners.values()])
284
+ release();
285
+ frameOwners.clear();
286
+ feature.destroy();
287
+ oauth.destroy();
288
+ images.destroy();
289
+ sdk.destroy();
290
+ shell.destroy();
291
+ for (const [url, timer] of downloads) {
292
+ clearTimeout(timer);
293
+ URL.revokeObjectURL(url);
294
+ }
295
+ downloads.clear();
296
+ changed();
297
+ },
298
+ };
299
+ }
300
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAA2B,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAC,uBAAuB,EAAE,wBAAwB,EAAC,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAC,aAAa,EAAkB,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAC,oBAAoB,EAA+C,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAC,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,oBAAoB,EAAsB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAC,gBAAgB,EAAkB,MAAM,YAAY,CAAC;AAU7D,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AA+BvD,IAAI,QAAQ,GAAG,CAAC,CAAC;AACjB,MAAM,QAAQ,GAAG,KAAK,EAAE,MAAwB,EAAyB,EAAE;IACzE,IAAI,CAAC;QAAA,OAAO,MAAM,MAAM,EAAE,IAAI,EAAC,EAAE,EAAE,IAAI,EAAC,CAAC;IAAA,CAAC;IAC1C,OAAO,KAAK,EAAE,CAAC;QAAA,OAAO,EAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAC,CAAC;IAAA,CAAC;AACpG,CAAC,CAAC;AAEF,oFAAoF;AACpF,MAAM,UAAU,iBAAiB,CAAC,KAAkB,EAAE,UAA8B,EAAE;IACpF,MAAM,QAAQ,G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AAQ,CAAC,OAAO,EAAE,CAAC;YAAC,SAAS,CAAC,OAAO,EAAE,CAAC;YAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAC9E,KAAK,MAAM,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;gBAAE,KAAK,CAAC,OAAO,EAAE,CAAC;YAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACxE,KAAK,MAAM,OAAO,IAAI,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC;gBAAE,OAAO,EAAE,CAAC;YAAC,WAAW,CAAC,KAAK,EAAE,CAAC;YAChF,OAAO,CAAC,OAAO,EAAE,CAAC;YAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACrF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC;gBAAA,YAAY,CAAC,KAAK,CAAC,CAAC;gBAAC,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;YAAA,CAAC;YAAC,SAAS,CAAC,KAAK,EAAE,CAAC;YAAC,OAAO,EAAE,CAAC;QACtH,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import {createWorkspaceShell, type WorkspaceDialogName} from '../workspace.js';\nimport {createSDKDialogElements, createFeatureDialogFrame} from '../forms/dialog-frame.js';\nimport {installImageViewer} from '../content/image-viewer.js';\nimport {setAppearance, type Appearance} from '../theme.js';\nimport type {ActionResult} from '../core.js';\nimport {createWorkspaceScene, type WorkspaceCallbacks, type WorkspaceScene} from './workspace.js';\nimport {createSettingsScene, type SettingsScene} from './settings.js';\nimport {createResourcesScene, type ResourcesScene} from './resources.js';\nimport {createFilesScene, type FilesScene} from './files.js';\nimport type {AppEnvironment, HostResult, OwnedContent, OwnedSurface} from './internal.js';\nexport type {LoadingState, LoadingSession} from './session.js';\n\nexport type {ActionResult} from '../core.js';\nexport type {Appearance} from '../theme.js';\nexport type {WorkspaceCallbacks, WorkspaceScene, WorkspaceAction, WorkspaceAvailability, NavigationStatus, NavigationState, ApplicationWorkspace, ApplicationConversation, ConversationState, ImageTarget, ConversationNavigationAction, SceneSession, MessageEditorState, MessageEditorSession, ConfirmationState, ComposerViewState, WorkspaceShellState, WelcomeState, PendingMessagesState, AttachmentsState, PermissionControlState, FullAccessState, TaskFailureState, ApprovalPanelState, RuntimePanelState, CostLedgerState, CompletionNoticeDisplay, ConversationMessage, ConversationAction, ConversationActionAvailability, WorkspacePickerState, RenameConversationState, RenameConversationDraft, BranchHistoryState} from './workspace.js';\nexport type {SettingsScene, SettingsSession, MCPSession, ModelSession, CustomConnectionSession, ProviderLoginSession, SettingsCredential, SettingsCallbacks, MCPCallbacks, ModelCallbacks, CustomConnectionCallbacks, ProviderLoginCallbacks, SettingsPanelState, SettingsDraft, SettingsProviderOption, MCPConnectionsState, MCPConnectionDraft, MCPEditorValue, MCPConnectionItem, ModelPickerState, ModelSelection, CustomConnectionState, CustomConnectionDraft, ProviderLoginState, UpdatePanelState, ProviderAction, ProviderActionsState, ProviderActionTarget, MCPConnectionAction, MCPConnectionTarget, UpdateAction} from './settings.js';\nexport type {ResourcesState, ResourcesCallbacks, ResourcesSession, ResourcesScene, AppResourceEntry, AppResourceTarget, AppResourceKind, AppResourceEditorState, ResourceEditorCallbacks, ResourceEditorSession, ResourceActionResult, ResourceDraft} from './resources.js';\nexport type {FilesScene, AppArtifactsState, ArtifactsCallbacks, AppFileOwner, AppFileTarget, AppFileAction, FileCapabilities, FileActionResult, AppFilePreviewState, FilePreviewInput, FilePreviewCallbacks, FilePreviewSession} from './files.js';\nexport {formatCost} from '../files/systems.js';\nexport {thinkingLabel} from '../forms/model-editor.js';\n\nexport interface ApplicationBrand {\n readonly name: string;\n readonly qualifier?: string;\n readonly mark?: {readonly src: string; readonly darkSrc?: string; readonly alt: string};\n}\nexport interface ApplicationHost {\n copyText?(text: string): HostResult;\n openExternal?(url: string): HostResult;\n}\nexport interface ApplicationState {readonly hasModal: boolean; readonly appearance: Appearance}\nexport interface ApplicationOptions {\n readonly brand?: ApplicationBrand;\n readonly appearance?: Appearance;\n readonly host?: ApplicationHost;\n readonly workspace?: WorkspaceCallbacks;\n readonly onUIStateChange?: (state: ApplicationState) => void;\n readonly onError?: (message: string) => void;\n}\nexport interface Application {\n readonly workspace: WorkspaceScene;\n readonly settings: SettingsScene;\n readonly resources: ResourcesScene;\n readonly files: FilesScene;\n read(): ApplicationState;\n setAppearance(appearance: Appearance): void;\n downloadFile(file: {readonly blob: Blob; readonly name: string}): Promise<ActionResult>;\n destroy(): void;\n}\n\nlet sequence = 0;\nconst resultOf = async (action: () => HostResult): Promise<ActionResult> => {\n try {return await action() || {ok: true};}\n catch (error) {return {ok: false, error: error instanceof Error ? error.message : String(error)};}\n};\n\n/** The only DOM argument is the application mount. Scenes return semantic ports. */\nexport function createApplication(mount: HTMLElement, options: ApplicationOptions = {}): Application {\n const idPrefix = `pui-app-${++sequence}-`;\n let destroyed = false, appearance = options.appearance ?? 'system', lastModal = false;\n const disposals: Array<() => void> = [];\n const fixed = new Map<WorkspaceDialogName, {content: OwnedContent; release(): void}>();\n const fixedOpenings = new Map<WorkspaceDialogName, number>();\n let openingSequence = 0;\n const brand = document.createElement('span'); brand.className = 'pui-app-brand';\n const brandData = options.brand ?? {name: 'Pith'};\n if (brandData.mark) {\n const image = document.createElement('img'); image.className = 'pui-app-brand-image';\n image.src = brandData.mark.src; image.alt = brandData.mark.alt; brand.append(image);\n }\n const wordmark = document.createElement('span'); wordmark.textContent = brandData.name;\n if (brandData.qualifier) {const suffix = document.createElement('span'); suffix.className = 'pui-brand-light'; suffix.textContent = ' ' + brandData.qualifier; wordmark.append(suffix);}\n brand.append(wordmark);\n const shell: ReturnType<typeof createWorkspaceShell> = createWorkspaceShell({brand, prefix: idPrefix, composer: {\n onSubmit: options.workspace?.onSubmit,\n onStop: options.workspace?.onStop,\n onInput: options.workspace?.onInput,\n onModel: () => options.workspace?.onAction?.('model'),\n onAttach: () => workspace.pickImages(),\n onImages: options.workspace?.onImages,\n onThinkingChange: options.workspace?.onThinkingChange,\n }, onBusyAction: key => options.workspace?.onBusyAction?.(key),\n onSearch: query => workspace.search(query),\n onDialogClose(name) {fixed.get(name)?.release(); changed();},\n });\n mount.replaceChildren(shell.element);\n const themeRoot = mount.ownerDocument.documentElement;\n setAppearance(themeRoot, appearance);\n const media = matchMedia('(prefers-color-scheme: dark)');\n const brandMarkSource = () => (appearance === 'dark' || appearance === 'system' && media.matches) && brandData.mark?.darkSrc ? brandData.mark.darkSrc : brandData.mark?.src || '';\n const syncTheme = () => {\n themeRoot.dataset.theme = appearance === 'system' ? media.matches ? 'dark' : 'light' : appearance;\n const source = brandMarkSource();\n for (const image of shell.element.querySelectorAll<HTMLImageElement>('.pui-app-brand-image')) if (image.getAttribute('src') !== source) image.setAttribute('src', source);\n };\n media.addEventListener('change', syncTheme); disposals.push(() => media.removeEventListener('change', syncTheme)); syncTheme();\n const sdk = createSDKDialogElements({idPrefix}); shell.element.append(sdk.dialog, sdk.oauthDialog);\n const feature = createFeatureDialogFrame({dialog: sdk.dialog, content: sdk.content, titleId: idPrefix + 'sdk-title', errorId: idPrefix + 'sdk-error', onClose: () => changed()});\n const oauth = createFeatureDialogFrame({dialog: sdk.oauthDialog, content: sdk.oauthContent, titleId: idPrefix + 'oauth-title', errorId: idPrefix + 'oauth-frame-error', onClose: () => changed()});\n const frameOpenings = new Map<typeof feature, number>();\n const frameOwners = new Map<typeof feature, (deferNotify?: boolean) => void>();\n const images = installImageViewer(shell.part<HTMLDialogElement>('image-dialog'), {triggerRoot: shell.element});\n const read = (): ApplicationState => Object.freeze({hasModal: !destroyed && !!shell.element.querySelector('dialog[open]'), appearance});\n function notify(callback?: () => void): void {\n try {callback?.();}\n catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n try {(options.onError ?? options.workspace?.onError)?.(message);} catch {}\n }\n }\n function changed(): void {\n const modal = read().hasModal;\n if (lastModal === modal) return;\n lastModal = modal; notify(() => options.onUIStateChange?.(read()));\n }\n // Image zoom and native dialog dismissal also participate in the same modal\n // state; this observer is UI-local and never starts business work or polling.\n const observer = new MutationObserver(changed);\n observer.observe(shell.element, {subtree: true, attributes: true, attributeFilter: ['open']});\n const copyText = (text: string) => resultOf(async () => {\n if (destroyed) return {ok: false, error: 'Application has been destroyed.'};\n if (options.host?.copyText) return options.host.copyText(text);\n await navigator.clipboard.writeText(text); return {ok: true};\n });\n const openExternal = (value: string) => resultOf(async () => {\n if (destroyed) return {ok: false, error: 'Application has been destroyed.'};\n const url = new URL(value);\n if (!['http:', 'https:'].includes(url.protocol)) return {ok: false, error: 'Unsupported external link.'};\n if (options.host?.openExternal) return options.host.openExternal(url.href);\n window.open(url.href, '_blank', 'noopener,noreferrer'); return {ok: true};\n });\n const frameOpen = (frame: typeof feature, title: string, content: OwnedContent, onClose?: () => void): OwnedSurface => {\n const opening = ++openingSequence; frameOpenings.set(frame, opening);\n let alive = !destroyed;\n const release = (deferNotify = false) => {\n if (!alive) return; alive = false;\n if (frameOwners.get(frame) === release) frameOwners.delete(frame);\n try {content.destroy();} finally {if (deferNotify) queueMicrotask(() => notify(onClose)); else notify(onClose);}\n };\n // Native dismissal clears the frame synchronously. Notify the host after\n // that clear so a new opening from onClose cannot be erased by the old one.\n const guarded: OwnedContent = {element: content.element, destroy: () => release(true)};\n const isOpen = () => alive && !destroyed && frameOwners.get(frame) === release && frame.isOpen();\n const close = () => {if (!alive) return; if (frameOwners.get(frame) !== release) {release(); return;} try {frame.close();} finally {try {release();} finally {changed();}}};\n if (alive) {\n frameOwners.get(frame)?.();\n if (destroyed || frameOpenings.get(frame) !== opening) release();\n else {frameOwners.set(frame, release); frame.open({title, body: guarded}); changed();}\n } else content.destroy();\n return {isOpen, close, destroy: close, fail(message) {if (isOpen()) frame.fail(message);}};\n };\n const environment: AppEnvironment = {\n idPrefix, productName: [brandData.name, brandData.qualifier].filter(Boolean).join(' '), brandMarkSource, part: shell.part, copyText, openExternal, hasModal: () => read().hasModal, changed, notifyClose: notify,\n openImage: image => {if (!destroyed) {images.open(image); changed();}},\n closeImage() {images.close(); changed();},\n openDialog(name, content, onClose) {\n const opening = ++openingSequence; fixedOpenings.set(name, opening);\n let alive = !destroyed;\n const dialog = shell.part<HTMLDialogElement>(name + '-dialog');\n const release = () => {\n if (!alive) return; alive = false;\n if (fixed.get(name)?.content === content) fixed.delete(name);\n try {content.destroy();} finally {notify(onClose);}\n };\n const isOpen = () => alive && !destroyed && fixed.get(name)?.content === content && dialog.open;\n const close = () => {if (!alive || fixed.get(name)?.content !== content) return; try {shell.closeDialog(name);} finally {try {release();} finally {changed();}}};\n if (alive) {\n fixed.get(name)?.release();\n if (destroyed || fixedOpenings.get(name) !== opening) release();\n else {\n fixed.set(name, {content, release});\n shell.part(name + '-content').replaceChildren(content.element);\n shell.openDialog(name); changed();\n }\n } else content.destroy();\n return {isOpen, close, destroy: close, fail(message) {\n if (!isOpen()) return;\n const error = content.element.querySelector<HTMLElement>('[data-dialog-error]') ?? content.element.querySelector<HTMLElement>('.pui-form-error[role=\"alert\"]');\n if (error) error.textContent = message;\n }};\n },\n openFeature: (title, content, onClose) => frameOpen(feature, title, content, onClose),\n openOAuth: (title, content, onClose) => frameOpen(oauth, title, content, onClose),\n };\n const workspace = createWorkspaceScene(environment, shell, options.workspace ?? {}, brandData);\n const settings = createSettingsScene(environment), resources = createResourcesScene(environment), files = createFilesScene(environment);\n const downloads = new Map<string, ReturnType<typeof setTimeout>>();\n return {\n workspace, settings, resources, files, read,\n setAppearance(next) {if (destroyed) return; appearance = next; setAppearance(themeRoot, next); syncTheme(); notify(() => options.onUIStateChange?.(read()));},\n async downloadFile({blob, name}) {\n if (destroyed) return {ok: false, error: 'Application has been destroyed.'};\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n try {link.href = url; link.download = name; shell.element.append(link); link.click(); return {ok: true};}\n catch (error) {return {ok: false, error: error instanceof Error ? error.message : String(error)};}\n finally {link.remove(); if (destroyed) URL.revokeObjectURL(url); else downloads.set(url, setTimeout(() => {URL.revokeObjectURL(url); downloads.delete(url);}, 30_000));}\n },\n destroy() {\n if (destroyed) return; destroyed = true;\n observer.disconnect(); disposals.splice(0).forEach(dispose => dispose());\n workspace.destroy(); settings.destroy(); resources.destroy(); files.destroy();\n for (const owner of [...fixed.values()]) owner.release(); fixed.clear();\n for (const release of [...frameOwners.values()]) release(); frameOwners.clear();\n feature.destroy(); oauth.destroy(); images.destroy(); sdk.destroy(); shell.destroy();\n for (const [url, timer] of downloads) {clearTimeout(timer); URL.revokeObjectURL(url);} downloads.clear(); changed();\n },\n };\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import type { ActionResult } from '../core.js';
2
+ import type { WorkspaceDialogName } from '../workspace.js';
3
+ /** Private composition ports. None of these types is exported by pith-ui/app. */
4
+ export interface OwnedContent {
5
+ readonly element: HTMLElement;
6
+ destroy(): void;
7
+ }
8
+ export interface OwnedSurface {
9
+ isOpen(): boolean;
10
+ close(): void;
11
+ destroy(): void;
12
+ fail(message: string): void;
13
+ }
14
+ export type HostResult = void | ActionResult | Promise<void | ActionResult>;
15
+ export interface AppEnvironment {
16
+ readonly idPrefix: string;
17
+ readonly productName: string;
18
+ brandMarkSource(): string;
19
+ part<T extends HTMLElement = HTMLElement>(name: string): T;
20
+ openDialog(name: WorkspaceDialogName, content: OwnedContent, onClose?: () => void): OwnedSurface;
21
+ openFeature(title: string, content: OwnedContent, onClose?: () => void): OwnedSurface;
22
+ openOAuth(title: string, content: OwnedContent, onClose?: () => void): OwnedSurface;
23
+ copyText(text: string): Promise<ActionResult>;
24
+ openExternal(url: string): Promise<ActionResult>;
25
+ openImage(image: HTMLImageElement): void;
26
+ closeImage(): void;
27
+ hasModal(): boolean;
28
+ changed(): void;
29
+ notifyClose(callback?: () => void): void;
30
+ }
31
+ //# sourceMappingURL=internal.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AO,CAAC,YAAY,CAAC,CAAC;IAC9C,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACjD,SAAS,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACzC,UAAU,IAAI,IAAI,CAAC;IACnB,QAAQ,IAAI,OAAO,CAAC;IACpB,OAAO,IAAI,IAAI,CAAC;IAChB,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAC1C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/app/internal.ts"],"names":[],"mappings":"","sourcesContent":["import type {ActionResult} from '../core.js';\nimport type {WorkspaceDialogName} from '../workspace.js';\n\n/** Private composition ports. None of these types is exported by pith-ui/app. */\nexport interface OwnedContent {readonly element: HTMLElement; destroy(): void}\nexport interface OwnedSurface {\n isOpen(): boolean;\n close(): void;\n destroy(): void;\n fail(message: string): void;\n}\nexport type HostResult = void | ActionResult | Promise<void | ActionResult>;\nexport interface AppEnvironment {\n readonly idPrefix: string;\n readonly productName: string;\n brandMarkSource(): string;\n part<T extends HTMLElement = HTMLElement>(name: string): T;\n openDialog(name: WorkspaceDialogName, content: OwnedContent, onClose?: () => void): OwnedSurface;\n openFeature(title: string, content: OwnedContent, onClose?: () => void): OwnedSurface;\n openOAuth(title: string, content: OwnedContent, onClose?: () => void): OwnedSurface;\n copyText(text: string): Promise<ActionResult>;\n openExternal(url: string): Promise<ActionResult>;\n openImage(image: HTMLImageElement): void;\n closeImage(): void;\n hasModal(): boolean;\n changed(): void;\n notifyClose(callback?: () => void): void;\n}\n"]}
@@ -0,0 +1,89 @@
1
+ import type { ActionResult } from '../core.js';
2
+ import { type ResourceDraft } from '../forms/resource-editor.js';
3
+ import type { AppEnvironment } from './internal.js';
4
+ import { type LoadingState, type LoadingSession } from './session.js';
5
+ export type { ResourceDraft } from '../forms/resource-editor.js';
6
+ export type AppResourceKind = 'instructions' | 'skill' | 'template';
7
+ export type ResourceActionResult = void | ActionResult | Promise<void | ActionResult>;
8
+ export interface AppResourceEntry {
9
+ readonly name: string;
10
+ readonly path: string;
11
+ readonly description?: string;
12
+ readonly content?: string;
13
+ }
14
+ export interface AppResourceTarget {
15
+ readonly workspaceId: string;
16
+ readonly kind: AppResourceKind;
17
+ readonly name: string;
18
+ readonly path: string;
19
+ }
20
+ export interface ResourcesState {
21
+ readonly workspace: {
22
+ readonly id: string;
23
+ readonly name: string;
24
+ readonly path: string;
25
+ };
26
+ readonly instructions: readonly AppResourceEntry[];
27
+ readonly skills: readonly AppResourceEntry[];
28
+ readonly templates: readonly AppResourceEntry[];
29
+ readonly diagnostics: readonly string[];
30
+ readonly canCreateInstructions?: boolean;
31
+ readonly loading?: boolean;
32
+ readonly error?: string;
33
+ readonly busy?: boolean;
34
+ }
35
+ export interface ResourcesCallbacks {
36
+ onRefresh?: () => ResourceActionResult;
37
+ onCreate?: (kind: AppResourceKind) => ResourceActionResult;
38
+ onUse?: (target: AppResourceTarget) => ResourceActionResult;
39
+ onEdit?: (target: AppResourceTarget) => ResourceActionResult;
40
+ onFileAction?: (action: 'open' | 'reveal', target: AppResourceTarget) => ResourceActionResult;
41
+ onClose?: () => void;
42
+ }
43
+ export interface ResourcesSession {
44
+ read(): Readonly<ResourcesState>;
45
+ update(state: Readonly<ResourcesState>): void;
46
+ fail(message: string): void;
47
+ close(): void;
48
+ isOpen(): boolean;
49
+ destroy(): void;
50
+ }
51
+ export interface AppResourceEditorState {
52
+ readonly workspaceId: string;
53
+ readonly workspacePath: string;
54
+ readonly path?: string;
55
+ readonly kind: AppResourceKind;
56
+ readonly name?: string;
57
+ readonly content: string;
58
+ readonly editable: boolean;
59
+ readonly workspaceBusy: boolean;
60
+ readonly error?: string;
61
+ readonly disabled?: boolean;
62
+ }
63
+ export interface ResourceEditorCallbacks {
64
+ onSubmit?: (draft: ResourceDraft) => ActionResult | Promise<ActionResult>;
65
+ onDelete?: (target: AppResourceTarget) => ResourceActionResult;
66
+ onClose?: () => void;
67
+ }
68
+ export interface ResourceEditorSession {
69
+ read(): ResourceDraft;
70
+ update(state: Readonly<AppResourceEditorState>): void;
71
+ fail(message: string): void;
72
+ close(): void;
73
+ isOpen(): boolean;
74
+ destroy(): void;
75
+ }
76
+ export interface ResourcesScene {
77
+ openEditorLoading(state: Readonly<LoadingState> & {
78
+ readonly kind: AppResourceKind;
79
+ readonly path?: string;
80
+ }, callbacks?: {
81
+ onClose?: () => void;
82
+ }): LoadingSession;
83
+ open(state: Readonly<ResourcesState>, callbacks?: ResourcesCallbacks): ResourcesSession;
84
+ openEditor(state: Readonly<AppResourceEditorState>, callbacks?: ResourceEditorCallbacks): ResourceEditorSession;
85
+ destroy(): void;
86
+ }
87
+ /** Compose the existing resource views; callers never own their DOM or slots. */
88
+ export declare function createResourcesScene(env: AppEnvironment): ResourcesScene;
89
+ //# sourceMappingURL=resources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/app/resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAuB,KAAK,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAErF,OAAO,KAAK,EAAC,cAAc,EAAe,MAAM,eAAe,CAAC;AAChE,OAAO,EAAuB,KAAK,YAAY,EAAE,KAAK,cAAc,EAAC,MAAM,cAAc,CAAC;AAE1F,YAAY,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAE/D,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,OAAO,GAAG,UAAU,CAAC;AACpE,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,YAAY,GAAG,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC,CAAC;AACtF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC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