fullstacked 0.12.0-1186 → 0.12.0-1198

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.
@@ -1,6 +1,6 @@
1
1
  import * as aiAgent from "@fullstacked/ai-agent";
2
2
  import { z as zod } from "zod";
3
- export * from "./tools/fs";
3
+ export * from "./tools/fs";
4
4
  import { createToolFS } from "./tools/fs";
5
5
 
6
6
  export * from "@fullstacked/ai-agent";
@@ -2,4 +2,4 @@
2
2
  "main": "./index.js",
3
3
  "name": "ai",
4
4
  "version": "0.0.0"
5
- }
5
+ }
@@ -6,13 +6,13 @@ import _fs from "fs";
6
6
  const fs: typeof fsType = _fs;
7
7
 
8
8
  type ToolFSOptions = {
9
- baseDirectory: string
10
- }
9
+ baseDirectory: string;
10
+ };
11
11
 
12
12
  export function createToolFS(opts?: Partial<ToolFSOptions>) {
13
13
  let basePath = opts?.baseDirectory || "";
14
14
 
15
- if(basePath !== "" && !basePath.endsWith("/")) {
15
+ if (basePath !== "" && !basePath.endsWith("/")) {
16
16
  basePath += "/";
17
17
  }
18
18
 
@@ -57,4 +57,4 @@ export function createToolFS(opts?: Partial<ToolFSOptions>) {
57
57
  message: ({ path }) => `Writing to \`${path}\``
58
58
  })
59
59
  ];
