@songsid/agend 2.4.0-beta.16 → 2.4.0-beta.18

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 (172) hide show
  1. package/dist/auth-api.js +2 -0
  2. package/dist/auth-api.js.map +1 -1
  3. package/dist/backend/claude-code.d.ts +10 -1
  4. package/dist/backend/claude-code.js +7 -2
  5. package/dist/backend/claude-code.js.map +1 -1
  6. package/dist/backend/claude-transcript-errors.d.ts +4 -0
  7. package/dist/backend/claude-transcript-errors.js +5 -1
  8. package/dist/backend/claude-transcript-errors.js.map +1 -1
  9. package/dist/backend/types.d.ts +6 -0
  10. package/dist/backend/types.js.map +1 -1
  11. package/dist/build-provenance.json +1 -1
  12. package/dist/claude-credential-launch.d.ts +1 -0
  13. package/dist/claude-credential-launch.js +13 -2
  14. package/dist/claude-credential-launch.js.map +1 -1
  15. package/dist/claude-credential-vault.d.ts +7 -1
  16. package/dist/claude-credential-vault.js +26 -1
  17. package/dist/claude-credential-vault.js.map +1 -1
  18. package/dist/claude-request-observation.d.ts +7 -0
  19. package/dist/claude-request-observation.js +26 -0
  20. package/dist/claude-request-observation.js.map +1 -0
  21. package/dist/cli-audited.js +11 -8
  22. package/dist/cli-audited.js.map +1 -1
  23. package/dist/daemon.d.ts +8 -0
  24. package/dist/daemon.js +68 -13
  25. package/dist/daemon.js.map +1 -1
  26. package/dist/fleet-context.d.ts +1 -0
  27. package/dist/fleet-manager.d.ts +28 -0
  28. package/dist/fleet-manager.js +222 -10
  29. package/dist/fleet-manager.js.map +1 -1
  30. package/dist/fleet-windows-runtime.d.ts +1 -1
  31. package/dist/fleet-windows-runtime.js +1 -1
  32. package/dist/fleet-windows-runtime.js.map +1 -1
  33. package/dist/fleet-yaml-stringify.d.ts +3 -0
  34. package/dist/fleet-yaml-stringify.js +79 -0
  35. package/dist/fleet-yaml-stringify.js.map +1 -0
  36. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +17 -3
  37. package/dist/host-monitoring-alert-policy.d.ts +71 -0
  38. package/dist/host-monitoring-alert-policy.js +150 -0
  39. package/dist/host-monitoring-alert-policy.js.map +1 -0
  40. package/dist/host-monitoring-alert-resources.d.ts +11 -0
  41. package/dist/host-monitoring-alert-resources.js +16 -0
  42. package/dist/host-monitoring-alert-resources.js.map +1 -0
  43. package/dist/host-monitoring-alert-settings.d.ts +14 -0
  44. package/dist/host-monitoring-alert-settings.js +63 -0
  45. package/dist/host-monitoring-alert-settings.js.map +1 -0
  46. package/dist/host-monitoring-alert-store.d.ts +49 -0
  47. package/dist/host-monitoring-alert-store.js +228 -0
  48. package/dist/host-monitoring-alert-store.js.map +1 -0
  49. package/dist/host-monitoring-alert-text.d.ts +7 -0
  50. package/dist/host-monitoring-alert-text.js +10 -0
  51. package/dist/host-monitoring-alert-text.js.map +1 -0
  52. package/dist/host-monitoring-alerts.d.ts +76 -0
  53. package/dist/host-monitoring-alerts.js +261 -0
  54. package/dist/host-monitoring-alerts.js.map +1 -0
  55. package/dist/host-monitoring-config.d.ts +2 -1
  56. package/dist/host-monitoring-config.js +8 -3
  57. package/dist/host-monitoring-config.js.map +1 -1
  58. package/dist/host-monitoring-footprint-policy.d.ts +45 -0
  59. package/dist/host-monitoring-footprint-policy.js +150 -0
  60. package/dist/host-monitoring-footprint-policy.js.map +1 -0
  61. package/dist/host-monitoring-footprint.d.ts +42 -0
  62. package/dist/host-monitoring-footprint.js +169 -0
  63. package/dist/host-monitoring-footprint.js.map +1 -0
  64. package/dist/host-monitoring-history-files.d.ts +2 -0
  65. package/dist/host-monitoring-history-files.js +16 -0
  66. package/dist/host-monitoring-history-files.js.map +1 -0
  67. package/dist/host-monitoring-history-policy.d.ts +57 -0
  68. package/dist/host-monitoring-history-policy.js +107 -0
  69. package/dist/host-monitoring-history-policy.js.map +1 -0
  70. package/dist/host-monitoring-history-store.d.ts +52 -0
  71. package/dist/host-monitoring-history-store.js +178 -0
  72. package/dist/host-monitoring-history-store.js.map +1 -0
  73. package/dist/host-monitoring-history-worker.d.ts +1 -0
  74. package/dist/host-monitoring-history-worker.js +66 -0
  75. package/dist/host-monitoring-history-worker.js.map +1 -0
  76. package/dist/host-monitoring-history.d.ts +80 -0
  77. package/dist/host-monitoring-history.js +301 -0
  78. package/dist/host-monitoring-history.js.map +1 -0
  79. package/dist/host-monitoring-platform.d.ts +73 -0
  80. package/dist/host-monitoring-platform.js +273 -0
  81. package/dist/host-monitoring-platform.js.map +1 -0
  82. package/dist/host-monitoring-process-identity.d.ts +8 -0
  83. package/dist/host-monitoring-process-identity.js +81 -0
  84. package/dist/host-monitoring-process-identity.js.map +1 -0
  85. package/dist/host-monitoring-runtime.d.ts +42 -0
  86. package/dist/host-monitoring-runtime.js +95 -0
  87. package/dist/host-monitoring-runtime.js.map +1 -0
  88. package/dist/host-monitoring-settings-store.d.ts +5 -0
  89. package/dist/host-monitoring-settings-store.js +49 -0
  90. package/dist/host-monitoring-settings-store.js.map +1 -0
  91. package/dist/host-monitoring.d.ts +108 -0
  92. package/dist/host-monitoring.js +157 -0
  93. package/dist/host-monitoring.js.map +1 -0
  94. package/dist/instance-lifecycle.js +2 -2
  95. package/dist/instance-lifecycle.js.map +1 -1
  96. package/dist/needs-you-hub.d.ts +1 -0
  97. package/dist/needs-you-hub.js +1 -0
  98. package/dist/needs-you-hub.js.map +1 -1
  99. package/dist/needs-you.d.ts +3 -2
  100. package/dist/needs-you.js +1 -0
  101. package/dist/needs-you.js.map +1 -1
  102. package/dist/public-web-gateway.js +11 -1
  103. package/dist/public-web-gateway.js.map +1 -1
  104. package/dist/runtime-cli-install.js +17 -16
  105. package/dist/runtime-cli-install.js.map +1 -1
  106. package/dist/settings-api.d.ts +5 -0
  107. package/dist/settings-api.js +70 -7
  108. package/dist/settings-api.js.map +1 -1
  109. package/dist/settings-baseline.d.ts +1 -0
  110. package/dist/settings-baseline.js +6 -4
  111. package/dist/settings-baseline.js.map +1 -1
  112. package/dist/settings-change.js +8 -0
  113. package/dist/settings-change.js.map +1 -1
  114. package/dist/settings-effect.d.ts +4 -0
  115. package/dist/settings-effect.js +25 -4
  116. package/dist/settings-effect.js.map +1 -1
  117. package/dist/topic-commands.js +4 -0
  118. package/dist/topic-commands.js.map +1 -1
  119. package/dist/transcript-monitor.d.ts +1 -0
  120. package/dist/transcript-monitor.js +18 -0
  121. package/dist/transcript-monitor.js.map +1 -1
  122. package/dist/ui/accounts-view.js +7 -5
  123. package/dist/ui/chat-store.js +21 -4
  124. package/dist/ui/claude-credentials.js +12 -1
  125. package/dist/ui/fleet-office-pack.js +2 -2
  126. package/dist/ui/fleet-office-play.js +142 -3
  127. package/dist/ui/fleet-office-skin.js +67 -2
  128. package/dist/ui/fleet-office-store.js +41 -0
  129. package/dist/ui/fleet-office-zones.js +15 -8
  130. package/dist/ui/fleet-office.js +126 -21
  131. package/dist/ui/host-alerts.js +23 -0
  132. package/dist/ui/host-footprint.js +17 -0
  133. package/dist/ui/host-health-model.js +42 -0
  134. package/dist/ui/host-health.js +79 -0
  135. package/dist/ui/host-time.js +5 -0
  136. package/dist/ui/panel-chat.js +101 -43
  137. package/dist/ui/panel-fleet.js +24 -11
  138. package/dist/ui/panel-hub.js +5 -1
  139. package/dist/ui/panel-needs.js +27 -16
  140. package/dist/ui/panel-settings.js +4 -3
  141. package/dist/ui/search-dialog.js +8 -1
  142. package/dist/ui/settings-capabilities.js +2 -0
  143. package/dist/ui/settings-host-alerts.js +22 -0
  144. package/dist/ui/settings-host-monitoring.js +37 -18
  145. package/dist/ui/settings-registry.js +4 -1
  146. package/dist/ui/shared/accounts.css +8 -4
  147. package/dist/ui/shared/agent-sheet.js +5 -2
  148. package/dist/ui/shared/app-i18n.js +2 -2
  149. package/dist/ui/shared/app-route.js +1 -1
  150. package/dist/ui/shared/app.css +87 -9
  151. package/dist/ui/shared/app.js +1 -0
  152. package/dist/ui/shared/chat-render.js +24 -9
  153. package/dist/ui/shared/chat-strings.js +4 -4
  154. package/dist/ui/shared/chat-thread.js +45 -11
  155. package/dist/ui/shared/instance-nav.js +47 -5
  156. package/dist/ui/shared/jump-idle.js +36 -0
  157. package/dist/ui/shared/theme.js +6 -2
  158. package/dist/ui/shared/ui-menu.js +17 -11
  159. package/dist/web-api.d.ts +3 -0
  160. package/dist/web-api.js +249 -4
  161. package/dist/web-api.js.map +1 -1
  162. package/dist/web-chat-history.d.ts +47 -2
  163. package/dist/web-chat-history.js +149 -11
  164. package/dist/web-chat-history.js.map +1 -1
  165. package/dist/web-guest-access.js +4 -4
  166. package/dist/web-guest-access.js.map +1 -1
  167. package/dist/web-shell-routes.d.ts +1 -1
  168. package/dist/web-shell-routes.js +1 -1
  169. package/dist/web-shell-routes.js.map +1 -1
  170. package/dist/web-upload.d.ts +1 -1
  171. package/dist/web-upload.js.map +1 -1
  172. package/package.json +1 -1
