@crewhaus/hangar-ui 0.5.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 +309 -0
- package/assets/hangar.css +1726 -0
- package/assets/index.html +21 -0
- package/assets/js/api.js +368 -0
- package/assets/js/app.js +734 -0
- package/assets/js/dom.js +228 -0
- package/assets/js/keys.js +159 -0
- package/assets/js/markdown.js +131 -0
- package/assets/js/notify.js +152 -0
- package/assets/js/omnibox.js +307 -0
- package/assets/js/router.js +280 -0
- package/assets/js/routes.js +793 -0
- package/assets/js/shapes.js +36 -0
- package/assets/js/supervision.js +1334 -0
- package/assets/js/util.js +426 -0
- package/assets/js/views/activity.js +140 -0
- package/assets/js/views/approvals.js +155 -0
- package/assets/js/views/channels.js +455 -0
- package/assets/js/views/control.js +253 -0
- package/assets/js/views/costs.js +103 -0
- package/assets/js/views/creds.js +610 -0
- package/assets/js/views/data.js +456 -0
- package/assets/js/views/deploy.js +106 -0
- package/assets/js/views/evals-lab.js +1029 -0
- package/assets/js/views/evals.js +342 -0
- package/assets/js/views/feedback.js +555 -0
- package/assets/js/views/health.js +176 -0
- package/assets/js/views/inbox.js +103 -0
- package/assets/js/views/inspect.js +751 -0
- package/assets/js/views/jobs.js +110 -0
- package/assets/js/views/library.js +605 -0
- package/assets/js/views/memory-fabric.js +2026 -0
- package/assets/js/views/memory.js +228 -0
- package/assets/js/views/onboarding.js +253 -0
- package/assets/js/views/overview.js +196 -0
- package/assets/js/views/panes.js +132 -0
- package/assets/js/views/proc.js +280 -0
- package/assets/js/views/review.js +164 -0
- package/assets/js/views/runs.js +452 -0
- package/assets/js/views/runtime.js +450 -0
- package/assets/js/views/schedulers.js +133 -0
- package/assets/js/views/security.js +925 -0
- package/assets/js/views/sessions.js +265 -0
- package/assets/js/views/settings.js +489 -0
- package/assets/js/views/spec-edit.js +1289 -0
- package/assets/js/views/spec.js +66 -0
- package/assets/js/views/thredz.js +1853 -0
- package/assets/js/views/token.js +49 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +145 -0
- package/package.json +36 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token screen — shown on any 401. Explains where the token lives and
|
|
3
|
+
* accepts a paste; the value goes to sessionStorage only (see api.js).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { setToken } from "../api.js";
|
|
7
|
+
import { clear, el } from "../dom.js";
|
|
8
|
+
|
|
9
|
+
export function renderTokenScreen(root, onSaved) {
|
|
10
|
+
clear(root);
|
|
11
|
+
const input = el("input", {
|
|
12
|
+
class: "input token-input",
|
|
13
|
+
type: "password",
|
|
14
|
+
placeholder: "paste your Hangar token",
|
|
15
|
+
autocomplete: "off",
|
|
16
|
+
spellcheck: "false",
|
|
17
|
+
"aria-label": "Hangar token",
|
|
18
|
+
});
|
|
19
|
+
const save = el("button", { class: "btn btn-primary", type: "button", text: "Use token" });
|
|
20
|
+
const form = el("form", { class: "token-form" }, [input, save]);
|
|
21
|
+
form.addEventListener("submit", (e) => {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
const value = input.value.trim();
|
|
24
|
+
if (value === "") return;
|
|
25
|
+
setToken(value);
|
|
26
|
+
onSaved();
|
|
27
|
+
});
|
|
28
|
+
root.appendChild(
|
|
29
|
+
el("div", { class: "token-screen" }, [
|
|
30
|
+
el("div", { class: "card token-card" }, [
|
|
31
|
+
el("h2", { text: "Authentication required" }),
|
|
32
|
+
el("p", {
|
|
33
|
+
text:
|
|
34
|
+
"This console is token-gated. crewhaus hangar prints a ready-to-open URL " +
|
|
35
|
+
"carrying the token; if you landed here without one, read it from the token " +
|
|
36
|
+
"file on the machine running Hangar:",
|
|
37
|
+
}),
|
|
38
|
+
el("pre", { class: "mdcode", text: "~/.crewhaus/hangar/token" }),
|
|
39
|
+
el("p", {
|
|
40
|
+
text:
|
|
41
|
+
"Paste the token below. It is kept in this tab's sessionStorage only — " +
|
|
42
|
+
"never in a cookie or a query string.",
|
|
43
|
+
}),
|
|
44
|
+
form,
|
|
45
|
+
]),
|
|
46
|
+
]),
|
|
47
|
+
);
|
|
48
|
+
input.focus();
|
|
49
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** One embeddable asset: the file's text plus its HTTP content type. */
|
|
2
|
+
export type HangarAsset = {
|
|
3
|
+
readonly body: string;
|
|
4
|
+
readonly contentType: string;
|
|
5
|
+
};
|
|
6
|
+
/** Extension → content type for everything the asset tree may contain. */
|
|
7
|
+
export declare const CONTENT_TYPES: Readonly<Record<string, string>>;
|
|
8
|
+
/** Content type for a serve path by extension (octet-stream fallback). */
|
|
9
|
+
export declare function contentTypeFor(path: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* The embed map, keyed by serve path. `"/"` is the SPA shell (the app is a
|
|
12
|
+
* hash router, so `/` is the only HTML route); everything else lives under
|
|
13
|
+
* `/assets/…` exactly as laid out on disk.
|
|
14
|
+
*/
|
|
15
|
+
export declare const hangarAssets: Readonly<Record<string, HangarAsset>>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@crewhaus/hangar-ui` — the Hangar console's static UI, embedded as text.
|
|
3
|
+
*
|
|
4
|
+
* Zero-build by design: the `assets/` tree is hand-written browser code
|
|
5
|
+
* (plain ES modules + one CSS file + one HTML shell, no framework, no npm
|
|
6
|
+
* deps, no bundler). This module imports every asset `with { type: "text" }`
|
|
7
|
+
* and exports them keyed by serve path, which is the exact map the CLI hands
|
|
8
|
+
* to the hangar server's static-asset option.
|
|
9
|
+
*
|
|
10
|
+
* STATIC imports only, deliberately: `bun build --compile` embeds only what
|
|
11
|
+
* the import graph references statically — a runtime `readFileSync` of a
|
|
12
|
+
* package-relative path resolves under `/$bunfs` in the compiled binary,
|
|
13
|
+
* where the files were never placed, and bricks every command at boot. The
|
|
14
|
+
* checked-in asset files stay the single source of truth; this module only
|
|
15
|
+
* re-exports their text.
|
|
16
|
+
*
|
|
17
|
+
* The unit tests enforce the embed map's completeness (every file under
|
|
18
|
+
* `assets/` appears under its serve path, with the right content type, and
|
|
19
|
+
* every relative import inside the JS modules resolves within the map), so
|
|
20
|
+
* adding an asset file without registering it here fails CI.
|
|
21
|
+
*/
|
|
22
|
+
import hangarCss from "../assets/hangar.css" with { type: "text" };
|
|
23
|
+
// bun-types declares `*.html` imports as HTMLBundle (Bun's HTML-bundle
|
|
24
|
+
// feature) and that ambient wins over a local one, but the `type: "text"`
|
|
25
|
+
// import attribute makes this a plain string at runtime — hence the cast.
|
|
26
|
+
import indexHtmlBundle from "../assets/index.html" with { type: "text" };
|
|
27
|
+
import apiJs from "../assets/js/api.js" with { type: "text" };
|
|
28
|
+
import appJs from "../assets/js/app.js" with { type: "text" };
|
|
29
|
+
import domJs from "../assets/js/dom.js" with { type: "text" };
|
|
30
|
+
import keysJs from "../assets/js/keys.js" with { type: "text" };
|
|
31
|
+
import markdownJs from "../assets/js/markdown.js" with { type: "text" };
|
|
32
|
+
import notifyJs from "../assets/js/notify.js" with { type: "text" };
|
|
33
|
+
import omniboxJs from "../assets/js/omnibox.js" with { type: "text" };
|
|
34
|
+
import routerJs from "../assets/js/router.js" with { type: "text" };
|
|
35
|
+
import routesJs from "../assets/js/routes.js" with { type: "text" };
|
|
36
|
+
import shapesJs from "../assets/js/shapes.js" with { type: "text" };
|
|
37
|
+
import supervisionJs from "../assets/js/supervision.js" with { type: "text" };
|
|
38
|
+
import utilJs from "../assets/js/util.js" with { type: "text" };
|
|
39
|
+
import activityViewJs from "../assets/js/views/activity.js" with { type: "text" };
|
|
40
|
+
import approvalsViewJs from "../assets/js/views/approvals.js" with { type: "text" };
|
|
41
|
+
import channelsViewJs from "../assets/js/views/channels.js" with { type: "text" };
|
|
42
|
+
import controlViewJs from "../assets/js/views/control.js" with { type: "text" };
|
|
43
|
+
import costsViewJs from "../assets/js/views/costs.js" with { type: "text" };
|
|
44
|
+
import credsViewJs from "../assets/js/views/creds.js" with { type: "text" };
|
|
45
|
+
import dataViewJs from "../assets/js/views/data.js" with { type: "text" };
|
|
46
|
+
import deployViewJs from "../assets/js/views/deploy.js" with { type: "text" };
|
|
47
|
+
import evalsLabViewJs from "../assets/js/views/evals-lab.js" with { type: "text" };
|
|
48
|
+
import evalsViewJs from "../assets/js/views/evals.js" with { type: "text" };
|
|
49
|
+
import feedbackViewJs from "../assets/js/views/feedback.js" with { type: "text" };
|
|
50
|
+
import healthViewJs from "../assets/js/views/health.js" with { type: "text" };
|
|
51
|
+
import inboxViewJs from "../assets/js/views/inbox.js" with { type: "text" };
|
|
52
|
+
import inspectViewJs from "../assets/js/views/inspect.js" with { type: "text" };
|
|
53
|
+
import jobsViewJs from "../assets/js/views/jobs.js" with { type: "text" };
|
|
54
|
+
import libraryViewJs from "../assets/js/views/library.js" with { type: "text" };
|
|
55
|
+
import memoryFabricViewJs from "../assets/js/views/memory-fabric.js" with { type: "text" };
|
|
56
|
+
import memoryViewJs from "../assets/js/views/memory.js" with { type: "text" };
|
|
57
|
+
import onboardingViewJs from "../assets/js/views/onboarding.js" with { type: "text" };
|
|
58
|
+
import overviewViewJs from "../assets/js/views/overview.js" with { type: "text" };
|
|
59
|
+
import panesViewJs from "../assets/js/views/panes.js" with { type: "text" };
|
|
60
|
+
import procViewJs from "../assets/js/views/proc.js" with { type: "text" };
|
|
61
|
+
import reviewViewJs from "../assets/js/views/review.js" with { type: "text" };
|
|
62
|
+
import runsViewJs from "../assets/js/views/runs.js" with { type: "text" };
|
|
63
|
+
import runtimeViewJs from "../assets/js/views/runtime.js" with { type: "text" };
|
|
64
|
+
import schedulersViewJs from "../assets/js/views/schedulers.js" with { type: "text" };
|
|
65
|
+
import securityViewJs from "../assets/js/views/security.js" with { type: "text" };
|
|
66
|
+
import sessionsViewJs from "../assets/js/views/sessions.js" with { type: "text" };
|
|
67
|
+
import settingsViewJs from "../assets/js/views/settings.js" with { type: "text" };
|
|
68
|
+
import specEditViewJs from "../assets/js/views/spec-edit.js" with { type: "text" };
|
|
69
|
+
import specViewJs from "../assets/js/views/spec.js" with { type: "text" };
|
|
70
|
+
import thredzViewJs from "../assets/js/views/thredz.js" with { type: "text" };
|
|
71
|
+
import tokenViewJs from "../assets/js/views/token.js" with { type: "text" };
|
|
72
|
+
/** Extension → content type for everything the asset tree may contain. */
|
|
73
|
+
export const CONTENT_TYPES = {
|
|
74
|
+
".html": "text/html; charset=utf-8",
|
|
75
|
+
".css": "text/css; charset=utf-8",
|
|
76
|
+
".js": "text/javascript; charset=utf-8",
|
|
77
|
+
".mjs": "text/javascript; charset=utf-8",
|
|
78
|
+
".json": "application/json; charset=utf-8",
|
|
79
|
+
".svg": "image/svg+xml",
|
|
80
|
+
".txt": "text/plain; charset=utf-8",
|
|
81
|
+
};
|
|
82
|
+
/** Content type for a serve path by extension (octet-stream fallback). */
|
|
83
|
+
export function contentTypeFor(path) {
|
|
84
|
+
const dot = path.lastIndexOf(".");
|
|
85
|
+
const ext = dot >= 0 ? path.slice(dot).toLowerCase() : "";
|
|
86
|
+
return CONTENT_TYPES[ext] ?? "application/octet-stream";
|
|
87
|
+
}
|
|
88
|
+
const indexHtml = indexHtmlBundle;
|
|
89
|
+
function asset(body, path) {
|
|
90
|
+
return { body, contentType: contentTypeFor(path) };
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The embed map, keyed by serve path. `"/"` is the SPA shell (the app is a
|
|
94
|
+
* hash router, so `/` is the only HTML route); everything else lives under
|
|
95
|
+
* `/assets/…` exactly as laid out on disk.
|
|
96
|
+
*/
|
|
97
|
+
export const hangarAssets = {
|
|
98
|
+
"/": asset(indexHtml, "index.html"),
|
|
99
|
+
"/assets/hangar.css": asset(hangarCss, "hangar.css"),
|
|
100
|
+
"/assets/js/app.js": asset(appJs, "app.js"),
|
|
101
|
+
"/assets/js/api.js": asset(apiJs, "api.js"),
|
|
102
|
+
"/assets/js/dom.js": asset(domJs, "dom.js"),
|
|
103
|
+
"/assets/js/keys.js": asset(keysJs, "keys.js"),
|
|
104
|
+
"/assets/js/markdown.js": asset(markdownJs, "markdown.js"),
|
|
105
|
+
"/assets/js/notify.js": asset(notifyJs, "notify.js"),
|
|
106
|
+
"/assets/js/omnibox.js": asset(omniboxJs, "omnibox.js"),
|
|
107
|
+
"/assets/js/router.js": asset(routerJs, "router.js"),
|
|
108
|
+
"/assets/js/routes.js": asset(routesJs, "routes.js"),
|
|
109
|
+
"/assets/js/shapes.js": asset(shapesJs, "shapes.js"),
|
|
110
|
+
"/assets/js/supervision.js": asset(supervisionJs, "supervision.js"),
|
|
111
|
+
"/assets/js/util.js": asset(utilJs, "util.js"),
|
|
112
|
+
"/assets/js/views/activity.js": asset(activityViewJs, "activity.js"),
|
|
113
|
+
"/assets/js/views/approvals.js": asset(approvalsViewJs, "approvals.js"),
|
|
114
|
+
"/assets/js/views/channels.js": asset(channelsViewJs, "channels.js"),
|
|
115
|
+
"/assets/js/views/control.js": asset(controlViewJs, "control.js"),
|
|
116
|
+
"/assets/js/views/costs.js": asset(costsViewJs, "costs.js"),
|
|
117
|
+
"/assets/js/views/creds.js": asset(credsViewJs, "creds.js"),
|
|
118
|
+
"/assets/js/views/data.js": asset(dataViewJs, "data.js"),
|
|
119
|
+
"/assets/js/views/deploy.js": asset(deployViewJs, "deploy.js"),
|
|
120
|
+
"/assets/js/views/evals-lab.js": asset(evalsLabViewJs, "evals-lab.js"),
|
|
121
|
+
"/assets/js/views/evals.js": asset(evalsViewJs, "evals.js"),
|
|
122
|
+
"/assets/js/views/feedback.js": asset(feedbackViewJs, "feedback.js"),
|
|
123
|
+
"/assets/js/views/health.js": asset(healthViewJs, "health.js"),
|
|
124
|
+
"/assets/js/views/inbox.js": asset(inboxViewJs, "inbox.js"),
|
|
125
|
+
"/assets/js/views/inspect.js": asset(inspectViewJs, "inspect.js"),
|
|
126
|
+
"/assets/js/views/jobs.js": asset(jobsViewJs, "jobs.js"),
|
|
127
|
+
"/assets/js/views/library.js": asset(libraryViewJs, "library.js"),
|
|
128
|
+
"/assets/js/views/memory-fabric.js": asset(memoryFabricViewJs, "memory-fabric.js"),
|
|
129
|
+
"/assets/js/views/memory.js": asset(memoryViewJs, "memory.js"),
|
|
130
|
+
"/assets/js/views/onboarding.js": asset(onboardingViewJs, "onboarding.js"),
|
|
131
|
+
"/assets/js/views/overview.js": asset(overviewViewJs, "overview.js"),
|
|
132
|
+
"/assets/js/views/panes.js": asset(panesViewJs, "panes.js"),
|
|
133
|
+
"/assets/js/views/proc.js": asset(procViewJs, "proc.js"),
|
|
134
|
+
"/assets/js/views/review.js": asset(reviewViewJs, "review.js"),
|
|
135
|
+
"/assets/js/views/runs.js": asset(runsViewJs, "runs.js"),
|
|
136
|
+
"/assets/js/views/runtime.js": asset(runtimeViewJs, "runtime.js"),
|
|
137
|
+
"/assets/js/views/schedulers.js": asset(schedulersViewJs, "schedulers.js"),
|
|
138
|
+
"/assets/js/views/security.js": asset(securityViewJs, "security.js"),
|
|
139
|
+
"/assets/js/views/sessions.js": asset(sessionsViewJs, "sessions.js"),
|
|
140
|
+
"/assets/js/views/settings.js": asset(settingsViewJs, "settings.js"),
|
|
141
|
+
"/assets/js/views/spec-edit.js": asset(specEditViewJs, "spec-edit.js"),
|
|
142
|
+
"/assets/js/views/spec.js": asset(specViewJs, "spec.js"),
|
|
143
|
+
"/assets/js/views/thredz.js": asset(thredzViewJs, "thredz.js"),
|
|
144
|
+
"/assets/js/views/token.js": asset(tokenViewJs, "token.js"),
|
|
145
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@crewhaus/hangar-ui",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "The Hangar web console's static UI — zero-build, dependency-free browser ES modules embedded as text assets for the single-binary CLI to hand to the hangar server",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"test": "bun test src"
|
|
16
|
+
},
|
|
17
|
+
"license": "Apache-2.0",
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "Max Meier",
|
|
20
|
+
"email": "max@crewhaus.ai",
|
|
21
|
+
"url": "https://crewhaus.ai"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/crewhaus/factory.git",
|
|
26
|
+
"directory": "packages/hangar-ui"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/crewhaus/factory/tree/main/packages/hangar-ui#readme",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/crewhaus/factory/issues"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"files": ["dist", "assets", "README.md", "LICENSE", "NOTICE"]
|
|
36
|
+
}
|