@galaxy-stack/blackhole-cli 2.0.0-alpha.10
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/LICENSE +21 -0
- package/README.md +133 -0
- package/dist/application.d.ts +63 -0
- package/dist/application.d.ts.map +1 -0
- package/dist/application.js +272 -0
- package/dist/application.js.map +1 -0
- package/dist/cli-meta.d.ts +15 -0
- package/dist/cli-meta.d.ts.map +1 -0
- package/dist/cli-meta.js +37 -0
- package/dist/cli-meta.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +177 -0
- package/dist/cli.js.map +1 -0
- package/dist/composer.d.ts +13 -0
- package/dist/composer.d.ts.map +1 -0
- package/dist/composer.js +115 -0
- package/dist/composer.js.map +1 -0
- package/dist/flow.d.ts +44 -0
- package/dist/flow.d.ts.map +1 -0
- package/dist/flow.js +102 -0
- package/dist/flow.js.map +1 -0
- package/dist/logs.d.ts +25 -0
- package/dist/logs.d.ts.map +1 -0
- package/dist/logs.js +80 -0
- package/dist/logs.js.map +1 -0
- package/dist/memory-import.d.ts +28 -0
- package/dist/memory-import.d.ts.map +1 -0
- package/dist/memory-import.js +51 -0
- package/dist/memory-import.js.map +1 -0
- package/dist/options.d.ts +32 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +121 -0
- package/dist/options.js.map +1 -0
- package/dist/sessions.d.ts +16 -0
- package/dist/sessions.d.ts.map +1 -0
- package/dist/sessions.js +56 -0
- package/dist/sessions.js.map +1 -0
- package/dist/spill.d.ts +30 -0
- package/dist/spill.d.ts.map +1 -0
- package/dist/spill.js +44 -0
- package/dist/spill.js.map +1 -0
- package/dist/terminal-input.d.ts +10 -0
- package/dist/terminal-input.d.ts.map +1 -0
- package/dist/terminal-input.js +10 -0
- package/dist/terminal-input.js.map +1 -0
- package/dist/timeline.d.ts +31 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +280 -0
- package/dist/timeline.js.map +1 -0
- package/dist/tui.d.ts +11 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +269 -0
- package/dist/tui.js.map +1 -0
- package/dist/web/command.d.ts +3 -0
- package/dist/web/command.d.ts.map +1 -0
- package/dist/web/command.js +37 -0
- package/dist/web/command.js.map +1 -0
- package/dist/web/credentials.d.ts +17 -0
- package/dist/web/credentials.d.ts.map +1 -0
- package/dist/web/credentials.js +36 -0
- package/dist/web/credentials.js.map +1 -0
- package/dist/web/doctor.d.ts +4 -0
- package/dist/web/doctor.d.ts.map +1 -0
- package/dist/web/doctor.js +79 -0
- package/dist/web/doctor.js.map +1 -0
- package/dist/web/dsh.d.ts +11 -0
- package/dist/web/dsh.d.ts.map +1 -0
- package/dist/web/dsh.js +59 -0
- package/dist/web/dsh.js.map +1 -0
- package/dist/web/open-browser.d.ts +3 -0
- package/dist/web/open-browser.d.ts.map +1 -0
- package/dist/web/open-browser.js +19 -0
- package/dist/web/open-browser.js.map +1 -0
- package/dist/web/options.d.ts +23 -0
- package/dist/web/options.d.ts.map +1 -0
- package/dist/web/options.js +154 -0
- package/dist/web/options.js.map +1 -0
- package/dist/web/paths.d.ts +17 -0
- package/dist/web/paths.d.ts.map +1 -0
- package/dist/web/paths.js +39 -0
- package/dist/web/paths.js.map +1 -0
- package/dist/web/web.d.ts +17 -0
- package/dist/web/web.d.ts.map +1 -0
- package/dist/web/web.js +153 -0
- package/dist/web/web.js.map +1 -0
- package/package.json +65 -0
- package/skills/galaxy-ui/SKILL.md +56 -0
- package/skills/galaxy-ui/references/cli-workflows.md +54 -0
- package/skills/galaxy-ui/references/component-patterns.md +46 -0
- package/skills/galaxy-ui/references/framework-notes.md +35 -0
- package/skills/galaxy-ui/references/tailwind.md +23 -0
- package/skills/orbit-framework/SKILL.md +126 -0
- package/web/brand/client.template.js +217 -0
- package/web/brand/favicon.png +0 -0
- package/web/brand/lib/client.js +1205 -0
- package/web/brand/lib/favicon.js +1 -0
- package/web/brand/lib/index.js +143 -0
- package/web/brand/logo.png +0 -0
- package/web/brand/package.json +35 -0
- package/web/brand/vi.locales.json +989 -0
- package/web/patches/gbh-brand.patch.yml +13 -0
- package/web/patches/gbh-ui.patch.yml +18 -0
- package/web/patches/gbh-web.patch.yml +68 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const FAVICON_DATA_URI = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAASFBMVEVHcEwQ6PIQ8PoQ7vcQ8PoQ8foP4uwQ6vQQ8PoQ7/kQ8fsQ7vgQ7PYQ7vgQ8PkQ8PkQ7/kQ7/kQ7vgQ7/kQ7/kQ8PkQ7/kQ8PqCT6ZFAAAAGHRSTlMABn4gg4kCDW1GojAUJmZZO1EaQEx0YZNxr+hxAAAA+UlEQVQ4y91S23LFIAhUEMW7RpP8/5/Wk3ZOTDqT89zyIDKsu4AI8adM6g8AXp7fb45weH3w6OBLvDLq4pIxjQFWGyyoNal84+jBExdEn3aIUoig5JQ1g69R/A4i9YGIMGkY9gLpXWV0exLcJwLvVsn2jLPbykVB9MVQOMPqytHTbHhKyqwa+Vt+WeF9BbbuV57yj6apZKvb73MEK+DVpLEq+ZVTPhqfimIhLKDfRrqTDbQEZWYCNUrWWa0dm+IgoQZyM+IADIdVMY4Rblpa1+Y5WJVtTQBu38ZZXuB2/UzsuRaUMrby+gb/vDqBdvywPGweAdoE8c/sC/VMCWjodaHMAAAAAElFTkSuQmCC";
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
//#region node half
|
|
2
|
+
import { FAVICON_DATA_URI } from "./favicon.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Host half of the gbh brand plugin: rewords the fixed harness:identity
|
|
6
|
+
* system-prompt section, replaces the page favicon, hides the built-in
|
|
7
|
+
* provider's edit/remove actions, and registers the Galaxy web-search provider.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const IDENTITY_SECTION = "harness:identity";
|
|
11
|
+
const IDENTITY_TEXT = "You are an AI agent powered by Galaxy Blackhole.";
|
|
12
|
+
const PERSONA_SECTION = "deployment:persona-prefix";
|
|
13
|
+
const PERSONA_TEXT = "You are a coding agent powered by Galaxy Blackhole.";
|
|
14
|
+
|
|
15
|
+
const FAVICON_SCRIPT = [
|
|
16
|
+
"(function(){",
|
|
17
|
+
"var href=" + JSON.stringify(FAVICON_DATA_URI) + ";",
|
|
18
|
+
'function apply(){var links=document.querySelectorAll("link[rel*=icon]");for(var i=0;i<links.length;i++){links[i].parentNode.removeChild(links[i]);}var link=document.createElement("link");link.rel="icon";link.type="image/png";link.href=href;document.head.appendChild(link);}',
|
|
19
|
+
'if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",apply);}else{apply();}',
|
|
20
|
+
"})();",
|
|
21
|
+
].join("");
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Hide two things the stock UI still shows:
|
|
25
|
+
* - the built-in provider's edit/remove actions on the Models page (buttons
|
|
26
|
+
* labelled "Edit/Remove provider {provider}"), keeping later providers editable;
|
|
27
|
+
* - the built-in Chinese language option, leaving English and Vietnamese.
|
|
28
|
+
*/
|
|
29
|
+
const HIDE_UI_SCRIPT = [
|
|
30
|
+
"(function(){",
|
|
31
|
+
"var name=" + JSON.stringify("Galaxy Blackhole") + ";",
|
|
32
|
+
"function hide(){",
|
|
33
|
+
"var body=document.body?document.body.textContent||'':'';",
|
|
34
|
+
"var keyMissing=body.indexOf('API key missing')!==-1||body.indexOf('Thiếu API key')!==-1;",
|
|
35
|
+
"var btns=document.querySelectorAll('button[aria-label]');",
|
|
36
|
+
"for(var i=0;i<btns.length;i++){var a=btns[i].getAttribute('aria-label')||'';if(a.indexOf(name)!==-1&&(a.indexOf('Edit')!==-1||a.indexOf('Remove')!==-1||a.indexOf('Delete')!==-1)){btns[i].style.display=keyMissing?'':'none';}}",
|
|
37
|
+
"var items=document.querySelectorAll('[role=menuitem],[role=option],li,button');",
|
|
38
|
+
"for(var j=0;j<items.length;j++){var el=items[j];if((el.textContent||'').trim()==='中文'){el.style.display='none';}}",
|
|
39
|
+
"var details=document.querySelectorAll('details');",
|
|
40
|
+
"for(var k=0;k<details.length;k++){var d=details[k];var sm=d.querySelector('summary');var lbl=sm?(sm.textContent||'').trim():'';if(lbl!=='Cài đặt tuỳ chỉnh'&&lbl!=='Customized settings')continue;var p=d.parentElement;var hit=false;for(var m=0;m<6&&p;m++){if((p.textContent||'').indexOf(name)!==-1){hit=true;break;}p=p.parentElement;}if(hit)d.style.display='none';}",
|
|
41
|
+
"}",
|
|
42
|
+
"hide();",
|
|
43
|
+
"if(typeof MutationObserver==='function'){new MutationObserver(hide).observe(document.documentElement,{childList:true,subtree:true});}",
|
|
44
|
+
"})();",
|
|
45
|
+
].join("");
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
/** Late text replacements the locale layer cannot reach on 0.1.5. */
|
|
49
|
+
const TEXT_FIX_SCRIPT = [
|
|
50
|
+
"(function(){",
|
|
51
|
+
"var exact={",
|
|
52
|
+
"\"HARNESS\":\"GALAXY BLACKHOLE\",",
|
|
53
|
+
"\"Read Only\":\"Chỉ đọc\",",
|
|
54
|
+
"\"Workspace Write\":\"Ghi trong workspace\",",
|
|
55
|
+
"\"Full access\":\"Toàn quyền\",",
|
|
56
|
+
"\"Loading plugins…\":\"Đang tải...\"",
|
|
57
|
+
"};",
|
|
58
|
+
"function fixText(t){if(!t)return t;var s=t.nodeValue;if(s===null)return;var v=s.trim();if(exact[v]!==undefined){t.nodeValue=s.replace(v,exact[v]);return;}if(v.indexOf('Ran for ')===0){t.nodeValue=s.replace('Ran for ','Chạy trong ');}}",
|
|
59
|
+
"function walk(root){if(!root)return;if(root.nodeType===3){fixText(root);return;}var it=document.createTreeWalker(root,NodeFilter.SHOW_TEXT,null);var n;while((n=it.nextNode())){fixText(n);}}",
|
|
60
|
+
"walk(document.body);",
|
|
61
|
+
"if(typeof MutationObserver==='function'){new MutationObserver(function(ms){for(var i=0;i<ms.length;i++){var m=ms[i];if(m.type==='characterData'){fixText(m.target);}else{for(var j=0;j<m.addedNodes.length;j++){walk(m.addedNodes[j]);}}}}).observe(document.documentElement,{childList:true,subtree:true,characterData:true});}",
|
|
62
|
+
"})();"
|
|
63
|
+
].join("");
|
|
64
|
+
|
|
65
|
+
/** Keep the browser tab title on the product name, even after in-app updates. */
|
|
66
|
+
const TITLE_SCRIPT = [
|
|
67
|
+
"(function(){",
|
|
68
|
+
'function enforce(){var want="Galaxy Blackhole";if(document.title!==want){document.title=want;}}',
|
|
69
|
+
"enforce();",
|
|
70
|
+
"if(typeof MutationObserver==='function'){new MutationObserver(enforce).observe(document.head,{childList:true,subtree:true,characterData:true});}",
|
|
71
|
+
"})();",
|
|
72
|
+
].join("");
|
|
73
|
+
|
|
74
|
+
const GALAXY_SEARCH_ID = "auto";
|
|
75
|
+
const GALAXY_SEARCH_URL = "https://ollama.com/api/web_search";
|
|
76
|
+
|
|
77
|
+
function galaxyKey() {
|
|
78
|
+
const key = process.env.GBH_GALAXY_API_KEY;
|
|
79
|
+
return typeof key === "string" && key.length > 0 ? key : undefined;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** A ctx.web search provider over the Galaxy web search endpoint. */
|
|
83
|
+
function createGalaxySearchProvider() {
|
|
84
|
+
return {
|
|
85
|
+
id: GALAXY_SEARCH_ID,
|
|
86
|
+
available() {
|
|
87
|
+
return galaxyKey() !== undefined;
|
|
88
|
+
},
|
|
89
|
+
async search(request, signal) {
|
|
90
|
+
const key = galaxyKey();
|
|
91
|
+
if (key === undefined) throw new Error("galaxy web_search requires GBH_GALAXY_API_KEY");
|
|
92
|
+
const body = { query: request?.query ?? "" };
|
|
93
|
+
if (typeof request?.maxResults === "number") body.max_results = request.maxResults;
|
|
94
|
+
const response = await fetch(GALAXY_SEARCH_URL, {
|
|
95
|
+
method: "POST",
|
|
96
|
+
headers: { "Content-Type": "application/json", Authorization: "Bearer " + key },
|
|
97
|
+
body: JSON.stringify(body),
|
|
98
|
+
...(signal === undefined ? {} : { signal }),
|
|
99
|
+
});
|
|
100
|
+
if (!response.ok) throw new Error("galaxy web_search HTTP " + response.status);
|
|
101
|
+
const payload = await response.json();
|
|
102
|
+
const rows = Array.isArray(payload?.results) ? payload.results : [];
|
|
103
|
+
const sources = [];
|
|
104
|
+
for (const row of rows) {
|
|
105
|
+
const url = typeof row?.url === "string" ? row.url : "";
|
|
106
|
+
if (url.length === 0) continue;
|
|
107
|
+
const source = { url };
|
|
108
|
+
if (typeof row?.title === "string") source.title = row.title;
|
|
109
|
+
if (typeof row?.content === "string") source.snippet = row.content;
|
|
110
|
+
sources.push(source);
|
|
111
|
+
}
|
|
112
|
+
return { sources, truncated: false };
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** The system-prompt registry owns the section this plugin rewrites. */
|
|
118
|
+
export const inject = ["systemPrompt"];
|
|
119
|
+
|
|
120
|
+
function apply(ctx) {
|
|
121
|
+
ctx.on("system-prompt/assemble", async (assembly, _context, next) => {
|
|
122
|
+
const sections = assembly?.sections;
|
|
123
|
+
if (Array.isArray(sections)) {
|
|
124
|
+
for (const section of sections) {
|
|
125
|
+
if (section?.name === IDENTITY_SECTION) section.text = IDENTITY_TEXT;
|
|
126
|
+
if (section?.name === PERSONA_SECTION) section.text = PERSONA_TEXT;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return next();
|
|
130
|
+
});
|
|
131
|
+
ctx.inject(["web"], (webCtx) => webCtx.web.registerSearchProvider(createGalaxySearchProvider()));
|
|
132
|
+
ctx.inject(["webServer"], (hostCtx) => {
|
|
133
|
+
hostCtx.on("webserver/index-inject", (table) => {
|
|
134
|
+
table.push({ kind: "script", placement: "body", text: FAVICON_SCRIPT });
|
|
135
|
+
table.push({ kind: "script", placement: "body", text: HIDE_UI_SCRIPT });
|
|
136
|
+
table.push({ kind: "script", placement: "body", text: TITLE_SCRIPT });
|
|
137
|
+
table.push({ kind: "script", placement: "body", text: TEXT_FIX_SCRIPT });
|
|
138
|
+
table.push({ kind: "global", name: "__GBH_HAS_KEY__", value: (process.env.GBH_GALAXY_API_KEY ?? "").length > 0 });
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
export { apply };
|
|
Binary file
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@galaxy-stack/gbh-brand",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Galaxy Blackhole brand occupant for the dsh web sidebar slots",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "lib/index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./client": {
|
|
14
|
+
"default": "./lib/client.js"
|
|
15
|
+
},
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"lib"
|
|
20
|
+
],
|
|
21
|
+
"dsh": {
|
|
22
|
+
"client": {
|
|
23
|
+
"inject": [
|
|
24
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
25
|
+
"@deepseek-ai/dsh-client-ui-sidebar",
|
|
26
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
27
|
+
"@deepseek-ai/dsh-client-ui-settings-models",
|
|
28
|
+
"@deepseek-ai/dsh-client-locale",
|
|
29
|
+
"@deepseek-ai/dsh-api-remotes",
|
|
30
|
+
"@deepseek-ai/dsh-client-ui-model-selection"
|
|
31
|
+
],
|
|
32
|
+
"platform": "web"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|