smart-home-engine 1.52.0 → 1.52.1

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,4 +1,4 @@
1
- import{m as O}from"./monaco-langs-DKJI_o9J.js";import{t as I}from"./index-CD6lY3HK.js";/*!-----------------------------------------------------------------------------
1
+ import{m as O}from"./monaco-langs-DKJI_o9J.js";import{t as I}from"./index-ClJLf8-l.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -175,10 +175,10 @@
175
175
  }
176
176
  })();
177
177
  </script>
178
- <script type="module" crossorigin src="/assets/index-CD6lY3HK.js"></script>
178
+ <script type="module" crossorigin src="/assets/index-ClJLf8-l.js"></script>
179
179
  <link rel="modulepreload" crossorigin href="/assets/monaco-langs-DKJI_o9J.js">
180
180
  <link rel="stylesheet" crossorigin href="/assets/monaco-langs-DyX1CsEw.css">
181
- <link rel="stylesheet" crossorigin href="/assets/index-BswjzIm1.css">
181
+ <link rel="stylesheet" crossorigin href="/assets/index-C5e-98I_.css">
182
182
  </head>
183
183
  <body>
184
184
  <div id="app"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-home-engine",
3
- "version": "1.52.0",
3
+ "version": "1.52.1",
4
4
  "description": "Node.js based script runner for use in MQTT based Smart Home environments",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/web/ai-api.js CHANGED
@@ -858,13 +858,17 @@ function publishContext(ai, context, send) {
858
858
  confirm: (req) =>
859
859
  new Promise((resolve) => {
860
860
  const id = 'p' + crypto.randomBytes(4).toString('hex');
861
+ // the chat learns how the request ended (a click, or the two minutes passing), so the card never
862
+ // offers a button for a request the daemon has already forgotten
861
863
  const timer = setTimeout(() => {
862
864
  _pendingPublish.delete(id);
865
+ send?.({ type: 'publish_decided', id, decided: 'timeout' });
863
866
  resolve('timeout');
864
867
  }, PUBLISH_CONFIRM_MS);
865
868
  _pendingPublish.set(id, (ok) => {
866
869
  clearTimeout(timer);
867
870
  _pendingPublish.delete(id);
871
+ send?.({ type: 'publish_decided', id, decided: ok ? 'published' : 'skipped' });
868
872
  resolve(!!ok);
869
873
  });
870
874
  send?.({ type: 'publish_request', id, ...req });
@@ -874,7 +878,7 @@ function publishContext(ai, context, send) {
874
878
 
875
879
  router.post('/publish/:id', (req, res) => {
876
880
  const resolve = _pendingPublish.get(req.params.id);
877
- if (!resolve) return res.status(404).json({ error: 'no pending publish with that id (answered or expired)' });
881
+ if (!resolve) return res.status(410).json({ error: 'this publish request was already answered or expired (two minutes); ask the assistant again' });
878
882
  resolve(req.body?.ok === true);
879
883
  res.json({ ok: true });
880
884
  });
@@ -58,7 +58,7 @@ function houseSection(cfg, entries, instances, notes) {
58
58
  const known = (instances || []).filter((i) => i.adapter).map((i) => `\`${i.instance}/\` ${i.adapter}${i.connected === 0 ? ' (offline)' : ''}`);
59
59
  if (known.length) lines.push(`- adapter instances: ${known.slice(0, 20).join(', ')}${known.length > 20 ? ` … (${known.length})` : ''}`);
60
60
  if (notes && notes.length) {
61
- lines.push('- facts the user confirmed earlier (trust them over guesses):');
61
+ lines.push('- your memory, facts from earlier chats (trust them over guesses; add with remember, drop with forget):');
62
62
  for (const n of notes.slice(0, 300)) lines.push(` - [${n.id}] ${String(n.text).replace(/\s+/g, ' ').slice(0, 200)}`);
63
63
  }
64
64
  return lines.length > 1 ? lines.join('\n') : '';
@@ -350,8 +350,8 @@ const TOOL_DEFINITIONS = [
350
350
  function: {
351
351
  name: 'remember',
352
352
  description:
353
- 'Store a fact about this installation that the user confirmed, for every later chat (shown and editable on the AI page). One short sentence, no secrets. ' +
354
- 'Use it when the user corrects you or explains something about their house that is not in any topic ("the PIR in the bathroom cannot see the shower").',
353
+ "Store a durable fact about this installation for every later chat (shown and editable in the chat's memory panel). One short sentence, no secrets. " +
354
+ 'Use it on your own when you learn something no topic tells — a sensor\'s blind spot ("the PIR in the bathroom cannot see the shower"), what a room or variable is for, a habit of the household, a cause found after a long search — and when the user corrects you or states a preference. Not for what a tool can look up.',
355
355
  parameters: {
356
356
  type: 'object',
357
357
  properties: { text: { type: 'string', description: 'The fact, at most 200 characters.' } },
@@ -6,4 +6,5 @@ Use the tools; they read the running daemon. In short:
6
6
  - what a script did or logged: get_script_logs with a time window; what is still pending: list_timers
7
7
  - "nothing happens": get_health first, then list_services for the adapters
8
8
  - Matter: list_matter_devices (with state), get_matter_attribute; sheDB: list_shedb_docs, get_shedb_doc
9
+ Your memory: the facts listed under "This installation" come from earlier chats. When you learn something durable that no topic tells — a sensor's blind spot, what a room or a variable is for, a habit of the household, a preference the user states, a cause you found after a long search — store it with remember (one short sentence, no secrets) and say that you did; the user can edit or delete it. Do not store what a tool can look up, and do not store the same fact twice.
9
10
  Results are paged; the note at the end says how to get the rest. Prefer one narrower call over three broad ones.
package/src/web/server.js CHANGED
@@ -20,7 +20,9 @@ const { attachWss, closeWss } = require('./log-ws');
20
20
  const { init: initAuth, authMiddleware, checkAuth, router: authRouter } = require('./auth');
21
21
 
22
22
  const app = express();
23
- app.use(express.json());
23
+ // 10 MB: a long AI conversation with its tool events, a saved script, a sheDB document — Express's 100 KB
24
+ // default answered "request entity too large" on a long chat (1.52.0)
25
+ app.use(express.json({ limit: '10mb' }));
24
26
 
25
27
  const SERVER_START_TIME = Date.now();
26
28