assistme 0.4.0 → 0.6.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.
@@ -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";
@@ -213,6 +234,31 @@ var BrowseSkillRowSchema = z.object({
213
234
  avg_rating: z.number().optional().nullable(),
214
235
  rating_count: z.number().optional().default(0)
215
236
  });
237
+ var SelfAnalysisResultSchema = z.object({
238
+ is_perfect: z.boolean(),
239
+ overall_score: z.number().min(1).max(10),
240
+ task_completion_quality: z.object({
241
+ score: z.number().min(1).max(10),
242
+ assessment: z.string()
243
+ }),
244
+ improvements: z.array(
245
+ z.object({
246
+ area: z.string(),
247
+ severity: z.enum(["critical", "major", "minor", "suggestion"]),
248
+ description: z.string(),
249
+ suggestion: z.string()
250
+ })
251
+ ),
252
+ data_quality: z.object({
253
+ session_logs_useful: z.boolean(),
254
+ session_logs_gaps: z.string().nullable().optional(),
255
+ message_events_useful: z.boolean(),
256
+ message_events_gaps: z.string().nullable().optional(),
257
+ conversation_context_useful: z.boolean(),
258
+ conversation_context_gaps: z.string().nullable().optional()
259
+ }),
260
+ summary: z.string()
261
+ });
216
262
 
217
263
  // src/utils/constants.ts
218
264
  var MAX_RESPONSE_CONTENT_LENGTH = 5e4;
@@ -237,6 +283,12 @@ var MEMORY_DEDUP_SIMILARITY_THRESHOLD = 0.75;
237
283
  var MEMORY_COMPRESSION_THRESHOLD = 50;
238
284
  var MEMORY_COMPRESSION_TARGET = 30;
239
285
  var MAX_BUDGET_USD = 2;
286
+ var SELF_ANALYSIS_MAX_SESSION_LOGS = 200;
287
+ var SELF_ANALYSIS_MAX_MESSAGE_EVENTS = 300;
288
+ var SELF_ANALYSIS_MAX_CONVERSATION_MESSAGES = 10;
289
+ var SELF_ANALYSIS_LOG_CONTEXT_CHARS = 2e4;
290
+ var SELF_ANALYSIS_EVENT_CONTEXT_CHARS = 2e4;
291
+ var EDSGER_PRODUCT_SLUG = "assistme";
240
292
  var MAX_COMPLETE_TASK_RETRIES = 2;
241
293
 
242
294
  // src/utils/errors.ts
@@ -424,6 +476,7 @@ export {
424
476
  writeAuthStore,
425
477
  callMcpHandler,
426
478
  setLogLevel,
479
+ setLogHook,
427
480
  setCorrelationId,
428
481
  newCorrelationId,
429
482
  log,
@@ -448,6 +501,12 @@ export {
448
501
  MEMORY_COMPRESSION_THRESHOLD,
449
502
  MEMORY_COMPRESSION_TARGET,
450
503
  MAX_BUDGET_USD,
504
+ SELF_ANALYSIS_MAX_SESSION_LOGS,
505
+ SELF_ANALYSIS_MAX_MESSAGE_EVENTS,
506
+ SELF_ANALYSIS_MAX_CONVERSATION_MESSAGES,
507
+ SELF_ANALYSIS_LOG_CONTEXT_CHARS,
508
+ SELF_ANALYSIS_EVENT_CONTEXT_CHARS,
509
+ EDSGER_PRODUCT_SLUG,
451
510
  MAX_COMPLETE_TASK_RETRIES,
452
511
  AppError,
453
512
  errorMessage,
@@ -456,5 +515,6 @@ export {
456
515
  SkillCreateResultSchema,
457
516
  SkillDecisionSchema,
458
517
  BrowseSkillRowSchema,
518
+ SelfAnalysisResultSchema,
459
519
  JobRunner
460
520
  };