@punica/editor 1.6.1 → 1.6.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punica/editor",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "Punica Editor",
5
5
  "private": false,
6
6
  "type": "module",
package/types/index.d.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  /// <reference path="punica.module.shell.view.d.ts" />
9
9
  /// <reference path="punica.module.shell.views.d.ts" />
10
10
  /// <reference path="punica.module.shell.panelTabs.d.ts" />
11
+ /// <reference path="punica.module.shell.panelLayout.d.ts" />
11
12
  /// <reference path="punica.module.shell.profile.d.ts" />
12
13
  /// <reference path="punica.module.shell.markdown.d.ts" />
13
14
  /// <reference path="punica.module.kernel.commands.d.ts" />
@@ -13,6 +13,15 @@ declare module 'punica' {
13
13
  * For activity bar items this will be invoked when the icon is clicked.
14
14
  */
15
15
  capability?: string;
16
+ /**
17
+ * Dock areas this view may be relocated to by the user (drag-drop /
18
+ * "Move to bottom / Move to right"). Only meaningful for `panel` and
19
+ * `secondarySidebar` views. When omitted, the substrate's default
20
+ * matrix already allows moving between `panel` and `secondarySidebar`,
21
+ * so most extensions never need to set this — declare it only to widen
22
+ * or restrict the default. Ignored by older cores.
23
+ */
24
+ relocatableTo?: Array<'panel' | 'secondarySidebar'>;
16
25
  }
17
26
 
18
27
  /**
@@ -280,6 +280,16 @@ declare module 'punica' {
280
280
  * active (meta-tools not counted). Default ~16.
281
281
  */
282
282
  hotSetSize?: number;
283
+ /**
284
+ * Prepend a one-shot workspace orientation (the
285
+ * `workspace.projectContext` snapshot: stack, dependencies, run
286
+ * scripts, VCS state, README digest, noise-free layout) as a frozen
287
+ * system block inside the cached prompt prefix. Off by default —
288
+ * a short/targeted run should not pay the orientation's tokens; the
289
+ * product opts in for open-ended "understand this project" runs.
290
+ * Best-effort: a failed snapshot is skipped, never fatal.
291
+ */
292
+ includeProjectContext?: boolean;
283
293
  }
284
294
 