60
- }
60
+ }
@@ -25,7 +25,7 @@ export let bridge: Bridge;
25
25
  switch (platform) {
26
26
  case Platform.NODE:
27
27
  bridge = BridgeNode;
28
- initCallbackNode();
28
+ await initCallbackNode();
29
29
  break;
30
30
  case Platform.APPLE:
31
31
  bridge = BridgeApple;
@@ -47,7 +47,7 @@ switch (platform) {
47
47
  break;
48
48
  case Platform.LINUX_QT:
49
49
  bridge = BridgeLinuxQT;
50
- initRespondLinuxQT();
50
+ await initRespondLinuxQT();
51
51
  break;
52
52
  case Platform.ELECTRON:
53
53
  bridge = BridgeElectron;
@@ -60,9 +60,9 @@ console.log("FullStacked");
60
60
  bridge(new Uint8Array([0]));
61
61
 
62
62
  let lastUpdateCheck = 0;
63
- const updateCheckDelay = 1000 * 10 // 10sec;
63
+ const updateCheckDelay = 1000 * 10; // 10sec;
64
64
  async function checkForUpdates() {
65
- window.requestAnimationFrame(checkForUpdates)
65
+ window.requestAnimationFrame(checkForUpdates);
66
66
 
67
67
  const now = Date.now();
68
68
  if (now - lastUpdateCheck < updateCheckDelay) {
@@ -71,7 +71,7 @@ async function checkForUpdates() {
71
71
 
72
72
  lastUpdateCheck = now;
73
73
 
74
- if (await git.pull() !== git.PullResponse.DID_PULL) {
74
+ if ((await git.pull()) !== git.PullResponse.DID_PULL) {
75
75
  return;
76
76
  }
77
77
 
@@ -82,22 +82,20 @@ async function checkForUpdates() {
82
82
  preventReloadButton.onclick = () => {
83
83
  preventReload = true;
84
84
  snackbar.dismiss();
85
- }
85
+ };
86
86
 
87
87
  const snackbar = SnackBar({
88
88
  message: "Project has updated. Rebuilding...",
89
89
  button: preventReloadButton
90
90
  });
91
91
 
92
- buildSASS(fs)
93
- .then(() => {
94
- esbuild.build().then(() => {
95
- snackbar.dismiss();
96
- if (preventReload) return;
97
- window.location.reload();
98
- });
92
+ buildSASS(fs).then(() => {
93
+ esbuild.build().then(() => {
94
+ snackbar.dismiss();
95
+ if (preventReload) return;
96
+ window.location.reload();
99
97
  });
100
-
98
+ });
101
99
  }
102
100
  if (await git.hasGit()) {
103
101
  checkForUpdates();
@@ -117,4 +115,4 @@ setInterval(() => {
117
115
  setTitle(document.title);
118
116
  }
119
117
  lastTitleSeen = document.title;
120
- }, 500);
118
+ }, 500);
@@ -37,7 +37,6 @@ export const BridgeLinuxGTK: Bridge = (
37
37
 
38
38
  export function initRespondLinuxGTK() {
39
39
  globalThis.respond = (base64: string) => {
40
- console.log(base64);
41
40
  const data = toByteArray(base64);
42
41
  const id = bytesToNumber(data.slice(0, 4));
43
42
  console.log(id);
@@ -51,18 +51,27 @@ export const BridgeLinuxQT: Bridge = (
51
51
  export async function initRespondLinuxQT() {
52
52
  const script = document.createElement("script");
53
53
  script.src = "qrc:///qtwebchannel/qwebchannel.js";
54
- script.onload = () => {
55
- new globalThis.QWebChannel(globalThis.qt.webChannelTransport, (c) => {
56
- channel = c;
57
- pendingRequests.forEach(({ payload, transformer, resolve }) => {
58
- respond(payload, transformer).then(resolve);
59
- });
60
- channel.objects.bridge.core_message.connect(
61
- function (type, message) {
62
- globalThis.oncoremessage(type, message);
54
+ return new Promise<void>((channelReady) => {
55
+ script.onload = () => {
56
+ new globalThis.QWebChannel(
57
+ globalThis.qt.webChannelTransport,
58
+ (c) => {
59
+ channel = c;
60
+ pendingRequests.forEach(
61
+ ({ payload, transformer, resolve }) => {
62
+ respond(payload, transformer).then(resolve);
63
+ }
64
+ );
65
+ channel.objects.bridge.core_message.connect(function (
66
+ type: string,
67
+ message: string
68
+ ) {
69
+ globalThis.oncoremessage(type, message);
70
+ });
71
+ channelReady();
63
72
  }
64
73
  );
65
- });
66
- };
67
- document.body.append(script);
74
+ };
75
+ document.body.append(script);
76
+ });
68
77
  }
@@ -24,9 +24,12 @@ export const BridgeNode: Bridge = async (
24
24
  export function initCallbackNode() {
25
25
  const url = new URL(globalThis.location.href);
26
26
  url.protocol = "ws:";
27
- const ws = new WebSocket(url.toString());
28
- ws.onmessage = (e) => {
29
- const [type, message] = JSON.parse(e.data);
30
- globalThis.oncoremessage(type, message);
31
- };
27
+ return new Promise<void>((wsReady) => {
28
+ const ws = new WebSocket(url.toString());
29
+ ws.onmessage = (e) => {
30
+ const [type, message] = JSON.parse(e.data);
31
+ globalThis.oncoremessage(type, message);
32
+ };
33
+ ws.onopen = () => wsReady();
34
+ });
32
35
  }
@@ -2,7 +2,6 @@ import { CONFIG_DATA_TYPE, CONFIG_TYPE } from "../../editor/types";
2
2
  import { bridge } from "../bridge";
3
3
  import { serializeArgs } from "../bridge/serialization";
4
4
 
5
-
6
5
  export function get<T extends CONFIG_TYPE>(
7
6
  configType: T,
8
7
  checkExists: boolean = false
@@ -57,18 +57,12 @@ export function build(project?: Project): Promise<Message[]> {
57
57
  addedListener = true;
58
58
  }
59
59
 
60
-
61
- const args: any[] = project
62
- ? [project.id]
63
- : []
60
+ const args: any[] = project ? [project.id] : [];
64
61
 
65
62
  const buildId = getLowestKeyIdAvailable(activeBuilds);
66
- args.push(buildId)
63
+ args.push(buildId);
67
64
 
68
- const payload = new Uint8Array([
69
- 56,
70
- ...serializeArgs(args)
71
- ]);
65
+ const payload = new Uint8Array([56, ...serializeArgs(args)]);
72
66
 
73
67
  return new Promise((resolve) => {
74
68
  activeBuilds.set(buildId, {
@@ -18,7 +18,7 @@ export async function buildSASS(
18
18
  ? `${baseDirectory}/.build`
19
19
  : ".build";
20
20
  await fs.mkdir(buildDirectory);
21
- console.log(buildDirectory + "/index.css", css)
21
+ console.log(buildDirectory + "/index.css", css);
22
22
  await fs.writeFile(buildDirectory + "/index.css", css);
23
23
  };
24
24
 
@@ -27,7 +27,7 @@ export async function buildSASS(
27
27
  (item) => item === "index.sass" || item === "index.scss"
28
28
  );
29
29
 
30
- console.log(entryPointSASS)
30
+ console.log(entryPointSASS);
31
31
 
32
32
  // check for css file and write to output
33
33
  // esbuild will pick it up and merge with css in js
@@ -69,8 +69,8 @@ export async function buildSASS(
69
69
  syntax: filePath.endsWith(".sass")
70
70
  ? "indented"
71
71
  : filePath.endsWith(".scss")
72
- ? "scss"
73
- : "css",
72
+ ? "scss"
73
+ : "css",
74
74
  contents
75
75
  };
76
76
  },
@@ -3,28 +3,26 @@ import { serializeArgs } from "../bridge/serialization";
3
3
  import core_message from "../core_message";
4
4
  import { Project } from "../../editor/types";
5
5
 
6
- const pullPromises = new Map<string, ((pullResponse: PullResponse) => void)[]>();
6
+ const pullPromises = new Map<
7
+ string,
8
+ ((pullResponse: PullResponse) => void)[]
9
+ >();
7
10
  let addedListener = false;
8
11
  function setListenerOnce() {
9
12
  if (addedListener) return;
10
13
 
11
14
  core_message.addListener("git-pull", (message) => {
12
- console.log(message);
13
15
  const { url, data, finished } = JSON.parse(message);
14
16
  if (!finished) return;
15
17
  const promises = pullPromises.get(url);
16
18
  promises?.forEach((resolve) => resolve(data));
17
19
  pullPromises.delete(url);
18
20
  });
19
-
20
- core_message.addListener("git-push", console.log);
21
-
22
21
  addedListener = true;
23
22
  }
24
23
 
25
24
  // 81
26
25
  export function gitAuthResponse(id: number, success: boolean) {
27
- console.log(id, success);
28
26
  const payload = new Uint8Array([81, ...serializeArgs([id, success])]);
29
27
  bridge(payload);
30
28
  }
@@ -36,10 +34,10 @@ export function clone(url: string, into: string) {
36
34
  }
37
35
 
38
36
  // 71
39
- export function head(projectId: string): Promise<{ name: string; hash: string }> {
40
- const payload = new Uint8Array([71,
41
- ...serializeArgs([projectId])
42
- ]);
37
+ export function head(
38
+ projectId: string
39
+ ): Promise<{ name: string; hash: string }> {
40
+ const payload = new Uint8Array([71, ...serializeArgs([projectId])]);
43
41
 
44
42
  const transformer = ([name, hash]) => {
45
43
  return { name, hash };
@@ -100,9 +98,7 @@ export enum PullResponse {
100
98
  export async function pull(project?: Project): Promise<PullResponse> {
101
99
  setListenerOnce();
102
100
 
103
- const args = project
104
- ? serializeArgs([project.id])
105
- : [];
101
+ const args = project ? serializeArgs([project.id]) : [];
106
102
 
107
103
  const payload = new Uint8Array([73, ...args]);
108
104
 
@@ -208,31 +204,20 @@ export function branchDelete(project: Project, branch: string) {
208
204
  return bridge(payload);
209
205
  }
210
206
 
211
-
212
207
  // 82
213
208
  export function hasGit(project?: Project) {
214
- const args = project
215
- ? [project.id]
216
- : [];
209
+ const args = project ? [project.id] : [];
217
210
 
218
- const payload = new Uint8Array([
219
- 82,
220
- ...serializeArgs(args)
221
- ]);
211
+ const payload = new Uint8Array([82, ...serializeArgs(args)]);
222
212
 
223
213
  return bridge(payload, ([hasGit]) => hasGit);
224
214
  }
225
215
 
226
216
  // 83
227
217
  export function remoteUrl(project?: Project) {
228
- const args = project
229
- ? [project.id]
230
- : [];
218
+ const args = project ? [project.id] : [];
231
219
 
232
- const payload = new Uint8Array([
233
- 83,
234
- ...serializeArgs(args)
235
- ]);
220
+ const payload = new Uint8Array([83, ...serializeArgs(args)]);
236
221
 
237
222
  return bridge(payload, ([url]) => url);
238
- }
223
+ }
@@ -1,9 +1,11 @@
1
1
  import { Project } from "../../editor/types";
2
2
  import { bridge } from "../bridge";
3
- import { getLowestKeyIdAvailable, serializeArgs } from "../bridge/serialization";
3
+ import {
4
+ getLowestKeyIdAvailable,
5
+ serializeArgs
6
+ } from "../bridge/serialization";
4
7
  import core_message from "../core_message";
5
8
 
6
-
7
9
  const activeInstallations = new Map<
8
10
  number,
9
11
  {
@@ -37,7 +39,6 @@ type InstallationProgressCb = (
37
39
  packages: [string, PackageInfoProgress][]
38
40
  ) => void;
39
41
 
40
-
41
42
  function installationsListener(messageStr: string) {
42
43
  const message = JSON.parse(messageStr) as { id: number };
43
44
 
@@ -83,10 +84,7 @@ let addedListener = false;
83
84
  function setListenerOnce() {
84
85
  if (addedListener) return;
85
86
 
86
- core_message.addListener(
87
- "packages-installation",
88
- installationsListener
89
- );
87
+ core_message.addListener("packages-installation", installationsListener);
90
88
 
91
89
  addedListener = true;
92
90
  }
@@ -119,14 +117,15 @@ export function install(
119
117
  }
120
118
 
121
119
  //61
122
- export function installQuick(project?: Project, progress?: InstallationProgressCb) {
120
+ export function installQuick(
121
+ project?: Project,
122
+ progress?: InstallationProgressCb
123
+ ) {
123
124
  setListenerOnce();
124
125
 
125
126
  const installationId = getLowestKeyIdAvailable(activeInstallations);
126
127
 
127
- let args: any[] = project
128
- ? [project.id, installationId]
129
- : [installationId];
128
+ let args: any[] = project ? [project.id, installationId] : [installationId];
130
129
 
131
130
  const payload = new Uint8Array([61, ...serializeArgs(args)]);
132
131
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fullstacked",
3
- "version": "0.12.0-1186",
3
+ "version": "0.12.0-1198",
4
4
  "scripts": {
5
5
  "build": "node build.js",
6
6
  "start": "npm run build && node index.js --lib ../../core/bin --root ~/FullStacked --config ~/.config/fullstacked --editor ../../out/editor",