opencode-swarm-plugin 0.45.4 → 0.45.5

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/dist/bin/swarm.js CHANGED
@@ -121615,40 +121615,24 @@ function ensureLogDir(logDir) {
121615
121615
  mkdirSync10(logDir, { recursive: true });
121616
121616
  }
121617
121617
  }
121618
- function createTransport(filename, logDir) {
121619
- const isPretty = process.env.SWARM_LOG_PRETTY === "1";
121620
- if (isPretty) {
121621
- return {
121622
- target: "pino-pretty",
121623
- options: {
121624
- colorize: true,
121625
- translateTime: "HH:MM:ss",
121626
- ignore: "pid,hostname"
121627
- }
121628
- };
121629
- }
121630
- return {
121631
- target: "pino-roll",
121632
- options: {
121633
- file: join23(logDir, filename),
121634
- frequency: "daily",
121635
- extension: "log",
121636
- limit: { count: 14 },
121637
- mkdir: true
121638
- }
121639
- };
121640
- }
121641
121618
  var loggerCache = new Map;
121642
121619
  function getLogger(logDir = DEFAULT_LOG_DIR) {
121643
121620
  const cacheKey = `swarm:${logDir}`;
121644
121621
  if (loggerCache.has(cacheKey)) {
121645
121622
  return loggerCache.get(cacheKey);
121646
121623
  }
121647
- ensureLogDir(logDir);
121648
- const logger = import_pino.default({
121624
+ const baseConfig = {
121649
121625
  level: process.env.LOG_LEVEL || "info",
121650
121626
  timestamp: import_pino.default.stdTimeFunctions.isoTime
121651
- }, import_pino.default.transport(createTransport("swarm", logDir)));
121627
+ };
121628
+ let logger;
121629
+ if (process.env.SWARM_LOG_FILE === "1") {
121630
+ ensureLogDir(logDir);
121631
+ const logPath = join23(logDir, "swarm.log");
121632
+ logger = import_pino.default(baseConfig, import_pino.default.destination({ dest: logPath, sync: false }));
121633
+ } else {
121634
+ logger = import_pino.default(baseConfig);
121635
+ }
121652
121636
  loggerCache.set(cacheKey, logger);
121653
121637
  return logger;
121654
121638
  }
package/dist/index.js CHANGED
@@ -65578,40 +65578,24 @@ function ensureLogDir(logDir) {
65578
65578
  mkdirSync5(logDir, { recursive: true });
65579
65579
  }
65580
65580
  }
65581
- function createTransport(filename, logDir) {
65582
- const isPretty = process.env.SWARM_LOG_PRETTY === "1";
65583
- if (isPretty) {
65584
- return {
65585
- target: "pino-pretty",
65586
- options: {
65587
- colorize: true,
65588
- translateTime: "HH:MM:ss",
65589
- ignore: "pid,hostname"
65590
- }
65591
- };
65592
- }
65593
- return {
65594
- target: "pino-roll",
65595
- options: {
65596
- file: join11(logDir, filename),
65597
- frequency: "daily",
65598
- extension: "log",
65599
- limit: { count: 14 },
65600
- mkdir: true
65601
- }
65602
- };
65603
- }
65604
65581
  var loggerCache = new Map;
65605
65582
  function getLogger(logDir = DEFAULT_LOG_DIR) {
65606
65583
  const cacheKey = `swarm:${logDir}`;
65607
65584
  if (loggerCache.has(cacheKey)) {
65608
65585
  return loggerCache.get(cacheKey);
65609
65586
  }
65610
- ensureLogDir(logDir);
65611
- const logger = import_pino.default({
65587
+ const baseConfig = {
65612
65588
  level: process.env.LOG_LEVEL || "info",
65613
65589
  timestamp: import_pino.default.stdTimeFunctions.isoTime
65614
- }, import_pino.default.transport(createTransport("swarm", logDir)));
65590
+ };
65591
+ let logger;
65592
+ if (process.env.SWARM_LOG_FILE === "1") {
65593
+ ensureLogDir(logDir);
65594
+ const logPath = join11(logDir, "swarm.log");
65595
+ logger = import_pino.default(baseConfig, import_pino.default.destination({ dest: logPath, sync: false }));
65596
+ } else {
65597
+ logger = import_pino.default(baseConfig);
65598
+ }
65615
65599
  loggerCache.set(cacheKey, logger);
65616
65600
  return logger;
65617
65601
  }
