@mnmal-ai/substrate-tui 1.0.0-alpha.0 → 1.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @mnmal-ai/substrate-tui
2
2
 
3
- A terminal UI for Substrate: ask questions in natural language, browse the federated schema, watch service status and metrics, and, with an unlocked admin identity, run admin operations. Install it with `pnpm add -g @mnmal-ai/substrate-tui`, then run `substrate-tui` in an interactive terminal with `SUBSTRATE_URL` set.
3
+ A terminal UI for Substrate: ask questions in natural language, browse the federated schema, watch service status and metrics, and, with an unlocked admin identity, run admin operations. Install it with `pnpm add -g @mnmal-ai/substrate-tui@next`, then run `substrate-tui` in an interactive terminal with `SUBSTRATE_URL` set.
4
4
 
5
5
  Without an admin identity it is read-only.
6
6
 
@@ -25,7 +25,7 @@ Without an admin identity it is read-only.
25
25
 
26
26
  ## Status row
27
27
 
28
- `● LIVE`, `● OFFLINE` or `● RECONNECTING` (polled from `/health` every 10 s), the service version, the agent kid (`anon` when unauthenticated, `anon?` when whoami fails) and the active namespace.
28
+ `● LIVE`, `● OFFLINE` or `● RECONNECTING` (polled from `/health` every 10 s), the service version, the agent kid (key id; `anon` when unauthenticated, `anon?` when whoami fails) and the active namespace.
29
29
 
30
30
  ## Environment
31
31
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { i as isKeyRejection, t as adminCapabilityOf } from "./session-C1D5Ermr.js";
3
3
  import { resolve } from "node:path";
4
- import { AdminBackfillError, AuthError, CURRENT_MARK, NetworkError, STEP_MARKS, adminClaimCapabilities, capabilitiesFor, checkRevocable, checkUpdatable, currentStep, decodeList, describeGrant, diagnose, encodeGrant, flattenGrant, grantEntriesConfer, isActiveAdminKeyRow, isEncryptedKey, makeTokenProvider, parseGrantEntries, planOnboarding, resolveAdminCredential } from "@mnmal-ai/substrate/client";
4
+ import { AdminBackfillError, AuthError, CURRENT_MARK, NetworkError, STEP_MARKS, adminClaimCapabilities, capabilitiesFor, checkRevocable, checkUpdatable, currentStep, decodeList, describeGrant, diagnose, encodeGrant, flattenGrant, grantEntriesConfer, isActiveAdminKeyRow, isEncryptedKey, makeTokenProvider, parseGrantEntries, planOnboarding, resolveAdminCredential, tokenAudience } from "@mnmal-ai/substrate/client";
5
5
  import { createApp, defineModule, sanitise } from "@mnmal-ai/surface-core";
6
6
  import { marathon } from "@mnmal-ai/surface-theme";
7
7
  import { complete } from "@mnmal-ai/substrate-nl/complete";
@@ -76,6 +76,7 @@ function adminModule(deps, io = {}) {
76
76
  kid
77
77
  }, {
78
78
  capabilities: adminClaimCapabilities(deps.adminEnv),
79
+ audience: tokenAudience(deps.endpoint),
79
80
  ...passphrase !== void 0 ? { passphrase } : {}
80
81
  });
81
82
  return verifyAndUnlock(() => `Bearer ${getToken()}`, keyPath, kid, getToken);
@@ -244,7 +245,7 @@ function outcomeChips(o) {
244
245
  tone: o.source === "handoff" ? "warn" : "dim"
245
246
  },
246
247
  {
247
- label: rejected ? "rejected" : `${o.data.length} rows`,
248
+ label: rejected ? "rejected" : `${o.count ?? o.data.length} rows`,
248
249
  tone: rejected ? "error" : "dim"
249
250
  }
250
251
  ];
