@kl-c/matrixos 0.3.54 → 0.3.55

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/dist/cli/index.js CHANGED
@@ -2163,7 +2163,7 @@ var package_default;
2163
2163
  var init_package = __esm(() => {
2164
2164
  package_default = {
2165
2165
  name: "@kl-c/matrixos",
2166
- version: "0.3.54",
2166
+ version: "0.3.55",
2167
2167
  description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
2168
2168
  main: "./dist/index.js",
2169
2169
  types: "dist/index.d.ts",
@@ -189419,6 +189419,16 @@ function createDashboardServer(dataProvider, config5) {
189419
189419
  if (req.method === "OPTIONS") {
189420
189420
  return new Response(null, { headers: corsHeaders });
189421
189421
  }
189422
+ if (config5.dashboardPassphrase) {
189423
+ const isHealth = path25 === "/api/health";
189424
+ const isGatewayToken = path25 === "/api/gateway/token";
189425
+ if (path25.startsWith("/api/") && !isHealth && !isGatewayToken) {
189426
+ const provided = req.headers.get("x-passphrase");
189427
+ if (!provided || provided !== config5.dashboardPassphrase) {
189428
+ return Response.json({ error: "Unauthorized \u2014 dashboard passphrase required" }, { status: 401, headers: corsHeaders });
189429
+ }
189430
+ }
189431
+ }
189422
189432
  if (path25.startsWith("/api/")) {
189423
189433
  if (path25 === "/api/logs/stream") {
189424
189434
  const headers = new Headers({
@@ -189696,7 +189706,7 @@ async function dashboardCli(options) {
189696
189706
  console.log(`[dashboard] frontend: ${frontendDir}`);
189697
189707
  try {
189698
189708
  const dataProvider = createDataProvider();
189699
- const server2 = createDashboardServer(dataProvider, { port: port3, host, frontendDir, gatewayPassphrase });
189709
+ const server2 = createDashboardServer(dataProvider, { port: port3, host, frontendDir, gatewayPassphrase, dashboardPassphrase: gatewayPassphrase });
189700
189710
  server2.start();
189701
189711
  console.log(`[dashboard] ready \u2014 http://${host}:${port3}`);
189702
189712
  if (!options.daemon) {
@@ -2163,7 +2163,7 @@ var package_default;
2163
2163
  var init_package = __esm(() => {
2164
2164
  package_default = {
2165
2165
  name: "@kl-c/matrixos",
2166
- version: "0.3.54",
2166
+ version: "0.3.55",
2167
2167
  description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
2168
2168
  main: "./dist/index.js",
2169
2169
  types: "dist/index.d.ts",
@@ -189474,6 +189474,16 @@ function createDashboardServer(dataProvider, config5) {
189474
189474
  if (req.method === "OPTIONS") {
189475
189475
  return new Response(null, { headers: corsHeaders });
189476
189476
  }
189477
+ if (config5.dashboardPassphrase) {
189478
+ const isHealth = path25 === "/api/health";
189479
+ const isGatewayToken = path25 === "/api/gateway/token";
189480
+ if (path25.startsWith("/api/") && !isHealth && !isGatewayToken) {
189481
+ const provided = req.headers.get("x-passphrase");
189482
+ if (!provided || provided !== config5.dashboardPassphrase) {
189483
+ return Response.json({ error: "Unauthorized \u2014 dashboard passphrase required" }, { status: 401, headers: corsHeaders });
189484
+ }
189485
+ }
189486
+ }
189477
189487
  if (path25.startsWith("/api/")) {
189478
189488
  if (path25 === "/api/logs/stream") {
189479
189489
  const headers = new Headers({
@@ -189751,7 +189761,7 @@ async function dashboardCli(options) {
189751
189761
  console.log(`[dashboard] frontend: ${frontendDir}`);
189752
189762
  try {
189753
189763
  const dataProvider = createDataProvider();
189754
- const server2 = createDashboardServer(dataProvider, { port: port3, host, frontendDir, gatewayPassphrase });
189764
+ const server2 = createDashboardServer(dataProvider, { port: port3, host, frontendDir, gatewayPassphrase, dashboardPassphrase: gatewayPassphrase });
189755
189765
  server2.start();
189756
189766
  console.log(`[dashboard] ready \u2014 http://${host}:${port3}`);
189757
189767
  if (!options.daemon) {
@@ -22,8 +22,20 @@ const API={
22
22
  cronRemove:(id)=>fetchJSON(`/cron?id=${encodeURIComponent(id)}`,{method:'DELETE'}),
23
23
  gatewayToken:(type,token,passphrase)=>fetch('/api/gateway/token',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({type,token,passphrase})}).then(r=>r.json())
24
24
  }
25
- async function fetchJSON(e,opts){
26
- const r=await fetch(`/api${e}`,opts)
27
- if(!r.ok)throw new Error(`API ${e}: ${r.status}`)
25
+ async function fetchJSON(e, opts) {
26
+ opts = opts || {}
27
+ opts.headers = Object.assign({ "x-passphrase": localStorage.getItem("matrixos_dashboard_passphrase") || "" }, opts.headers || {})
28
+ const r = await fetch(`/api${e}`, opts)
29
+ if (r.status === 401) {
30
+ const tried = localStorage.getItem("matrixos_dashboard_passphrase")
31
+ if (!tried) {
32
+ const p = prompt("Dashboard passphrase required:")
33
+ if (p) {
34
+ localStorage.setItem("matrixos_dashboard_passphrase", p)
35
+ return fetchJSON(e, opts)
36
+ }
37
+ }
38
+ }
39
+ if (!r.ok) throw new Error(`API ${e}: ${r.status}`)
28
40
  return r.json()
29
41
  }
@@ -5,6 +5,8 @@ export interface DashboardServerConfig {
5
5
  frontendDir: string;
6
6
  /** Passphrase required to submit gateway tokens via POST /api/gateway/token */
7
7
  gatewayPassphrase?: string;
8
+ /** Global passphrase required for ALL /api/* routes (except /api/health) when set */
9
+ dashboardPassphrase?: string;
8
10
  }
9
11
  export declare function createDashboardServer(dataProvider: DataProvider, config: DashboardServerConfig): {
10
12
  start(): void;
package/dist/index.js CHANGED
@@ -368086,7 +368086,7 @@ function getCachedVersion(options = {}) {
368086
368086
  // package.json
368087
368087
  var package_default = {
368088
368088
  name: "@kl-c/matrixos",
368089
- version: "0.3.54",
368089
+ version: "0.3.55",
368090
368090
  description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
368091
368091
  main: "./dist/index.js",
368092
368092
  types: "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kl-c/matrixos",
3
- "version": "0.3.54",
3
+ "version": "0.3.55",
4
4
  "description": "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "dist/index.d.ts",