@@ -65620,11 +65604,18 @@ function createChildLogger(module, logDir = DEFAULT_LOG_DIR) {
65620
65604
  if (loggerCache.has(cacheKey)) {
65621
65605
  return loggerCache.get(cacheKey);
65622
65606
  }
65623
- ensureLogDir(logDir);
65624
- const childLogger = import_pino.default({
65607
+ const baseConfig = {
65625
65608
  level: process.env.LOG_LEVEL || "info",
65626
65609
  timestamp: import_pino.default.stdTimeFunctions.isoTime
65627
- }, import_pino.default.transport(createTransport(module, logDir)));
65610
+ };
65611
+ let childLogger;
65612
+ if (process.env.SWARM_LOG_FILE === "1") {
65613
+ ensureLogDir(logDir);
65614
+ const logPath = join11(logDir, `${module}.log`);
65615
+ childLogger = import_pino.default(baseConfig, import_pino.default.destination({ dest: logPath, sync: false }));
65616
+ } else {
65617
+ childLogger = import_pino.default(baseConfig);
65618
+ }
65628
65619
  const logger = childLogger.child({ module });
65629
65620
  loggerCache.set(cacheKey, logger);
65630
65621
  return logger;
package/dist/logger.d.ts CHANGED
@@ -1,26 +1,30 @@
1
1
  /**
2
- * Logger infrastructure using Pino with daily rotation
2
+ * Logger infrastructure using Pino
3
3
  *
4
4
  * Features:
5
- * - Daily log rotation via pino-roll (numeric format: swarm.1log, swarm.2log, etc.)
6
- * - 14-day retention (14 files max in addition to current file)
7
- * - Module-specific child loggers with separate log files
5
+ * - File logging to ~/.config/swarm-tools/logs/ (when SWARM_LOG_FILE=1)
8
6
  * - Pretty mode for development (SWARM_LOG_PRETTY=1 env var)
9
- * - Logs to ~/.config/swarm-tools/logs/ by default
7
+ * - Default: stdout JSON logging (works everywhere including global installs)
10
8
  *
11
- * Note: pino-roll uses numeric rotation (e.g., swarm.1log, swarm.2log) not date-based names.
12
- * Files rotate daily based on frequency='daily', with a maximum of 14 retained files.
9
+ * NOTE: We intentionally avoid pino.transport() because it spawns worker_threads
10
+ * that have module resolution issues in bundled/global-install contexts.
11
+ * Uses pino.destination() for sync file writes instead.
13
12
  */
14
13
  import type { Logger } from "pino";
15
14
  /**
16
15
  * Gets or creates the main logger instance
17
16
  *
17
+ * Logging modes (set via environment variables):
18
+ * - Default: stdout JSON (works in all contexts)
19
+ * - SWARM_LOG_FILE=1: writes to ~/.config/swarm-tools/logs/swarm.log
20
+ * - SWARM_LOG_PRETTY=1: pretty console output (requires pino-pretty installed)
21
+ *
18
22
  * @param logDir - Optional log directory (defaults to ~/.config/swarm-tools/logs)
19
23
  * @returns Pino logger instance
20
24
  */
21
25
  export declare function getLogger(logDir?: string): Logger;
22
26
  /**
23
- * Creates a child logger for a specific module with its own log file
27
+ * Creates a child logger for a specific module
24
28
  *
25
29
  * @param module - Module name (e.g., "compaction", "cli")
26
30
  * @param logDir - Optional log directory (defaults to ~/.config/swarm-tools/logs)
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAuDnC;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,GAAE,MAAwB,GAAG,MAAM,CAmBlE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAwB,GAC/B,MAAM,CAoBR;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,QAAc,CAAC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAgBnC;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,MAAM,GAAE,MAAwB,GAAG,MAAM,CA0BlE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAwB,GAC/B,MAAM,CA2BR;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,QAAc,CAAC"}
package/dist/plugin.js CHANGED
@@ -65103,40 +65103,24 @@ function ensureLogDir(logDir) {
65103
65103
  mkdirSync5(logDir, { recursive: true });
65104
65104
  }
65105
65105
  }
65106
- function createTransport(filename, logDir) {
65107
- const isPretty = process.env.SWARM_LOG_PRETTY === "1";
65108
- if (isPretty) {
65109
- return {
65110
- target: "pino-pretty",
65111
- options: {
65112
- colorize: true,
65113
- translateTime: "HH:MM:ss",
65114
- ignore: "pid,hostname"
65115
- }
65116
- };
65117
- }
65118
- return {
65119
- target: "pino-roll",
65120
- options: {
65121
- file: join11(logDir, filename),
65122
- frequency: "daily",
65123
- extension: "log",
65124
- limit: { count: 14 },
65125
- mkdir: true
65126
- }
65127
- };
65128
- }
65129
65106
  var loggerCache = new Map;
65130
65107
  function getLogger(logDir = DEFAULT_LOG_DIR) {
65131
65108
  const cacheKey = `swarm:${logDir}`;
65132
65109
  if (loggerCache.has(cacheKey)) {
65133
65110
  return loggerCache.get(cacheKey);
65134
65111
  }
65135
- ensureLogDir(logDir);
65136
- const logger = import_pino.default({
65112
+ const baseConfig = {
65137
65113
  level: process.env.LOG_LEVEL || "info",
65138
65114
  timestamp: import_pino.default.stdTimeFunctions.isoTime
65139
- }, import_pino.default.transport(createTransport("swarm", logDir)));
65115
+ };
65116
+ let logger;
65117
+ if (process.env.SWARM_LOG_FILE === "1") {
65118
+ ensureLogDir(logDir);
65119
+ const logPath = join11(logDir, "swarm.log");
65120
+ logger = import_pino.default(baseConfig, import_pino.default.destination({ dest: logPath, sync: false }));
65121
+ } else {
65122
+ logger = import_pino.default(baseConfig);
65123
+ }
65140
65124
  loggerCache.set(cacheKey, logger);
65141
65125
  return logger;
65142
65126
  }
@@ -65145,11 +65129,18 @@ function createChildLogger(module, logDir = DEFAULT_LOG_DIR) {
65145
65129
  if (loggerCache.has(cacheKey)) {
65146
65130
  return loggerCache.get(cacheKey);
65147
65131
  }
65148
- ensureLogDir(logDir);
65149
- const childLogger = import_pino.default({
65132
+ const baseConfig = {
65150
65133
  level: process.env.LOG_LEVEL || "info",
65151
65134
  timestamp: import_pino.default.stdTimeFunctions.isoTime
65152
- }, import_pino.default.transport(createTransport(module, logDir)));
65135
+ };
65136
+ let childLogger;
65137
+ if (process.env.SWARM_LOG_FILE === "1") {
65138
+ ensureLogDir(logDir);
65139
+ const logPath = join11(logDir, `${module}.log`);
65140
+ childLogger = import_pino.default(baseConfig, import_pino.default.destination({ dest: logPath, sync: false }));
65141
+ } else {
65142
+ childLogger = import_pino.default(baseConfig);
65143
+ }
65153
65144
  const logger = childLogger.child({ module });
65154
65145
  loggerCache.set(cacheKey, logger);
65155
65146
  return logger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm-plugin",
3
- "version": "0.45.4",
3
+ "version": "0.45.5",
4
4
  "description": "Multi-agent swarm coordination for OpenCode with learning capabilities, beads integration, and Agent Mail",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",