285
295
  /** Terminal result of an agent run. */
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Bottom-panel layout persistence (`punica.shell.PanelLayout`).
3
+ *
4
+ * The single store for user/product bottom-panel preferences that must
5
+ * survive restart: tab display mode, user-hidden tabs, user tab order, and
6
+ * per-view slot overrides (view relocation). It resolves a merged view of
7
+ * three tiers — **Project > Global > Profile default** — and exposes it via
8
+ * SYNCHRONOUS getters, because `PanelTabs.open()` and the views analysis
9
+ * decorator consult it as each tab/placement is created (which happens
10
+ * during extension load, after module `start()`).
11
+ *
12
+ * Persistence reuses `SettingsManager` under the `'system'` pseudo-extension
13
+ * (same precedent as `theme.profile`): global scope = the user's default
14
+ * across workspaces, project scope = a per-workspace override. Profile
15
+ * defaults come from the active `ApplicationProfile`
16
+ * (`shell.panel` / `shell.viewDefaults`).
17
+ */
18
+
19
+ declare module 'punica' {
20
+ export namespace shell {
21
+ namespace PanelLayout {
22
+ /** How a panel tab renders its icon + label. */
23
+ type TabDisplayMode = 'icon' | 'label' | 'both';
24
+
25
+ /** Optional per-write scope + target-container selector. */
26
+ interface SetOptions {
27
+ /** When true, write to project (per-workspace) scope instead of global. */
28
+ workspace?: boolean;
29
+ /**
30
+ * Tabbed container the preference applies to. Defaults to `'panel'`
31
+ * (the bottom, horizontal strip), whose keys stay unscoped for
32
+ * backward compatibility; other slots (e.g. `'secondarySidebar'`,
33
+ * the right vertical strip) are stored under slot-scoped keys.
34
+ */
35
+ slot?: string;
36
+ }
37
+
38
+ interface IPanelLayoutManager {
39
+ /**
40
+ * Load settings (idempotent `settings.manager.load()`) and cache the
41
+ * merged Project > Global > Profile-default view in memory. Called by
42
+ * the module's `start()`; getters are synchronous afterwards.
43
+ */
44
+ load(): Promise<void>;
45
+
46
+ // ── Synchronous getters (consulted during tab/placement creation) ──
47
+ // Each takes the container `slot` (default `'panel'`): the bottom
48
+ // strip uses the legacy unscoped keys, other strips slot-scoped keys.
49
+ getDisplayMode(slot?: string): TabDisplayMode;
50
+ getHiddenTabs(slot?: string): string[];
51
+ isTabHidden(id: string, slot?: string): boolean;
52
+ /** User tab order (view ids, ascending), or undefined when unset. */
53
+ getTabOrder(slot?: string): string[] | undefined;
54
+ /** Persisted slot override for a view id, or undefined when none. */
55
+ getSlotOverride(viewId: string): string | undefined;
56
+
57
+ // ── Async setters (update cache immediately, then persist) ──
58
+ setDisplayMode(
59
+ mode: TabDisplayMode,
60
+ options?: SetOptions
61
+ ): Promise<void>;
62
+ setTabHidden(
63
+ id: string,
64
+ hidden: boolean,
65
+ options?: SetOptions
66
+ ): Promise<void>;
67
+ setTabOrder(ids: string[], options?: SetOptions): Promise<void>;
68
+ /**
69
+ * Record (or clear) a view→slot relocation. When `slot === homeSlot`
70
+ * the override is DELETED (reset-to-default) rather than stored as an
71
+ * identity mapping.
72
+ */
73
+ setSlotOverride(
74
+ viewId: string,
75
+ slot: string,
76
+ homeSlot: string,
77
+ options?: SetOptions
78
+ ): Promise<void>;
79
+ }
80
+
81
+ const manager: IPanelLayoutManager;
82
+ }
83
+ }
84
+ }
@@ -66,11 +66,77 @@ declare module 'punica' {
66
66
  * provider-rendered panel view is revealed.
67
67
  */
68
68
  activateTabVisual(id: string): void;
69
+
70
+ // ── Tab display / user layout (persisted via PanelLayout) ──
71
+
72
+ /**
73
+ * Set how every tab renders: `'icon'` (icon only), `'label'` (label
74
+ * only) or `'both'`. Applies to all current + future tabs and persists
75
+ * the choice. Re-runs the overflow recompute (widths change).
76
+ */
77
+ setDisplayMode(mode: 'icon' | 'label' | 'both'): void;
78
+ getDisplayMode(): 'icon' | 'label' | 'both';
79
+
80
+ /**
81
+ * User-hide a tab (distinct from overflow-collapse): the tab keeps its
82
+ * entry but is removed from the strip and the overflow menu until
83
+ * `showTab` restores it. Persisted. If the hidden tab was active, the
84
+ * first still-visible sibling is promoted.
85
+ */
86
+ hideTab(id: string): void;
87
+ showTab(id: string): void;
88
+
89
+ /**
90
+ * Apply a user-defined tab order (view ids ascending). Reorders the DOM,
91
+ * reindexes internal order, persists, and recomputes overflow.
92
+ */
93
+ setUserOrder(ids: string[]): void;
94
+
95
+ /**
96
+ * Enumerate current tabs in display order — used by the re-show menu and
97
+ * the Settings UI. `userHidden` reflects the user-hide state (not the
98
+ * transient overflow-collapse state).
99
+ */
100
+ listTabs(): Array<{ id: string; title: string; userHidden: boolean }>;
101
+ }
102
+
103
+ /**
104
+ * A tabbed dock container. The bottom panel renders a HORIZONTAL strip
105
+ * (icon+label), the right sidebar a VERTICAL strip (icon-only, activity-bar
106
+ * style). Both expose the same `PanelTabsApi`; only the tab-strip
107
+ * orientation and default display mode differ.
108
+ */
109
+ export type TabStripOrientation = 'horizontal' | 'vertical';
110
+
111
+ export interface TabbedContainerApi extends PanelTabsApi {
112
+ /** The layout slot this container renders into. */
113
+ readonly slotId: string;
114
+ /** Strip orientation (bottom = horizontal, right = vertical). */
115
+ readonly orientation: TabStripOrientation;
116
+ }
117
+
118
+ /**
119
+ * Registry addressing a tabbed container by slot. `moveView` and the
120
+ * views decorator use it to open/activate tabs on the container for a
121
+ * view's effective slot (bottom or right).
122
+ */
123
+ export interface PanelContainersApi {
124
+ /** The bottom (horizontal) container — same object as `PanelTabs`. */
125
+ readonly bottom: TabbedContainerApi;
126
+ /** The right (vertical) container. */
127
+ readonly right: TabbedContainerApi;
128
+ /** Container for a slot, or null for slots without a tabbed container. */
129
+ forSlot(slot: string): TabbedContainerApi | null;
69
130
  }
