pilotswarm-web 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.
- package/README.md +144 -0
- package/auth/authz/engine.js +139 -0
- package/auth/config.js +110 -0
- package/auth/index.js +153 -0
- package/auth/normalize/entra.js +22 -0
- package/auth/providers/entra.js +76 -0
- package/auth/providers/none.js +24 -0
- package/auth.js +10 -0
- package/bin/serve.js +53 -0
- package/config.js +20 -0
- package/dist/app.js +469 -0
- package/dist/assets/index-BSVg-lGb.css +1 -0
- package/dist/assets/index-BXD5YP7A.js +24 -0
- package/dist/assets/msal-CytV9RFv.js +7 -0
- package/dist/assets/pilotswarm-WX3NED6m.js +40 -0
- package/dist/assets/react-jg0oazEi.js +1 -0
- package/dist/index.html +16 -0
- package/node_modules/pilotswarm-ui-core/README.md +6 -0
- package/node_modules/pilotswarm-ui-core/package.json +32 -0
- package/node_modules/pilotswarm-ui-core/src/commands.js +72 -0
- package/node_modules/pilotswarm-ui-core/src/context-usage.js +212 -0
- package/node_modules/pilotswarm-ui-core/src/controller.js +3613 -0
- package/node_modules/pilotswarm-ui-core/src/formatting.js +872 -0
- package/node_modules/pilotswarm-ui-core/src/history.js +571 -0
- package/node_modules/pilotswarm-ui-core/src/index.js +13 -0
- package/node_modules/pilotswarm-ui-core/src/layout.js +196 -0
- package/node_modules/pilotswarm-ui-core/src/reducer.js +1027 -0
- package/node_modules/pilotswarm-ui-core/src/selectors.js +2786 -0
- package/node_modules/pilotswarm-ui-core/src/session-tree.js +109 -0
- package/node_modules/pilotswarm-ui-core/src/state.js +80 -0
- package/node_modules/pilotswarm-ui-core/src/store.js +23 -0
- package/node_modules/pilotswarm-ui-core/src/system-titles.js +24 -0
- package/node_modules/pilotswarm-ui-core/src/themes/catppuccin-mocha.js +56 -0
- package/node_modules/pilotswarm-ui-core/src/themes/cobalt2.js +56 -0
- package/node_modules/pilotswarm-ui-core/src/themes/dark-high-contrast.js +56 -0
- package/node_modules/pilotswarm-ui-core/src/themes/dracula.js +56 -0
- package/node_modules/pilotswarm-ui-core/src/themes/github-dark.js +56 -0
- package/node_modules/pilotswarm-ui-core/src/themes/gruvbox-dark.js +56 -0
- package/node_modules/pilotswarm-ui-core/src/themes/hacker-x-matrix.js +56 -0
- package/node_modules/pilotswarm-ui-core/src/themes/hacker-x-orion-prime.js +56 -0
- package/node_modules/pilotswarm-ui-core/src/themes/helpers.js +77 -0
- package/node_modules/pilotswarm-ui-core/src/themes/index.js +42 -0
- package/node_modules/pilotswarm-ui-core/src/themes/noctis-viola.js +56 -0
- package/node_modules/pilotswarm-ui-core/src/themes/noctis.js +56 -0
- package/node_modules/pilotswarm-ui-core/src/themes/nord.js +56 -0
- package/node_modules/pilotswarm-ui-core/src/themes/solarized-dark.js +56 -0
- package/node_modules/pilotswarm-ui-core/src/themes/tokyo-night.js +56 -0
- package/node_modules/pilotswarm-ui-react/README.md +5 -0
- package/node_modules/pilotswarm-ui-react/package.json +36 -0
- package/node_modules/pilotswarm-ui-react/src/components.js +1316 -0
- package/node_modules/pilotswarm-ui-react/src/index.js +4 -0
- package/node_modules/pilotswarm-ui-react/src/platform.js +15 -0
- package/node_modules/pilotswarm-ui-react/src/use-controller-state.js +38 -0
- package/node_modules/pilotswarm-ui-react/src/web-app.js +2661 -0
- package/package.json +64 -0
- package/runtime.js +146 -0
- package/server.js +311 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { FOCUS_REGIONS } from "./commands.js";
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_LEFT_PANE_RATIO = 0.7;
|
|
4
|
+
export const MIN_LEFT_WIDTH = 30;
|
|
5
|
+
export const MIN_RIGHT_WIDTH = 36;
|
|
6
|
+
export const COLLAPSE_LEFT_THRESHOLD = 18;
|
|
7
|
+
export const COLLAPSE_RIGHT_THRESHOLD = 18;
|
|
8
|
+
export const PANE_GAP_X = 0;
|
|
9
|
+
export const PANE_GAP_Y = 0;
|
|
10
|
+
export const MAX_PROMPT_INPUT_ROWS = 3;
|
|
11
|
+
export const MIN_SESSION_PANE_HEIGHT = 6;
|
|
12
|
+
export const MIN_CHAT_PANE_HEIGHT = 10;
|
|
13
|
+
export const DEFAULT_SESSION_PANE_RATIO = 0.25;
|
|
14
|
+
|
|
15
|
+
function clamp(value, min, max) {
|
|
16
|
+
return Math.max(min, Math.min(max, value));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function normalizeFullscreenPane(fullscreenPane) {
|
|
20
|
+
return [
|
|
21
|
+
FOCUS_REGIONS.SESSIONS,
|
|
22
|
+
FOCUS_REGIONS.CHAT,
|
|
23
|
+
FOCUS_REGIONS.INSPECTOR,
|
|
24
|
+
FOCUS_REGIONS.ACTIVITY,
|
|
25
|
+
].includes(fullscreenPane)
|
|
26
|
+
? fullscreenPane
|
|
27
|
+
: null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function normalizeViewport(viewport = {}) {
|
|
31
|
+
return {
|
|
32
|
+
width: Math.max(40, Number(viewport.width) || 120),
|
|
33
|
+
height: Math.max(18, Number(viewport.height) || 40),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function getPromptInputRows(prompt = "") {
|
|
38
|
+
const explicitLines = String(prompt || "").split("\n").length;
|
|
39
|
+
return clamp(explicitLines, 1, MAX_PROMPT_INPUT_ROWS);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function computeLegacyLayout(viewport, paneAdjust = 0, promptRows = 1, sessionPaneAdjust = 0, fullscreenPane = null) {
|
|
43
|
+
const safeViewport = normalizeViewport(viewport);
|
|
44
|
+
const totalWidth = safeViewport.width;
|
|
45
|
+
const totalHeight = safeViewport.height;
|
|
46
|
+
const safePromptRows = clamp(Number(promptRows) || 1, 1, MAX_PROMPT_INPUT_ROWS);
|
|
47
|
+
const safeFullscreenPane = normalizeFullscreenPane(fullscreenPane);
|
|
48
|
+
const reservedRows = 5 + safePromptRows;
|
|
49
|
+
const bodyHeight = Math.max(18, totalHeight - reservedRows);
|
|
50
|
+
const baseLeftWidth = Math.floor(totalWidth * DEFAULT_LEFT_PANE_RATIO);
|
|
51
|
+
const desiredLeftWidth = baseLeftWidth + (Number(paneAdjust) || 0);
|
|
52
|
+
const desiredRightWidth = totalWidth - desiredLeftWidth - PANE_GAP_X;
|
|
53
|
+
|
|
54
|
+
let leftHidden = false;
|
|
55
|
+
let rightHidden = false;
|
|
56
|
+
|
|
57
|
+
if (desiredLeftWidth <= COLLAPSE_LEFT_THRESHOLD && desiredRightWidth > COLLAPSE_RIGHT_THRESHOLD) {
|
|
58
|
+
leftHidden = true;
|
|
59
|
+
} else if (desiredRightWidth <= COLLAPSE_RIGHT_THRESHOLD && desiredLeftWidth > COLLAPSE_LEFT_THRESHOLD) {
|
|
60
|
+
rightHidden = true;
|
|
61
|
+
} else if (desiredLeftWidth <= COLLAPSE_LEFT_THRESHOLD && desiredRightWidth <= COLLAPSE_RIGHT_THRESHOLD) {
|
|
62
|
+
rightHidden = paneAdjust >= 0;
|
|
63
|
+
leftHidden = !rightHidden;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let leftWidth;
|
|
67
|
+
let rightWidth;
|
|
68
|
+
|
|
69
|
+
if (leftHidden) {
|
|
70
|
+
leftWidth = 0;
|
|
71
|
+
rightWidth = totalWidth;
|
|
72
|
+
} else if (rightHidden) {
|
|
73
|
+
leftWidth = totalWidth;
|
|
74
|
+
rightWidth = 0;
|
|
75
|
+
} else {
|
|
76
|
+
leftWidth = clamp(desiredLeftWidth, MIN_LEFT_WIDTH, totalWidth - MIN_RIGHT_WIDTH - PANE_GAP_X);
|
|
77
|
+
rightWidth = Math.max(MIN_RIGHT_WIDTH, totalWidth - leftWidth - PANE_GAP_X);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const baseSessionPaneHeight = Math.max(MIN_SESSION_PANE_HEIGHT, Math.floor(bodyHeight * DEFAULT_SESSION_PANE_RATIO));
|
|
81
|
+
const sessionPaneHeight = clamp(
|
|
82
|
+
baseSessionPaneHeight + (Number(sessionPaneAdjust) || 0),
|
|
83
|
+
MIN_SESSION_PANE_HEIGHT,
|
|
84
|
+
Math.max(MIN_SESSION_PANE_HEIGHT, bodyHeight - MIN_CHAT_PANE_HEIGHT),
|
|
85
|
+
);
|
|
86
|
+
const activityPaneHeight = Math.max(6, Math.floor(bodyHeight * 0.28));
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
viewport: safeViewport,
|
|
90
|
+
totalWidth,
|
|
91
|
+
totalHeight,
|
|
92
|
+
reservedRows,
|
|
93
|
+
bodyHeight,
|
|
94
|
+
promptRows: safePromptRows,
|
|
95
|
+
fullscreenPane: safeFullscreenPane,
|
|
96
|
+
paneAdjust: Number(paneAdjust) || 0,
|
|
97
|
+
sessionPaneAdjust: Number(sessionPaneAdjust) || 0,
|
|
98
|
+
leftHidden,
|
|
99
|
+
rightHidden,
|
|
100
|
+
leftWidth,
|
|
101
|
+
rightWidth,
|
|
102
|
+
sessionPaneHeight,
|
|
103
|
+
chatPaneHeight: Math.max(MIN_CHAT_PANE_HEIGHT, bodyHeight - sessionPaneHeight),
|
|
104
|
+
activityPaneHeight,
|
|
105
|
+
inspectorPaneHeight: Math.max(10, bodyHeight - activityPaneHeight),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function getFocusOrderForLayout(layout) {
|
|
110
|
+
if (layout?.fullscreenPane) {
|
|
111
|
+
return [layout.fullscreenPane, FOCUS_REGIONS.PROMPT];
|
|
112
|
+
}
|
|
113
|
+
if (layout?.leftHidden) {
|
|
114
|
+
return [FOCUS_REGIONS.INSPECTOR, FOCUS_REGIONS.ACTIVITY, FOCUS_REGIONS.PROMPT];
|
|
115
|
+
}
|
|
116
|
+
if (layout?.rightHidden) {
|
|
117
|
+
return [FOCUS_REGIONS.SESSIONS, FOCUS_REGIONS.CHAT, FOCUS_REGIONS.PROMPT];
|
|
118
|
+
}
|
|
119
|
+
return [
|
|
120
|
+
FOCUS_REGIONS.SESSIONS,
|
|
121
|
+
FOCUS_REGIONS.CHAT,
|
|
122
|
+
FOCUS_REGIONS.INSPECTOR,
|
|
123
|
+
FOCUS_REGIONS.ACTIVITY,
|
|
124
|
+
FOCUS_REGIONS.PROMPT,
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function normalizeFocusRegion(focusRegion, layout) {
|
|
129
|
+
const order = getFocusOrderForLayout(layout);
|
|
130
|
+
if (order.includes(focusRegion)) return focusRegion;
|
|
131
|
+
return order[0] || FOCUS_REGIONS.PROMPT;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function getFocusLeftTarget(focusRegion, layout) {
|
|
135
|
+
if (layout?.fullscreenPane) {
|
|
136
|
+
return layout.fullscreenPane;
|
|
137
|
+
}
|
|
138
|
+
if (layout?.leftHidden) {
|
|
139
|
+
const map = {
|
|
140
|
+
[FOCUS_REGIONS.PROMPT]: FOCUS_REGIONS.PROMPT,
|
|
141
|
+
[FOCUS_REGIONS.ACTIVITY]: FOCUS_REGIONS.INSPECTOR,
|
|
142
|
+
[FOCUS_REGIONS.INSPECTOR]: FOCUS_REGIONS.INSPECTOR,
|
|
143
|
+
};
|
|
144
|
+
return map[focusRegion] || FOCUS_REGIONS.INSPECTOR;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (layout?.rightHidden) {
|
|
148
|
+
const map = {
|
|
149
|
+
[FOCUS_REGIONS.PROMPT]: FOCUS_REGIONS.PROMPT,
|
|
150
|
+
[FOCUS_REGIONS.CHAT]: FOCUS_REGIONS.SESSIONS,
|
|
151
|
+
[FOCUS_REGIONS.SESSIONS]: FOCUS_REGIONS.SESSIONS,
|
|
152
|
+
};
|
|
153
|
+
return map[focusRegion] || FOCUS_REGIONS.SESSIONS;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const map = {
|
|
157
|
+
[FOCUS_REGIONS.PROMPT]: FOCUS_REGIONS.SESSIONS,
|
|
158
|
+
[FOCUS_REGIONS.ACTIVITY]: FOCUS_REGIONS.CHAT,
|
|
159
|
+
[FOCUS_REGIONS.INSPECTOR]: FOCUS_REGIONS.CHAT,
|
|
160
|
+
[FOCUS_REGIONS.CHAT]: FOCUS_REGIONS.SESSIONS,
|
|
161
|
+
[FOCUS_REGIONS.SESSIONS]: FOCUS_REGIONS.SESSIONS,
|
|
162
|
+
};
|
|
163
|
+
return map[focusRegion] || FOCUS_REGIONS.SESSIONS;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function getFocusRightTarget(focusRegion, layout) {
|
|
167
|
+
if (layout?.fullscreenPane) {
|
|
168
|
+
return layout.fullscreenPane;
|
|
169
|
+
}
|
|
170
|
+
if (layout?.leftHidden) {
|
|
171
|
+
const map = {
|
|
172
|
+
[FOCUS_REGIONS.PROMPT]: FOCUS_REGIONS.PROMPT,
|
|
173
|
+
[FOCUS_REGIONS.INSPECTOR]: FOCUS_REGIONS.ACTIVITY,
|
|
174
|
+
[FOCUS_REGIONS.ACTIVITY]: FOCUS_REGIONS.ACTIVITY,
|
|
175
|
+
};
|
|
176
|
+
return map[focusRegion] || FOCUS_REGIONS.INSPECTOR;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (layout?.rightHidden) {
|
|
180
|
+
const map = {
|
|
181
|
+
[FOCUS_REGIONS.PROMPT]: FOCUS_REGIONS.PROMPT,
|
|
182
|
+
[FOCUS_REGIONS.SESSIONS]: FOCUS_REGIONS.CHAT,
|
|
183
|
+
[FOCUS_REGIONS.CHAT]: FOCUS_REGIONS.CHAT,
|
|
184
|
+
};
|
|
185
|
+
return map[focusRegion] || FOCUS_REGIONS.CHAT;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const map = {
|
|
189
|
+
[FOCUS_REGIONS.PROMPT]: FOCUS_REGIONS.PROMPT,
|
|
190
|
+
[FOCUS_REGIONS.SESSIONS]: FOCUS_REGIONS.CHAT,
|
|
191
|
+
[FOCUS_REGIONS.CHAT]: FOCUS_REGIONS.INSPECTOR,
|
|
192
|
+
[FOCUS_REGIONS.INSPECTOR]: FOCUS_REGIONS.ACTIVITY,
|
|
193
|
+
[FOCUS_REGIONS.ACTIVITY]: FOCUS_REGIONS.ACTIVITY,
|
|
194
|
+
};
|
|
195
|
+
return map[focusRegion] || FOCUS_REGIONS.CHAT;
|
|
196
|
+
}
|