@noodleseed/one 0.17.0 → 0.18.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.
Files changed (180) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +3 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/alerts-ops.d.ts +2 -0
  5. package/dist/commands/alerts-ops.d.ts.map +1 -0
  6. package/dist/commands/alerts-ops.js +249 -0
  7. package/dist/commands/alerts-ops.js.map +1 -0
  8. package/dist/commands/analytics-ops.d.ts +13 -0
  9. package/dist/commands/analytics-ops.d.ts.map +1 -1
  10. package/dist/commands/analytics-ops.js +5 -2
  11. package/dist/commands/analytics-ops.js.map +1 -1
  12. package/dist/commands/catalog-data-resources.d.ts.map +1 -1
  13. package/dist/commands/catalog-data-resources.js +45 -0
  14. package/dist/commands/catalog-data-resources.js.map +1 -1
  15. package/dist/commands/github-ops.d.ts.map +1 -1
  16. package/dist/commands/github-ops.js +24 -4
  17. package/dist/commands/github-ops.js.map +1 -1
  18. package/dist/commands/github-runs-ops.d.ts +32 -0
  19. package/dist/commands/github-runs-ops.d.ts.map +1 -0
  20. package/dist/commands/github-runs-ops.js +132 -0
  21. package/dist/commands/github-runs-ops.js.map +1 -0
  22. package/dist/commands/mcp-apps.js +27 -0
  23. package/dist/commands/mcp-apps.js.map +1 -1
  24. package/dist/prompts.d.ts.map +1 -1
  25. package/dist/prompts.js +1 -3
  26. package/dist/prompts.js.map +1 -1
  27. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.d.ts.map +1 -1
  28. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js +5 -0
  29. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js.map +1 -1
  30. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.d.ts.map +1 -1
  31. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js +1 -0
  32. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js.map +1 -1
  33. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.d.ts.map +1 -1
  34. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js +3 -1
  35. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js.map +1 -1
  36. package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
  37. package/node_modules/@noodle-borg/authoring/dist/recording.js +18 -23
  38. package/node_modules/@noodle-borg/authoring/dist/recording.js.map +1 -1
  39. package/node_modules/@noodle-borg/authoring/dist/server.d.ts +4 -1
  40. package/node_modules/@noodle-borg/authoring/dist/server.d.ts.map +1 -1
  41. package/node_modules/@noodle-borg/authoring/dist/server.js +3 -1
  42. package/node_modules/@noodle-borg/authoring/dist/server.js.map +1 -1
  43. package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts +2 -0
  44. package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts.map +1 -1
  45. package/node_modules/@noodle-borg/compiler/dist/compile.js +1 -1
  46. package/node_modules/@noodle-borg/compiler/dist/compile.js.map +1 -1
  47. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +1 -0
  48. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts.map +1 -1
  49. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +6 -0
  50. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js.map +1 -1
  51. package/node_modules/@noodle-borg/compiler/dist/widget-compile-helpers.d.ts +3 -1
  52. package/node_modules/@noodle-borg/compiler/dist/widget-compile-helpers.d.ts.map +1 -1
  53. package/node_modules/@noodle-borg/compiler/dist/widget-compile-helpers.js +7 -1
  54. package/node_modules/@noodle-borg/compiler/dist/widget-compile-helpers.js.map +1 -1
  55. package/node_modules/@noodle-borg/compiler/dist/widget-emit.d.ts.map +1 -1
  56. package/node_modules/@noodle-borg/compiler/dist/widget-emit.js +3 -1
  57. package/node_modules/@noodle-borg/compiler/dist/widget-emit.js.map +1 -1
  58. package/node_modules/@noodle-borg/protocol/dist/mapping.d.ts +3 -1
  59. package/node_modules/@noodle-borg/protocol/dist/mapping.d.ts.map +1 -1
  60. package/node_modules/@noodle-borg/protocol/dist/mapping.js +9 -3
  61. package/node_modules/@noodle-borg/protocol/dist/mapping.js.map +1 -1
  62. package/node_modules/@noodle-borg/protocol/dist/sdk-server.js +1 -1
  63. package/node_modules/@noodle-borg/protocol/dist/sdk-server.js.map +1 -1
  64. package/node_modules/@noodle-borg/protocol/dist/widget/react-bridge-bootstrap.d.ts +1 -1
  65. package/node_modules/@noodle-borg/protocol/dist/widget/react-bridge-bootstrap.d.ts.map +1 -1
  66. package/node_modules/@noodle-borg/protocol/dist/widget/react-bridge-bootstrap.js +1 -1
  67. package/node_modules/@noodle-borg/service/dist/alert-evaluator.d.ts +57 -0
  68. package/node_modules/@noodle-borg/service/dist/alert-evaluator.d.ts.map +1 -0
  69. package/node_modules/@noodle-borg/service/dist/alert-evaluator.js +158 -0
  70. package/node_modules/@noodle-borg/service/dist/alert-evaluator.js.map +1 -0
  71. package/node_modules/@noodle-borg/service/dist/alert-webhook.d.ts +72 -0
  72. package/node_modules/@noodle-borg/service/dist/alert-webhook.d.ts.map +1 -0
  73. package/node_modules/@noodle-borg/service/dist/alert-webhook.js +138 -0
  74. package/node_modules/@noodle-borg/service/dist/alert-webhook.js.map +1 -0
  75. package/node_modules/@noodle-borg/service/dist/github/pending-installations.d.ts +15 -8
  76. package/node_modules/@noodle-borg/service/dist/github/pending-installations.d.ts.map +1 -1
  77. package/node_modules/@noodle-borg/service/dist/github/pending-installations.js +16 -9
  78. package/node_modules/@noodle-borg/service/dist/github/pending-installations.js.map +1 -1
  79. package/node_modules/@noodle-borg/service/dist/index.d.ts +10 -2
  80. package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
  81. package/node_modules/@noodle-borg/service/dist/index.js +9 -1
  82. package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
  83. package/node_modules/@noodle-borg/service/dist/options.d.ts +20 -1
  84. package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
  85. package/node_modules/@noodle-borg/service/dist/routes/alerts-dispatch.d.ts +28 -0
  86. package/node_modules/@noodle-borg/service/dist/routes/alerts-dispatch.d.ts.map +1 -0
  87. package/node_modules/@noodle-borg/service/dist/routes/alerts-dispatch.js +50 -0
  88. package/node_modules/@noodle-borg/service/dist/routes/alerts-dispatch.js.map +1 -0
  89. package/node_modules/@noodle-borg/service/dist/routes/alerts.d.ts +39 -0
  90. package/node_modules/@noodle-borg/service/dist/routes/alerts.d.ts.map +1 -0
  91. package/node_modules/@noodle-borg/service/dist/routes/alerts.js +204 -0
  92. package/node_modules/@noodle-borg/service/dist/routes/alerts.js.map +1 -0
  93. package/node_modules/@noodle-borg/service/dist/routes/contracts.d.ts +149 -0
  94. package/node_modules/@noodle-borg/service/dist/routes/contracts.d.ts.map +1 -1
  95. package/node_modules/@noodle-borg/service/dist/routes/contracts.js +81 -0
  96. package/node_modules/@noodle-borg/service/dist/routes/contracts.js.map +1 -1
  97. package/node_modules/@noodle-borg/service/dist/routes/github-connection.js +1 -1
  98. package/node_modules/@noodle-borg/service/dist/routes/github-connection.js.map +1 -1
  99. package/node_modules/@noodle-borg/service/dist/routes/github-dispatch.d.ts +2 -1
  100. package/node_modules/@noodle-borg/service/dist/routes/github-dispatch.d.ts.map +1 -1
  101. package/node_modules/@noodle-borg/service/dist/routes/github-dispatch.js +37 -2
  102. package/node_modules/@noodle-borg/service/dist/routes/github-dispatch.js.map +1 -1
  103. package/node_modules/@noodle-borg/service/dist/routes/github-runs.d.ts +8 -0
  104. package/node_modules/@noodle-borg/service/dist/routes/github-runs.d.ts.map +1 -0
  105. package/node_modules/@noodle-borg/service/dist/routes/github-runs.js +33 -0
  106. package/node_modules/@noodle-borg/service/dist/routes/github-runs.js.map +1 -0
  107. package/node_modules/@noodle-borg/service/dist/routes/github-setup.d.ts +1 -1
  108. package/node_modules/@noodle-borg/service/dist/routes/github-setup.d.ts.map +1 -1
  109. package/node_modules/@noodle-borg/service/dist/routes/github-setup.js +3 -3
  110. package/node_modules/@noodle-borg/service/dist/routes/github-setup.js.map +1 -1
  111. package/node_modules/@noodle-borg/service/dist/routes/github-webhook.d.ts +29 -0
  112. package/node_modules/@noodle-borg/service/dist/routes/github-webhook.d.ts.map +1 -0
  113. package/node_modules/@noodle-borg/service/dist/routes/github-webhook.js +355 -0
  114. package/node_modules/@noodle-borg/service/dist/routes/github-webhook.js.map +1 -0
  115. package/node_modules/@noodle-borg/service/dist/routes/org-admin-dispatch.d.ts +27 -0
  116. package/node_modules/@noodle-borg/service/dist/routes/org-admin-dispatch.d.ts.map +1 -0
  117. package/node_modules/@noodle-borg/service/dist/routes/org-admin-dispatch.js +61 -0
  118. package/node_modules/@noodle-borg/service/dist/routes/org-admin-dispatch.js.map +1 -0
  119. package/node_modules/@noodle-borg/service/dist/routes/paths.d.ts +20 -1
  120. package/node_modules/@noodle-borg/service/dist/routes/paths.d.ts.map +1 -1
  121. package/node_modules/@noodle-borg/service/dist/routes/paths.js +54 -0
  122. package/node_modules/@noodle-borg/service/dist/routes/paths.js.map +1 -1
  123. package/node_modules/@noodle-borg/service/dist/serve.d.ts.map +1 -1
  124. package/node_modules/@noodle-borg/service/dist/serve.js +42 -1
  125. package/node_modules/@noodle-borg/service/dist/serve.js.map +1 -1
  126. package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
  127. package/node_modules/@noodle-borg/service/dist/service.js +37 -53
  128. package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
  129. package/node_modules/@noodle-borg/service/dist/store/alert-rules-json-file.d.ts +21 -0
  130. package/node_modules/@noodle-borg/service/dist/store/alert-rules-json-file.d.ts.map +1 -0
  131. package/node_modules/@noodle-borg/service/dist/store/alert-rules-json-file.js +115 -0
  132. package/node_modules/@noodle-borg/service/dist/store/alert-rules-json-file.js.map +1 -0
  133. package/node_modules/@noodle-borg/service/dist/store/alert-rules.d.ts +108 -0
  134. package/node_modules/@noodle-borg/service/dist/store/alert-rules.d.ts.map +1 -0
  135. package/node_modules/@noodle-borg/service/dist/store/alert-rules.js +181 -0
  136. package/node_modules/@noodle-borg/service/dist/store/alert-rules.js.map +1 -0
  137. package/node_modules/@noodle-borg/service/dist/store/github-connections-json-file.d.ts +1 -0
  138. package/node_modules/@noodle-borg/service/dist/store/github-connections-json-file.d.ts.map +1 -1
  139. package/node_modules/@noodle-borg/service/dist/store/github-connections-json-file.js +4 -0
  140. package/node_modules/@noodle-borg/service/dist/store/github-connections-json-file.js.map +1 -1
  141. package/node_modules/@noodle-borg/service/dist/store/github-connections.d.ts +1 -0
  142. package/node_modules/@noodle-borg/service/dist/store/github-connections.d.ts.map +1 -1
  143. package/node_modules/@noodle-borg/service/dist/store/github-connections.js +4 -0
  144. package/node_modules/@noodle-borg/service/dist/store/github-connections.js.map +1 -1
  145. package/node_modules/@noodle-borg/service/dist/store/github-runs-json-file.d.ts +22 -0
  146. package/node_modules/@noodle-borg/service/dist/store/github-runs-json-file.d.ts.map +1 -0
  147. package/node_modules/@noodle-borg/service/dist/store/github-runs-json-file.js +116 -0
  148. package/node_modules/@noodle-borg/service/dist/store/github-runs-json-file.js.map +1 -0
  149. package/node_modules/@noodle-borg/service/dist/store/github-runs.d.ts +51 -0
  150. package/node_modules/@noodle-borg/service/dist/store/github-runs.d.ts.map +1 -0
  151. package/node_modules/@noodle-borg/service/dist/store/github-runs.js +158 -0
  152. package/node_modules/@noodle-borg/service/dist/store/github-runs.js.map +1 -0
  153. package/node_modules/@noodle-borg/service/dist/store/pending-installations-postgres.d.ts +19 -0
  154. package/node_modules/@noodle-borg/service/dist/store/pending-installations-postgres.d.ts.map +1 -0
  155. package/node_modules/@noodle-borg/service/dist/store/pending-installations-postgres.js +46 -0
  156. package/node_modules/@noodle-borg/service/dist/store/pending-installations-postgres.js.map +1 -0
  157. package/node_modules/@noodle-borg/service/dist/store/postgres-alerts.d.ts +26 -0
  158. package/node_modules/@noodle-borg/service/dist/store/postgres-alerts.d.ts.map +1 -0
  159. package/node_modules/@noodle-borg/service/dist/store/postgres-alerts.js +142 -0
  160. package/node_modules/@noodle-borg/service/dist/store/postgres-alerts.js.map +1 -0
  161. package/node_modules/@noodle-borg/service/dist/store/postgres-github-runs.d.ts +9 -0
  162. package/node_modules/@noodle-borg/service/dist/store/postgres-github-runs.d.ts.map +1 -0
  163. package/node_modules/@noodle-borg/service/dist/store/postgres-github-runs.js +113 -0
  164. package/node_modules/@noodle-borg/service/dist/store/postgres-github-runs.js.map +1 -0
  165. package/node_modules/@noodle-borg/service/dist/store/postgres-github.d.ts +1 -0
  166. package/node_modules/@noodle-borg/service/dist/store/postgres-github.d.ts.map +1 -1
  167. package/node_modules/@noodle-borg/service/dist/store/postgres-github.js +7 -2
  168. package/node_modules/@noodle-borg/service/dist/store/postgres-github.js.map +1 -1
  169. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.d.ts.map +1 -1
  170. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js +49 -0
  171. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js.map +1 -1
  172. package/node_modules/@noodle-borg/service/dist/store/postgres.d.ts +9 -2
  173. package/node_modules/@noodle-borg/service/dist/store/postgres.d.ts.map +1 -1
  174. package/node_modules/@noodle-borg/service/dist/store/postgres.js +17 -1
  175. package/node_modules/@noodle-borg/service/dist/store/postgres.js.map +1 -1
  176. package/node_modules/@noodle-borg/service/dist/store.d.ts +104 -0
  177. package/node_modules/@noodle-borg/service/dist/store.d.ts.map +1 -1
  178. package/node_modules/@noodle-borg/service/dist/store.js +2 -0
  179. package/node_modules/@noodle-borg/service/dist/store.js.map +1 -1
  180. package/package.json +2 -2