70
131
 
71
132
  /**
72
133
  * Global panel tabs API surfaced via `punica.shell.PanelTabs`.
134
+ * This is the bottom (horizontal) container; use `PanelContainers` to
135
+ * reach the right (vertical) one too.
73
136
  */
74
137
  export const PanelTabs: PanelTabsApi;
138
+
139
+ /** Slot → tabbed-container registry (`punica.shell.PanelContainers`). */
140
+ export const PanelContainers: PanelContainersApi;
75
141
  }
76
142
  }
@@ -28,6 +28,8 @@ declare module 'punica' {
28
28
  | 'shell.layout'
29
29
  | 'shell.contentTabs'
30
30
  | 'shell.panelTabs'
31
+ | 'shell.panelLayout'
32
+ | 'shell.viewDnd'
31
33
  | 'flow.shell'
32
34
  | (string & {});
33
35
 
@@ -134,6 +136,32 @@ declare module 'punica' {
134
136
  * default minimal layout (single content slot).
135
137
  */
136
138
  layout?: ProfileLayoutSpec;
139
+ /**
140
+ * Optional product defaults for the bottom panel. User settings
141
+ * (Project > Global) override these; when both are unset the substrate
142
+ * falls back to its own defaults (`tabDisplay: 'both'`, nothing hidden,
143
+ * manifest tab order). Non-enforced (read by `shell.panelLayout`).
144
+ */
145
+ panel?: ProfilePanelSpec;
146
+ /**
147
+ * Optional product defaults for view placement — e.g. a profile that
148
+ * ships the AI Assistant in the bottom panel instead of the right
149
+ * sidebar. `slotOverrides` maps a view id to its default slot; a user
150
+ * relocation (Project > Global) still wins. Non-enforced.
151
+ */
152
+ viewDefaults?: ProfileViewDefaultsSpec;
153
+ }
154
+
155
+ /** Product defaults for the bottom-panel tab strip (see ProfileShellSpec.panel). */
156
+ interface ProfilePanelSpec {
157
+ tabDisplay?: 'icon' | 'label' | 'both';
158
+ hiddenTabs?: string[];
159
+ tabOrder?: string[];
160
+ }
161
+
162
+ /** Product defaults for view→slot placement (see ProfileShellSpec.viewDefaults). */
163
+ interface ProfileViewDefaultsSpec {
164
+ slotOverrides?: Record<string, string>;
137
165
  }
138
166
 
139
167
  /**
@@ -42,6 +42,19 @@ declare module 'punica' {
42
42
  * the fleet migrates to view providers.
43
43
  */
44
44
  fallbackCommand?: string;
45
+ /**
46
+ * Dock areas this view may be relocated to (relocation primitive).
47
+ * Resolved by the analysis decorator from `slot` ∪ manifest
48
+ * `relocatableTo` ∪ the default `panel ↔ secondarySidebar` matrix.
49
+ * `moveView` validates its target against this set.
50
+ */
51
+ allowedSlots?: ViewSlotId[];
52
+ /**
53
+ * The manifest-declared slot — the view's "home". `slot` is the live
54
+ * (possibly user-overridden) location; moving back to `homeSlot`
55
+ * clears the persisted override (reset-to-default).
56
+ */
57
+ homeSlot?: ViewSlotId;
45
58
  }
46
59
 
47
60
  export interface ViewProviderDisposable {
@@ -129,6 +142,21 @@ declare module 'punica' {
129
142
  */
130
143
  hide(viewId: string, source: RevealSource): void;
131
144
 
145
+ /**
146
+ * Relocate a view to another dock area (relocation primitive).
147
+ * Validates `targetSlot ∈ placement.allowedSlots`, tears down the
148
+ * old slot's tab/host, moves the placement, persists the override
149
+ * via `PanelLayout.setSlotOverride`, and — if the view was visible —
150
+ * re-reveals it in the destination container (landing in that
151
+ * strip's orientation). Emits `shell.view.moved`. Publicly surfaced
152
+ * as the `shell.moveView` capability.
153
+ */
154
+ moveView(
155
+ viewId: string,
156
+ targetSlot: ViewSlotId,
157
+ source: RevealSource
158
+ ): Promise<void>;
159
+
132
160
  /**
133
161
  * Sync bookkeeping after the Layout manager wiped a slot's
134
162
  * hosts wholesale (primary sidebar switch resets the contextual