@@ -3660,6 +3661,14 @@ function surgeryModule(deps, io = {}) {
3660
3661
 
3661
3662
  //#endregion
3662
3663
  //#region src/app.ts
3664
+ /** marathon with no overlay fill: an empty `raised` means Ink paints no background, so panels sit on the ground. */
3665
+ const substrateTheme = {
3666
+ ...marathon,
3667
+ color: {
3668
+ ...marathon.color,
3669
+ raised: ""
3670
+ }
3671
+ };
3663
3672
  function buildModules(deps, opts = {}) {
3664
3673
  return [
3665
3674
  statusModule(deps, opts),
@@ -3674,11 +3683,12 @@ function buildModules(deps, opts = {}) {
3674
3683
  }
3675
3684
  function substrateAppOptions(deps, opts = {}) {
3676
3685
  return {
3677
- theme: marathon,
3686
+ theme: substrateTheme,
3678
3687
  modules: buildModules(deps, opts),
3679
3688
  defaultTurn: "substrate.ask:ask",
3680
3689
  band: true,
3681
3690
  gutter: 2,
3691
+ anchored: true,
3682
3692
  terminal: false
3683
3693
  };
3684
3694
  }
@@ -3687,4 +3697,4 @@ function createTui(deps, opts = {}) {
3687
3697
  }
3688
3698
 
3689
3699
  //#endregion
3690
- export { buildModules, createTui, substrateAppOptions };
3700
+ export { buildModules, createTui, substrateAppOptions, substrateTheme };
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as colorDepthEnv } from "../terminal-XfKFiD7r.js";
3
3
  import { basename } from "node:path";
4
- import { DEFAULT_CAPABILITIES, makeTokenProvider } from "@mnmal-ai/substrate/client";
4
+ import { DEFAULT_CAPABILITIES, makeTokenProvider, tokenAudience } from "@mnmal-ai/substrate/client";
5
+ import { trimTrailingSlashes } from "@mnmal-ai/substrate/sdk";
5
6
 
6
7
  //#region src/config.ts
7
8
  const message = (err) => err instanceof Error ? err.message : String(err);
8
9
  function readConfig(env, cwd) {
9
- const endpoint = (env.SUBSTRATE_URL ?? "").replace(/\/+$/, "");
10
+ const endpoint = trimTrailingSlashes(env.SUBSTRATE_URL ?? "");
10
11
  if (endpoint === "") return { error: "SUBSTRATE_URL is required (e.g. https://substrate.example.com:3100)" };
11
12
  const namespace = env.SUBSTRATE_NAMESPACE ?? "";
12
13
  if (namespace === "") return { error: "SUBSTRATE_NAMESPACE is required (the namespace to watch)" };
@@ -19,7 +20,10 @@ function readConfig(env, cwd) {
19
20
  token = makeTokenProvider({
20
21
  keyPath,
21
22
  kid
22
- }, { capabilities: raw !== void 0 && raw.length > 0 ? raw : DEFAULT_CAPABILITIES });
23
+ }, {
24
+ capabilities: raw !== void 0 && raw.length > 0 ? raw : DEFAULT_CAPABILITIES,
25
+ audience: tokenAudience(endpoint)
26
+ });
23
27
  } catch (err) {
24
28
  return { error: `agent identity: ${message(err)}` };
25
29
  }
@@ -47,7 +51,7 @@ async function main() {
47
51
  }
48
52
  Object.assign(process.env, colorDepthEnv(process.env));
49
53
  const [{ createTui }, { makeDeps }, { prepareTerminal }, { terminalOptions }] = await Promise.all([
50
- import("../app-BLOyJcBh.js"),
54
+ import("../app-D0y2D8WL.js"),
51
55
  import("../deps-WzqsHHiC.js"),
52
56
  import("@mnmal-ai/surface-core/pure"),
53
57
  import("../terminal-CVX2CKWu.js")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mnmal-ai/substrate-tui",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.0.0-alpha.10",
4
4
  "description": "Terminal UI for Substrate: ask in natural language, browse the schema, see the service status.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "type": "module",
12
12
  "bin": {
13
- "substrate-tui": "dist/bin/tui.js"
13
+ "substrate-tui": "dist/bin/substrate-tui.js"
14
14
  },
15
15
  "files": [
16
16
  "dist"
@@ -20,17 +20,17 @@
20
20
  "access": "public"
21
21
  },
22
22
  "dependencies": {
23
- "@mnmal-ai/substrate": "1.0.0-alpha.0",
24
- "@mnmal-ai/substrate-nl": "1.0.0-alpha.0",
25
- "@mnmal-ai/surface-core": "0.14.5",
26
- "@mnmal-ai/surface-kit": "0.14.5",
27
- "@mnmal-ai/surface-theme": "0.14.5",
28
- "ink": "^7.1.1",
23
+ "@mnmal-ai/substrate": "1.0.0-alpha.10",
24
+ "@mnmal-ai/substrate-nl": "1.0.0-alpha.10",
25
+ "@mnmal-ai/surface-core": "0.14.6",
26
+ "@mnmal-ai/surface-kit": "0.14.6",
27
+ "@mnmal-ai/surface-theme": "0.14.6",
28
+ "ink": "^8.0.0",
29
29
  "react": "^19.3.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@biomejs/biome": "^2.5.15",
33
- "@mnmal-ai/substrate-config": "1.0.0-alpha.0",
32
+ "@biomejs/biome": "2.6.2",
33
+ "@mnmal-ai/substrate-config": "1.0.0-alpha.10",
34
34
  "@types/node": "^26.6.4",
35
35
  "@types/react": "^19.2.0",
36
36
  "ink-testing-library": "^4.0.0",
@@ -40,7 +40,7 @@
40
40
  "vitest": "^5.0.3"
41
41
  },
42
42
  "engines": {
43
- "node": ">=26.2.0"
43
+ "node": ">=26.12.1"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "tsdown",