@@ -0,0 +1,138 @@
1
+ import { isIP } from 'node:net';
2
+ import { guardedFetch, isPublicUnicast } from '@noodle-borg/connector-http';
3
+ /**
4
+ * Alert webhook delivery (E2, ADR 0130): a single POST attempt with a bounded timeout through the
5
+ * shared SSRF guard (`guardedFetch` pins DNS resolutions to public unicast addresses — the same
6
+ * anti-rebinding layer the HTTP connector uses). No retries, no backoff queue (deferred to E3).
7
+ *
8
+ * The webhook URL is SENSITIVE (it may embed capability tokens). Nothing this module returns or
9
+ * throws carries the URL, its host, or an upstream error message: outcomes are closed-vocabulary
10
+ * reason codes plus the HTTP status, safe to log verbatim.
11
+ */
12
+ export const ALERT_WEBHOOK_SCHEMA_VERSION = 1;
13
+ const DEFAULT_TIMEOUT_MS = 10_000;
14
+ const LOOPBACK_HOSTS = new Set(['localhost', '127.0.0.1', '::1']);
15
+ export function buildAlertWebhookPayload(rule, event, observed, firedAt) {
16
+ return {
17
+ schemaVersion: ALERT_WEBHOOK_SCHEMA_VERSION,
18
+ event,
19
+ org: rule.orgSlug,
20
+ app: rule.appSlug,
21
+ env: rule.environment,
22
+ rule: {
23
+ id: rule.id,
24
+ ...(rule.name !== undefined ? { name: rule.name } : {}),
25
+ metric: rule.metric,
26
+ threshold: rule.threshold,
27
+ windowMinutes: rule.windowMinutes,
28
+ comparison: rule.comparison,
29
+ },
30
+ observed,
31
+ firedAt,
32
+ };
33
+ }
34
+ /**
35
+ * Policy validation for a webhook URL, applied at rule create/test time AND re-applied on every
36
+ * delivery (defense in depth for stored rules). Error messages are generic policy text — they
37
+ * never echo the URL, host, or credentials back.
38
+ */
39
+ export function validateAlertWebhookUrl(raw, policy) {
40
+ let url;
41
+ try {
42
+ url = new URL(raw);
43
+ }
44
+ catch {
45
+ return { ok: false, error: '"webhookUrl" must be a valid absolute URL' };
46
+ }
47
+ if (url.username !== '' || url.password !== '') {
48
+ return { ok: false, error: '"webhookUrl" must not embed credentials' };
49
+ }
50
+ const host = url.hostname.replace(/^\[|\]$/g, '');
51
+ const loopback = LOOPBACK_HOSTS.has(host);
52
+ if (url.protocol === 'http:') {
53
+ if (loopback && policy.allowLoopback)
54
+ return { ok: true, url };
55
+ return {
56
+ ok: false,
57
+ error: '"webhookUrl" must use https (plain http is allowed only for loopback targets outside production)',
58
+ };
59
+ }
60
+ if (url.protocol !== 'https:') {
61
+ return { ok: false, error: '"webhookUrl" must use https' };
62
+ }
63
+ if (loopback) {
64
+ return policy.allowLoopback
65
+ ? { ok: true, url }
66
+ : { ok: false, error: '"webhookUrl" must not target a loopback address' };
67
+ }
68
+ // Literal IPs carry no DNS step for the delivery-time guard to pin, so they are policy-checked
69
+ // here: only public unicast addresses are accepted (blocks 10/8, 172.16/12, 192.168/16,
70
+ // link-local incl. the cloud metadata address, and other reserved ranges).
71
+ if (isIP(host) !== 0 && !isPublicUnicast(host)) {
72
+ return { ok: false, error: '"webhookUrl" must not target a private or reserved IP address' };
73
+ }
74
+ return { ok: true, url };
75
+ }
76
+ /**
77
+ * Single-attempt webhook POST. Loopback targets (dev carve-out) use the plain platform fetch —
78
+ * the pinned lookup would reject loopback resolutions by design; everything else goes through
79
+ * {@link guardedFetch}. Redirects are not followed (a redirect could re-point the request at an
80
+ * unguarded literal-IP target); a 3xx reports as an ordinary non-2xx outcome.
81
+ */
82
+ export async function deliverAlertWebhook(rawUrl, payload, options = {}) {
83
+ const validated = validateAlertWebhookUrl(rawUrl, {
84
+ allowLoopback: options.allowLoopback === true,
85
+ });
86
+ if (!validated.ok)
87
+ return { delivered: false, reason: 'invalid_url' };
88
+ const init = {
89
+ method: 'POST',
90
+ headers: {
91
+ 'content-type': 'application/json; charset=utf-8',
92
+ 'user-agent': 'noodleseed-alerts/1',
93
+ },
94
+ body: JSON.stringify(payload),
95
+ redirect: 'manual',
96
+ signal: AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS),
97
+ };
98
+ const host = validated.url.hostname.replace(/^\[|\]$/g, '');
99
+ try {
100
+ const response = LOOPBACK_HOSTS.has(host)
101
+ ? await fetch(validated.url, init)
102
+ : await guardedFetch(validated.url, init, {
103
+ ...(options.timeoutMs !== undefined ? { connectTimeoutMs: options.timeoutMs } : {}),
104
+ ...(options.lookup !== undefined ? { lookup: options.lookup } : {}),
105
+ });
106
+ // Drain/cancel the body — the response content is untrusted and unbounded; only the status matters.
107
+ try {
108
+ await response.body?.cancel();
109
+ }
110
+ catch {
111
+ // ignore: some bodies are already consumed/closed
112
+ }
113
+ if (response.ok)
114
+ return { delivered: true, status: response.status };
115
+ return { delivered: false, status: response.status, reason: 'http_error' };
116
+ }
117
+ catch (error) {
118
+ return { delivered: false, reason: classifyDeliveryError(error) };
119
+ }
120
+ }
121
+ /** Map a fetch failure to a closed reason code — upstream messages may embed the URL/host. */
122
+ function classifyDeliveryError(error) {
123
+ if (error instanceof Error) {
124
+ if (error.name === 'TimeoutError' || error.name === 'AbortError')
125
+ return 'timeout';
126
+ if (error.message.startsWith('egress blocked:'))
127
+ return 'egress_blocked';
128
+ const cause = error.cause;
129
+ if (cause instanceof Error && cause.message.startsWith('egress blocked:')) {
130
+ return 'egress_blocked';
131
+ }
132
+ if (cause instanceof Error && (cause.name === 'TimeoutError' || cause.name === 'AbortError')) {
133
+ return 'timeout';
134
+ }
135
+ }
136
+ return 'network_error';
137
+ }
138
+ //# sourceMappingURL=alert-webhook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-webhook.js","sourceRoot":"","sources":["../src/alert-webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAkB,YAAY,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG5F;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAC9C,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;AAoBlE,MAAM,UAAU,wBAAwB,CACtC,IAAqB,EACrB,KAAwB,EACxB,QAAgB,EAChB,OAAe;IAEf,OAAO;QACL,aAAa,EAAE,4BAA4B;QAC3C,KAAK;QACL,GAAG,EAAE,IAAI,CAAC,OAAO;QACjB,GAAG,EAAE,IAAI,C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CAAC;IACpE,CAAC;AACH,CAAC;AAED,8FAA8F;AAC9F,SAAS,qBAAqB,CAAC,KAAc;IAC3C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY;YAAE,OAAO,SAAS,CAAC;QACnF,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC;YAAE,OAAO,gBAAgB,CAAC;QACzE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC1B,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC1E,OAAO,gBAAgB,CAAC;QAC1B,CAAC;QACD,IAAI,KAAK,YAAY,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC,EAAE,CAAC;YAC7F,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Minimal in-memory hand-off for the CLI `noodle github connect` poll (GHD-1.4). GitHub's installation
2
+ * Hand-off store for the CLI `noodle github connect` poll (GHD-1.4). GitHub's installation
3
3
  * flow redirects the installer's BROWSER to the GitHub App's configured "Setup URL" once the install
