@kyma-api/agent 0.1.3 → 0.1.5

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/package.json CHANGED
@@ -1,17 +1,20 @@
1
1
  {
2
2
  "name": "@kyma-api/agent",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Kyma coding agent — one account, many models. AI-powered coding assistant backed by Kyma API.",
5
5
  "type": "module",
6
6
  "bin": {
7
- "kyma": "bin/kyma.js"
7
+ "kyma": "bin/kyma.js",
8
+ "kyma-ter": "bin/kyma-ter.js"
8
9
  },
9
10
  "files": [
10
11
  "bin/",
11
12
  "dist/",
12
- "themes/"
13
+ "themes/",
14
+ "scripts/"
13
15
  ],
14
16
  "scripts": {
17
+ "postinstall": "node scripts/postinstall.js",
15
18
  "build": "tsup",
16
19
  "pretest": "npm run build",
17
20
  "test": "vitest run",
@@ -37,7 +40,7 @@
37
40
  "ai",
38
41
  "llm",
39
42
  "cli",
40
- "open-source-models",
43
+ "models",
41
44
  "coding-assistant"
42
45
  ],
43
46
  "repository": {
@@ -47,6 +50,7 @@
47
50
  },
48
51
  "homepage": "https://kymaapi.com",
49
52
  "author": "Son Piaz <sonxpiaz@gmail.com>",
53
+ "kymaTerminal": "0.1.0",
50
54
  "license": "MIT",
51
55
  "dependencies": {
52
56
  "@mariozechner/pi-coding-agent": "0.66.1",
@@ -0,0 +1,135 @@
1
+ #!/usr/bin/env node
2
+
3
+ // 1. Symlink Pi's built-in assets (themes, export-html) into the expected paths.
4
+ // 2. Download kyma-ter Go binary if needed.
5
+
6
+ import {
7
+ existsSync,
8
+ mkdirSync,
9
+ symlinkSync,
10
+ unlinkSync,
11
+ readdirSync,
12
+ readFileSync,
13
+ writeFileSync,
14
+ chmodSync,
15
+ } from "fs";
16
+ import { join, dirname } from "path";
17
+ import { fileURLToPath } from "url";
18
+ import { createRequire } from "module";
19
+ import https from "https";
20
+ import http from "http";
21
+ import os from "os";
22
+
23
+ const __dirname = dirname(fileURLToPath(import.meta.url));
24
+ const root = dirname(__dirname);
25
+
26
+ // ── Pi symlinks ─────────────────────────────────────────────────────────
27
+ const piDist = join(root, "node_modules/@mariozechner/pi-coding-agent/dist");
28
+ if (existsSync(piDist)) {
29
+ const links = [
30
+ {
31
+ src: join(piDist, "modes/interactive/theme"),
32
+ dest: join(root, "src/modes/interactive/theme"),
33
+ files: ["dark.json", "light.json"],
34
+ },
35
+ {
36
+ src: join(piDist, "core/export-html"),
37
+ dest: join(root, "src/core/export-html"),
38
+ files: null,
39
+ },
40
+ ];
41
+
42
+ for (const { src, dest, files } of links) {
43
+ if (!existsSync(src)) continue;
44
+ mkdirSync(dest, { recursive: true });
45
+
46
+ const targets = files || readdirSync(src);
47
+ for (const file of targets) {
48
+ const srcPath = join(src, file);
49
+ const destPath = join(dest, file);
50
+ if (!existsSync(srcPath)) continue;
51
+ if (existsSync(destPath)) unlinkSync(destPath);
52
+ symlinkSync(srcPath, destPath);
53
+ }
54
+ }
55
+ }
56
+
57
+ // ── kyma-ter binary download ────────────────────────────────────────────
58
+ const KYMA_HOME = join(os.homedir(), ".kyma", "ter");
59
+ const BIN_DIR = join(KYMA_HOME, "bin");
60
+ const VERSION_FILE = join(KYMA_HOME, "version");
61
+ const BINARY_PATH = join(BIN_DIR, "kyma-ter");
62
+ const BASE_URL = "https://github.com/sonpiaz/kyma-releases/releases/download";
63
+
64
+ function getPlatform() {
65
+ const platformMap = { darwin: "darwin", linux: "linux" };
66
+ const archMap = { arm64: "arm64", x64: "amd64" };
67
+ return {
68
+ os: platformMap[process.platform],
69
+ cpu: archMap[process.arch],
70
+ };
71
+ }
72
+
73
+ function download(url) {
74
+ return new Promise((resolve, reject) => {
75
+ const client = url.startsWith("https") ? https : http;
76
+ client
77
+ .get(url, (res) => {
78
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
79
+ return download(res.headers.location).then(resolve).catch(reject);
80
+ }
81
+ if (res.statusCode !== 200) {
82
+ return reject(new Error(`HTTP ${res.statusCode}`));
83
+ }
84
+ const chunks = [];
85
+ res.on("data", (chunk) => chunks.push(chunk));
86
+ res.on("end", () => resolve(Buffer.concat(chunks)));
87
+ res.on("error", reject);
88
+ })
89
+ .on("error", reject);
90
+ });
91
+ }
92
+
93
+ async function installKymaTer() {
94
+ const require = createRequire(import.meta.url);
95
+ const pkg = require("../package.json");
96
+ const targetVersion = pkg.kymaTerminal;
97
+ if (!targetVersion) return;
98
+
99
+ const { os: platform, cpu } = getPlatform();
100
+ if (!platform || !cpu) {
101
+ console.log(
102
+ `kyma-ter: skipping binary download (unsupported platform: ${process.platform}-${process.arch})`
103
+ );
104
+ return;
105
+ }
106
+
107
+ // Check cached version
108
+ if (existsSync(VERSION_FILE) && existsSync(BINARY_PATH)) {
109
+ const installed = readFileSync(VERSION_FILE, "utf8").trim();
110
+ if (installed === targetVersion) return;
111
+ }
112
+
113
+ const url = `${BASE_URL}/ter-v${targetVersion}/kyma-ter-${platform}-${cpu}`;
114
+ console.log(`Downloading kyma-ter v${targetVersion} for ${platform}/${cpu}...`);
115
+
116
+ const data = await download(url);
117
+ mkdirSync(BIN_DIR, { recursive: true });
118
+ writeFileSync(BINARY_PATH, data);
119
+ chmodSync(BINARY_PATH, 0o755);
120
+ writeFileSync(VERSION_FILE, targetVersion);
121
+ console.log(`kyma-ter v${targetVersion} installed.`);
122
+ }
123
+
124
+ try {
125
+ await installKymaTer();
126
+ } catch (err) {
127
+ // Don't fail the install — kyma CLI should still work without kyma-ter
128
+ if (process.env.npm_config_loglevel !== "silent") {
129
+ console.log(`kyma-ter: binary download skipped (${err.message})`);
130
+ console.log(` You can install manually from https://kymaapi.com/ter`);
131
+ }
132
+ }
133
+
134
+ // Always exit cleanly — postinstall must not block npm link/install
135
+ process.exit(0);
@@ -2,33 +2,34 @@
2
2
  "$schema": "https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
3
3
  "name": "kyma-dark",
4
4
  "vars": {
5
- "accent": "#C9A84C",
6
- "accentLight": "#DDBF6F",
7
- "accentSoft": "#A89060",
8
- "teal": "#7DCFCF",
9
- "purple": "#B4A7D6",
10
- "green": "#00B894",
11
- "red": "#E17055",
12
- "yellow": "#FDCB6E",
13
- "gray": "#A0A6B8",
14
- "dimGray": "#6B7285",
15
- "darkGray": "#4A4E5C",
16
- "text": "#E8EAF2",
17
- "selectedBg": "#232119",
18
- "userMsgBg": "#1E1D18",
19
- "toolPendingBg": "#1B1D1E",
20
- "toolSuccessBg": "#14251D",
21
- "toolErrorBg": "#2A1C1E",
22
- "customMsgBg": "#211E18"
5
+ "brand": "#C9A84C",
6
+ "brandLight": "#DDBF6F",
7
+ "cyan": "#56B6C2",
8
+ "purple": "#9D7CD8",
9
+ "peach": "#FAB283",
10
+ "green": "#7FD88F",
11
+ "red": "#E06C75",
12
+ "amber": "#F5A742",
13
+ "text": "#EEEEEE",
14
+ "gray": "#808080",
15
+ "dimGray": "#606060",
16
+ "darkGray": "#484848",
17
+ "subtleBorder": "#3C3C3C",
18
+ "selectedBg": "#1E1E1E",
19
+ "userMsgBg": "#1A1A1A",
20
+ "toolPendingBg": "#141414",
21
+ "toolSuccessBg": "#1A2B1F",
22
+ "toolErrorBg": "#2A1A1A",
23
+ "customMsgBg": "#1A1A1A"
23
24
  },
24
25
  "colors": {
25
- "accent": "accent",
26
- "border": "accent",
27
- "borderAccent": "accentLight",
26
+ "accent": "brand",
27
+ "border": "subtleBorder",
28
+ "borderAccent": "cyan",
28
29
  "borderMuted": "darkGray",
29
30
  "success": "green",
30
31
  "error": "red",
31
- "warning": "yellow",
32
+ "warning": "amber",
32
33
  "muted": "gray",
33
34
  "dim": "dimGray",
34
35
  "text": "",
@@ -39,55 +40,55 @@
39
40
  "userMessageText": "",
40
41
  "customMessageBg": "customMsgBg",
41
42
  "customMessageText": "",
42
- "customMessageLabel": "accentSoft",
43
+ "customMessageLabel": "gray",
43
44
  "toolPendingBg": "toolPendingBg",
44
45
  "toolSuccessBg": "toolSuccessBg",
45
46
  "toolErrorBg": "toolErrorBg",
46
47
  "toolTitle": "",
47
- "toolOutput": "#C8CCD8",
48
+ "toolOutput": "#D4D4D4",
48
49
 
49
- "mdHeading": "#F0E4A8",
50
- "mdLink": "teal",
50
+ "mdHeading": "purple",
51
+ "mdLink": "cyan",
51
52
  "mdLinkUrl": "dimGray",
52
- "mdCode": "teal",
53
- "mdCodeBlock": "gray",
54
- "mdCodeBlockBorder": "dimGray",
53
+ "mdCode": "green",
54
+ "mdCodeBlock": "text",
55
+ "mdCodeBlockBorder": "darkGray",
55
56
  "mdQuote": "gray",
56
- "mdQuoteBorder": "dimGray",
57
- "mdHr": "dimGray",
58
- "mdListBullet": "accent",
57
+ "mdQuoteBorder": "darkGray",
58
+ "mdHr": "darkGray",
59
+ "mdListBullet": "cyan",
59
60
 
60
- "toolDiffAdded": "green",
61
- "toolDiffRemoved": "red",
61
+ "toolDiffAdded": "#4FD6BE",
62
+ "toolDiffRemoved": "#C53B53",
62
63
  "toolDiffContext": "gray",
63
64
 
64
65
  "syntaxComment": "#6A9955",
65
66
  "syntaxKeyword": "purple",
66
- "syntaxFunction": "#E2C87A",
67
- "syntaxVariable": "#C8BFA0",
68
- "syntaxString": "#9BE9A8",
69
- "syntaxNumber": "#B5CEA8",
70
- "syntaxType": "teal",
71
- "syntaxOperator": "#D4D4D4",
67
+ "syntaxFunction": "peach",
68
+ "syntaxVariable": "#E06C75",
69
+ "syntaxString": "green",
70
+ "syntaxNumber": "amber",
71
+ "syntaxType": "cyan",
72
+ "syntaxOperator": "cyan",
72
73
  "syntaxPunctuation": "#D4D4D4",
73
74
 
74
75
  "thinkingOff": "darkGray",
75
76
  "thinkingMinimal": "darkGray",
76
- "thinkingLow": "#5C5647",
77
+ "thinkingLow": "#505050",
77
78
  "thinkingMedium": "dimGray",
78
- "thinkingHigh": "#8B7A5F",
79
- "thinkingXhigh": "accentSoft",
79
+ "thinkingHigh": "#76B5BD",
80
+ "thinkingXhigh": "cyan",
80
81
 
81
82
  "bashMode": "green",
82
83
 
83
84
  "modeCode": "#5B9CF5",
84
- "modeReason": "#B4A7D6",
85
- "modeFast": "#00B894",
86
- "modeCreative": "#E17055"
85
+ "modeReason": "purple",
86
+ "modeFast": "green",
87
+ "modeCreative": "red"
87
88
  },
88
89
  "export": {
89
- "pageBg": "#13141C",
90
- "cardBg": "#1A1B26",
91
- "infoBg": "#251E14"
90
+ "pageBg": "#0A0A0A",
91
+ "cardBg": "#141414",
92
+ "infoBg": "#1A1A1A"
92
93
  }
93
94
  }