@punica/editor 1.0.5 → 1.0.7

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 (69) hide show
  1. package/dist/index.bundle.esm.js +1 -1
  2. package/dist/index.bundle.esm.js.map +1 -1
  3. package/dist/index.bundle.umd.js +1 -1
  4. package/dist/index.bundle.umd.js.map +1 -1
  5. package/package.json +28 -3
  6. package/types/index.d.ts +120 -11
  7. package/types/punica.module.bootstrap.d.ts +45 -0
  8. package/types/punica.module.capability.d.ts +359 -0
  9. package/types/punica.module.extensions.api.d.ts +740 -0
  10. package/types/punica.module.extensions.settings.d.ts +106 -0
  11. package/types/punica.module.flow.agent.d.ts +75 -0
  12. package/types/punica.module.flow.api.d.ts +128 -0
  13. package/types/punica.module.flow.d.ts +490 -0
  14. package/types/punica.module.flow.engine.d.ts +228 -0
  15. package/types/punica.module.flow.mcp.d.ts +26 -0
  16. package/types/punica.module.flow.notebook.d.ts +210 -0
  17. package/types/punica.module.flow.primitives.d.ts +700 -0
  18. package/types/punica.module.flow.shell.d.ts +374 -0
  19. package/types/punica.module.kernel.ai.d.ts +462 -0
  20. package/types/punica.module.kernel.commands.d.ts +49 -0
  21. package/types/punica.module.kernel.events.d.ts +274 -0
  22. package/types/punica.module.kernel.history.d.ts +20 -0
  23. package/types/punica.module.kernel.llm.d.ts +343 -0
  24. package/types/punica.module.kernel.notifications.d.ts +64 -0
  25. package/types/punica.module.kernel.policy.d.ts +273 -0
  26. package/types/punica.module.kernel.tasks.d.ts +107 -0
  27. package/types/punica.module.kernel.timeServer.d.ts +16 -0
  28. package/types/punica.module.runtime.api.d.ts +214 -0
  29. package/types/punica.module.runtime.capabilities.d.ts +175 -0
  30. package/types/punica.module.runtime.compute.d.ts +339 -0
  31. package/types/punica.module.runtime.datasets.d.ts +234 -0
  32. package/types/punica.module.runtime.fs.d.ts +385 -0
  33. package/types/punica.module.runtime.harness.d.ts +246 -0
  34. package/types/punica.module.runtime.host.d.ts +272 -0
  35. package/types/punica.module.runtime.inference.d.ts +164 -0
  36. package/types/punica.module.runtime.lifecycle.d.ts +15 -0
  37. package/types/punica.module.runtime.llm.d.ts +470 -0
  38. package/types/punica.module.runtime.mcp.d.ts +139 -0
  39. package/types/punica.module.runtime.modelRuntimes.d.ts +90 -0
  40. package/types/punica.module.runtime.models.d.ts +254 -0
  41. package/types/punica.module.runtime.search.d.ts +59 -0
  42. package/types/punica.module.runtime.secrets.d.ts +26 -0
  43. package/types/punica.module.runtime.tasks.d.ts +27 -0
  44. package/types/punica.module.runtime.vcs.d.ts +67 -0
  45. package/types/punica.module.runtime.vectors.d.ts +74 -0
  46. package/types/punica.module.runtime.workspace.d.ts +134 -0
  47. package/types/punica.module.shell.activityBar.d.ts +42 -0
  48. package/types/punica.module.shell.components.d.ts +87 -0
  49. package/types/punica.module.shell.contentTabs.d.ts +33 -0
  50. package/types/punica.module.shell.dragDrop.d.ts +25 -0
  51. package/types/punica.module.shell.keyboardShortcuts.d.ts +38 -0
  52. package/types/punica.module.shell.layout.d.ts +106 -0
  53. package/types/punica.module.shell.markdown.d.ts +36 -0
  54. package/types/punica.module.shell.panelTabs.d.ts +48 -0
  55. package/types/punica.module.shell.profile.d.ts +278 -0
  56. package/types/punica.module.shell.statusbar.d.ts +26 -0
  57. package/types/punica.module.shell.view.d.ts +455 -0
  58. package/types/punica.module.shell.views.d.ts +150 -0
  59. package/types/punica.module.test.d.ts +562 -0
  60. package/types/punica.module.activityBar.d.ts +0 -21
  61. package/types/punica.module.commands.d.ts +0 -21
  62. package/types/punica.module.dragDrop.d.ts +0 -23
  63. package/types/punica.module.extensions.d.ts +0 -157
  64. package/types/punica.module.history.d.ts +0 -18
  65. package/types/punica.module.keyboardShortcuts.d.ts +0 -29
  66. package/types/punica.module.layout.d.ts +0 -23
  67. package/types/punica.module.statusbar.d.ts +0 -21
  68. package/types/punica.module.timeServer.d.ts +0 -14
  69. package/types/punica.module.view.d.ts +0 -8
