taskchef 8.2.2 → 8.3.1

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.
@@ -66,7 +66,7 @@ export function ModelSettings() {
66
66
  setRevision((value) => value + 1);
67
67
  }}><IconRefresh className={loading ? 'taskchef-refresh-spinning' : undefined} size={18} stroke={1.8} /></ActionIcon>
68
68
  </Group>
69
- <Text c="dimmed" size="sm">Your models for planning, implementation, and review.</Text>
69
+ <Text c="dimmed" size="sm">Your models for orchestration, planning, implementation, and review.</Text>
70
70
  {error && <Alert color="red" role="alert">{error}</Alert>}
71
71
  {profile && <>
72
72
  {profile.problems.map((problem) => <Alert color="yellow" key={problem}>{problem}</Alert>)}
@@ -0,0 +1,34 @@
1
+ export const DASHBOARD_CONTROL_SHUTDOWN_PATH = "/api/control/shutdown";
2
+ export const DASHBOARD_CONTROL_SESSION_PATH = "/api/control/session";
3
+ export const DASHBOARD_CONTROL_HEADER = "x-taskchef-control";
4
+
5
+ const DASHBOARD_IDENTITY_KEYS = Object.freeze([
6
+ "launcher",
7
+ "schemaVersion",
8
+ "serverVersion",
9
+ "service",
10
+ "taskchefVersion",
11
+ "workspace",
12
+ ]);
13
+
14
+ export function exactDashboardIdentity(value, expected) {
15
+ if (!value || typeof value !== "object" || Array.isArray(value)
16
+ || !expected || typeof expected !== "object" || Array.isArray(expected)) return false;
17
+ const valueKeys = Object.keys(value).sort();
18
+ const expectedKeys = Object.keys(expected).sort();
19
+ return valueKeys.length === DASHBOARD_IDENTITY_KEYS.length
20
+ && expectedKeys.length === DASHBOARD_IDENTITY_KEYS.length
21
+ && DASHBOARD_IDENTITY_KEYS.every((key, index) => valueKeys[index] === key
22
+ && expectedKeys[index] === key && value[key] === expected[key]);
23
+ }
24
+
25
+ export function validDashboardControlRequest(request, {
26
+ authority,
27
+ origin,
28
+ action,
29
+ } = {}) {
30
+ return request.headers.host === authority
31
+ && request.headers.origin === origin
32
+ && request.headers[DASHBOARD_CONTROL_HEADER] === action
33
+ && request.headers["content-type"] === "application/json";
34
+ }