agentel 0.3.0 → 0.3.1

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/src/config.js CHANGED
@@ -61,6 +61,19 @@ function defaultConfig(env = process.env) {
61
61
  maxFileBytes: 25 * 1024 * 1024,
62
62
  maxSessionBytes: 100 * 1024 * 1024
63
63
  },
64
+ notify: {
65
+ // Posting publishes session content beyond this machine; stays off
66
+ // until explicitly configured via `agentlog notify slack setup`.
67
+ // `summary` and `stream` (firehose) toggle independently with
68
+ // independent channels.
69
+ slack: {
70
+ enabled: false,
71
+ repos: [],
72
+ botToken: "",
73
+ summary: { enabled: true, channel: "", quietMinutes: 10 },
74
+ stream: { enabled: false, channel: "", batchSeconds: 45 }
75
+ }
76
+ },
64
77
  createdAt: new Date().toISOString()
65
78
  };
66
79
  }
@@ -81,12 +94,35 @@ function loadConfig(env = process.env) {
81
94
  index: { ...defaults.index, ...(cfg.index || {}) },
82
95
  imports: { ...defaults.imports, ...(cfg.imports || {}) },
83
96
  privacy: { ...defaults.privacy, ...(cfg.privacy || {}) },
84
- artifacts: { ...defaults.artifacts, ...(cfg.artifacts || {}) }
97
+ artifacts: { ...defaults.artifacts, ...(cfg.artifacts || {}) },
98
+ notify: {
99
+ ...defaults.notify,
100
+ ...(cfg.notify || {}),
101
+ slack: mergeSlackNotifyConfig(defaults.notify.slack, cfg.notify?.slack)
102
+ }
85
103
  };
86
104
  merged.imports.sources = enabledImportSources(merged.imports.sources);
87
105
  return merged;
88
106
  }
89
107
 
108
+ // Configs written before the summary/stream split kept channel and
109
+ // quietMinutes at the slack top level; lift them into the summary block so
110
+ // the defaults merge cannot shadow them.
111
+ function mergeSlackNotifyConfig(defaults, raw) {
112
+ const slack = raw || {};
113
+ const summary = { ...defaults.summary, ...(slack.summary || {}) };
114
+ if (!slack.summary) {
115
+ if (slack.channel) summary.channel = slack.channel;
116
+ if (slack.quietMinutes) summary.quietMinutes = slack.quietMinutes;
117
+ }
118
+ return {
119
+ ...defaults,
120
+ ...slack,
121
+ summary,
122
+ stream: { ...defaults.stream, ...(slack.stream || {}) }
123
+ };
124
+ }
125
+
90
126
  function effectiveImportSources(config) {
91
127
  const imports = config?.imports || {};
92
128
  const configured = enabledImportSources(Array.isArray(imports.sources) ? imports.sources : []);