@floegence/floe-webapp-core 0.81.2 → 0.81.3

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,5 +1,5 @@
1
- import { normalizeTerminalWorkspaceProfile as T } from "./workspaceProfile.js";
2
- const y = {
1
+ import { normalizeTerminalWorkspaceProfile as z } from "./workspaceProfile.js";
2
+ const A = {
3
3
  "README.md": `# Floe Webapp
4
4
  Terminal-first demo workspace with a mobile keyboard.`,
5
5
  "package.json": `{
@@ -26,8 +26,8 @@ VITE_FLOE_ENDPOINT_ID=demo-endpoint`,
26
26
  "scripts/dev.mjs": `import { spawn } from 'node:child_process';
27
27
 
28
28
  spawn('pnpm', ['--filter', '@floegence/floe-webapp-demo', 'dev'], { stdio: 'inherit' });`
29
- }, B = (s, r) => {
30
- const n = T(r?.profile), u = r?.resolveNow ?? (() => (/* @__PURE__ */ new Date()).toString()), e = s.trim();
29
+ }, G = (i, n) => {
30
+ const r = z(n?.profile), a = n?.resolveNow ?? (() => (/* @__PURE__ */ new Date()).toString()), e = i.trim();
31
31
  if (!e)
32
32
  return {
33
33
  clear: !1,
@@ -39,28 +39,28 @@ spawn('pnpm', ['--filter', '@floegence/floe-webapp-demo', 'dev'], { stdio: 'inhe
39
39
  "Available commands:",
40
40
  'pwd, ls, ls -la, cat <file>, less <file>, head -n <count> <file>, tail -n <count> <file>, wc -l|-w|-c <file>, mkdir -p <dir>, touch <file>, chmod <mode> <target>, clear, date, echo <text>, echo "$PATH", echo "$SHELL"',
41
41
  "git status, git diff, git log --oneline -10, git add ., git checkout -b <branch>, git commit -m <message>",
42
- `pnpm ${n.scripts.join(", pnpm ")}`,
42
+ `pnpm ${r.scripts.join(", pnpm ")}`,
43
43
  "find . -name <pattern>, grep -R <pattern> src/, grep -n <pattern> <file>, grep -i <pattern> <file>, sort <file>, cut <options> <file>, uname -a, vim <file>, sed -n <range> <file>, awk <program> <file>",
44
44
  "curl -I|-L <url>, tar -czf|-xzf|-tf <archive>, ssh <host>, scp <src> <dest>"
45
45
  ].join(`
46
46
  `)
47
47
  );
48
48
  if (e === "pwd")
49
- return t(n.cwd);
49
+ return t(r.cwd);
50
50
  if (e === "ls" || e === "ls -la") {
51
- const i = [...n.directories, ...n.files];
51
+ const s = [...r.directories, ...r.files];
52
52
  return t(
53
- e === "ls" ? i.join(" ") : [
54
- ...n.directories.map((o) => `drwxr-xr-x ${o}`),
55
- ...n.files.map((o) => `-rw-r--r-- ${o}`)
53
+ e === "ls" ? s.join(" ") : [
54
+ ...r.directories.map((o) => `drwxr-xr-x ${o}`),
55
+ ...r.files.map((o) => `-rw-r--r-- ${o}`)
56
56
  ].join(`
57
57
  `)
58
58
  );
59
59
  }
60
60
  if (e.startsWith("ls ")) {
61
- const i = e.slice(3).trim().replace(/\/$/, "");
62
- if (n.directories.includes(i))
63
- return t(i === "packages" ? "boot core init protocol" : i === "apps" ? "demo" : i === "src" ? "app.ts widgets terminal components" : `${i}/`);
61
+ const s = e.slice(3).trim().replace(/\/$/, "");
62
+ if (r.directories.includes(s))
63
+ return t(s === "packages" ? "boot core init protocol" : s === "apps" ? "demo" : s === "src" ? "app.ts widgets terminal components" : `${s}/`);
64
64
  }
65
65
  if (e === "clear")
66
66
  return {
@@ -68,7 +68,7 @@ spawn('pnpm', ['--filter', '@floegence/floe-webapp-demo', 'dev'], { stdio: 'inhe
68
68
  lines: []
69
69
  };
70
70
  if (e === "date")
71
- return t(u());
71
+ return t(a());
72
72
  if (e === 'echo "$PATH"')
73
73
  return t("/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin");
74
74
  if (e === 'echo "$SHELL"')
@@ -93,97 +93,98 @@ c942cb5 add terminal-first mobile keyboard
93
93
  37fa316 release 0.35.7`);
94
94
  if (e === "git add .")
95
95
  return t("staged tracked changes");
96
- const f = e.match(/^git checkout -b\s+(.+)$/);
96
+ const f = e.match(/^git checkout -b\s+(\S.*)$/);
97
97
  if (f)
98
98
  return t(`Switched to a new branch '${f[1]}'`);
99
- const m = e.match(/^git commit -m\s+"(.+)"$/);
100
- if (m)
101
- return t(`[main abc1234] ${m[1]}
99
+ const u = e.match(/^git commit -m\s+"(.+)"$/);
100
+ if (u)
101
+ return t(`[main abc1234] ${u[1]}
102
102
  3 files changed, 42 insertions(+), 8 deletions(-)`);
103
- const d = e.match(/^cat\s+(.+)$/);
103
+ const d = e.match(/^cat\s+(\S.*)$/);
104
104
  if (d) {
105
- const i = p(n.files, d[1] ?? "");
106
- if (i)
107
- return t(i);
105
+ const s = p(r.files, d[1] ?? "");
106
+ if (s)
107
+ return t(s);
108
108
  }
109
- const j = e.match(/^vim\s+(.+)$/);
110
- if (j) {
111
- const i = l(j[1] ?? ""), o = p(n.files, i);
109
+ const S = e.match(/^vim\s+(\S.*)$/);
110
+ if (S) {
111
+ const s = m(S[1] ?? ""), o = p(r.files, s);
112
112
  if (o)
113
- return t(S(i, o));
113
+ return t(_(s, o));
114
114
  }
115
115
  const $ = e.match(/^pnpm\s+([a-z0-9:-]+)$/i);
116
- if ($ && n.scripts.includes($[1] ?? ""))
116
+ if ($ && r.scripts.includes($[1] ?? ""))
117
117
  return t(`> pnpm ${$[1]}
118
118
  completed mock run for script '${$[1]}'`);
119
- if (e.match(/^find \. -name\s+(.+)$/))
119
+ if (e.match(/^find \. -name\s+(\S.*)$/))
120
120
  return t(["./README.md", "./packages/core/src/terminal/suggestionEngine.ts"].join(`
121
121
  `));
122
- if (e.match(/^grep -R\s+(.+)\s+src\/?$/))
122
+ const j = e.match(/^grep -R\s+(\S.*)$/)?.[1], L = j ? C(j) : null;
123
+ if (L && ["src", "src/"].includes(L[1]))
123
124
  return t("src/terminal/suggestionEngine.ts:getTerminalSuggestions");
124
- const b = e.match(/^grep\s+(-n|-i)\s+(.+?)\s+(.+)$/);
125
+ const b = e.match(/^grep\s+(-n|-i)\s+(\S+)\s+(\S.*)$/);
125
126
  if (b) {
126
- const i = b[1] ?? "", o = C(b[2] ?? ""), c = l(b[3] ?? ""), a = p(n.files, c);
127
- if (a)
128
- return t(W(a, c, o, i));
127
+ const s = b[1] ?? "", o = D(b[2] ?? ""), c = m(b[3] ?? ""), l = p(r.files, c);
128
+ if (l)
129
+ return t(P(l, c, o, s));
129
130
  }
130
- const v = e.match(/^less\s+(.+)$/);
131
+ const v = e.match(/^less\s+(\S.*)$/);
131
132
  if (v) {
132
- const i = l(v[1] ?? ""), o = p(n.files, i);
133
+ const s = m(v[1] ?? ""), o = p(r.files, s);
133
134
  if (o)
134
135
  return t(`${o}
135
136
  (END)`);
136
137
  }
137
- const L = e.match(/^mkdir\s+-p\s+(.+)$/);
138
- if (L)
139
- return t(`created directory ${l(L[1] ?? "")}`);
140
- const N = e.match(/^touch\s+(.+)$/);
138
+ const N = e.match(/^mkdir\s+-p\s+(\S.*)$/);
141
139
  if (N)
142
- return t(`updated timestamp for ${l(N[1] ?? "")}`);
143
- const M = e.match(/^chmod\s+(.+?)\s+(.+)$/);
144
- if (M)
140
+ return t(`created directory ${m(N[1] ?? "")}`);
141
+ const T = e.match(/^touch\s+(\S.*)$/);
142
+ if (T)
143
+ return t(`updated timestamp for ${m(T[1] ?? "")}`);
144
+ const w = e.match(/^chmod\s+(\S+)\s+(\S.*)$/);
145
+ if (w)
145
146
  return t(
146
- `mode ${M[1] ?? ""} applied to ${l(M[2] ?? "")}`
147
+ `mode ${w[1] ?? ""} applied to ${m(w[2] ?? "")}`
147
148
  );
148
- const h = e.match(/^head(?:\s+-n\s+(\d+))?(?:\s+-c\s+(\d+))?\s+(.+)$/);
149
+ const h = e.match(/^head(?:\s+-n\s+(\d+))?(?:\s+-c\s+(\d+))?\s+(\S.*)$/);
149
150
  if (h) {
150
- const i = Number(h[1] ?? 10), o = h[2] ? Number(h[2]) : null, c = l(h[3] ?? ""), a = p(n.files, c);
151
- if (a)
151
+ const s = Number(h[1] ?? 10), o = h[2] ? Number(h[2]) : null, c = m(h[3] ?? ""), l = p(r.files, c);
152
+ if (l)
152
153
  return t(
153
- o === null ? z(a, i) : a.slice(0, Math.max(0, o))
154
+ o === null ? R(l, s) : l.slice(0, Math.max(0, o))
154
155
  );
155
156
  }
156
- const g = e.match(/^tail(?:\s+-n\s+(\d+))?(?:\s+-c\s+(\d+))?\s+(.+)$/);
157
+ const g = e.match(/^tail(?:\s+-n\s+(\d+))?(?:\s+-c\s+(\d+))?\s+(\S.*)$/);
157
158
  if (g) {
158
- const i = Number(g[1] ?? 10), o = g[2] ? Number(g[2]) : null, c = l(g[3] ?? ""), a = p(n.files, c);
159
- if (a)
159
+ const s = Number(g[1] ?? 10), o = g[2] ? Number(g[2]) : null, c = m(g[3] ?? ""), l = p(r.files, c);
160
+ if (l)
160
161
  return t(
161
- o === null ? D(a, i) : a.slice(Math.max(0, a.length - Math.max(0, o)))
162
+ o === null ? W(l, s) : l.slice(Math.max(0, l.length - Math.max(0, o)))
162
163
  );
163
164
  }
164
- const w = e.match(/^wc\s+(-[lwc])\s+(.+)$/);
165
- if (w) {
166
- const i = w[1] ?? "", o = l(w[2] ?? ""), c = p(n.files, o);
165
+ const M = e.match(/^wc\s+(-[lwc])\s+(\S.*)$/);
166
+ if (M) {
167
+ const s = M[1] ?? "", o = m(M[2] ?? ""), c = p(r.files, o);
167
168
  if (c)
168
- return t(A(c, o, i));
169
+ return t(O(c, o, s));
169
170
  }
170
- const x = e.match(/^sort(?:\s+(-u|-r))?\s+(.+)$/);
171
+ const x = e.match(/^sort(?:\s+(-u|-r))?\s+(\S.*)$/);
171
172
  if (x) {
172
- const i = x[1] ?? "", o = l(x[2] ?? ""), c = p(n.files, o);
173
+ const s = x[1] ?? "", o = m(x[2] ?? ""), c = p(r.files, o);
173
174
  if (c)
174
- return t(F(c, i));
175
+ return t(I(c, s));
175
176
  }
176
- const E = e.match(/^cut\s+(.+)\s+(.+)$/);
177
+ const y = e.match(/^cut\s+(\S.*)$/)?.[1], E = y ? C(y) : null;
177
178
  if (E) {
178
- const i = E[1] ?? "", o = l(E[2] ?? ""), c = p(n.files, o);
179
+ const s = E[0], o = m(E[1]), c = p(r.files, o);
179
180
  if (c)
180
- return t(_(c, i));
181
+ return t(B(c, s));
181
182
  }
182
- const k = e.match(/^sed -n '(\d+),(\d+)p'\s+(.+)$/);
183
+ const k = e.match(/^sed -n '(\d+),(\d+)p'\s+(\S.*)$/);
183
184
  if (k) {
184
- const i = Number(k[1] ?? 1), o = Number(k[2] ?? i), c = l(k[3] ?? ""), a = p(n.files, c);
185
- if (a)
186
- return t(R(a, i, o));
185
+ const s = Number(k[1] ?? 1), o = Number(k[2] ?? s), c = m(k[3] ?? ""), l = p(r.files, c);
186
+ if (l)
187
+ return t(F(l, s, o));
187
188
  }
188
189
  return e === "sed -E 's/floe/Floe/g' README.md" ? t(`# Floe Webapp
189
190
  Terminal-first demo workspace with a mobile keyboard.`) : e === "awk '{print $1}' package.json" ? t(["{", '"name":', '"scripts":', '"dev":', '"build":', "}", "}"].join(`
@@ -210,78 +211,85 @@ Last login: Tue Mar 17 22:00:00 2026`) : e === "ssh -p 22 user@example.com" ? t(
210
211
  ]
211
212
  };
212
213
  };
213
- function t(s) {
214
+ function t(i) {
214
215
  return {
215
216
  clear: !1,
216
217
  lines: [
217
218
  {
218
219
  type: "output",
219
- content: s
220
+ content: i
220
221
  }
221
222
  ]
222
223
  };
223
224
  }
224
- function p(s, r) {
225
- const n = l(r);
226
- return !n || !s.includes(n) ? null : y[n] ?? `// Mock contents for ${n}
225
+ function p(i, n) {
226
+ const r = m(n);
227
+ return !r || !i.includes(r) ? null : A[r] ?? `// Mock contents for ${r}
227
228
  // Generated by the shared terminal runtime.`;
228
229
  }
229
- function l(s) {
230
- return s.trim().replace(/\/$/, "");
230
+ function m(i) {
231
+ return i.trim().replace(/\/$/, "");
231
232
  }
232
- function C(s) {
233
- const r = s.trim();
234
- return r.startsWith('"') && r.endsWith('"') || r.startsWith("'") && r.endsWith("'") ? r.slice(1, -1) : r;
233
+ function D(i) {
234
+ const n = i.trim();
235
+ return n.startsWith('"') && n.endsWith('"') || n.startsWith("'") && n.endsWith("'") ? n.slice(1, -1) : n;
235
236
  }
236
- function z(s, r) {
237
- return s.split(`
238
- `).slice(0, Math.max(0, r)).join(`
237
+ function R(i, n) {
238
+ return i.split(`
239
+ `).slice(0, Math.max(0, n)).join(`
239
240
  `);
240
241
  }
241
- function D(s, r) {
242
- return s.split(`
243
- `).slice(-Math.max(0, r)).join(`
242
+ function W(i, n) {
243
+ return i.split(`
244
+ `).slice(-Math.max(0, n)).join(`
244
245
  `);
245
246
  }
246
- function R(s, r, n) {
247
- return s.split(`
248
- `).slice(Math.max(0, r - 1), Math.max(r - 1, n)).join(`
247
+ function F(i, n, r) {
248
+ return i.split(`
249
+ `).slice(Math.max(0, n - 1), Math.max(n - 1, r)).join(`
249
250
  `);
250
251
  }
251
- function S(s, r) {
252
- return `"${s}" ${r.split(`
253
- `).length}L, ${r.length}B
252
+ function _(i, n) {
253
+ return `"${i}" ${n.split(`
254
+ `).length}L, ${n.length}B
254
255
  ~
255
- Mock vim session opened for ${s}`;
256
+ Mock vim session opened for ${i}`;
256
257
  }
257
- function A(s, r, n) {
258
- return n === "-l" ? `${s.split(`
259
- `).length} ${r}` : n === "-w" ? `${s.trim().split(/\s+/).filter(Boolean).length} ${r}` : `${s.length} ${r}`;
258
+ function O(i, n, r) {
259
+ return r === "-l" ? `${i.split(`
260
+ `).length} ${n}` : r === "-w" ? `${i.trim().split(/\s+/).filter(Boolean).length} ${n}` : `${i.length} ${n}`;
260
261
  }
261
- function W(s, r, n, u) {
262
- if (!n)
263
- return `${r}: pattern is empty`;
264
- const e = u === "-i" ? n.toLowerCase() : n;
265
- return s.split(`
266
- `).map((m, d) => ({ line: m, index: d })).filter(
267
- ({ line: m }) => (u === "-i" ? m.toLowerCase() : m).includes(e)
268
- ).map(({ line: m, index: d }) => u === "-n" ? `${d + 1}:${m}` : m).join(`
269
- `) || `${r}: no matches`;
262
+ function P(i, n, r, a) {
263
+ if (!r)
264
+ return `${n}: pattern is empty`;
265
+ const e = a === "-i" ? r.toLowerCase() : r;
266
+ return i.split(`
267
+ `).map((u, d) => ({ line: u, index: d })).filter(
268
+ ({ line: u }) => (a === "-i" ? u.toLowerCase() : u).includes(e)
269
+ ).map(({ line: u, index: d }) => a === "-n" ? `${d + 1}:${u}` : u).join(`
270
+ `) || `${n}: no matches`;
270
271
  }
271
- function F(s, r) {
272
- const u = [...s.split(`
272
+ function I(i, n) {
273
+ const a = [...i.split(`
273
274
  `)].sort((e, f) => e.localeCompare(f));
274
- return r === "-u" ? [...new Set(u)].join(`
275
- `) : r === "-r" ? u.reverse().join(`
276
- `) : u.join(`
275
+ return n === "-u" ? [...new Set(a)].join(`
276
+ `) : n === "-r" ? a.reverse().join(`
277
+ `) : a.join(`
277
278
  `);
278
279
  }
279
- function _(s, r) {
280
- const n = r.match(/-d\s+"([^"]+)"/), u = r.match(/-f\s+(\d+)/), e = n?.[1] ?? " ", f = Math.max(1, Number(u?.[1] ?? 1)) - 1;
281
- return s.split(`
282
- `).map((m) => m.split(e)[f] ?? "").join(`
280
+ function B(i, n) {
281
+ const r = n.match(/-d\s+"([^"]+)"/), a = n.match(/-f\s+(\d+)/), e = r?.[1] ?? " ", f = Math.max(1, Number(a?.[1] ?? 1)) - 1;
282
+ return i.split(`
283
+ `).map((u) => u.split(e)[f] ?? "").join(`
283
284
  `);
284
285
  }
286
+ function C(i) {
287
+ let n = i.length - 1;
288
+ for (; n >= 0 && !/\s/.test(i[n]); ) n -= 1;
289
+ if (n < 0) return null;
290
+ const r = i.slice(n + 1), a = i.slice(0, n).trimEnd();
291
+ return a ? [a, r] : null;
292
+ }
285
293
  export {
286
- B as runTerminalMockCommand
294
+ G as runTerminalMockCommand
287
295
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.81.2",
3
+ "version": "0.81.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -152,9 +152,10 @@
152
152
  "dependencies": {
153
153
  "clsx": "^2.1.1",
154
154
  "diff": "^8.0.4",
155
+ "dompurify": "^3.4.15",
155
156
  "marked": "^17.0.6",
156
157
  "mermaid": "^11.17.2",
157
- "monaco-editor": "^0.55.1",
158
+ "monaco-editor": "^0.57.0",
158
159
  "pdfjs-dist": "6.3.289",
159
160
  "shiki": "^3.23.0",
160
161
  "solid-motionone": "^1.0.4",