@@ -0,0 +1,261 @@
1
+ /** Owner-fenced cache and delivery coordinator. All incident I/O belongs to the existing worker. */
2
+ import { randomBytes } from 'node:crypto';
3
+ import { HostAlertWindow, validateHostAlertRule } from './host-monitoring-alert-policy.js';
4
+ import { emptyHostAlerts, validateHostAlertDocument } from './host-monitoring-alert-store.js';
5
+ import { defaultHostAlertSettings, parseHostAlertSettings, hostAlertRuleFor } from './host-monitoring-alert-settings.js';
6
+ import { hostAlertResources } from './host-monitoring-alert-resources.js';
7
+ /** Queue bounds: one running operation, at most four explicit edits, one latest sample, one delivery receipt. */
8
+ export class HostMonitoringAlerts {
9
+ options;
10
+ enabled = false;
11
+ workerReady = false;
12
+ epoch = 0;
13
+ loaded = false;
14
+ failure;
15
+ settings = defaultHostAlertSettings();
16
+ sequence = 0;
17
+ document = emptyHostAlerts();
18
+ windows = new Map();
19
+ busy = false;
20
+ edits = [];
21
+ latest = null;
22
+ receipt = null;
23
+ flight = null;
24
+ now;
25
+ monotonic;
26
+ constructor(options) {
27
+ this.options = options;
28
+ this.now = options.now ?? Date.now;
29
+ this.monotonic = options.monotonic ?? (() => performance.now());
30
+ }
31
+ configure(enabled, settings = this.settings) {
32
+ const next = parseHostAlertSettings(settings), changed = JSON.stringify(next) !== JSON.stringify(this.settings);
33
+ this.settings = next;
34
+ if (enabled === this.enabled && !changed)
35
+ return;
36
+ this.enabled = enabled;
37
+ if (!enabled)
38
+ this.workerReady = false;
39
+ this.epoch++;
40
+ this.loaded = false;
41
+ this.failure = undefined;
42
+ this.document = emptyHostAlerts();
43
+ this.windows.clear();
44
+ this.latest = null;
45
+ this.receipt = null;
46
+ for (const edit of this.edits.splice(0))
47
+ edit.resolve(false);
48
+ this.publish();
49
+ if (enabled && this.workerReady)
50
+ this.ready();
51
+ }
52
+ unavailable(reason = 'incident_settings_invalid') { if (this.enabled)
53
+ this.fail(reason); }
54
+ stop() { this.workerReady = false; this.configure(false); }
55
+ /** Called after the persistence worker is ready. No retries or extra timers while off. */
56
+ ready() {
57
+ this.workerReady = true;
58
+ if (!this.enabled || this.loaded || this.busy || this.failure)
59
+ return;
60
+ const epoch = this.epoch;
61
+ this.busy = true;
62
+ void this.options.persistence.incidentRead().then(answer => {
63
+ if (!this.current(epoch))
64
+ return;
65
+ if (!answer.ok || !answer.value)
66
+ throw Error('incident_load_failed');
67
+ validateHostAlertDocument(answer.value.document);
68
+ this.sequence = answer.value.sequence;
69
+ this.document = answer.value.document;
70
+ for (const record of this.document.active)
71
+ this.windows.set(record.key, new HostAlertWindow(record.key, hostAlertRuleFor(this.settings, record.key, record.kind), record));
72
+ this.loaded = true;
73
+ this.publish();
74
+ }).catch(() => { if (this.current(epoch))
75
+ this.fail('incident_load_failed'); }).finally(() => { this.busy = false; this.drain(); });
76
+ }
77
+ snapshot() { return { state: !this.enabled ? 'off' : this.failure ? 'failed' : this.loaded ? 'ready' : 'starting', ...(this.failure ? { reason: this.failure } : {}), needsYou: this.settings.needsYou, general: this.settings.general, active: this.document.active.map(record => { const live = this.windows.get(record.key)?.snapshot(); return live?.revision === record.revision ? { ...structuredClone(record), value: live.value, updatedAt: live.updatedAt } : structuredClone(record); }), resolved: structuredClone(this.document.resolved.slice(-50)), pending: this.document.pending.length }; }
78
+ ingest(snapshot) { if (!this.enabled || this.failure || !snapshot.enabled)
79
+ return; this.latest = structuredClone(snapshot); this.drain(); }
80
+ act(key, revision, actor, snoozeMs) {
81
+ if (!this.enabled || !this.loaded || this.failure || this.edits.length >= 4 || !this.windows.has(key) || this.windows.get(key).snapshot()?.revision !== revision)
82
+ return Promise.resolve(false);
83
+ if (!/^[a-zA-Z0-9:_-]{1,128}$/.test(actor) || (snoozeMs !== undefined && (!Number.isSafeInteger(snoozeMs) || snoozeMs < 60000 || snoozeMs > 86400000)))
84
+ return Promise.resolve(false);
85
+ return new Promise(resolve => {
86
+ this.edits.push({ resolve, run: async () => {
87
+ const window = this.windows.get(key), record = window?.snapshot();
88
+ if (!window || !record || record.revision !== revision)
89
+ throw Error('stale_incident');
90
+ if (snoozeMs === undefined)
91
+ window.acknowledge(actor, this.now());
92
+ else
93
+ window.snooze(this.now(), snoozeMs);
94
+ const document = structuredClone(this.document);
95
+ document.active = document.active.map(r => r.key === key ? window.snapshot() : r);
96
+ await this.save(document, this.epoch);
97
+ } });
98
+ this.drain();
99
+ });
100
+ }
101
+ current(epoch) { return this.enabled && this.epoch === epoch; }
102
+ publish() { try {
103
+ this.options.changed?.();
104
+ }
105
+ catch { /* Notification consumers cannot disrupt collection. */ } }
106
+ fail(reason) { this.failure = reason; this.latest = null; for (const edit of this.edits.splice(0))
107
+ edit.resolve(false); this.publish(); }
108
+ async save(document, epoch) {
109
+ validateHostAlertDocument(document);
110
+ const answer = await this.options.persistence.incidentSave(this.sequence, document);
111
+ if (!this.current(epoch))
112
+ throw Error('incident_epoch_changed');
113
+ if (!answer.ok || !answer.value)
114
+ throw Error('incident_save_failed');
115
+ validateHostAlertDocument(answer.value.document);
116
+ this.sequence = answer.value.sequence;
117
+ this.document = answer.value.document;
118
+ this.publish();
119
+ }
120
+ drain() {
121
+ if (this.busy || !this.enabled || this.failure)
122
+ return;
123
+ if (!this.loaded) {
124
+ if (this.workerReady)
125
+ this.ready();
126
+ return;
127
+ }
128
+ const epoch = this.epoch, receipt = this.receipt, edit = receipt ? undefined : this.edits.shift(), sample = receipt || edit ? null : this.latest;
129
+ if (receipt)
130
+ this.receipt = null;
131
+ else if (sample)
132
+ this.latest = null;
133
+ if (!receipt && !edit && !sample) {
134
+ this.dispatch();
135
+ return;
136
+ }
137
+ this.busy = true;
138
+ void (receipt ? this.received(receipt) : edit ? edit.run() : this.observe(sample, epoch)).then(() => edit?.resolve(true), error => { edit?.resolve(false); if (this.current(epoch) && error?.message !== 'stale_incident')
139
+ this.fail('incident_save_failed'); }).finally(() => { this.busy = false; this.drain(); });
140
+ }
141
+ pending(record, transition) {
142
+ return { key: record.key, revision: record.revision, transition, token: (this.options.token ?? (() => randomBytes(16).toString('hex')))(), attempts: 0, nextAttemptAt: this.now() };
143
+ }
144
+ async observe(snapshot, epoch) {
145
+ const document = structuredClone(this.document), now = this.now(), mono = this.monotonic(), seen = new Set();
146
+ let changed = false;
147
+ for (const resource of hostAlertResources(snapshot, now)) {
148
+ seen.add(resource.key);
149
+ let window = this.windows.get(resource.key);
150
+ if (!window) {
151
+ if (this.windows.size >= 64)
152
+ throw Error('incident_capacity');
153
+ const rule = hostAlertRuleFor(this.settings, resource.key, resource.kind);
154
+ if (rule.kind !== resource.kind)
155
+ throw Error('invalid_alert_resource');
156
+ validateHostAlertRule(rule, this.settings.rules[resource.key] ? resource.capacity : undefined);
157
+ window = new HostAlertWindow(resource.key, rule, undefined, Math.max(0, ...document.resolved.filter(r => r.key === resource.key).map(r => r.revision)));
158
+ this.windows.set(resource.key, window);
159
+ }
160
+ const transition = window.observe({ sampledAt: resource.sampledAt, monotonicAt: mono, wallAt: now, value: resource.value });
161
+ if (transition) {
162
+ this.transition(document, transition);
163
+ changed = true;
164
+ }
165
+ const record = window.snapshot();
166
+ if (record && this.settings.general && window.reminderDue(now) && !document.pending.some(p => p.key === record.key)) {
167
+ if (document.pending.length >= 64)
168
+ throw Error('incident_capacity');
169
+ document.pending.push(this.pending(record, 'reminder'));
170
+ changed = true;
171
+ }
172
+ }
173
+ for (const [key, window] of this.windows)
174
+ if (!seen.has(key))
175
+ window.observe({ sampledAt: now, monotonicAt: mono, wallAt: now, value: null });
176
+ const cutoff = now - 30 * 24 * 60 * 60_000;
177
+ const retained = document.resolved.filter(r => (r.resolvedAt ?? now) >= cutoff).slice(-500);
178
+ const pendingResolved = new Set(document.pending.filter(p => p.transition === 'resolved').map(p => p.token));
179
+ // Retention must not leave an outbox entry whose record was pruned.
180
+ document.pending = document.pending.filter(p => p.transition !== 'resolved' || retained.some(r => r.key === p.key && r.revision === p.revision));
181
+ if (retained.length !== document.resolved.length || pendingResolved.size !== document.pending.filter(p => p.transition === 'resolved').length)
182
+ changed = true;
183
+ document.resolved = retained;
184
+ if (changed)
185
+ await this.save(document, epoch);
186
+ else
187
+ this.publish();
188
+ }
189
+ transition(document, transition) {
190
+ const { record, kind } = transition;
191
+ document.active = document.active.filter(r => r.key !== record.key);
192
+ document.pending = document.pending.filter(p => p.key !== record.key);
193
+ if (kind === 'resolved')
194
+ document.resolved.push(record);
195
+ else
196
+ document.active.push(record);
197
+ if (this.settings.general && kind !== 'deescalated') {
198
+ if (document.pending.length >= 64)
199
+ throw Error('incident_capacity');
200
+ document.pending.push(this.pending(record, kind));
201
+ }
202
+ }
203
+ dispatch() {
204
+ if (this.flight || !this.settings.general || !this.loaded || !this.enabled || this.failure)
205
+ return;
206
+ const now = this.now(), entries = this.document.pending.filter(p => p.nextAttemptAt <= now && this.sendable(p, now));
207
+ if (!entries.length)
208
+ return;
209
+ const flight = { epoch: this.epoch, entries: structuredClone(entries) };
210
+ this.flight = flight;
211
+ let answered = false;
212
+ const ack = (delivered) => { if (answered)
213
+ return; answered = true; if (this.flight !== flight)
214
+ return; this.flight = null; if (this.current(flight.epoch)) {
215
+ this.receipt = { flight, delivered };
216
+ this.drain();
217
+ }
218
+ else
219
+ this.drain(); };
220
+ const records = entries.map(p => ({ transition: p.transition, record: structuredClone((p.transition === 'resolved' ? this.document.resolved : this.document.active).find(r => r.key === p.key && r.revision === p.revision)) }));
221
+ try {
222
+ if (!this.options.deliver(records, ack))
223
+ ack(false);
224
+ }
225
+ catch {
226
+ ack(false);
227
+ }
228
+ }
229
+ sendable(p, now) {
230
+ const record = (p.transition === 'resolved' ? this.document.resolved : this.document.active).find(r => r.key === p.key && r.revision === p.revision);
231
+ return !!record && (p.transition === 'resolved' || record.snoozedUntil === undefined || now >= record.snoozedUntil || (record.level === 'urgent' && record.snoozedLevel === 'warning'));
232
+ }
233
+ async received({ flight, delivered }) {
234
+ if (!this.current(flight.epoch))
235
+ return;
236
+ const document = structuredClone(this.document);
237
+ let changed = false;
238
+ for (const entry of flight.entries) {
239
+ const p = document.pending.find(p => p.token === entry.token && p.revision === entry.revision);
240
+ if (!p)
241
+ continue;
242
+ changed = true;
243
+ if (delivered) {
244
+ document.pending = document.pending.filter(q => q.token !== p.token);
245
+ const records = p.transition === 'resolved' ? document.resolved : document.active;
246
+ const record = records.find(r => r.key === p.key && r.revision === p.revision);
247
+ if (record) {
248
+ record.lastSentAt = this.now();
249
+ this.windows.get(p.key)?.delivered(p.revision, this.now());
250
+ }
251
+ }
252
+ else {
253
+ p.attempts = Math.min(100, p.attempts + 1);
254
+ p.nextAttemptAt = this.now() + Math.min(60 * 60_000, 30_000 * 2 ** Math.min(7, p.attempts - 1));
255
+ }
256
+ }
257
+ if (changed)
258
+ await this.save(document, flight.epoch);
259
+ }
260
+ }
261
+ //# sourceMappingURL=host-monitoring-alerts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-monitoring-alerts.js","sourceRoot":"","sources":["../src/host-monitoring-alerts.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,eAAe,EAAC,qBAAqB,EAA+C,MAAM,mCAAmC,CAAC;AACtI,OAAO,EAAC,eAAe,EAAC,yBAAyB,EAA8C,MAAM,k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AC,EAAC,CAAC,CAAC,QAAQ,GAAC,CAAC,CAAC,CAAC,CAAC;YAAA,CAAC;QAC/H,CAAC;QACD,IAAG,OAAO;YAAC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;CACD"}
@@ -2,8 +2,9 @@
2
2
  export interface HostMonitoringConfig {
3
3
  enabled: boolean;
4
4
  agent_footprint: boolean;
5
+ wsl_drive?: string;
5
6
  }
