zyn-ai 1.3.6 → 1.3.7

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/README.md CHANGED
@@ -20,6 +20,9 @@
20
20
 
21
21
  ---
22
22
 
23
+ > [!CAUTION]
24
+ > Using the web version of the agent is not recommended as it contains bugs. I am doing my best to fix most of the web bugs.
25
+
23
26
  ## What is Zyn
24
27
 
25
28
  Zyn is a local AI agent designed for terminal and web usage. It supports persistent sessions, system tools, multiple AI providers, session exports, and configurable models.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zyn-ai",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "description": "Production-ready AI agent for CLI and web with real tool execution and automation",
5
5
  "author": "Maycol",
6
6
  "keywords": [
@@ -35,7 +35,6 @@
35
35
  "express": "^5.2.1",
36
36
  "express-session": "^1.19.0",
37
37
  "ink": "^6.8.0",
38
- "keypress": "^0.2.1",
39
38
  "react": "^19.0.0",
40
39
  "session-file-store": "^1.5.0",
41
40
  "jimp": "^1.6.1"
@@ -7,6 +7,7 @@ const { listSkills, SKILLS_DIR } = require('../core/skills');
7
7
  const { DEFAULT_LANGUAGE, DEFAULT_MODEL_KEY, GEMINI_MODEL_WARNING, MODELS, listProvidersFromModels } = require('../config');
8
8
  const { languageLabel, normalizeLanguage, t } = require('../i18n');
9
9
  const { createNewSessionState, listSessions, loadSessionState, saveState } = require('../utils/sessionStorage');
10
+ const { compactMemory, normalizeCompactMode } = require('../core/agent');
10
11
  const { listGitSecrets, removeGitSecret, upsertGitSecret } = require('../utils/secretStorage');
11
12
  const { clearGmailAuth, getGmailAuthStatus, startGmailOAuthFlow } = require('../utils/gmailAuth');
12
13
  const { exportTranscriptText, formatTranscriptPreview } = require('../utils/transcriptStorage');
@@ -33,12 +34,49 @@ function printLanguageChanged(language) {
33
34
  : `Updated to language ${label} (${normalized})`);
34
35
  }
35
36
 
37
+ function getCompactModeArgs(args) {
38
+ const value = String(args || '').trim().toLowerCase();
39
+ if (!value) return 'medium';
40
+ const [mode] = value.split(/\s+/);
41
+ return ['low', 'medium', 'high'].includes(mode) ? mode : null;
42
+ }
43
+
44
+ async function runCompactCommand(state, args, printMemoryFn) {
45
+ const compactMode = getCompactModeArgs(args);
46
+ if (!compactMode) {
47
+ throw new Error(t(state.language, 'compactInvalid'));
48
+ }
49
+ const isHigh = compactMode === 'high';
50
+ if (isHigh) {
51
+ const warn = t(state.language, 'compactWarningHigh');
52
+ console.log(warn);
53
+ }
54
+
55
+ const ui = {
56
+ logEvent: (_state, kind, title, detail) => {
57
+ const prefix = kind === 'error' ? 'ERROR' : kind === 'warn' ? 'WARN' : 'INFO';
58
+ const line = [prefix, title, detail].filter(Boolean).join(' - ');
59
+ if (line) console.log(line);
60
+ },
61
+ };
62
+
63
+ const result = await compactMemory(state, ui, compactMode, { force: !isHigh });
64
+ if (!result?.changed) {
65
+ console.log(t(state.language, 'compactNoChange'));
66
+ return true;
67
+ }
68
+ console.log(t(state.language, 'compactCommand', { mode: compactMode }));
69
+ if (typeof printMemoryFn === 'function') printMemoryFn(state);
70
+ return true;
71
+ }
72
+
36
73
  const SLASH_COMMANDS = [
37
74
  { name: 'help', desc: 'full help', descEs: 'ayuda completa' },
38
75
  { name: 'status', desc: 'current status', descEs: 'estado actual' },
39
76
  { name: 'history', desc: 'recent actions', descEs: 'acciones recientes' },
40
77
  { name: 'memory', desc: 'memory summary', descEs: 'resumen de memoria' },
41
78
  { name: 'summary', desc: 'memory summary', descEs: 'resumen de memoria' },
79
+ { name: 'compact', desc: 'compact memory', descEs: 'compactar memoria' },
42
80
  { name: 'session', desc: 'current session', descEs: 'sesión actual' },
43
81
  { name: 'sessions', desc: 'list sessions', descEs: 'listar sesiones' },
44
82
  { name: 'new', desc: 'new session', descEs: 'nueva sesión' },
@@ -259,10 +297,18 @@ async function handleLocalCommand(input, state, deps) {
259
297
  }
260
298
 
261
299
  if (commandName === 'memory' || commandName === 'summary') {
300
+ if (args && args.startsWith('compact')) {
301
+ const compactArgs = args.replace(/^compact\s*/i, '').trim();
302
+ return runCompactCommand(state, compactArgs, printMemory);
303
+ }
262
304
  printMemory(state);
263
305
  return true;
264
306
  }
265
307
 
308
+ if (commandName === 'compact') {
309
+ return runCompactCommand(state, args, printMemory);
310
+ }
311
+
266
312
  if (commandName === 'session') {
267
313
  printSession(state);
268
314
  return true;