agent-worker 0.13.0 → 0.15.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.
@@ -1,63 +0,0 @@
1
- //#region src/workflow/logger.ts
2
- /**
3
- * Create a silent logger (no output)
4
- */
5
- function createSilentLogger() {
6
- const noop = () => {};
7
- return {
8
- debug: noop,
9
- info: noop,
10
- warn: noop,
11
- error: noop,
12
- isDebug: () => false,
13
- child: () => createSilentLogger()
14
- };
15
- }
16
- /**
17
- * Create a logger that writes to the channel.
18
- *
19
- * - info/warn/error → channel entry with kind="system" (always shown to user)
20
- * - debug → channel entry with kind="debug" (only shown with --debug)
21
- *
22
- * The display layer handles formatting and filtering.
23
- */
24
- function createChannelLogger(config) {
25
- const { provider, from = "system" } = config;
26
- const formatContent = (level, message, args) => {
27
- const argsStr = args.length > 0 ? " " + args.map(formatArg).join(" ") : "";
28
- if (level === "warn") return `[WARN] ${message}${argsStr}`;
29
- if (level === "error") return `[ERROR] ${message}${argsStr}`;
30
- return `${message}${argsStr}`;
31
- };
32
- const write = (level, message, args) => {
33
- const content = formatContent(level, message, args);
34
- const kind = level === "debug" ? "debug" : "system";
35
- provider.appendChannel(from, content, { kind }).catch(() => {});
36
- };
37
- return {
38
- debug: (message, ...args) => write("debug", message, args),
39
- info: (message, ...args) => write("info", message, args),
40
- warn: (message, ...args) => write("warn", message, args),
41
- error: (message, ...args) => write("error", message, args),
42
- isDebug: () => true,
43
- child: (childPrefix) => {
44
- return createChannelLogger({
45
- provider,
46
- from: from ? `${from}:${childPrefix}` : childPrefix
47
- });
48
- }
49
- };
50
- }
51
- /** Format an argument for logging */
52
- function formatArg(arg) {
53
- if (arg === null || arg === void 0) return String(arg);
54
- if (typeof arg === "object") try {
55
- return JSON.stringify(arg);
56
- } catch {
57
- return String(arg);
58
- }
59
- return String(arg);
60
- }
61
-
62
- //#endregion
63
- export { createChannelLogger, createSilentLogger };