4
4
  * completes — a request the CLI process cannot receive directly (it has no public callback endpoint of
5
5
  * its own). `GET /v1/github/setup` (`../routes/github-setup.ts`) IS that Setup URL: it lands the
@@ -8,10 +8,14 @@
8
8
  * (same file) until the entry appears, then proceeds to `POST /v1/github/installations/claim`.
9
9
  *
10
10
  * Entries expire on the same 10-minute TTL as the nonce itself (`install-nonce.ts`) so a stale poll can
11
- * never resurrect an old install correlation. Deliberately NOT the durable `GithubConnectionStore` this
12
- * is single-flight hand-off state, not a persisted record; a multi-instance deployment needs a shared
13
- * backing (e.g. Postgres/Redis) before this feature is exposed there (see ADR 0111).
11
+ * never resurrect an old install correlation. The interface is async because a multi-instance
12
+ * deployment backs it with Postgres (`PostgresArtifactStore` implements it GHD-2 closed the gap
13
+ * flagged in the GHD-1 review): the setup redirect and the CLI poll can land on different instances,
14
+ * so the hand-off must live in the shared store. The in-memory backend remains the single-instance
15
+ * dev/test default.
14
16
  */
17
+ /** Shared hand-off TTL — mirrors the install-nonce TTL so neither side outlives the other. */
18
+ export declare const PENDING_GITHUB_INSTALLATION_TTL_MS: number;
15
19
  export interface PendingGithubInstallationStore {
16
20
  /**
17
21
  * Record that the setup redirect landed for `state`, carrying the installationId GitHub reported.
@@ -19,13 +23,16 @@ export interface PendingGithubInstallationStore {
19
23
  * redirect cannot overwrite the recorded installation (hardening: the repo-confirm step and the
20
24
  * repo-in-installation re-verification already blunt a swapped id; this closes the race outright).
21
25
  */
22
- put(state: string, installationId: number): void;
26
+ put(state: string, installationId: number): Promise<void>;
23
27
  /** The installationId stashed for `state`, or `undefined` if it hasn't landed yet (or has expired). */
24
- get(state: string): number | undefined;
28
+ get(state: string): Promise<number | undefined>;
25
29
  }
