assistme 0.3.6 → 0.5.0

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.
Files changed (32) hide show
  1. package/dist/{chunk-4YWS463E.js → chunk-KAS2PTOX.js} +32 -0
  2. package/dist/index.js +358 -93
  3. package/dist/{job-runner-JT3JWZBV.js → job-runner-AT3V6LAQ.js} +1 -1
  4. package/package.json +1 -1
  5. package/src/agent/event-hooks.ts +43 -2
  6. package/src/agent/memory.ts +124 -0
  7. package/src/agent/processor.ts +42 -64
  8. package/src/agent/skill-evaluator.ts +173 -61
  9. package/src/agent/system-prompt.ts +9 -0
  10. package/src/commands/start.ts +15 -1
  11. package/src/db/session-log.ts +71 -0
  12. package/src/db/types.ts +3 -1
  13. package/src/utils/constants.ts +21 -0
  14. package/src/utils/logger.ts +28 -0
  15. package/src/utils/schemas.ts +33 -0
  16. package/{src → tests}/agent/event-hooks.test.ts +121 -33
  17. package/{src → tests}/agent/mcp-servers.test.ts +43 -29
  18. package/{src → tests}/agent/memory.test.ts +71 -3
  19. package/{src → tests}/agent/processor.test.ts +59 -55
  20. package/{src → tests}/agent/scheduler.test.ts +1 -1
  21. package/{src → tests}/agent/session.test.ts +20 -10
  22. package/{src → tests}/agent/skills.test.ts +51 -29
  23. package/{src → tests}/credentials/credential-store.test.ts +23 -8
  24. package/{src → tests}/credentials/encryption.test.ts +1 -1
  25. package/{src → tests}/db/supabase.test.ts +4 -4
  26. package/{src → tests}/tools/filesystem.test.ts +6 -15
  27. package/{src → tests}/tools/shell.test.ts +1 -1
  28. package/{src → tests}/utils/config.test.ts +2 -1
  29. package/{src → tests}/utils/rate-limiter.test.ts +1 -1
  30. package/{src → tests}/utils/retry.test.ts +6 -12
  31. package/tsconfig.json +1 -1
  32. package/vitest.config.ts +1 -1
@@ -61,6 +61,7 @@ import chalk from "chalk";
61
61
  import { randomUUID } from "crypto";
62
62
  var currentLevel = "info";
63
63
  var currentCorrelationId = null;
64
+ var logHook = null;
64
65
  var LEVEL_ORDER = {
65
66
  debug: 0,
66
67
  info: 1,
@@ -70,6 +71,9 @@ var LEVEL_ORDER = {
70
71
  function setLogLevel(level) {
71
72
  currentLevel = level;
72
73
  }
74
+ function setLogHook(hook) {
75
+ logHook = hook;
76
+ }
73
77
  function setCorrelationId(id) {
74
78
  currentCorrelationId = id;
75
79
  }
@@ -91,39 +95,56 @@ function prefix() {
91
95
  var log = {
92
96
  debug(msg, ...args) {
93
97
  if (shouldLog("debug")) {
98
+ const text = formatArgs(msg, args);
99
+ logHook?.("stdout", `[DEBUG] ${text}`);
94
100
  console.log(chalk.gray(`[${prefix()}] DEBUG`), msg, ...args);
95
101
  }
96
102
  },
97
103
  info(msg, ...args) {
98
104
  if (shouldLog("info")) {
105
+ const text = formatArgs(msg, args);
106
+ logHook?.("stdout", text);
99
107
  console.log(chalk.blue(`[${prefix()}]`), msg, ...args);
100
108
  }
101
109
  },
102
110
  success(msg, ...args) {
103
111
  if (shouldLog("info")) {
112
+ const text = formatArgs(msg, args);
113
+ logHook?.("stdout", `\u2713 ${text}`);
104
114
  console.log(chalk.green(`[${prefix()}] \u2713`), msg, ...args);
105
115
  }
106
116
  },
107
117
  warn(msg, ...args) {
108
118
  if (shouldLog("warn")) {
119
+ const text = formatArgs(msg, args);
120
+ logHook?.("stderr", `[WARN] ${text}`);
109
121
  console.log(chalk.yellow(`[${prefix()}] WARN`), msg, ...args);
110
122
  }
111
123
  },
112
124
  error(msg, ...args) {
113
125
  if (shouldLog("error")) {
126
+ const text = formatArgs(msg, args);
127
+ logHook?.("stderr", `[ERROR] ${text}`);
114
128
  console.error(chalk.red(`[${prefix()}] ERROR`), msg, ...args);
115
129
  }
116
130
  },
117
131
  agent(msg) {
132
+ logHook?.("stdout", `\u25B8 ${msg}`);
118
133
  console.log(chalk.cyan(" \u25B8"), msg);
119
134
  },
120
135
  tool(name, msg) {
136
+ logHook?.("stdout", `\u26A1 ${name}: ${msg}`);
121
137
  console.log(chalk.magenta(` \u26A1 ${name}:`), msg);
122
138
  },
123
139
  result(msg) {
140
+ logHook?.("stdout", `\u2190 ${msg}`);
124
141
  console.log(chalk.green(" \u2190"), msg);
125
142
  }
126
143
  };
144
+ function formatArgs(msg, args) {
145
+ if (args.length === 0) return msg;
146
+ return `${msg} ${args.map((a) => typeof a === "string" ? a : JSON.stringify(a)).join(" ")}`;
147
+ }
127
148
 
128
149
  // src/utils/schemas.ts
129
150
  import { z } from "zod";
@@ -232,6 +253,11 @@ var FRAME_CONTEXTS_MAX_SIZE = 500;
232
253
  var MAX_FILE_SEARCH_RESULTS = 50;
233
254
  var MAX_CONTENT_SEARCH_FILES = 200;
234
255
  var MAX_CONTENT_SEARCH_RESULTS = 30;
256
+ var SKILL_VALIDATION_MAX_TURNS = 2;
257
+ var MEMORY_DEDUP_SIMILARITY_THRESHOLD = 0.75;
258
+ var MEMORY_COMPRESSION_THRESHOLD = 50;
259
+ var MEMORY_COMPRESSION_TARGET = 30;
260
+ var MAX_BUDGET_USD = 2;
235
261
  var MAX_COMPLETE_TASK_RETRIES = 2;
236
262
 
237
263
  // src/utils/errors.ts
@@ -419,6 +445,7 @@ export {
419
445
  writeAuthStore,
420
446
  callMcpHandler,
421
447
  setLogLevel,
448
+ setLogHook,
422
449
  setCorrelationId,
423
450
  newCorrelationId,
424
451
  log,
@@ -438,6 +465,11 @@ export {
438
465
  MAX_FILE_SEARCH_RESULTS,
439
466
  MAX_CONTENT_SEARCH_FILES,
440
467
  MAX_CONTENT_SEARCH_RESULTS,
468
+ SKILL_VALIDATION_MAX_TURNS,
469
+ MEMORY_DEDUP_SIMILARITY_THRESHOLD,
470
+ MEMORY_COMPRESSION_THRESHOLD,
471
+ MEMORY_COMPRESSION_TARGET,
472
+ MAX_BUDGET_USD,
441
473
  MAX_COMPLETE_TASK_RETRIES,
442
474
  AppError,
443
475
  errorMessage,