6
- export declare const HOST_MONITORING_COLLECTOR_AVAILABLE = false;
7
+ export declare const HOST_MONITORING_PAGE_AVAILABLE = true;
7
8
  export declare const HOST_MONITORING_KEYS: readonly ['enabled', 'agent_footprint'];
8
9
  export declare function monitoringProblem(value: unknown): string | null;
9
10
  export declare function monitoringConfig(value?: unknown): HostMonitoringConfig;
@@ -1,11 +1,15 @@
1
- // The first settings slice cannot claim collection exists. The collector slice
2
- // changes this only when its production lifecycle is connected and tested.
3
- export const HOST_MONITORING_COLLECTOR_AVAILABLE = false;
1
+ // S-207 changes this only when the actual Host health page is available.
2
+ export const HOST_MONITORING_PAGE_AVAILABLE = true;
4
3
  export const HOST_MONITORING_KEYS = ['enabled', 'agent_footprint'];
5
4
  export function monitoringProblem(value) {
6
5
  if (!value || typeof value !== 'object' || Array.isArray(value))
7
6
  return 'must be a mapping';
8
7
  for (const [key, setting] of Object.entries(value)) {
8
+ if (key === 'wsl_drive') {
9
+ if (typeof setting !== 'string' || !/^(?:[A-Z])?$/.test(setting))
10
+ return 'wsl_drive must be an uppercase drive letter or empty for automatic';
11
+ continue;
12
+ }
9
13
  if (!HOST_MONITORING_KEYS.includes(key))
10
14
  return `unknown key: ${key}`;
11
15
  if (typeof setting !== 'boolean')
@@ -20,6 +24,7 @@ export function monitoringConfig(value) {
20
24
  throw new Error(`monitoring: ${problem}`);
21
25
  }
22
26
  const v = value;
27
+ // Persist only the beta.16-compatible booleans. wsl_drive is accepted solely for legacy migration / Settings input.
23
28
  // Explicit literals, never a changeable default or an environment override.
24
29
  return { enabled: v?.enabled === true, agent_footprint: v?.agent_footprint === true };
25
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"host-monitoring-config.js","sourceRoot":"","sources":["../src/host-monitoring-config.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,mCAAmC,GAAG,KAAK,CAAC;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAAS,EAAE,iBAAiB,CAAU,CAAC;AAC5E,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,mBAAmB,CAAC;IAC5F,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACnD,IAAI,CAAE,oBAA0C,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,OAAO,gBAAgB,GAAG,EAAE,CAAC;QAC7F,IAAI,OAAO,OAAO,KAAK,SAAS;YAAE,OAAO,GAAG,GAAG,oBAAoB,CAAC;IACtE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AACD,MAAM,UAAU,gBAAgB,CAAC,KAAe;IAC9C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAAC,MAAM,OAAO,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAAC,IAAI,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,eAAe,OAAO,EAAE,CAAC,CAAC;IAAC,CAAC;IAC9H,MAAM,CAAC,GAAG,KAAkD,CAAC;IAC7D,4EAA4E;IAC5E,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,IAAI,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,KAAK,IAAI,EAAE,CAAC;AACxF,CAAC;AAC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QAAC,MAAM,OAAO,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAAC,IAAI,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,eAAe,OAAO,EAAE,CAAC,CAAC;IAAC,CAAC;IAC9H,MAAM,CAAC,GAAG,KAAkD,CAAC;IAC7D,oHAAoH;IACpH,4EAA4E;IAC5E,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,IAAI,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,KAAK,IAAI,EAAE,CAAC;AACxF,CAAC;AACD,MAAM,UAAU,uBAAuB,CAAC,IAAa;IACnD,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAc,CAAC,CAAC,MAAM;QAAE,OAAO,EAAE,KAAK,EAAE,6BAA6B,EAAE,CAAC;IACpH,OAAO,EAAE,KAAK,EAAE,EAAE,GAAG,IAAqC,EAAE,EAAE,CAAC;AACjE,CAAC"}
@@ -0,0 +1,45 @@
1
+ /** Pure, numerical process attribution; no command lines, names, environments or paths in telemetry. */
2
+ export declare const FOOTPRINT_ROOTS = 128, FOOTPRINT_ROWS = 4096, FOOTPRINT_BYTES: number;
3
+ export interface FootprintRoot {
4
+ id: string;
5
+ pid: number;
6
+ owner: string;
7
+ observedAt: number;
8
+ }
9
+ export interface FootprintProcess {
10
+ pid: number;
11
+ ppid: number;
12
+ start: number;
13
+ birth?: number;
14
+ identity?: number;
15
+ cpuMs: number;
16
+ rssBytes: number;
17
+ }
18
+ export interface FootprintRow {
19
+ id: string;
20
+ cpuPercent: number | null;
21
+ rssBytes: number | null;
22
+ managedBytes: number | null;
23
+ processes: number;
24
+ reason?: string;
25
+ }
26
+ export interface FootprintReading {
27
+ rows: FootprintRow[];
28
+ shared: Omit<FootprintRow, 'id'>;
29
+ total: number;
30
+ covered: number;
31
+ processRows: number;
32
+ sampledAt: number;
33
+ truncated: boolean;
34
+ }
35
+ export declare function processCpuMs(text: string): number | null;
36
+ export declare function processStartTime(text: string): number | null;
37
+ /** ps runs with TZ=UTC and LC_ALL=C. Overflow/malformed rows fail the entire inventory, not a partial attribution. */
38
+ export declare function parseFootprintProcesses(text: string | null): FootprintProcess[] | null;
39
+ /** One bounded latest baseline. Root PID reuse, owner changes, clock rollback and gaps withdraw CPU evidence. */
40
+ export declare class FootprintAttribution {
41
+ private before;
42
+ private pins;
43
+ reset(): void;
44
+ sample(processes: FootprintProcess[], roots: FootprintRoot[], fleetPid: number, wall: number, mono: number, logicalCpus: number, candidatePids?: readonly number[]): FootprintReading;
45
+ }
@@ -0,0 +1,150 @@
1
+ /** Pure, numerical process attribution; no command lines, names, environments or paths in telemetry. */
2
+ export const FOOTPRINT_ROOTS = 128, FOOTPRINT_ROWS = 4096, FOOTPRINT_BYTES = 512 * 1024;
3
+ const safe = (n) => Number.isSafeInteger(n) && n >= 0;
4
+ const pid = (n) => safe(n) && n > 1;
5
+ export function processCpuMs(text) {
6
+ const match = /^(?:(\d+)-)?(\d+):(\d{2})(?::(\d{2}))?(?:\.(\d{1,3}))?$/.exec(text);
7
+ if (!match)
8
+ return null;
9
+ const days = Number(match[1] ?? 0), first = Number(match[2]), second = Number(match[3]), third = match[4] === undefined ? null : Number(match[4]), fraction = Number((match[5] ?? '').padEnd(3, '0') || 0);
10
+ if (second > 59 || (third !== null && third > 59) || (days > 0 && third === null))
11
+ return null;
12
+ const value = (days * 86400 + (third === null ? first * 60 + second : first * 3600 + second * 60 + third)) * 1000 + fraction;
13
+ return safe(value) ? value : null;
14
+ }
15
+ const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
16
+ export function processStartTime(text) {
17
+ const m = /^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s+([A-Z][a-z]{2})\s+(\d{1,2})\s+(\d{2}):(\d{2}):(\d{2})\s+(\d{4})$/.exec(text.trim());
18
+ if (!m)
19
+ return null;
20
+ const month = months.indexOf(m[1]), day = Number(m[2]), hour = Number(m[3]), minute = Number(m[4]), second = Number(m[5]), year = Number(m[6]);
21
+ if (month < 0 || day < 1 || day > 31 || hour > 23 || minute > 59 || second > 59 || year < 1970)
22
+ return null;
23
+ const at = Date.UTC(year, month, day, hour, minute, second), d = new Date(at);
24
+ return d.getUTCDate() === day && safe(at) ? at : null;
25
+ }
26
+ /** ps runs with TZ=UTC and LC_ALL=C. Overflow/malformed rows fail the entire inventory, not a partial attribution. */
27
+ export function parseFootprintProcesses(text) {
28
+ if (text === null || Buffer.byteLength(text) > FOOTPRINT_BYTES)
29
+ return null;
30
+ const lines = text.trim() ? text.trim().split(/\r?\n/) : [];
31
+ if (lines.length > FOOTPRINT_ROWS)
32
+ return null;
33
+ const result = [], seen = new Set();
34
+ for (const line of lines) {
35
+ const m = /^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(.+?)\s*$/.exec(line);
36
+ if (!m)
37
+ return null;
38
+ const p = Number(m[1]), parent = Number(m[2]), rss = Number(m[3]) * 1024, cpu = processCpuMs(m[4]), start = processStartTime(m[5]);
39
+ if (!Number.isSafeInteger(p) || p < 1 || !safe(parent) || !safe(rss) || cpu === null || start === null || seen.has(p))
40
+ return null;
41
+ seen.add(p);
42
+ result.push({ pid: p, ppid: parent, start, cpuMs: cpu, rssBytes: rss });
43
+ }
44
+ return result;
45
+ }
46
+ const identity = (process) => process.identity ?? process.start;
47
+ /** One bounded latest baseline. Root PID reuse, owner changes, clock rollback and gaps withdraw CPU evidence. */
48
+ export class FootprintAttribution {
49
+ before = null;
50
+ pins = new Map();
51
+ reset() { this.before = null; this.pins.clear(); }
52
+ sample(processes, roots, fleetPid, wall, mono, logicalCpus, candidatePids = []) {
53
+ if (processes.length > FOOTPRINT_ROWS || roots.length > FOOTPRINT_ROOTS || candidatePids.length > FOOTPRINT_ROOTS * 2 || !safe(wall) || !Number.isFinite(mono) || mono < 0 || !Number.isInteger(logicalCpus) || logicalCpus < 1 || logicalCpus > 1024)
54
+ throw Error('invalid_footprint_input');
55
+ const rows = new Map(processes.map(p => [p.pid, p]));
56
+ if (rows.size !== processes.length)
57
+ throw Error('invalid_footprint_input');
58
+ const priorPins = new Map(this.pins);
59
+ const previous = this.before, elapsed = previous ? mono - previous.mono : 0, continuous = !!previous && elapsed > 0 && elapsed <= 120000 && wall >= previous.wall;
60
+ this.before = { rows, mono, wall };
61
+ if (!continuous)
62
+ this.pins.clear();
63
+ const result = [], owner = new Map(), ambiguous = new Set(), ids = new Set();
64
+ for (const root of roots) {
65
+ if (!/^[a-f0-9]{16}$/.test(root.id) || ids.has(root.id) || typeof root.owner !== 'string' || !root.owner.length || root.owner.length > 256 || !safe(root.observedAt))
66
+ throw Error('invalid_footprint_root');
67
+ ids.add(root.id);
68
+ const row = { id: root.id, cpuPercent: null, rssBytes: null, managedBytes: null, processes: 0, reason: 'root_unavailable' };
69
+ result.push(row);
70
+ const process = rows.get(root.pid), pin = this.pins.get(root.id);
71
+ // Second-resolution OS start stamps must predate the daemon's positive live-pane observation.
72
+ if (!pid(root.pid) || !process || (process.birth ?? process.start) > root.observedAt - 1000 || root.observedAt > wall || wall - root.observedAt > 120000)
73
+ continue;
74
+ if (pin && pin.owner === root.owner && pin.pid === root.pid && pin.identity !== identity(process)) {
75
+ continue;
76
+ }
77
+ this.pins.set(root.id, { owner: root.owner, pid: root.pid, identity: identity(process) });
78
+ if (owner.has(root.pid)) {
79
+ ambiguous.add(root.pid);
80
+ continue;
81
+ }
82
+ owner.set(root.pid, root.id);
83
+ row.rssBytes = 0;
84
+ delete row.reason;
85
+ }
86
+ for (const root of roots)
87
+ if (ambiguous.has(root.pid)) {
88
+ const r = result.find(r => r.id === root.id);
89
+ r.rssBytes = null;
90
+ r.reason = 'ambiguous_root';
91
+ owner.delete(root.pid);
92
+ }
93
+ for (const id of this.pins.keys())
94
+ if (!ids.has(id))
95
+ this.pins.delete(id);
96
+ const knownRoots = new Set([...roots.map(root => root.pid), ...candidatePids].filter(pid));
97
+ const byId = new Map(result.map(r => [r.id, r])), shared = { cpuPercent: null, rssBytes: 0, managedBytes: null, processes: 0 }, cpu = new Map(), unknown = new Set();
98
+ const sharedRoots = new Set([fleetPid]);
99
+ for (const root of roots) {
100
+ const p = rows.get(root.pid);
101
+ if (owner.has(root.pid) && p?.ppid && rows.has(p.ppid))
102
+ sharedRoots.add(p.ppid);
103
+ }
104
+ const attribution = (p) => {
105
+ const seen = new Set();
106
+ let current = p;
107
+ for (let i = 0; i < 64; i++) {
108
+ if (seen.has(current.pid) || ambiguous.has(current.pid))
109
+ return null;
110
+ seen.add(current.pid);
111
+ const owned = owner.get(current.pid);
112
+ if (owned)
113
+ return owned;
114
+ if (knownRoots.has(current.pid))
115
+ return null;
116
+ if (current.pid === fleetPid)
117
+ return 'shared';
118
+ const parent = rows.get(current.ppid);
119
+ if (!parent || parent.start > current.start)
120
+ return sharedRoots.has(p.pid) ? 'shared' : null;
121
+ current = parent;
122
+ }
123
+ return null;
124
+ };
125
+ for (const process of processes) {
126
+ const id = attribution(process);
127
+ if (!id)
128
+ continue;
129
+ const target = id === 'shared' ? shared : byId.get(id);
130
+ if (target.rssBytes === null)
131
+ continue;
132
+ target.rssBytes += process.rssBytes;
133
+ target.processes++;
134
+ const old = previous?.rows.get(process.pid), pin = id === 'shared' ? null : priorPins.get(id), root = roots.find(r => r.id === id);
135
+ const stable = continuous && (!root || !!pin && pin.owner === root.owner && pin.pid === root.pid && pin.identity === identity(rows.get(root.pid))) && !!old && identity(old) === identity(process) && process.cpuMs >= old.cpuMs;
136
+ if (stable)
137
+ cpu.set(id, (cpu.get(id) ?? 0) + process.cpuMs - old.cpuMs);
138
+ else if (continuous && (!root || !!pin && pin.owner === root.owner && pin.pid === root.pid && pin.identity === identity(rows.get(root.pid))) && process.start >= previous.wall)
139
+ cpu.set(id, (cpu.get(id) ?? 0) + process.cpuMs);
140
+ else
141
+ unknown.add(id);
142
+ }
143
+ for (const row of [...result.map(r => ({ id: r.id, row: r })), { id: 'shared', row: shared }]) {
144
+ const value = (cpu.get(row.id) ?? 0) / (elapsed * logicalCpus) * 100;
145
+ row.row.cpuPercent = continuous && !unknown.has(row.id) && row.row.rssBytes !== null && row.row.processes > 0 && Number.isFinite(value) && value <= 101 ? Math.min(100, value) : null;
146
+ }
147
+ return { rows: result, shared, total: roots.length, covered: result.filter(r => r.rssBytes !== null).length, processRows: processes.length, sampledAt: wall, truncated: false };
148
+ }
149
+ }
150
+ //# sourceMappingURL=host-monitoring-footprint-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-monitoring-footprint-policy.js","sourceRoot":"","sources":["../src/host-monitoring-footprint-policy.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,cAAc,GAAG,IAAI,EAAE,eAAe,GAAG,GAAG,GAAG,IAAI,CAAC;AAKxF,MAAM,IAAI,GAAC,CAAC,CAAQ,EAAC,EAAE,CAAA,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAE,CAAC,IAAE,CAAC,CAAC;AACrD,MAAM,GAAG,GAAC,CAAC,CAAQ,EAAC,EAAE,CAAA,IAAI,CAAC,CAAC,CAAC,IAAE,CAAC,GAAC,CAAC,CAAC;AACnC,MAAM,UAAU,YAAY,CAAC,IAAW;IACvC,MAAM,KAAK,GAAC,yDAAyD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAAA,IAAG,CAAC,KAAK;QAAC,OAAO,IAAI,CAAC;IACvG,MAAM,IAAI,GAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAE,CAAC,CAAC,EAAC,KAAK,GAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAC,MAAM,GAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAC,KAAK,GAAC,KAAK,CAAC,CAAC,CAAC,KAAG,SAAS,CAAA,CAAC,CAAA,IAAI,CAAA,CAAC,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EAAC,KAAK,EAAC,KAAK,CAAC,MAAM,EAAC,OAAO,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA,EAAE,CAAA,CAAC,CAAC,QAAQ,KAAG,IAAI,CAAC,CAAC,MAAM,EAAC,WAAW,EAAC,SAAS,CAAC,MAAM,EAAC,SAAS,EAAC,IAAI,EAAC,SAAS,EAAC,KAAK,EAAC,CAAC;IAC/J,CAAC;CACD"}
@@ -0,0 +1,42 @@
1
+ import { bindLinuxRootIdentities } from './host-monitoring-process-identity.js';
2
+ import { type FootprintRoot, type FootprintReading } from './host-monitoring-footprint-policy.js';
3
+ import type { MonitoringProbe } from './host-monitoring.js';
4
+ export interface FootprintInput extends FootprintRoot {
5
+ files: string[];
6
+ }
7
+ export interface FootprintSnapshot {
8
+ enabled: boolean;
9
+ status: 'off' | 'starting' | 'ok' | 'stale' | 'unavailable' | 'stopping';
10
+ reading: FootprintReading | null;
11
+ reason?: string;
12
+ }
13
+ export type ProcessRunner = () => MonitoringProbe<string>;
14
+ /** Separate from disk probes: fixed columns, no command line, no shell, one bounded pipe. */
15
+ export declare const runFootprintProcesses: ProcessRunner;
16
+ interface Options {
17
+ roots(): FootprintInput[];
18
+ identities?: typeof bindLinuxRootIdentities;
19
+ runner?: ProcessRunner;
20
+ now?: () => number;
21
+ monotonic?: () => number;
22
+ logicalCpus?: () => number;
23
+ fleetPid?: number;
24
+ changed?(): void;
25
+ }
26
+ /** A single 60-second flight. Logical timeout never releases physical process/stat ownership. */
27
+ export declare class HostFootprint {
28
+ private readonly options;
29
+ private enabled;
30
+ private timer;
31
+ private flight;
32
+ private cancel;
33
+ private epoch;
34
+ private policy;
35
+ private value;
36
+ constructor(options: Options);
37
+ snapshot(): FootprintSnapshot;
38
+ configure(enabled: boolean): void;
39
+ stop(): Promise<void>;
40
+ private sample;
41
+ }
42
+ export {};