@@ -0,0 +1,87 @@
1
+ declare module 'punica' {
2
+ export namespace shell {
3
+ /**
4
+ * Punica Components
5
+ * Type definitions for punica-components web elements
6
+ */
7
+ export namespace Components {
8
+ // Punica element tag names from punica-components
9
+ // This list matches punica-components/src/component.d.ts
10
+ // Maintained manually to avoid React/JSX dependencies
11
+ export type Element =
12
+ | 'punica-accordion'
13
+ | 'punica-accordion-summary'
14
+ | 'punica-accordion-details'
15
+ | 'punica-select'
16
+ | 'punica-select-item'
17
+ | 'punica-popover'
18
+ | 'punica-qr-code'
19
+ | 'punica-pagination'
20
+ | 'punica-button'
21
+ | 'punica-button-group'
22
+ | 'punica-icon-button'
23
+ | 'punica-avatar'
24
+ | 'punica-alert'
25
+ | 'punica-alert-action'
26
+ | 'punica-alert-icon'
27
+ | 'punica-alert-content'
28
+ | 'punica-app-bar'
29
+ | 'punica-badge'
30
+ | 'punica-chip'
31
+ | 'punica-input'
32
+ | 'punica-textarea'
33
+ | 'punica-container'
34
+ | 'punica-hidden'
35
+ | 'punica-icon'
36
+ | 'punica-date-picker'
37
+ | 'punica-drawer'
38
+ | 'punica-paper'
39
+ | 'punica-split-button'
40
+ | 'punica-card'
41
+ | 'punica-card-header'
42
+ | 'punica-card-media'
43
+ | 'punica-card-content'
44
+ | 'punica-card-actions'
45
+ | 'punica-box'
46
+ | 'punica-tooltip'
47
+ | 'punica-divider'
48
+ | 'punica-switch'
49
+ | 'punica-modal'
50
+ | 'punica-modal-header'
51
+ | 'punica-modal-content'
52
+ | 'punica-modal-footer'
53
+ | 'punica-dialog'
54
+ | 'punica-dialog-header'
55
+ | 'punica-dialog-content'
56
+ | 'punica-dialog-footer'
57
+ | 'punica-skeleton'
58
+ | 'punica-checkbox'
59
+ | 'punica-menu'
60
+ | 'punica-menu-item'
61
+ | 'punica-tab'
62
+ | 'punica-tab-item'
63
+ | 'punica-tab-panel'
64
+ | 'punica-list-view'
65
+ | 'punica-list-view-item'
66
+ | 'punica-single-select-list'
67
+ | 'punica-single-select-list-item'
68
+ | 'punica-multi-select-list'
69
+ | 'punica-multi-select-list-item'
70
+ | 'punica-time-picker'
71
+ | 'punica-typography'
72
+ | 'punica-toggle-button'
73
+ | 'punica-toggle-button-group'
74
+ | 'punica-context-menu'
75
+ | 'punica-context-menu-item'
76
+ | 'punica-context-menu-sperator'
77
+ | 'punica-toolbar'
78
+ | 'punica-toast'
79
+ | 'punica-toaster'
80
+ | 'punica-progress-line'
81
+ | 'punica-virtual-list'
82
+ | 'punica-virtual-table'
83
+ | 'punica-col'
84
+ | 'punica-row';
85
+ }
86
+ }
87
+ }
@@ -0,0 +1,33 @@
1
+ declare module 'punica' {
2
+ export namespace shell {
3
+ /**
4
+ * Content tab management capability for the main editor area.
5
+ */
6
+ export interface ContentTabsApi {
7
+ open(options: {
8
+ path: string;
9
+ title?: string;
10
+ viewType?: string;
11
+ }): HTMLElement | null;
12
+ close(path: string): void;
13
+ closeOthers(path: string): void;
14
+ closeAll(): void;
15
+ setDirty(path: string, dirty: boolean): void;
16
+ /**
17
+ * Returns the path of the currently active content tab, or null if none.
18
+ */
19
+ getActivePath(): string | null;
20
+ /**
21
+ * Returns the viewType of the currently active content tab, or null if none.
22
+ * View types are provided by content extensions when opening tabs
23
+ * (e.g. "code", "flow-book", "markdown").
24
+ */
25
+ getActiveViewType(): string | null;
26
+ }
27
+
28
+ /**
29
+ * Global content tabs API surfaced via `punica.shell.ContentTabs`.
30
+ */
31
+ export const ContentTabs: ContentTabsApi;
32
+ }
33
+ }
@@ -0,0 +1,25 @@
1
+ declare module 'punica' {
2
+ export namespace shell {
3
+ export namespace DragDrop {
4
+ type DragDropEvents = 'dragging' | 'dragStart' | 'dragStop';
5
+ type Events = { [key in DragDropEvents]: string };
6
+ type Point = {
7
+ x: number;
8
+ y: number;
9
+ };
10
+ type PositionDetail = {
11
+ offsetX: number;
12
+ offsetY: number;
13
+ pageX: number;
14
+ pageY: number;
15
+ clientX: number;
16
+ clientY: number;
17
+ };
18
+ interface IServiceDragDrop {
19
+ handleDragStart(event: MouseEvent): void;
20
+ handleDragging(event: MouseEvent): void;
21
+ handleDragStop(event: MouseEvent): void;
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,38 @@
1
+ declare module 'punica' {
2
+ export namespace shell {
3
+ export namespace KeyboardShortcuts {
4
+ interface IDisposable {
5
+ dispose(): void;
6
+ }
7
+
8
+ interface IKey {
9
+ key: string;
10
+ ctrlKey?: boolean;
11
+ shiftKey?: boolean;
12
+ altKey?: boolean;
13
+ metaKey?: boolean;
14
+ }
15
+
16
+ interface IShortcut {
17
+ command: string;
18
+ keys: IKey[];
19
+ disposable?: IDisposable;
20
+ /**
21
+ * Optional context expression that determines when the shortcut is active.
22
+ * The first supported context key is:
23
+ * - view: the current active content tab viewType (e.g. "code", "flow-book").
24
+ * Example: "view == code", "view == flow-book".
25
+ */
26
+ when?: string;
27
+ }
28
+
29
+ interface IShortcutManager {
30
+ registerShortcut(shortcut: IShortcut): void;
31
+ unregisterShortcut(keys: IKey[]): void;
32
+ handleKeyEvent(event: KeyboardEvent): void;
33
+ }
34
+
35
+ export const manager: IShortcutManager;
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,106 @@
1
+ declare module 'punica' {
2
+ export namespace shell {
3
+ export namespace Layout {
4
+ export type LayoutSlotId = string;
5
+
6
+ export type LayoutSlotRole =
7
+ | 'content'
8
+ | 'primarySidebar'
9
+ | 'secondarySidebar'
10
+ | 'panel'
11
+ | 'statusbar'
12
+ | 'activityBar'
13
+ | 'overlay'
14
+ | 'custom';
15
+
16
+ export interface LayoutSlot {
17
+ id: LayoutSlotId;
18
+ role?: LayoutSlotRole;
19
+ content: HTMLElement;
20
+ }
21
+
22
+ export type LayoutNode =
23
+ | { type: 'row'; sizes?: number[]; children: LayoutNode[] }
24
+ | { type: 'column'; sizes?: number[]; children: LayoutNode[] }
25
+ | { type: 'slot'; id: LayoutSlotId; role?: LayoutSlotRole };
26
+
27
+ export interface LayoutProfile {
28
+ id: string;
29
+ title: string;
30
+ root: LayoutNode;
31
+ }
32
+
33
+ export interface ILayoutManager {
34
+ /**
35
+ * Render the current layout profile into the given container.
36
+ */
37
+ render(container: HTMLElement): void;
38
+
39
+ /**
40
+ * Apply a new layout profile, rebuilding the DOM and slot map.
41
+ * Backward-compatible API — use `applyApplicationProfile` for
42
+ * profile-driven structural slot derivation.
43
+ */
44
+ applyProfile(profile: LayoutProfile): void;
45
+
46
+ /**
47
+ * Apply an ApplicationProfile's shell spec to the layout.
48
+ * Derives structural slots from `profile.shell.activeModules`
49
+ * rather than relying on hardcoded profile id checks.
50
+ * Called by ProfileManager during bootstrap.
51
+ */
52
+ applyApplicationProfile(
53
+ profile: shell.Profile.ApplicationProfile
54
+ ): void;
55
+
56
+ /**
57
+ * Get the currently active layout profile.
58
+ */
59
+ getActiveProfile(): LayoutProfile;
60
+
61
+ /**
62
+ * Get a slot by id. Returns undefined if the slot is not present
63
+ * in the active layout profile.
64
+ */
65
+ getSlot(id: LayoutSlotId): LayoutSlot | undefined;
66
+
67
+ /**
68
+ * Create (or re-attach) the DOM host for a view WITHOUT any
69
+ * visibility side effect. New hosts start hidden. Visibility is
70
+ * changed only by the shell ViewRegistry
71
+ * (`punica.shell.Views.manager.reveal`, i.e. the
72
+ * `shell.revealView` capability).
73
+ */
74
+ materializeViewHost(slotId: LayoutSlotId, viewId: string): HTMLElement;
75
+
76
+ /**
77
+ * Make a materialized view the visible one in its slot.
78
+ * Visibility authority: only the shell ViewRegistry and the
79
+ * legacy `ensureViewHost` compatibility path call this — do not
80
+ * call it from extensions.
81
+ */
82
+ showView(slotId: LayoutSlotId, viewId: string): void;
83
+
84
+ /** Hide every view host in a slot. */
85
+ hideSlotViews(slotId: LayoutSlotId): void;
86
+
87
+ /** Remove a view host from the DOM (extension deactivation). */
88
+ removeViewHost(slotId: LayoutSlotId, viewId: string): void;
89
+
90
+ /**
91
+ * LEGACY compatibility surface — materialize + reveal in one
92
+ * call. During a headless extension activation the reveal half
93
+ * is blocked (host is created hidden and a
94
+ * `shell.view.revealBlocked` event is emitted).
95
+ *
96
+ * @deprecated Register a ViewProvider
97
+ * (`context.ui.registerViewProvider`) and reveal via the
98
+ * `shell.revealView` capability instead.
99
+ */
100
+ ensureViewHost(slotId: LayoutSlotId, viewId: string): HTMLElement;
101
+ }
102
+
103
+ export const manager: ILayoutManager;
104
+ }
105
+ }
106
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Shared Markdown renderer type declarations — `punica.shell.Markdown`.
3
+ *
4
+ * The substrate-central markdown→HTML renderer (markdown-it + highlight.js)
5
+ * consumed by every UI surface so code blocks and typography are identical
6
+ * everywhere. Pure data / DOM-free (D1): `render` returns an HTML string and
7
+ * `css` is a stylesheet string.
8
+ *
9
+ * Naming convention mirrors other shell module type files:
10
+ * `punica.module.shell.<area>.d.ts`.
11
+ */
12
+
13
+ declare module 'punica' {
14
+ export namespace shell {
15
+ namespace Markdown {
16
+ interface RenderOptions {
17
+ /**
18
+ * Syntax-highlight fenced code blocks (default true). Pass false for
19
+ * per-token streaming — highlighting is applied once the block is
20
+ * finalized (avoids re-highlighting partial code every token).
21
+ */
22
+ highlight?: boolean;
23
+ }
24
+
25
+ /** Render a Markdown string to a safe, DOM-free HTML fragment. */
26
+ function render(src: string, opts?: RenderOptions): string;
27
+
28
+ /**
29
+ * Stylesheet for the rendered HTML (hljs One Dark palette + code-block
30
+ * chrome hooks + markdown typography). Inject once per document via
31
+ * `punica.extensions.Styles.register('punica:markdown', css, …)`.
32
+ */
33
+ const css: string;
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,48 @@
1
+ declare module 'punica' {
2
+ export namespace shell {
3
+ /**
4
+ * Panel tab management for the bottom panel area (problems, terminals, etc.).
5
+ */
6
+ export interface PanelTabsApi {
7
+ open(options: {
8
+ id: string;
9
+ title: string;
10
+ commandId: string;
11
+ iconClass?: string;
12
+ order?: number;
13
+ /**
14
+ * When false, the panel tab is added but not activated.
15
+ */
16
+ autoActivate?: boolean;
17
+ }): void;
18
+
19
+ close(id: string): void;
20
+ closeAll(): void;
21
+
22
+ /** Returns the id of the currently active panel tab, or null. */
23
+ getActiveId(): string | null;
24
+
25
+ /**
26
+ * Activate a tab and execute its bound command (legacy render
27
+ * path). Blocked during headless extension activation — a
28
+ * capability call must never steal the visible panel; reveal via
29
+ * the `shell.revealView` capability instead.
30
+ *
31
+ * @param id
32
+ */
33
+ setActive(id: string): void;
34
+
35
+ /**
36
+ * Update the tab strip visual selection WITHOUT executing the
37
+ * tab's command. Used by the shell ViewRegistry when a
38
+ * provider-rendered panel view is revealed.
39
+ */
40
+ activateTabVisual(id: string): void;
41
+ }
42
+
43
+ /**
44
+ * Global panel tabs API surfaced via `punica.shell.PanelTabs`.
45
+ */
46
+ export const PanelTabs: PanelTabsApi;
47
+ }
48
+ }
@@ -0,0 +1,278 @@
1
+ /**
2
+ * ApplicationProfile type declarations.
3
+ *
4
+ * Minimum viable v1 schema: 4 enforced dimensions
5
+ * (identity, shell, theme, capabilities) + 6 optional
6
+ * non-enforced dimensions for future progressive enforcement.
7
+ *
8
+ * Naming convention mirrors other shell module type files:
9
+ * `punica.module.shell.<area>.d.ts`.
10
+ */
11
+
12
+ declare module 'punica' {
13
+ export namespace shell {
14
+ namespace Profile {
15
+ /**
16
+ * Shell module identifiers that can be activated per-profile.
17
+ * These map directly to MODULE_NAMES entries in identifiers.ts.
18
+ */
19
+ type ShellModuleId =
20
+ | 'shell.activityBar'
21
+ | 'shell.statusbar'
22
+ | 'shell.view'
23
+ | 'shell.views'
24
+ | 'shell.keyboardShortcuts'
25
+ | 'shell.layout'
26
+ | 'shell.contentTabs'
27
+ | 'shell.panelTabs'
28
+ | 'flow.shell';
29
+
30
+ /**
31
+ * Per-profile branding overrides.
32
+ * All fields are optional — omitted fields fall back to substrate defaults.
33
+ */
34
+ interface ProfileBranding {
35
+ /** URL or data URI for the product logo. */
36
+ logo?: string;
37
+ /** URL for the browser-tab favicon. */
38
+ favicon?: string;
39
+ /** Product display name shown in title bars and "about" dialogs. */
40
+ productName?: string;
41
+ /** Raw CSS injected into the document for profile-specific overrides. */
42
+ customCss?: string;
43
+ }
44
+
45
+ /**
46
+ * v1 enforced: theme presentation.
47
+ */
48
+ interface ProfileThemeSpec {
49
+ /** Color scheme preference. */
50
+ mode: 'light' | 'dark' | 'auto';
51
+ /** Layout density — defaults to 'comfortable'. */
52
+ density?: 'compact' | 'comfortable';
53
+ /**
54
+ * CSS variable overrides. Keys are CSS custom property names
55
+ * (without leading `--`); the ProfileManager prepends `--punica-`.
56
+ */
57
+ colors?: Record<string, string>;
58
+ branding?: ProfileBranding;
59
+ }
60
+
61
+ /** Capability origin categories from the unified registry. */
62
+ type CapabilityOrigin =
63
+ | 'core'
64
+ | 'extension'
65
+ | 'instruction-class'
66
+ | 'ivy-node'
67
+ | 'ivy-agent'
68
+ | 'mcp';
69
+
70
+ /**
71
+ * v1 enforced: per-profile capability budget.
72
+ *
73
+ * Enforcement order (gateway profileBudget middleware):
74
+ * 1. `allowedOrigins` — reject if origin not listed (skipped when omitted)
75
+ * 2. `deniedIds` — explicit blocklist (takes precedence over allowedIds)
76
+ * 3. `allowedIds` — `'*'` = allow all; array = allowlist
77
+ */
78
+ interface ProfileCapabilityBudget {
79
+ /**
80
+ * `'*'` = allow all capability ids (default permissive).
81
+ * Array = allowlist — only these ids may be invoked.
82
+ */
83
+ allowedIds: string[] | '*';
84
+ /**
85
+ * Explicit blocklist. These ids are rejected even when present
86
+ * in `allowedIds`. Evaluated before the allowlist check.
87
+ */
88
+ deniedIds?: string[];
89
+ /**
90
+ * Filter by capability origin. When provided, only capabilities
91
+ * from listed origins are allowed. Evaluated first (cheapest check).
92
+ * Trinity invariant: all 4 origins treated equally.
93
+ */
94
+ allowedOrigins?: CapabilityOrigin[];
95
+ }
96
+
97
+ /** Layout sub-spec embedded in the profile's shell spec. */
98
+ interface ProfileLayoutSpec {
99
+ /**
100
+ * Layout identifier — used as the `data-profile-id` attribute and
101
+ * for host CSS. Must be unique within a host's profile set.
102
+ */
103
+ id: string;
104
+ /**
105
+ * Root layout tree (same as `shell.Layout.LayoutNode`).
106
+ * Substrate renders this as a recursive split tree inside the main
107
+ * content area.
108
+ */
109
+ root: shell.Layout.LayoutNode;
110
+ }
111
+
112
+ /**
113
+ * v1 enforced: shell composition spec.
114
+ */
115
+ interface ProfileShellSpec {
116
+ /**
117
+ * Shell modules to bootstrap for this profile.
118
+ * Only modules listed here are registered in the ModuleRegistry
119
+ * during bootstrap. Kernel and runtime modules are always registered
120
+ * unconditionally.
121
+ *
122
+ * Structural DOM slots are derived from this list:
123
+ * - `shell.activityBar` → creates `activityBar` slot
124
+ * - `shell.view` → creates `primarySidebar` + `contentSidebar` slots
125
+ * - `shell.statusbar` → creates `statusbar` slot
126
+ */
127
+ activeModules: ShellModuleId[];
128
+ /**
129
+ * Optional layout tree. When omitted, the ProfileManager applies the
130
+ * default minimal layout (single content slot).
131
+ */
132
+ layout?: ProfileLayoutSpec;
133
+ }
134
+
135
+ /**
136
+ * v1 enforced: profile identity.
137
+ */
138
+ interface ProfileIdentity {
139
+ /**
140
+ * Stable machine-readable profile id.
141
+ * Examples: `'ivyx-classic'`, `'agent-ops-console'`.
142
+ */
143
+ id: string;
144
+ /** Human-readable product/profile name. */
145
+ name: string;
146
+ /**
147
+ * Semver profile version. Substrate uses this for profile schema
148
+ * migration (future migration registry — same pattern as flow authoring).
149
+ */
150
+ version: string;
151
+ /**
152
+ * Target audience descriptor.
153
+ * Examples: `'ml-engineer'`, `'compliance-officer'`, `'end-user'`.
154
+ */
155
+ audience?: string;
156
+ branding?: ProfileBranding;
157
+ }
158
+
159
+ // ─── Optional v1 non-enforced dimensions ────────────────────────────────
160
+ // Declared as types so hosts can populate them; the substrate runtime
161
+ // does not validate or enforce these in v1.
162
+
163
+ interface ProfileExtensionsSpec {
164
+ defaultInstalled?: string[];
165
+ allowedToInstall?: string[] | '*';
166
+ }
167
+
168
+ interface ProfileCommandPaletteSpec {
169
+ visibleCommands?: string[];
170
+ hiddenCommands?: string[];
171
+ }
172
+
173
+ interface ProfileAuthoringSpec {
174
+ mode?: 'admin' | 'end-user' | 'ai';
175
+ }
176
+
177
+ interface ProfileRedactionRule {
178
+ field: string;
179
+ strategy: 'redact' | 'hash' | 'drop';
180
+ }
181
+
182
+ interface ProfileTelemetrySpec {
183
+ capture?: boolean;
184
+ redactionRules?: ProfileRedactionRule[];
185
+ }
186
+
187
+ interface ProfileLocalizationSpec {
188
+ default?: string;
189
+ supported?: string[];
190
+ }
191
+
192
+ interface ProfileTenancySpec {
193
+ multiTenant?: boolean;
194
+ }
195
+
196
+ /**
197
+ * ApplicationProfile — the substrate's product-agnosticity contract.
198
+ *
199
+ * A single binary ships multiple products by swapping this profile.
200
+ * `ivyx-classic` and `agent-ops-console` are the two proof profiles
201
+ * that demonstrate the "two products, one substrate" claim (ApplicationProfile).
202
+ *
203
+ * Schema version: `'1'` (enforces 4 dimensions).
204
+ */
205
+ interface ApplicationProfile {
206
+ /** Schema version — required for future migration registry. */
207
+ schemaVersion: '1';
208
+
209
+ // ── v1 enforced dimensions ──────────────────────────────────────────
210
+ identity: ProfileIdentity;
211
+ shell: ProfileShellSpec;
212
+ theme: ProfileThemeSpec;
213
+ capabilities: ProfileCapabilityBudget;
214
+
215
+ // ── v1 optional dimensions (shape declared, not enforced at runtime) ─
216
+ extensions?: ProfileExtensionsSpec;
217
+ commandPalette?: ProfileCommandPaletteSpec;
218
+ authoring?: ProfileAuthoringSpec;
219
+ telemetry?: ProfileTelemetrySpec;
220
+ localization?: ProfileLocalizationSpec;
221
+ tenancy?: ProfileTenancySpec;
222
+ }
223
+
224
+ /** Result returned by `switchProfile()` — always reload-based in v1. */
225
+ type ProfileSwitchResult = { reloadRequired: true };
226
+
227
+ /**
228
+ * ProfileRegistry — registers and retrieves ApplicationProfiles.
229
+ */
230
+ interface IProfileRegistry {
231
+ /**
232
+ * Register a profile. Throws if a profile with the same id is already
233
+ * registered (use `replace` option in future v2 to override).
234
+ */
235
+ register(profile: ApplicationProfile): void;
236
+ /** Get a profile by id. Returns undefined if not registered. */
237
+ get(id: string): ApplicationProfile | undefined;
238
+ /** Get the currently active profile. */
239
+ getActive(): ApplicationProfile;
240
+ /**
241
+ * Signal profile switch. Always returns `{ reloadRequired: true }` in
242
+ * v1 — the substrate does not teardown/re-bootstrap modules in-memory.
243
+ * The host is responsible for triggering a full reload.
244
+ */
245
+ switchProfile(id: string): ProfileSwitchResult;
246
+ }
247
+
248
+ /** Loader options for `ProfileLoader.load()`. */
249
+ type ProfileSource =
250
+ | { kind: 'inline'; profile: ApplicationProfile }
251
+ | { kind: 'json'; json: string }
252
+ | { kind: 'object'; data: unknown };
253
+
254
+ /** Validates an ApplicationProfile against the v1 schema. */
255
+ interface IProfileValidator {
256
+ validate(
257
+ data: unknown
258
+ ):
259
+ | { valid: true; profile: ApplicationProfile }
260
+ | { valid: false; errors: string[] };
261
+ }
262
+
263
+ /** Top-level manager surface exposed as `punica.shell.Profile.manager`. */
264
+ interface IProfileManager {
265
+ readonly registry: IProfileRegistry;
266
+ readonly validator: IProfileValidator;
267
+ /**
268
+ * Load and activate a profile from a source.
269
+ * Must be called before `moduleRegistry.bootstrapAll()`.
270
+ */
271
+ loadProfile(source: ProfileSource | ApplicationProfile | string): void;
272
+ }
273
+
274
+ // Namespace shape for punica.shell.Profile
275
+ const manager: IProfileManager;
276
+ }
277
+ }
278
+ }
@@ -0,0 +1,26 @@
1
+ declare module 'punica' {
2
+ export namespace shell {
3
+ export namespace Statusbar {
4
+ type Alignment = 'primary' | 'secondary';
5
+ type ItemType = 'progress' | 'warning' | 'error' | 'normal';
6
+
7
+ interface IItem {
8
+ id: string;
9
+ label: string;
10
+ alignment: Alignment;
11
+ title: string;
12
+ icon: string;
13
+ /** Command (or capability) id executed when the item is clicked. */
14
+ command?: string;
15
+ capability?: string;
16
+ }
17
+
18
+ interface IStatusbarManager {
19
+ addItem(item: IItem): void;
20
+ removeItem(itemId: string): void;
21
+ }
22
+
23
+ export const manager: IStatusbarManager;
24
+ }
25
+ }
26
+ }