26
30
  export declare class InMemoryPendingGithubInstallationStore implements PendingGithubInstallationStore {
27
31
  #private;
28
- put(state: string, installationId: number): void;
29
- get(state: string): number | undefined;
32
+ constructor(options?: {
33
+ now?: () => Date;
34
+ });
35
+ put(state: string, installationId: number): Promise<void>;
36
+ get(state: string): Promise<number | undefined>;
30
37
  }
31
38
  //# sourceMappingURL=pending-installations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pending-installations.d.ts","sourceRoot":"","sources":["../../src/github/pending-installations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AASH,MAAM,WAAW,8BAA8B;IAC7C;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD,uGAAuG;IACvG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACxC;AAED,qBAAa,sCAAuC,YAAW,8BAA8B;;IAG3F,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI;IAKhD,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CASvC"}
1
+ {"version":3,"file":"pending-installations.d.ts","sourceRoot":"","sources":["../../src/github/pending-installations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,8FAA8F;AAC9F,eAAO,MAAM,kCAAkC,QAAiB,CAAC;AAOjE,MAAM,WAAW,8BAA8B;IAC7C;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,uGAAuG;IACvG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACjD;AAED,qBAAa,sCAAuC,YAAW,8BAA8B;;gBAI/E,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;KAAO;IAIxC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzD,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAStD"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Minimal in-memory hand-off for the CLI `noodle github connect` poll (GHD-1.4). GitHub's installation
2
+ * Hand-off store for the CLI `noodle github connect` poll (GHD-1.4). GitHub's installation
3
3
  * flow redirects the installer's BROWSER to the GitHub App's configured "Setup URL" once the install
4
4
  * completes — a request the CLI process cannot receive directly (it has no public callback endpoint of
5
5
  * its own). `GET /v1/github/setup` (`../routes/github-setup.ts`) IS that Setup URL: it lands the
@@ -8,23 +8,30 @@
8
8
  * (same file) until the entry appears, then proceeds to `POST /v1/github/installations/claim`.
9
9
  *
10
10
  * Entries expire on the same 10-minute TTL as the nonce itself (`install-nonce.ts`) so a stale poll can
11
- * never resurrect an old install correlation. Deliberately NOT the durable `GithubConnectionStore` this
12
- * is single-flight hand-off state, not a persisted record; a multi-instance deployment needs a shared
13
- * backing (e.g. Postgres/Redis) before this feature is exposed there (see ADR 0111).
11
+ * never resurrect an old install correlation. The interface is async because a multi-instance
12
+ * deployment backs it with Postgres (`PostgresArtifactStore` implements it GHD-2 closed the gap
13
+ * flagged in the GHD-1 review): the setup redirect and the CLI poll can land on different instances,
14
+ * so the hand-off must live in the shared store. The in-memory backend remains the single-instance
15
+ * dev/test default.
14
16
  */
15
- const PENDING_TTL_MS = 10 * 60 * 1000;
17
+ /** Shared hand-off TTL mirrors the install-nonce TTL so neither side outlives the other. */
18
+ export const PENDING_GITHUB_INSTALLATION_TTL_MS = 10 * 60 * 1000;
16
19
  export class InMemoryPendingGithubInstallationStore {
17
20
  #entries = new Map();
18
- put(state, installationId) {
21
+ #now;
22
+ constructor(options = {}) {
23
+ this.#now = options.now ?? (() => new Date());
24
+ }
25
+ async put(state, installationId) {
19
26
  if (this.#entries.has(state))
20
27
  return; // first write wins — see the interface doc
21
- this.#entries.set(state, { installationId, createdAt: Date.now() });
28
+ this.#entries.set(state, { installationId, createdAt: this.#now().getTime() });
22
29
  }
23
- get(state) {
30
+ async get(state) {
24
31
  const entry = this.#entries.get(state);
25
32
  if (entry === undefined)
26
33
  return undefined;
27
- if (Date.now() - entry.createdAt > PENDING_TTL_MS) {
34
+ if (this.#now().getTime() - entry.createdAt > PENDING_GITHUB_INSTALLATION_TTL_MS) {
28
35
  this.#entries.delete(state);
29
36
  return undefined;
30
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pending-installations.js","sourceRoot":"","sources":["../../src/github/pending-installations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,cAAc,GAAG,EAA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Aa,EAAE,cAAsB;QAC7C,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,2CAA2C;QACjF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,KAAa;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC1C,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,SAAS,GAAG,kCAAkC,EAAE,CAAC;YACjF,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,KAAK,CAAC,cAAc,CAAC;IAC9B,CAAC;CACF"}
@@ -1,4 +1,6 @@
1
1
  export { ensureAuditSchema, PostgresAuditStore } from '@noodle-borg/module-audit';
2
+ export { ALERT_EVALUATION_INTERVAL_MS, AlertEvaluator, type AlertEvaluatorOptions, observedMetricValue, } from './alert-evaluator.js';
3
+ export { ALERT_WEBHOOK_SCHEMA_VERSION, type AlertWebhookDelivery, type AlertWebhookPayload, buildAlertWebhookPayload, type DeliverAlertWebhookOptions, deliverAlertWebhook, validateAlertWebhookUrl, type WebhookUrlPolicy, } from './alert-webhook.js';
2
4
  export { ARCHIVE_SWEEP_INTERVAL_MS, ArchiveSweeper, type ArchiveSweeperOptions, DEFAULT_ARCHIVE_RETENTION_DAYS, resolveArchiveRetentionDays, } from './archive-sweeper.js';
3
5
  export { type AssetAdapterKind, type AssetConfigInput, type AssetConfigResolution, type AssetQuotaOverride, createAssetStore, type ResolvedAssetConfig, resolveAssetConfig, } from './asset-config.js';
4
6
  export { type AssetStore, type AssetUploadPlan, type AssetUploadTarget, InMemoryAssetStore, type InMemoryAssetStoreOptions, } from './assets.js';
@@ -17,20 +19,26 @@ export { CachingPolicyAssignmentStore, type PolicyCacheOptions, } from './policy
17
19
  export { InMemoryPolicyCounterStore } from './policy-counters.js';
18
20
  export { type DeployError, type DeployResult, type RecoverResult, type RollbackResult, ServerRegistry, } from './registry.js';
19
21
  export { aggregateRequestEvents, type ClientMetrics, type MethodMetrics, type RequestMetrics, type SeriesBucket, type ToolMetrics, } from './request-event-metrics.js';
20
- export { AppResponseSchema, AppSummarySchema, AppsListResponseSchema, DeploymentResponseSchema, DeploymentSummarySchema, EnvResponseSchema, EnvSummarySchema, EnvsListResponseSchema, GithubConnectionResponseSchema, GithubInstallUrlResponseSchema, OrgSummarySchema, RepoConnectionSchema, } from './routes/contracts.js';
22
+ export { AppResponseSchema, AppSummarySchema, AppsListResponseSchema, DeploymentResponseSchema, DeploymentSummarySchema, DeployRunSchema, EnvResponseSchema, EnvSummarySchema, EnvsListResponseSchema, GithubConnectionResponseSchema, GithubInstallUrlResponseSchema, GithubRunsListResponseSchema, OrgSummarySchema, RepoConnectionSchema, } from './routes/contracts.js';
21
23
  export { type GcpKmsConfig, gcpKmsMasterKeyProvider, type KmsClient, } from './secret/kms-master-key.js';
22
24
  export { type RunningService, serveService } from './serve.js';
23
25
  export { createServiceHandler } from './service.js';
24
26
  export { capabilitiesForConfig, defineNoodleService, expandServiceProfile, type NoodleServiceConfig, type ObservabilityConfig, type ObservabilityLogFormat, type ObservabilityLogLevel, type ObservabilityLogSink, parseNoodleServiceYaml, resolveServiceConfigSource, type ServiceConfigSource, } from './service-config.js';
27
+ export { ALERT_METRICS, ALERT_WINDOWS_MINUTES, type AlertFiringState, type AlertMetric, type AlertRuleRecord, type AlertRuleStore, type AlertWindowMinutes, type CreateAlertRuleInput, DEFAULT_ALERT_COOLDOWN_MINUTES, InMemoryAlertRuleStore, MAX_ALERT_RULES_PER_ENV, } from './store/alert-rules.js';
28
+ export { JsonFileAlertRuleStore } from './store/alert-rules-json-file.js';
25
29
  export { AUDIT_SCHEMA_VERSION, type AuditDecision, type AuditDetails, type AuditEvent, type AuditEventInput, type AuditFilter, type AuditSink, type AuditStore, InMemoryAuditStore, type InMemoryAuditStoreOptions, MultiSink, redactDetails, StdoutAuditSink, } from './store/audit.js';
26
30
  export { InMemoryControlPlaneStore } from './store/control-plane.js';
27
31
  export { InMemoryGithubConnectionStore } from './store/github-connections.js';
28
32
  export { JsonFileGithubConnectionStore } from './store/github-connections-json-file.js';
33
+ export { canTransitionDeployRun, DEFAULT_DEPLOY_RUN_LIST_LIMIT, DEPLOY_RUN_TRANSITIONS, InMemoryGithubDeployRunStore, } from './store/github-runs.js';
34
+ export { JsonFileGithubDeployRunStore } from './store/github-runs-json-file.js';
35
+ export { PostgresPendingGithubInstallationStore } from './store/pending-installations-postgres.js';
29
36
  export { PostgresArtifactStore, type PostgresStoreOptions } from './store/postgres.js';
37
+ export { ensureAlertRuleSchema, PostgresAlertRuleStore, } from './store/postgres-alerts.js';
30
38
  export { ensureStateHandleSchema, PostgresStateHandleStore, type PostgresStateHandleStoreOptions, } from './store/postgres-state-handles.js';
31
39
  export { RequestEventBuffer } from './store/request-event-buffer.js';
32
40
  export { InMemoryRequestEventStore } from './store/request-events.js';
33
41
  export { ensureRequestEventSchema, PostgresRequestEventStore, } from './store/request-events-postgres.js';
34
42
  export { InMemoryUserAppLogStore, type InMemoryUserAppLogStoreOptions, type UserAppLogEvent, type UserAppLogFilter, type UserAppLogInput, type UserAppLogLevel, type UserAppLogSink, type UserAppLogStore, } from './store/user-app-logs.js';
35
- export { type AppArchiveResult, type AppRestoreResult, type AppSummary, type ArtifactStore, CONFIG_NAME_PATTERN, type ConfigScope, type ConfigStore, type ConfigValueMetadata, type ControlPlaneStore, DEPLOYMENT_ID_PATTERN, type DeploymentListFilter, type DeploymentSummary, type DeployRecord, DOMAIN_PATTERN, type EnvSummary, type GithubConnectionStore, InMemoryArtifactStore, InMemoryConfigStore, JsonFileArtifactStore, type ManagedConfigKind, type OrgDomainRecord, type OrgInvitationRecord, type OrgMemberRecord, type OrgRecord, type OrgRole, type RepoConnectionConflict, type RepoConnectionConflictReason, type RepoConnectionRecord, resolveConfigScope, type SecretEnvelope, type SignupAllowlistKind, type SignupAllowlistRecord, SLUG_PATTERN, scopeChain, type TenantAuthConfig, type TenantRef, type UpsertRepoConnectionInput, type UpsertRepoConnectionResult, validateConfigName, validateConfigScope, validateDomain, validateOrgRole, validatePositiveInteger, validateSignupAllowlistKind, validateSlug, validateTenantRef, } from './store.js';
43
+ export { type AppArchiveResult, type AppRestoreResult, type AppSummary, type ArtifactStore, type CancelQueuedDeployRunsFilter, CONFIG_NAME_PATTERN, type ConfigScope, type ConfigStore, type ConfigValueMetadata, type ControlPlaneStore, type CreateDeployRunDuplicateReason, type CreateDeployRunInput, type CreateDeployRunResult, DEPLOYMENT_ID_PATTERN, type DeploymentListFilter, type DeploymentSummary, type DeployRecord, type DeployRunRecord, type DeployRunSourceEvent, type DeployRunStatus, DOMAIN_PATTERN, type EnvSummary, type GithubConnectionStore, type GithubDeployRunStore, InMemoryArtifactStore, InMemoryConfigStore, JsonFileArtifactStore, type ListDeployRunsResult, type ManagedConfigKind, type OrgDomainRecord, type OrgInvitationRecord, type OrgMemberRecord, type OrgRecord, type OrgRole, type RepoConnectionConflict, type RepoConnectionConflictReason, type RepoConnectionRecord, resolveConfigScope, type SecretEnvelope, type SignupAllowlistKind, type SignupAllowlistRecord, SLUG_PATTERN, scopeChain, type TenantAuthConfig, type TenantRef, type UpsertRepoConnectionInput, type UpsertRepoConnectionResult, validateConfigName, validateConfigScope, validateDomain, validateOrgRole, validatePositiveInteger, validateSignupAllowlistKind, validateSlug, validateTenantRef, } from './store.js';
36
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names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oC,CAAC;AAC5C,OAAO,EACL,uBAAuB,EACvB,KAAK,8BAA8B,EACnC,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,cAAc,EACd,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,YAAY,EACZ,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,uBAAuB,EACvB,2BAA2B,EAC3B,YAAY,EACZ,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EACL,4BAA4B,EAC5B,cAAc,EACd,KAAK,qBAAqB,EAC1B,mBAAmB,GAC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B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,cAAc,EACd,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,YAAY,EACZ,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,uBAAuB,EACvB,2BAA2B,EAC3B,YAAY,EACZ,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export { ensureAuditSchema, PostgresAuditStore } from '@noodle-borg/module-audit';
2
+ export { ALERT_EVALUATION_INTERVAL_MS, AlertEvaluator, observedMetricValue, } from './alert-evaluator.js';
3
+ export { ALERT_WEBHOOK_SCHEMA_VERSION, buildAlertWebhookPayload, deliverAlertWebhook, validateAlertWebhookUrl, } from './alert-webhook.js';
2
4
  export { ARCHIVE_SWEEP_INTERVAL_MS, ArchiveSweeper, DEFAULT_ARCHIVE_RETENTION_DAYS, resolveArchiveRetentionDays, } from './archive-sweeper.js';
3
5
  export { createAssetStore, resolveAssetConfig, } from './asset-config.js';
4
6
  export { InMemoryAssetStore, } from './assets.js';
@@ -16,16 +18,22 @@ export { CachingPolicyAssignmentStore, } from './policy-cache.js';
16
18
  export { InMemoryPolicyCounterStore } from './policy-counters.js';
17
19
  export { ServerRegistry, } from './registry.js';
18
20
  export { aggregateRequestEvents, } from './request-event-metrics.js';
19
- export { AppResponseSchema, AppSummarySchema, AppsListResponseSchema, DeploymentResponseSchema, DeploymentSummarySchema, EnvResponseSchema, EnvSummarySchema, EnvsListResponseSchema, GithubConnectionResponseSchema, GithubInstallUrlResponseSchema, OrgSummarySchema, RepoConnectionSchema, } from './routes/contracts.js';
21
+ export { AppResponseSchema, AppSummarySchema, AppsListResponseSchema, DeploymentResponseSchema, DeploymentSummarySchema, DeployRunSchema, EnvResponseSchema, EnvSummarySchema, EnvsListResponseSchema, GithubConnectionResponseSchema, GithubInstallUrlResponseSchema, GithubRunsListResponseSchema, OrgSummarySchema, RepoConnectionSchema, } from './routes/contracts.js';
20
22
  export { gcpKmsMasterKeyProvider, } from './secret/kms-master-key.js';
21
23
  export { serveService } from './serve.js';
22
24
  export { createServiceHandler } from './service.js';
23
25
  export { capabilitiesForConfig, defineNoodleService, expandServiceProfile, parseNoodleServiceYaml, resolveServiceConfigSource, } from './service-config.js';
26
+ export { ALERT_METRICS, ALERT_WINDOWS_MINUTES, DEFAULT_ALERT_COOLDOWN_MINUTES, InMemoryAlertRuleStore, MAX_ALERT_RULES_PER_ENV, } from './store/alert-rules.js';
27
+ export { JsonFileAlertRuleStore } from './store/alert-rules-json-file.js';
24
28
  export { AUDIT_SCHEMA_VERSION, InMemoryAuditStore, MultiSink, redactDetails, StdoutAuditSink, } from './store/audit.js';
25
29
  export { InMemoryControlPlaneStore } from './store/control-plane.js';
26
30
  export { InMemoryGithubConnectionStore } from './store/github-connections.js';
27
31
  export { JsonFileGithubConnectionStore } from './store/github-connections-json-file.js';
32
+ export { canTransitionDeployRun, DEFAULT_DEPLOY_RUN_LIST_LIMIT, DEPLOY_RUN_TRANSITIONS, InMemoryGithubDeployRunStore, } from './store/github-runs.js';
33
+ export { JsonFileGithubDeployRunStore } from './store/github-runs-json-file.js';
34
+ export { PostgresPendingGithubInstallationStore } from './store/pending-installations-postgres.js';
28
35
  export { PostgresArtifactStore } from './store/postgres.js';
36
+ export { ensureAlertRuleSchema, PostgresAlertRuleStore, } from './store/postgres-alerts.js';
29
37
  export { ensureStateHandleSchema, PostgresStateHandleStore, } from './store/postgres-state-handles.js';
30
38
  export { RequestEventBuffer } from './store/request-event-buffer.js';
31
39
  export { InMemoryRequestEventStore } from './store/request-events.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EACL,yBAAyB,EACzB,cAAc,EAEd,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAKL,gBAAgB,EAEhB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAIL,kBAAkB,GAEnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,WAAW,EAGX,iBAAiB,EAEjB,sBAAsB,EAEtB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAkB,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EACL,qBAAqB,EAGrB,sBAAsB,EACtB,+BAA+B,EAC/B,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,oBAAoB,EAGpB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,qBAAqB,EACrB,cAAc,EACd,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAKL,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,sCA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,kBAAkB,EAIlB,YAAY,EACZ,UAAU,EAKV,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,uBAAuB,EACvB,2BAA2B,EAC3B,YAAY,EACZ,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
@@ -10,9 +10,10 @@ import type { GitHubAppClient, GithubAppConfig } from './github/app-client.js';
10
10
  import type { PendingGithubInstallationStore } from './github/pending-installations.js';
11
11
  import type { LoadedServiceModule } from './modules/host.js';
12
12
  import type { PolicyAssignmentStore, PolicyCounterStore } from './policy.js';
13
+ import type { AlertRuleStore } from './store/alert-rules.js';
13
14
  import type { AuditSink } from './store/audit.js';
14
15
  import type { UserAppLogStore } from './store/user-app-logs.js';
15
- import type { ConfigStore, ControlPlaneStore, GithubConnectionStore } from './store.js';
16
+ import type { ConfigStore, ControlPlaneStore, GithubConnectionStore, GithubDeployRunStore } from './store.js';
16
17
  export interface ServiceOptions {
17
18
  /** Public base URL used to build returned endpoint URLs. Defaults to the request's Host header. */
18
19
  readonly publicBaseUrl?: string;
@@ -109,6 +110,19 @@ export interface ServiceOptions {
109
110
  * tiered by-plan retention is a later stage). Default 30.
110
111
  */
111
112
  readonly requestEventRetentionDays?: number;
113
+ /**
114
+ * Analytics alert-rule store (E2, ADR 0130). Backs the tenant `alerts` CRUD/test routes and the
115
+ * periodic evaluator. Default: in-memory in the handler; `serveService` selects Postgres when
116
+ * persistence is configured, else a `dataDir` JSON-file store, else in-memory (mirrors the
117
+ * request-event store selection).
118
+ */
119
+ readonly alertRuleStore?: AlertRuleStore;
120
+ /**
121
+ * Dev/test-only carve-out allowing `http://localhost` / `http://127.0.0.1` / `[::1]` alert
122
+ * webhook targets (mirrors `customerVerifierAllowInsecureLocalhost`). Production leaves this
123
+ * unset: webhooks are https-only and delivery is SSRF-guarded (DNS-pinned public unicast).
124
+ */
125
+ readonly alertWebhookAllowLoopback?: boolean;
112
126
  /**
113
127
  * The self-hosted authorization server issuer (OA-2) advertised in protected-resource metadata so an
114
128
  * MCP client can discover where to authenticate. When unset, the metadata omits `authorization_servers`.
@@ -143,6 +157,11 @@ export interface ServiceOptions {
143
157
  * store, else in-memory (mirrors `controlPlaneStore`/`configStore`).
144
158
  */
145
159
  readonly githubConnectionStore?: GithubConnectionStore;
160
+ /**
161
+ * GHD-2 deploy-run store (ADR 0111 §6): webhook-accepted runs, replay-safe. Same backend-selection
162
+ * rule as `githubConnectionStore`.
163
+ */
164
+ readonly githubDeployRunStore?: GithubDeployRunStore;
146
165
  /**
147
166
  * Non-secret Noodle Seed GitHub App identity (ADR 0111). Everything is optional — the whole GHD-1
148
167
  * connection feature is off (install-url 409s) when absent. Long-lived credentials
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,kBAAkB,EAClB,UAAU,EACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EA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2, ADR 0130), extracted the same way as
3
+ * `analytics-dispatch.ts`/`github-dispatch.ts` so `service.ts` stays a thin composition root
4
+ * under the size gate. The three path shapes are mutually exclusive by regex (the item pattern's
5
+ * final `[^/]+$` can never match the `/test` suffix), so dispatch order carries no behavior.
6
+ */
7
+ import type { IncomingMessage, ServerResponse } from 'node:http';
8
+ import type { TlsPosture } from '@noodle-borg/transport-http';
9
+ import type { DeployAuthGate } from '../auth/deploy-gate.js';
10
+ import type { AlertRuleStore } from '../store/alert-rules.js';
11
+ import type { AuditSink } from '../store/audit.js';
12
+ import type { ControlPlaneStore } from '../store.js';
13
+ export interface AlertsDispatchDeps {
14
+ readonly gate: DeployAuthGate;
15
+ readonly controlPlane: ControlPlaneStore;
16
+ readonly alertRuleStore: AlertRuleStore;
17
+ readonly audit: AuditSink;
18
+ readonly maxBody: number;
19
+ readonly allowLoopbackWebhooks: boolean;
20
+ readonly applySecurityHeaders: (res: ServerResponse, tls: TlsPosture) => void;
21
+ readonly enforceHttps: (req: IncomingMessage, res: ServerResponse, tls: TlsPosture) => boolean;
22
+ readonly sendJson: (res: ServerResponse, status: number, body: unknown) => void;
23
+ readonly tls: TlsPosture;
24
+ readonly clock?: () => Date;
25
+ }
26
+ /** Try the alerting routes; returns true when the request was handled (or a guard ended it). */
27
+ export declare function dispatchAlertRoutes(req: IncomingMessage, res: ServerResponse, url: URL, deps: AlertsDispatchDeps): boolean;
28
+ //# sourceMappingURL=alerts-dispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alerts-dispatch.d.ts","sourceRoot":"","sources":["../../src/routes/alerts-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAQrD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC,QAAQ,CAAC,oBAAoB,EAAE,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,UAAU,KAAK,IAAI,CAAC;IAC9E,QAAQ,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,UAAU,KAAK,OAAO,CAAC;IAC/F,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAChF,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,gGAAgG;AAChG,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,kBAAkB,GACvB,OAAO,CA2CT"}
@@ -0,0 +1,50 @@
1
+ import { handleAlertRuleDelete, handleAlertRules, handleAlertRuleTest } from './alerts.js';
2
+ import { parseTenantAlertItemPath, parseTenantAlertsPath, parseTenantAlertTestPath, } from './paths.js';
3
+ /** Try the alerting routes; returns true when the request was handled (or a guard ended it). */
4
+ export function dispatchAlertRoutes(req, res, url, deps) {
5
+ const { applySecurityHeaders, enforceHttps, sendJson, tls } = deps;
6
+ const routeDeps = {
7
+ gate: deps.gate,
8
+ controlPlane: deps.controlPlane,
9
+ store: deps.alertRuleStore,
10
+ audit: deps.audit,
11
+ maxBody: deps.maxBody,
12
+ allowLoopbackWebhooks: deps.allowLoopbackWebhooks,
13
+ ...(deps.clock !== undefined ? { clock: deps.clock } : {}),
14
+ };
15
+ const collectionRef = parseTenantAlertsPath(url.pathname);
16
+ if (collectionRef !== undefined && (req.method === 'GET' || req.method === 'POST')) {
17
+ applySecurityHeaders(res, tls);
18
+ if (enforceHttps(req, res, tls))
19
+ return true;
20
+ handleAlertRules(req, res, collectionRef, routeDeps).catch(() => {
21
+ if (!res.headersSent)
22
+ sendJson(res, 500, { error: 'internal error' });
23
+ });
24
+ return true;
25
+ }
26
+ const testRef = parseTenantAlertTestPath(url.pathname);
27
+ if (testRef !== undefined && req.method === 'POST') {
28
+ applySecurityHeaders(res, tls);
29
+ if (enforceHttps(req, res, tls))
30
+ return true;
31
+ handleAlertRuleTest(req, res, testRef.ref, testRef.id, routeDeps).catch(() => {
32
+ if (!res.headersSent)
33
+ sendJson(res, 500, { error: 'internal error' });
34
+ });
35
+ return true;
36
+ }
37
+ const itemRef = parseTenantAlertItemPath(url.pathname);
38
+ if (itemRef !== undefined && req.method === 'DELETE') {
39
+ applySecurityHeaders(res, tls);
40
+ if (enforceHttps(req, res, tls))
41
+ return true;
42
+ handleAlertRuleDelete(req, res, itemRef.ref, itemRef.id, routeDeps).catch(() => {
43
+ if (!res.headersSent)
44
+ sendJson(res, 500, { error: 'internal error' });
45
+ });
46
+ return true;
47
+ }
48
+ return false;
49
+ }
50
+ //# sourceMappingURL=alerts-dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alerts-dispatch.js","sourceRoot":"","sources":["../../src/routes/alerts-dispatch.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,qBAAq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EAAE,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ import type { DeployAuthGate } from '../auth/deploy-gate.js';
3
+ import { type AlertRuleStore } from '../store/alert-rules.js';
4
+ import type { AuditSink } from '../store/audit.js';
5
+ import type { ControlPlaneStore, TenantRef } from '../store.js';
6
+ /**
7
+ * Analytics alerting routes (E2, ADR 0130): `GET`/`POST .../alerts`, `DELETE .../alerts/{id}`,
8
+ * and `POST .../alerts/{id}/test`. Reads are org-MEMBER gated (`authorizeTenantControl`, like the
9
+ * neighbouring analytics reads); mutations and test-fires are org-OWNER gated (`canManageMembers`,
10
+ * like the GHD-1 connection writes) and emit audit events with scalar details only.
11
+ *
12
+ * The webhook URL enters once through `POST` (validated by `validateAlertWebhookUrl`) and never
13
+ * leaves again: responses serialize rules through {@link publicAlertRule} and the strict Zod
14
+ * contract has no field that could carry it.
15
+ */
16
+ export interface AlertRouteDeps {
17
+ readonly gate: DeployAuthGate;
18
+ readonly controlPlane: ControlPlaneStore;
19
+ readonly store: AlertRuleStore;
20
+ readonly audit: AuditSink;
21
+ readonly maxBody: number;
22
+ /** Dev/test-only loopback webhook carve-out (`alertWebhookAllowLoopback`). */
23
+ readonly allowLoopbackWebhooks: boolean;
24
+ /** Injectable clock for deterministic test-fire timestamps. */
25
+ readonly clock?: () => Date;
26
+ }
27
+ /** Redact a webhook URL to its origin — path/query (where tokens live) never leave the service. */
28
+ export declare function redactWebhookUrl(url: string): string;
29
+ /** `GET` (member) / `POST` (owner) on the alert-rule collection. */
30
+ export declare function handleAlertRules(req: IncomingMessage, res: ServerResponse, ref: TenantRef, deps: AlertRouteDeps): Promise<void>;
31
+ /** `DELETE .../alerts/{id}` — org OWNER only; 404 when the rule is not in this tenant scope. */
32
+ export declare function handleAlertRuleDelete(req: IncomingMessage, res: ServerResponse, ref: TenantRef, id: string, deps: AlertRouteDeps): Promise<void>;
33
+ /**
34
+ * `POST .../alerts/{id}/test` — org OWNER only: sends a synthetic `event: "test"` payload through
35
+ * the exact guarded delivery path a real breach uses. The response carries only the closed-code
36
+ * delivery outcome; a failed delivery is still a 200 (the route worked, the endpoint did not).
37
+ */
38
+ export declare function handleAlertRuleTest(req: IncomingMessage, res: ServerResponse, ref: TenantRef, id: string, deps: AlertRouteDeps): Promise<void>;
39
+ //# sourceMappingURL=alerts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../../src/routes/alerts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAMjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAKL,KAAK,cAAc,EAGpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMhE;;;;;;;;;GASG;AAEH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8EAA8E;IAC9E,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,mGAAmG;AACnG,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMpD;AAsBD,oEAAoE;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