@akanjs/devkit 0.0.39 → 0.0.40

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.
@@ -0,0 +1,34 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var installExternalLib_exports = {};
20
+ __export(installExternalLib_exports, {
21
+ installExternalLib: () => installExternalLib
22
+ });
23
+ module.exports = __toCommonJS(installExternalLib_exports);
24
+ const utilGitRepo = "git@github.com:akan-team/util.git";
25
+ const sharedGitRepo = "git@github.com:akan-team/shared.git";
26
+ const installExternalLib = /* @__PURE__ */ __name(async (libName, workspace) => {
27
+ workspace.log(`Installing ${libName} library as git subtree...`);
28
+ await workspace.exec(`git remote add ${libName} git@github.com:akan-team/${libName}.git`);
29
+ await workspace.exec(`git subtree add --prefix=libs/${libName} ${libName} main`);
30
+ }, "installExternalLib");
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ installExternalLib
34
+ });
@@ -0,0 +1,3 @@
1
+ declare const selectModel: (modulePath: string) => Promise<string>;
2
+
3
+ export { selectModel };
@@ -0,0 +1,50 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var selectModel_exports = {};
30
+ __export(selectModel_exports, {
31
+ selectModel: () => selectModel
32
+ });
33
+ module.exports = __toCommonJS(selectModel_exports);
34
+ var import_prompts = require("@inquirer/prompts");
35
+ var import_fs = __toESM(require("fs"));
36
+ const selectModel = /* @__PURE__ */ __name(async (modulePath) => {
37
+ const modelNames = import_fs.default.readdirSync(`${modulePath}/lib`).filter((dir) => !dir.includes(".") && !dir.startsWith("_"));
38
+ const modelName = await (0, import_prompts.select)({
39
+ message: "Select the model to create the unit for",
40
+ choices: modelNames.map((name) => ({
41
+ name,
42
+ value: name
43
+ }))
44
+ });
45
+ return modelName;
46
+ }, "selectModel");
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ selectModel
50
+ });
@@ -0,0 +1,7 @@
1
+ interface StreamResponse {
2
+ content: string;
3
+ chunk?: string;
4
+ }
5
+ declare const streamAi: (question: string, callback: (chunk: string) => void) => Promise<StreamResponse>;
6
+
7
+ export { streamAi };
@@ -0,0 +1,69 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var streamAi_exports = {};
20
+ __export(streamAi_exports, {
21
+ streamAi: () => streamAi
22
+ });
23
+ module.exports = __toCommonJS(streamAi_exports);
24
+ var import_prompts = require("@langchain/core/prompts");
25
+ var import_runnables = require("@langchain/core/runnables");
26
+ var import_openai = require("@langchain/openai");
27
+ const streamAi = /* @__PURE__ */ __name(async (question, callback) => {
28
+ const createStreamingModel = /* @__PURE__ */ __name((apiKey = process.env.DEEPSEEK_API_KEY) => {
29
+ if (!apiKey) throw new Error(`process.env.DEEPSEEK_API_KEY is not set`);
30
+ return new import_openai.ChatOpenAI({
31
+ modelName: "deepseek-reasoner",
32
+ temperature: 0.7,
33
+ streaming: true,
34
+ configuration: {
35
+ baseURL: "https://api.deepseek.com/v1",
36
+ apiKey
37
+ }
38
+ });
39
+ }, "createStreamingModel");
40
+ const createProcessingChain = /* @__PURE__ */ __name(() => {
41
+ return import_runnables.RunnableSequence.from([
42
+ import_prompts.PromptTemplate.fromTemplate(`Answer concisely: {question}`),
43
+ createStreamingModel()
44
+ ]);
45
+ }, "createProcessingChain");
46
+ try {
47
+ const chain = createProcessingChain();
48
+ const stream = await chain.stream({
49
+ question
50
+ });
51
+ let fullResponse = "";
52
+ for await (const chunk of stream) {
53
+ const content = chunk.content;
54
+ if (typeof content === "string") {
55
+ fullResponse += content;
56
+ callback(content);
57
+ }
58
+ }
59
+ return {
60
+ content: fullResponse
61
+ };
62
+ } catch (error) {
63
+ throw new Error("Failed to stream response");
64
+ }
65
+ }, "streamAi");
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
68
+ streamAi
69
+ });
package/src/types.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ interface PackageJson {
2
+ name: string;
3
+ version: string;
4
+ main?: string;
5
+ description: string;
6
+ scripts?: Record<string, string>;
7
+ dependencies?: Record<string, string>;
8
+ devDependencies?: Record<string, string>;
9
+ peerDependencies?: Record<string, string>;
10
+ engines?: Record<string, string>;
11
+ }
12
+ interface TsConfigJson {
13
+ extends?: string;
14
+ compilerOptions: {
15
+ target: string;
16
+ paths: Record<string, string[]>;
17
+ };
18
+ }
19
+
20
+ export type { PackageJson, TsConfigJson };
package/src/types.js ADDED
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var types_exports = {};
15
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,11 @@
1
+ declare const uploadRelease: (projectName: string, { workspaceRoot, environment, buildNum, platformVersion, local, }: {
2
+ workspaceRoot: string;
3
+ environment: string;
4
+ buildNum: number;
5
+ platformVersion?: string;
6
+ local?: boolean;
7
+ }) => Promise<{
8
+ id: string;
9
+ } | null>;
10
+
11
+ export { uploadRelease };
@@ -0,0 +1,82 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var uploadRelease_exports = {};
30
+ __export(uploadRelease_exports, {
31
+ uploadRelease: () => uploadRelease
32
+ });
33
+ module.exports = __toCommonJS(uploadRelease_exports);
34
+ var import_axios = __toESM(require("axios"));
35
+ var import_form_data = __toESM(require("form-data"));
36
+ var import_fs = __toESM(require("fs"));
37
+ const uploadRelease = /* @__PURE__ */ __name(async (projectName, { workspaceRoot, environment, buildNum, platformVersion, local }) => {
38
+ const basePath = local ? "http://localhost:8080/backend" : "https://akasys.akamir.com/backend";
39
+ const buildPath = `${workspaceRoot}/releases/builds/${projectName}-release.tar.gz`;
40
+ const appBuildPath = `${workspaceRoot}/releases/builds/${projectName}-appBuild.zip`;
41
+ const sourcePath = `${workspaceRoot}/releases/sources/${projectName}-source.tar.gz`;
42
+ const formData = new import_form_data.default();
43
+ const build = import_fs.default.readFileSync(buildPath);
44
+ const source = import_fs.default.readFileSync(sourcePath);
45
+ const appBuild = import_fs.default.readFileSync(appBuildPath);
46
+ const buildStat = import_fs.default.statSync(buildPath);
47
+ const sourceStat = import_fs.default.statSync(sourcePath);
48
+ const appBuildStat = import_fs.default.statSync(appBuildPath);
49
+ formData.append("files", build, `${projectName}-release.tar.gz`);
50
+ formData.append("files", source, `${projectName}-source.tar.gz`);
51
+ formData.append("files", appBuild, `${projectName}-appBuild.zip`);
52
+ formData.append("metas", JSON.stringify([
53
+ {
54
+ lastModifiedAt: buildStat.mtime,
55
+ size: buildStat.size
56
+ },
57
+ {
58
+ lastModifiedAt: sourceStat.mtime,
59
+ size: sourceStat.size
60
+ },
61
+ {
62
+ lastModifiedAt: appBuildStat.mtime,
63
+ size: appBuildStat.size
64
+ }
65
+ ]));
66
+ formData.append("type", "release");
67
+ try {
68
+ const [buildFile, sourceFile, appBuildFile] = (await import_axios.default.post(`${basePath}/file/addFilesRestApi`, formData)).data;
69
+ const major = platformVersion ? parseInt(platformVersion.split(".")[0]) : 1;
70
+ const minor = platformVersion ? parseInt(platformVersion.split(".")[1]) : 0;
71
+ const patch = platformVersion ? parseInt(platformVersion.split(".")[2]) : 0;
72
+ const latestRelease = await import_axios.default.get(`${basePath}/release/findVersionRelease?appName=${projectName}&branch=${environment}&major=${major}&minor=${minor}`);
73
+ const release = (await import_axios.default.post(`${basePath}/release/pushRelease/${projectName}/${environment}/${major}/${minor}/${sourceFile.id}/${buildFile.id}/${appBuildFile.id}`)).data;
74
+ return release;
75
+ } catch (e) {
76
+ return null;
77
+ }
78
+ }, "uploadRelease");
79
+ // Annotate the CommonJS export names for ESM import in node:
80
+ 0 && (module.exports = {
81
+ uploadRelease
82
+ });