@noodleseed/one 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +16 -4
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/archive-ops.d.ts +3 -0
  5. package/dist/commands/archive-ops.d.ts.map +1 -0
  6. package/dist/commands/archive-ops.js +168 -0
  7. package/dist/commands/archive-ops.js.map +1 -0
  8. package/dist/commands/org-admin.d.ts +17 -0
  9. package/dist/commands/org-admin.d.ts.map +1 -0
  10. package/dist/commands/org-admin.js +241 -0
  11. package/dist/commands/org-admin.js.map +1 -0
  12. package/dist/commands/policy-ops.d.ts.map +1 -1
  13. package/dist/commands/policy-ops.js +123 -1
  14. package/dist/commands/policy-ops.js.map +1 -1
  15. package/dist/commands/session.d.ts +1 -15
  16. package/dist/commands/session.d.ts.map +1 -1
  17. package/dist/commands/session.js +15 -170
  18. package/dist/commands/session.js.map +1 -1
  19. package/dist/commands/shared.d.ts.map +1 -1
  20. package/dist/commands/shared.js +13 -5
  21. package/dist/commands/shared.js.map +1 -1
  22. package/dist/commands/update-ops.d.ts +29 -0
  23. package/dist/commands/update-ops.d.ts.map +1 -0
  24. package/dist/commands/update-ops.js +315 -0
  25. package/dist/commands/update-ops.js.map +1 -0
  26. package/dist/config.d.ts +2 -0
  27. package/dist/config.d.ts.map +1 -1
  28. package/dist/config.js.map +1 -1
  29. package/dist/update-binary.d.ts +38 -0
  30. package/dist/update-binary.d.ts.map +1 -0
  31. package/dist/update-binary.js +144 -0
  32. package/dist/update-binary.js.map +1 -0
  33. package/dist/update-check.d.ts +40 -0
  34. package/dist/update-check.d.ts.map +1 -0
  35. package/dist/update-check.js +212 -0
  36. package/dist/update-check.js.map +1 -0
  37. package/dist/update-render.d.ts +17 -0
  38. package/dist/update-render.d.ts.map +1 -0
  39. package/dist/update-render.js +39 -0
  40. package/dist/update-render.js.map +1 -0
  41. package/dist/update.d.ts +10 -9
  42. package/dist/update.d.ts.map +1 -1
  43. package/dist/update.js +21 -89
  44. package/dist/update.js.map +1 -1
  45. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.d.ts.map +1 -1
  46. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js +13 -1
  47. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js.map +1 -1
  48. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.d.ts.map +1 -1
  49. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js +2 -0
  50. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js.map +1 -1
  51. package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
  52. package/node_modules/@noodle-borg/service/dist/archive-sweeper.d.ts +43 -0
  53. package/node_modules/@noodle-borg/service/dist/archive-sweeper.d.ts.map +1 -0
  54. package/node_modules/@noodle-borg/service/dist/archive-sweeper.js +122 -0
  55. package/node_modules/@noodle-borg/service/dist/archive-sweeper.js.map +1 -0
  56. package/node_modules/@noodle-borg/service/dist/commercial-plans.d.ts +11 -0
  57. package/node_modules/@noodle-borg/service/dist/commercial-plans.d.ts.map +1 -0
  58. package/node_modules/@noodle-borg/service/dist/commercial-plans.js +119 -0
  59. package/node_modules/@noodle-borg/service/dist/commercial-plans.js.map +1 -0
  60. package/node_modules/@noodle-borg/service/dist/deployment-versioning.d.ts +2 -0
  61. package/node_modules/@noodle-borg/service/dist/deployment-versioning.d.ts.map +1 -1
  62. package/node_modules/@noodle-borg/service/dist/deployment-versioning.js +1 -1
  63. package/node_modules/@noodle-borg/service/dist/deployment-versioning.js.map +1 -1
  64. package/node_modules/@noodle-borg/service/dist/index.d.ts +3 -1
  65. package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
  66. package/node_modules/@noodle-borg/service/dist/index.js +2 -0
  67. package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
  68. package/node_modules/@noodle-borg/service/dist/options.d.ts +9 -0
  69. package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
  70. package/node_modules/@noodle-borg/service/dist/policy.d.ts +3 -0
  71. package/node_modules/@noodle-borg/service/dist/policy.d.ts.map +1 -1
  72. package/node_modules/@noodle-borg/service/dist/policy.js +32 -0
  73. package/node_modules/@noodle-borg/service/dist/policy.js.map +1 -1
  74. package/node_modules/@noodle-borg/service/dist/registry-state.d.ts +25 -0
  75. package/node_modules/@noodle-borg/service/dist/registry-state.d.ts.map +1 -0
  76. package/node_modules/@noodle-borg/service/dist/registry-state.js +119 -0
  77. package/node_modules/@noodle-borg/service/dist/registry-state.js.map +1 -0
  78. package/node_modules/@noodle-borg/service/dist/registry.d.ts +7 -6
  79. package/node_modules/@noodle-borg/service/dist/registry.d.ts.map +1 -1
  80. package/node_modules/@noodle-borg/service/dist/registry.js +44 -44
  81. package/node_modules/@noodle-borg/service/dist/registry.js.map +1 -1
  82. package/node_modules/@noodle-borg/service/dist/routes/archive.d.ts +16 -0
  83. package/node_modules/@noodle-borg/service/dist/routes/archive.d.ts.map +1 -0
  84. package/node_modules/@noodle-borg/service/dist/routes/archive.js +83 -0
  85. package/node_modules/@noodle-borg/service/dist/routes/archive.js.map +1 -0
  86. package/node_modules/@noodle-borg/service/dist/routes/control-plane.d.ts +1 -18
  87. package/node_modules/@noodle-borg/service/dist/routes/control-plane.d.ts.map +1 -1
  88. package/node_modules/@noodle-borg/service/dist/routes/control-plane.js +18 -260
  89. package/node_modules/@noodle-borg/service/dist/routes/control-plane.js.map +1 -1
  90. package/node_modules/@noodle-borg/service/dist/routes/deployments.d.ts +17 -0
  91. package/node_modules/@noodle-borg/service/dist/routes/deployments.d.ts.map +1 -0
  92. package/node_modules/@noodle-borg/service/dist/routes/deployments.js +88 -0
  93. package/node_modules/@noodle-borg/service/dist/routes/deployments.js.map +1 -0
  94. package/node_modules/@noodle-borg/service/dist/routes/org-admin.d.ts +40 -0
  95. package/node_modules/@noodle-borg/service/dist/routes/org-admin.d.ts.map +1 -0
  96. package/node_modules/@noodle-borg/service/dist/routes/org-admin.js +353 -0
  97. package/node_modules/@noodle-borg/service/dist/routes/org-admin.js.map +1 -0
  98. package/node_modules/@noodle-borg/service/dist/routes/paths.d.ts +15 -0
  99. package/node_modules/@noodle-borg/service/dist/routes/paths.d.ts.map +1 -1
  100. package/node_modules/@noodle-borg/service/dist/routes/paths.js +47 -0
  101. package/node_modules/@noodle-borg/service/dist/routes/paths.js.map +1 -1
  102. package/node_modules/@noodle-borg/service/dist/routes/plans.d.ts +20 -0
  103. package/node_modules/@noodle-borg/service/dist/routes/plans.d.ts.map +1 -0
  104. package/node_modules/@noodle-borg/service/dist/routes/plans.js +217 -0
  105. package/node_modules/@noodle-borg/service/dist/routes/plans.js.map +1 -0
  106. package/node_modules/@noodle-borg/service/dist/routes/policies.d.ts.map +1 -1
  107. package/node_modules/@noodle-borg/service/dist/routes/policies.js +7 -0
  108. package/node_modules/@noodle-borg/service/dist/routes/policies.js.map +1 -1
  109. package/node_modules/@noodle-borg/service/dist/routes/rollback.d.ts.map +1 -1
  110. package/node_modules/@noodle-borg/service/dist/routes/rollback.js +19 -1
  111. package/node_modules/@noodle-borg/service/dist/routes/rollback.js.map +1 -1
  112. package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
  113. package/node_modules/@noodle-borg/service/dist/service.js +107 -4
  114. package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
  115. package/node_modules/@noodle-borg/service/dist/store/control-plane.d.ts +14 -0
  116. package/node_modules/@noodle-borg/service/dist/store/control-plane.d.ts.map +1 -1
  117. package/node_modules/@noodle-borg/service/dist/store/control-plane.js +38 -0
  118. package/node_modules/@noodle-borg/service/dist/store/control-plane.js.map +1 -1
  119. package/node_modules/@noodle-borg/service/dist/store/json-file.d.ts +25 -0
  120. package/node_modules/@noodle-borg/service/dist/store/json-file.d.ts.map +1 -0
  121. package/node_modules/@noodle-borg/service/dist/store/json-file.js +163 -0
  122. package/node_modules/@noodle-borg/service/dist/store/json-file.js.map +1 -0
  123. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.d.ts +14 -0
  124. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.d.ts.map +1 -1
  125. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.js +16 -0
  126. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.js.map +1 -1
  127. package/node_modules/@noodle-borg/service/dist/store/postgres-policy.d.ts.map +1 -1
  128. package/node_modules/@noodle-borg/service/dist/store/postgres-policy.js +10 -4
  129. package/node_modules/@noodle-borg/service/dist/store/postgres-policy.js.map +1 -1
  130. package/node_modules/@noodle-borg/service/dist/store/postgres-rows.d.ts +60 -0
  131. package/node_modules/@noodle-borg/service/dist/store/postgres-rows.d.ts.map +1 -0
  132. package/node_modules/@noodle-borg/service/dist/store/postgres-rows.js +101 -0
  133. package/node_modules/@noodle-borg/service/dist/store/postgres-rows.js.map +1 -0
  134. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.d.ts.map +1 -1
  135. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js +10 -0
  136. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js.map +1 -1
  137. package/node_modules/@noodle-borg/service/dist/store/postgres.d.ts +20 -6
  138. package/node_modules/@noodle-borg/service/dist/store/postgres.d.ts.map +1 -1
  139. package/node_modules/@noodle-borg/service/dist/store/postgres.js +74 -122
  140. package/node_modules/@noodle-borg/service/dist/store/postgres.js.map +1 -1
  141. package/node_modules/@noodle-borg/service/dist/store/records.d.ts +35 -0
  142. package/node_modules/@noodle-borg/service/dist/store/records.d.ts.map +1 -0
  143. package/node_modules/@noodle-borg/service/dist/store/records.js +87 -0
  144. package/node_modules/@noodle-borg/service/dist/store/records.js.map +1 -0
  145. package/node_modules/@noodle-borg/service/dist/store/validate.d.ts +19 -0
  146. package/node_modules/@noodle-borg/service/dist/store/validate.d.ts.map +1 -0
  147. package/node_modules/@noodle-borg/service/dist/store/validate.js +61 -0
  148. package/node_modules/@noodle-borg/service/dist/store/validate.js.map +1 -0
  149. package/node_modules/@noodle-borg/service/dist/store.d.ts +68 -44
  150. package/node_modules/@noodle-borg/service/dist/store.d.ts.map +1 -1
  151. package/node_modules/@noodle-borg/service/dist/store.js +48 -213
  152. package/node_modules/@noodle-borg/service/dist/store.js.map +1 -1
  153. package/package.json +2 -2
package/dist/update.js CHANGED
@@ -1,10 +1,17 @@
1
- import { spawn } from 'node:child_process';
1
+ /**
2
+ * Shared update-system core (#242, ADR 0118): package identity, installed-version
3
+ * lookup, registry `latest` fetch, and version comparison.
4
+ *
5
+ * The update system is split along its natural seams:
6
+ * - `update.ts` (this file) — shared constants + helpers.
7
+ * - `update-binary.ts` — global `noodle` binary ownership resolver (safe vs unsafe repair).
8
+ * - `commands/update-ops.ts` — the `noodle update` command (--check/--yes/--repair/--json).
9
+ * - `update-check.ts` — the passive post-command check (default prompt, modes, snooze).
10
+ */
2
11
  import { readFileSync } from 'node:fs';
3
- import { readConfig, writeConfig } from './config.js';
4
- import { bundledAgentKitVersion, fetchLatestAgentKitVersion, isSkillsUpdateAvailable, skillsUpdatePromptMessage, } from './skills-update.js';
5
12
  export const CLI_PACKAGE_NAME = '@noodleseed/one';
6
13
  export const GLOBAL_UPDATE_COMMAND = `npm install -g ${CLI_PACKAGE_NAME}@latest`;
7
- const UPDATE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
14
+ export const UPDATE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
8
15
  const REGISTRY_LATEST_URL = `https://registry.npmjs.org/${encodeURIComponent(CLI_PACKAGE_NAME)}/latest`;
9
16
  let versionCache;
10
17
  export function currentCliVersion() {
@@ -14,97 +21,22 @@ export function currentCliVersion() {
14
21
  versionCache = typeof pkg.version === 'string' ? pkg.version : '0.0.0';
15
22
  return versionCache;
16
23
  }
17
- export async function runUpdateCommand(rest) {
18
- const yes = rest.includes('--yes') || rest.includes('-y');
19
- console.log(`Installed: ${currentCliVersion()}`);
20
- console.log(`Update: ${GLOBAL_UPDATE_COMMAND}`);
21
- if (!yes) {
22
- console.log('Run `noodle update --yes` to execute that command.');
23
- return 0;
24
- }
25
- return new Promise((resolve) => {
26
- const child = spawn('npm', ['install', '-g', `${CLI_PACKAGE_NAME}@latest`], {
27
- stdio: 'inherit',
28
- });
29
- child.on('error', (error) => {
30
- console.error(`update: ${error.message}`);
31
- resolve(1);
32
- });
33
- child.on('close', (code) => resolve(code ?? 1));
34
- });
35
- }
36
- export async function maybeCheckForCliUpdate(input) {
37
- // shouldSkipUpdateCheck already gates CI / non-TTY / disabled, so neither the notice nor the opt-in
38
- // auto-update ever fires in a non-interactive or CI context.
39
- if (shouldSkipUpdateCheck(input.command, input.env))
40
- return;
41
- const config = readConfig(input.home);
42
- if (wasRecentlyChecked(config.updateCheck?.checkedAt))
43
- return;
44
- const latestVersion = await fetchLatestVersion(input.fetchImpl ?? fetch).catch(() => undefined);
45
- // Skills check shares the same interactive gate + 24h throttle as the CLI check (no second notifier).
46
- const skillsLatest = await fetchLatestAgentKitVersion(input.fetchImpl ?? fetch).catch(() => undefined);
47
- if (latestVersion === undefined && skillsLatest === undefined)
48
- return;
49
- writeConfig({
50
- ...readConfig(input.home),
51
- updateCheck: {
52
- checkedAt: new Date().toISOString(),
53
- ...(latestVersion !== undefined ? { latestVersion } : {}),
54
- ...(skillsLatest !== undefined ? { skillsLatestVersion: skillsLatest } : {}),
55
- },
56
- }, input.home);
57
- const currentVersion = currentCliVersion();
58
- if (latestVersion !== undefined && compareVersions(latestVersion, currentVersion) > 0) {
59
- console.error(`A newer Noodle CLI is available: ${currentVersion} -> ${latestVersion}`);
60
- if (isAutoUpdateEnabled(input.env)) {
61
- console.error('NOODLE_AUTO_UPDATE is set — updating now...');
62
- await (input.runUpdate ?? runUpdateCommand)(['--yes']);
63
- }
64
- else {
65
- console.error(`Update: ${GLOBAL_UPDATE_COMMAND}`);
66
- }
67
- }
68
- // Self-checking skills: notify (no auto-update) when the registry has a newer agent-kit.
69
- if (skillsLatest !== undefined && isSkillsUpdateAvailable(skillsLatest)) {
70
- console.error(skillsUpdatePromptMessage(skillsLatest, bundledAgentKitVersion()));
71
- }
72
- }
73
- /** Opt-in auto-update. Enabled when `NOODLE_AUTO_UPDATE` is set to anything other than `0`/`false`. */
74
- function isAutoUpdateEnabled(env) {
75
- const value = env.NOODLE_AUTO_UPDATE;
24
+ /** True for set env toggles, honoring the `0`/`false` opt-outs. */
25
+ export function truthyEnv(value) {
76
26
  if (value === undefined || value === '')
77
27
  return false;
78
28
  return value !== '0' && value.toLowerCase() !== 'false';
79
29
  }
80
- function shouldSkipUpdateCheck(command, env) {
81
- if (command === undefined ||
82
- command === '--version' ||
83
- command === '-v' ||
84
- command === 'version') {
85
- return true;
86
- }
87
- if (command === 'update')
88
- return true;
89
- if (env.NOODLE_DISABLE_UPDATE_CHECK !== undefined && env.NOODLE_DISABLE_UPDATE_CHECK !== '') {
90
- return true;
91
- }
92
- if (env.CI !== undefined && env.CI !== '')
93
- return true;
94
- return process.stderr.isTTY !== true;
95
- }
96
- function wasRecentlyChecked(checkedAt) {
97
- if (checkedAt === undefined)
98
- return false;
99
- const checked = Date.parse(checkedAt);
100
- if (!Number.isFinite(checked))
101
- return false;
102
- return Date.now() - checked < UPDATE_CHECK_INTERVAL_MS;
103
- }
104
- async function fetchLatestVersion(fetchImpl) {
30
+ /**
31
+ * Fetch the registry `latest` dist-tag version of the CLI package. Throws on
32
+ * failure so callers choose their own inconclusive-network handling. The passive
33
+ * check uses the default ~1s budget; the explicit `noodle update` command passes
34
+ * a longer one.
35
+ */
36
+ export async function fetchLatestVersion(fetchImpl, timeoutMs = 1000) {
105
37
  const res = await fetchImpl(REGISTRY_LATEST_URL, {
106
38
  headers: { accept: 'application/json' },
107
- signal: AbortSignal.timeout(1000),
39
+ signal: AbortSignal.timeout(timeoutMs),
108
40
  });
109
41
  if (!res.ok)
110
42
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"update.js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OAAe;IACnC,OAAO,OAAO;SACX,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;SACjB,KAAK,CAAC,MAAM,CAAC;SACb,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"command-groups.d.ts","sourceRoot":"","sources":["../../src/curated/command-groups.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,qEAAqE;AACrE,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAShD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAiJ5D,CAAC"}
1
+ {"version":3,"file":"command-groups.d.ts","sourceRoot":"","sources":["../../src/curated/command-groups.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,qEAAqE;AACrE,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAShD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CA+J5D,CAAC"}
@@ -107,6 +107,14 @@ export const COMMAND_GROUPS = {
107
107
  group: 'Hosted deploy & operations',
108
108
  summary: 'Roll back to a previous deployment.',
109
109
  },
110
+ archive: {
111
+ group: 'Hosted deploy & operations',
112
+ summary: 'Archive the whole app: endpoints answer 410 Gone; hard-deleted after the retention window.',
113
+ },
114
+ restore: {
115
+ group: 'Hosted deploy & operations',
116
+ summary: 'Restore an archived app within the retention window.',
117
+ },
110
118
  access: {
111
119
  group: 'Hosted deploy & operations',
112
120
  summary: 'Set the access mode (owner-only|org-members|authenticated|customers).',
@@ -147,7 +155,11 @@ export const COMMAND_GROUPS = {
147
155
  },
148
156
  help: { group: 'CLI maintenance', summary: 'Print CLI usage and command help.' },
149
157
  version: { group: 'CLI maintenance', summary: 'Print the installed CLI version.' },
150
- update: { group: 'CLI maintenance', summary: 'Show or run the global npm update command.' },
158
+ update: {
159
+ group: 'CLI maintenance',
160
+ summary: 'Check for, install, or safely repair the CLI update. Agents: `noodle update --check --json`, then ' +
161
+ '`noodle update --yes --json`; add `--repair` only when the check reports `repairSafe: true`.',
162
+ },
151
163
  keys: {
152
164
  group: 'Deprecated',
153
165
  summary: 'Removed: this command no longer exists; hosted access is identity-based.',
@@ -1 +1 @@
1
- {"version":3,"file":"command-groups.js","sourceRoot":"","sources":["../../src/curated/command-groups.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,8FAA8F;AAC9F,+FAA+F;AAC/F,+FAA+F;AAC/F,gGAAgG;AAShG,qEAAqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,wBAAwB;IACxB,qBAAqB;IACrB,4BAA4B;IAC5B,eAAe;IACf,gBAAgB;IAChB,4BAA4B;IAC5B,iBAAiB;IACjB,YAAY;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAsC;IAC/D,KAAK,EAAE;QACL,KAAK,EAAE,wBAAwB;QAC/B,OAAO,EACL,0FAA0F;KAC7F;IACD,IAAI,EAAE,EAAE,KAAK,EAAE,wBAAwB,EAAE,OAAO,EAAE,gCAAgC,EAAE;IACpF,KAAK,EA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gBAAgB;QACvB,OAAO,EAAE,wEAAwE;KAClF;IACD,SAAS,EAAE;QACT,KAAK,EAAE,gBAAgB;QACvB,OAAO,EAAE,0EAA0E;KACpF;IAED,KAAK,EAAE;QACL,KAAK,EAAE,4BAA4B;QACnC,OAAO,EAAE,qDAAqD;KAC/D;IACD,MAAM,EAAE;QACN,KAAK,EAAE,4BAA4B;QACnC,OAAO,EAAE,6EAA6E;KACvF;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,4BAA4B;QACnC,OAAO,EAAE,+BAA+B;KACzC;IAED,IAAI,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,mCAAmC,EAAE;IAChF,OAAO,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,kCAAkC,EAAE;IAClF,MAAM,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,4CAA4C,EAAE;IAE3F,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,0EAA0E;KACpF;CACF,CAAC"}
1
+ {"version":3,"file":"command-groups.js","sourceRoot":"","sources":["../../src/curated/command-groups.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,8FAA8F;AAC9F,+FAA+F;AAC/F,+FAA+F;AAC/F,gGAAgG;AAShG,qEAAqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,wBAAwB;IACxB,qBAAqB;IACrB,4BAA4B;IAC5B,eAAe;IACf,gBAAgB;IAChB,4BAA4B;IAC5B,iBAAiB;IACjB,YAAY;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAsC;IAC/D,KAAK,EAAE;QACL,KAAK,EAAE,wBAAwB;QAC/B,OAAO,EACL,0FAA0F;KAC7F;IACD,IAAI,EAAE,EAAE,KAAK,EAAE,wBAAwB,EAAE,OAAO,EAAE,gCAAgC,EAAE;IACpF,KAAK,EAAE;QACL,KAAK,EAAE,wBAAwB;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AsB,EAAE;IACjE,OAAO,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,uCAAuC,EAAE;IAErF,OAAO,EAAE;QACP,KAAK,EAAE,gBAAgB;QACvB,OAAO,EAAE,wEAAwE;KAClF;IACD,SAAS,EAAE;QACT,KAAK,EAAE,gBAAgB;QACvB,OAAO,EAAE,0EAA0E;KACpF;IAED,KAAK,EAAE;QACL,KAAK,EAAE,4BAA4B;QACnC,OAAO,EAAE,qDAAqD;KAC/D;IACD,MAAM,EAAE;QACN,KAAK,EAAE,4BAA4B;QACnC,OAAO,EAAE,6EAA6E;KACvF;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,4BAA4B;QACnC,OAAO,EAAE,+BAA+B;KACzC;IAED,IAAI,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,mCAAmC,EAAE;IAChF,OAAO,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,kCAAkC,EAAE;IAClF,MAAM,EAAE;QACN,KAAK,EAAE,iBAAiB;QACxB,OAAO,EACL,oGAAoG;YACpG,8FAA8F;KACjG;IAED,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,0EAA0E;KACpF;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../src/generated/surface.ts"],"names":[],"mappings":"AAIA,8FAA8F;AAC9F,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EA4CzC,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAgBxC,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAwChD,CAAC"}
1
+ {"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../src/generated/surface.ts"],"names":[],"mappings":"AAIA,8FAA8F;AAC9F,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EA8CzC,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAgBxC,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAwChD,CAAC"}
@@ -34,6 +34,8 @@ export const CLI_COMMANDS = [
34
34
  'inspect',
35
35
  'smoke',
36
36
  'rollback',
37
+ 'archive',
38
+ 'restore',
37
39
  'access',
38
40
  'service',
39
41
  'login',
@@ -1 +1 @@
1
- {"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/generated/surface.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,6EAA6E;AAC7E,iGAAiG;AAEjG,8FAA8F;AAC9F,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,MAAM;IACN,SAAS;IACT,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,MAAM;IACN,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,OAAO;IACP,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACT,KAAK;IACL,UAAU;IACV,OAAO;IACP,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,UAAU;IACV,QAAQ;IACR,SAAS;IACT,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,MAAM;IACN,SAAS;IACT,MAAM;IACN,QAAQ;IACR,SAAS;IACT,WAAW;CACZ,CAAC;AAEF,8FAA8F;AAC9F,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC5C,aAAa;IACb,OAAO;IACP,WAAW;IACX,gBAAgB;IAChB,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,eAAe;IACf,gBAAgB;IAChB,UAAU;IACV,MAAM;IACN,QAAQ;IACR,GAAG;CACJ,CAAC;AAEF,iGAAiG;AACjG,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,kBAAkB;IAClB,eAAe;IACf,cAAc;IACd,gBAAgB;IAChB,8BAA8B;IAC9B,uBAAuB;IACvB,cAAc;IACd,oBAAoB;IACpB,oBAAoB;IACpB,qBAAqB;IACrB,oBAAoB;IACpB,mBAAmB;IACnB,uBAAuB;IACvB,2BAA2B;IAC3B,qBAAqB;IACrB,kBAAkB;IAClB,kBAAkB;IAClB,eAAe;IACf,mBAAmB;IACnB,oBAAoB;IACpB,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,wBAAwB;IACxB,0BAA0B;IAC1B,kBAAkB;IAClB,qBAAqB;IACrB,4BAA4B;IAC5B,uBAAuB;IACvB,wBAAwB;IACxB,6BAA6B;IAC7B,eAAe;IACf,gCAAgC;IAChC,oBAAoB;IACpB,yBAAyB;IACzB,0BAA0B;IAC1B,mBAAmB;IACnB,wBAAwB;IACxB,cAAc;CACf,CAAC"}
1
+ {"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/generated/surface.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,6EAA6E;AAC7E,iGAAiG;AAEjG,8FAA8F;AAC9F,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,MAAM;IACN,SAAS;IACT,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,MAAM;IACN,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,OAAO;IACP,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACT,KAAK;IACL,UAAU;IACV,OAAO;IACP,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,UAAU;IACV,SAAS;IACT,SAAS;IACT,QAAQ;IACR,SAAS;IACT,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,MAAM;IACN,SAAS;IACT,MAAM;IACN,QAAQ;IACR,SAAS;IACT,WAAW;CACZ,CAAC;AAEF,8FAA8F;AAC9F,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC5C,aAAa;IACb,OAAO;IACP,WAAW;IACX,gBAAgB;IAChB,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,eAAe;IACf,gBAAgB;IAChB,UAAU;IACV,MAAM;IACN,QAAQ;IACR,GAAG;CACJ,CAAC;AAEF,iGAAiG;AACjG,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,kBAAkB;IAClB,eAAe;IACf,cAAc;IACd,gBAAgB;IAChB,8BAA8B;IAC9B,uBAAuB;IACvB,cAAc;IACd,oBAAoB;IACpB,oBAAoB;IACpB,qBAAqB;IACrB,oBAAoB;IACpB,mBAAmB;IACnB,uBAAuB;IACvB,2BAA2B;IAC3B,qBAAqB;IACrB,kBAAkB;IAClB,kBAAkB;IAClB,eAAe;IACf,mBAAmB;IACnB,oBAAoB;IACpB,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,wBAAwB;IACxB,0BAA0B;IAC1B,kBAAkB;IAClB,qBAAqB;IACrB,4BAA4B;IAC5B,uBAAuB;IACvB,wBAAwB;IACxB,6BAA6B;IAC7B,eAAe;IACf,gCAAgC;IAChC,oBAAoB;IACpB,yBAAyB;IACzB,0BAA0B;IAC1B,mBAAmB;IACnB,wBAAwB;IACxB,cAAc;CACf,CAAC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noodle-borg/agent-kit",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "engines": {
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Opportunistic retention sweeper for archived apps (ADR 0117 §3). No scheduler: the service
3
+ * handler fires one sweep at construction (boot) and piggybacks a throttled, fire-and-forget
4
+ * `maybeSweep()` on the deploy and deployments-list control-plane paths. A sweep hard-deletes
5
+ * every deployment record archived before the retention cutoff, reclaims the purged app's managed
6
+ * config (app scope + the swept environments' env scopes — org scope is shared and untouched),
7
+ * and emits one `app.purged` audit event per org/app.
8
+ */
9
+ import { type Logger } from '@noodle-borg/transport-http';
10
+ import type { ServerRegistry } from './registry.js';
11
+ import type { AuditSink } from './store/audit.js';
12
+ import { type ConfigStore } from './store.js';
13
+ /** Platform default retention: archived apps are hard-deleted after this many days. */
14
+ export declare const DEFAULT_ARCHIVE_RETENTION_DAYS = 30;
15
+ /** Piggybacked sweeps run at most this often per instance; boot always sweeps once. */
16
+ export declare const ARCHIVE_SWEEP_INTERVAL_MS: number;
17
+ /** Resolve the retention override from env. Fails closed on a malformed value (boot-time error). */
18
+ export declare function resolveArchiveRetentionDays(env: NodeJS.ProcessEnv): number;
19
+ export interface ArchiveSweeperOptions {
20
+ readonly registry: ServerRegistry;
21
+ readonly configStore: ConfigStore;
22
+ readonly audit: AuditSink;
23
+ readonly retentionDays: number;
24
+ /** Injectable clock for deterministic retention tests. Default: `new Date()`. */
25
+ readonly clock?: () => Date;
26
+ readonly logger?: Logger;
27
+ /** Throttle for {@link maybeSweep}. Default {@link ARCHIVE_SWEEP_INTERVAL_MS}. */
28
+ readonly intervalMs?: number;
29
+ }
30
+ export declare class ArchiveSweeper {
31
+ #private;
32
+ constructor(options: ArchiveSweeperOptions);
33
+ /**
34
+ * Throttled, fire-and-forget sweep for request-path piggybacking: never blocks or fails the
35
+ * carrying request. The first call (boot) always sweeps.
36
+ */
37
+ maybeSweep(): void;
38
+ sweepNow(): Promise<{
39
+ readonly deletedDeployments: number;
40
+ readonly purgedApps: number;
41
+ }>;
42
+ }
43
+ //# sourceMappingURL=archive-sweeper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archive-sweeper.d.ts","sourceRoot":"","sources":["../src/archive-sweeper.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,KAAK,WAAW,EAIjB,MAAM,YAAY,CAAC;AAEpB,uFAAuF;AACvF,eAAO,MAAM,8BAA8B,KAAK,CAAC;AACjD,uFAAuF;AACvF,eAAO,MAAM,yBAAyB,QAAqB,CAAC;AAK5D,oGAAoG;AACpG,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAQ1E;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,iFAAiF;IACjF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,kFAAkF;IAClF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AASD,qBAAa,cAAc;;gBAUb,OAAO,EAAE,qBAAqB;IAU1C;;;OAGG;IACH,UAAU,IAAI,IAAI;IAgBZ,QAAQ,IAAI,OAAO,CAAC;QAAE,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CA0ChG"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Opportunistic retention sweeper for archived apps (ADR 0117 §3). No scheduler: the service
3
+ * handler fires one sweep at construction (boot) and piggybacks a throttled, fire-and-forget
4
+ * `maybeSweep()` on the deploy and deployments-list control-plane paths. A sweep hard-deletes
5
+ * every deployment record archived before the retention cutoff, reclaims the purged app's managed
6
+ * config (app scope + the swept environments' env scopes — org scope is shared and untouched),
7
+ * and emits one `app.purged` audit event per org/app.
8
+ */
9
+ import { noopLogger } from '@noodle-borg/transport-http';
10
+ import { resolveConfigScope, } from './store.js';
11
+ /** Platform default retention: archived apps are hard-deleted after this many days. */
12
+ export const DEFAULT_ARCHIVE_RETENTION_DAYS = 30;
13
+ /** Piggybacked sweeps run at most this often per instance; boot always sweeps once. */
14
+ export const ARCHIVE_SWEEP_INTERVAL_MS = 6 * 60 * 60 * 1000;
15
+ const DAY_MS = 24 * 60 * 60 * 1000;
16
+ const CONFIG_KINDS = ['secret', 'variable'];
17
+ /** Resolve the retention override from env. Fails closed on a malformed value (boot-time error). */
18
+ export function resolveArchiveRetentionDays(env) {
19
+ const raw = env.NOODLE_ARCHIVE_RETENTION_DAYS;
20
+ if (raw === undefined || raw.trim() === '')
21
+ return DEFAULT_ARCHIVE_RETENTION_DAYS;
22
+ const parsed = Number(raw);
23
+ if (!Number.isInteger(parsed) || parsed < 1) {
24
+ throw new Error('NOODLE_ARCHIVE_RETENTION_DAYS must be a positive integer number of days');
25
+ }
26
+ return parsed;
27
+ }
28
+ export class ArchiveSweeper {
29
+ #registry;
30
+ #configStore;
31
+ #audit;
32
+ #retentionDays;
33
+ #clock;
34
+ #logger;
35
+ #intervalMs;
36
+ #lastSweepStartedAt;
37
+ constructor(options) {
38
+ this.#registry = options.registry;
39
+ this.#configStore = options.configStore;
40
+ this.#audit = options.audit;
41
+ this.#retentionDays = options.retentionDays;
42
+ this.#clock = options.clock ?? (() => new Date());
43
+ this.#logger = options.logger ?? noopLogger;
44
+ this.#intervalMs = options.intervalMs ?? ARCHIVE_SWEEP_INTERVAL_MS;
45
+ }
46
+ /**
47
+ * Throttled, fire-and-forget sweep for request-path piggybacking: never blocks or fails the
48
+ * carrying request. The first call (boot) always sweeps.
49
+ */
50
+ maybeSweep() {
51
+ const now = this.#clock().getTime();
52
+ if (this.#lastSweepStartedAt !== undefined &&
53
+ now - this.#lastSweepStartedAt < this.#intervalMs) {
54
+ return;
55
+ }
56
+ this.#lastSweepStartedAt = now;
57
+ void this.sweepNow().catch((error) => {
58
+ this.#logger.warn('archive.sweep.failed', {
59
+ message: error instanceof Error ? error.message : String(error),
60
+ });
61
+ });
62
+ }
63
+ async sweepNow() {
64
+ const cutoff = new Date(this.#clock().getTime() - this.#retentionDays * DAY_MS).toISOString();
65
+ const deleted = await this.#registry.sweepArchived(cutoff);
66
+ if (deleted.length === 0)
67
+ return { deletedDeployments: 0, purgedApps: 0 };
68
+ const apps = groupByApp(deleted);
69
+ for (const entry of apps.values()) {
70
+ await this.#deleteAppConfig(entry);
71
+ await this.#audit.emit({
72
+ eventType: 'app.purged',
73
+ org: entry.org,
74
+ app: entry.app,
75
+ decision: 'allow',
76
+ reasonCode: 'retention_elapsed',
77
+ details: {
78
+ deletedDeployments: entry.count,
79
+ retentionDays: this.#retentionDays,
80
+ archivedBefore: cutoff,
81
+ },
82
+ });
83
+ }
84
+ this.#logger.info('archive.sweep.completed', {
85
+ deletedDeployments: deleted.length,
86
+ purgedApps: apps.size,
87
+ });
88
+ return { deletedDeployments: deleted.length, purgedApps: apps.size };
89
+ }
90
+ /** Reclaim the purged app's managed config: app scope + each swept environment's env scope. */
91
+ async #deleteAppConfig(entry) {
92
+ const scopes = [
93
+ resolveConfigScope({ org: entry.org, app: entry.app }),
94
+ ...[...entry.envs].map((env) => resolveConfigScope({ org: entry.org, app: entry.app, env })),
95
+ ];
96
+ for (const scope of scopes) {
97
+ for (const kind of CONFIG_KINDS) {
98
+ const values = await this.#configStore.listConfigValues(kind, scope);
99
+ for (const value of values) {
100
+ await this.#configStore.deleteConfigValue(kind, scope, value.name);
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ function groupByApp(deleted) {
107
+ const apps = new Map();
108
+ for (const record of deleted) {
109
+ const key = `${record.orgSlug}/${record.appSlug}`;
110
+ const entry = apps.get(key) ?? {
111
+ org: record.orgSlug,
112
+ app: record.appSlug,
113
+ envs: new Set(),
114
+ count: 0,
115
+ };
116
+ entry.envs.add(record.environment);
117
+ entry.count += 1;
118
+ apps.set(key, entry);
119
+ }
120
+ return apps;
121
+ }
122
+ //# sourceMappingURL=archive-sweeper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archive-sweeper.js","sourceRoot":"","sources":["../src/archive-sweeper.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAe,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGtE,OAAO,EAIL,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,uFAAuF;AACvF,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAC;AACjD,uFAAuF;AACvF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE5D,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACnC,MAAM,YAAY,GAAiC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAE1E,oGAAoG;AACpG,MAAM,UAAU,2BAA2B,CAAC,GAAsB;IAChE,MAAM,GAAG,GAAG,GAAG,CAAC,6BAA6B,CAAC;IAC9C,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,8BAA8B,CAAC;IAClF,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAqBD,MAAM,OAAO,cAAc;IAChB,SAAS,CAAiB;IAC1B,YAAY,CAAc;IAC1B,MAAM,CAAY;IAClB,cAAc,CAAS;IACvB,MAAM,CAAa;IACnB,OAAO,CAAS;IAChB,WAAW,CAAS;IAC7B,mB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IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { PolicyDocument } from './policy.js';
2
+ export type CommercialPlanName = 'free' | 'pro' | 'scale' | 'enterprise';
3
+ export type CommercialPlanCatalog = Readonly<Record<CommercialPlanName, PolicyDocument>>;
4
+ export declare const COMMERCIAL_PLAN_NAMES: readonly CommercialPlanName[];
5
+ export declare const DEFAULT_COMMERCIAL_PLAN_CATALOG: CommercialPlanCatalog;
6
+ export declare function commercialPlanPolicyId(org: string): string;
7
+ export declare function isCommercialPlanPolicyId(id: string): boolean;
8
+ export declare function isCommercialPlanName(value: unknown): value is CommercialPlanName;
9
+ export declare function resolveCommercialPlanCatalog(override: CommercialPlanCatalog | undefined): CommercialPlanCatalog;
10
+ export declare function planNameForPolicy(policy: PolicyDocument, catalog: CommercialPlanCatalog): CommercialPlanName | undefined;
11
+ //# sourceMappingURL=commercial-plans.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commercial-plans.d.ts","sourceRoot":"","sources":["../src/commercial-plans.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,YAAY,CAAC;AAEzE,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC,CAAC;AAEzF,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EAK9D,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,qBAwE7C,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAS5D;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAEhF;AAED,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,qBAAqB,GAAG,SAAS,GAC1C,qBAAqB,CAEvB;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,qBAAqB,GAC7B,kBAAkB,GAAG,SAAS,CAMhC"}
@@ -0,0 +1,119 @@
1
+ import { validateSlug } from './store.js';
2
+ export const COMMERCIAL_PLAN_NAMES = [
3
+ 'free',
4
+ 'pro',
5
+ 'scale',
6
+ 'enterprise',
7
+ ];
8
+ export const DEFAULT_COMMERCIAL_PLAN_CATALOG = {
9
+ free: {
10
+ schemaVersion: 1,
11
+ categories: {
12
+ execute: {
13
+ reason: 'free_plan_quota',
14
+ quota: { limit: 1_000_000, windowSeconds: 2_592_000 },
15
+ rate: {
16
+ algorithm: 'token-bucket',
17
+ limit: 60,
18
+ refillSeconds: 60,
19
+ burst: 120,
20
+ partitionBy: 'subject',
21
+ },
22
+ },
23
+ discovery: { rate: commonReadRate() },
24
+ read: { rate: commonReadRate() },
25
+ },
26
+ },
27
+ pro: {
28
+ schemaVersion: 1,
29
+ categories: {
30
+ execute: {
31
+ reason: 'pro_plan_quota',
32
+ quota: { limit: 10_000_000, windowSeconds: 2_592_000 },
33
+ rate: {
34
+ algorithm: 'token-bucket',
35
+ limit: 300,
36
+ refillSeconds: 60,
37
+ burst: 600,
38
+ partitionBy: 'subject',
39
+ },
40
+ },
41
+ discovery: { rate: commonReadRate() },
42
+ read: { rate: commonReadRate() },
43
+ },
44
+ },
45
+ scale: {
46
+ schemaVersion: 1,
47
+ categories: {
48
+ execute: {
49
+ reason: 'scale_plan_quota',
50
+ quota: { limit: 100_000_000, windowSeconds: 2_592_000 },
51
+ rate: {
52
+ algorithm: 'token-bucket',
53
+ limit: 1_000,
54
+ refillSeconds: 60,
55
+ burst: 2_000,
56
+ partitionBy: 'subject',
57
+ },
58
+ },
59
+ discovery: { rate: commonReadRate() },
60
+ read: { rate: commonReadRate() },
61
+ },
62
+ },
63
+ enterprise: {
64
+ schemaVersion: 1,
65
+ categories: {
66
+ execute: {
67
+ reason: 'enterprise_plan_rate',
68
+ rate: {
69
+ algorithm: 'token-bucket',
70
+ limit: 2_000,
71
+ refillSeconds: 60,
72
+ burst: 4_000,
73
+ partitionBy: 'subject',
74
+ },
75
+ },
76
+ discovery: { rate: commonReadRate() },
77
+ read: { rate: commonReadRate() },
78
+ },
79
+ },
80
+ };
81
+ export function commercialPlanPolicyId(org) {
82
+ return `org:${validateSlug('org', org)}:commercial-plan`;
83
+ }
84
+ export function isCommercialPlanPolicyId(id) {
85
+ const match = /^org:([^:]+):commercial-plan$/.exec(id);
86
+ if (!match)
87
+ return false;
88
+ try {
89
+ validateSlug('org', match[1]);
90
+ return true;
91
+ }
92
+ catch {
93
+ return false;
94
+ }
95
+ }
96
+ export function isCommercialPlanName(value) {
97
+ return typeof value === 'string' && COMMERCIAL_PLAN_NAMES.includes(value);
98
+ }
99
+ export function resolveCommercialPlanCatalog(override) {
100
+ return override ?? DEFAULT_COMMERCIAL_PLAN_CATALOG;
101
+ }
102
+ export function planNameForPolicy(policy, catalog) {
103
+ const fingerprint = JSON.stringify(policy);
104
+ for (const name of COMMERCIAL_PLAN_NAMES) {
105
+ if (JSON.stringify(catalog[name]) === fingerprint)
106
+ return name;
107
+ }
108
+ return undefined;
109
+ }
110
+ function commonReadRate() {
111
+ return {
112
+ algorithm: 'token-bucket',
113
+ limit: 120,
114
+ refillSeconds: 60,
115
+ burst: 240,
116
+ partitionBy: 'subject',
117
+ };
118
+ }
119
+ //# sourceMappingURL=commercial-plans.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commercial-plans.js","sourceRoot":"","sources":["../src/commercial-plans.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAM1C,MAAM,CAAC,MAAM,qBAAqB,GAAkC;IAClE,MAAM;IACN,KAAK;IACL,OAAO;IACP,YAAY;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+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B,MAAsB,EACtB,OAA8B;IAE9B,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3C,KAAK,MAAM,IAAI,IAAI,qBAAqB,EAAE,CAAC;QACzC,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,WAAW;YAAE,OAAO,IAAI,CAAC;IACjE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,cAAc;IACrB,OAAO;QACL,SAAS,EAAE,cAAuB;QAClC,KAAK,EAAE,GAAG;QACV,aAAa,EAAE,EAAE;QACjB,KAAK,EAAE,GAAG;QACV,WAAW,EAAE,SAAkB;KAChC,CAAC;AACJ,CAAC"}
@@ -5,6 +5,8 @@ export interface DeploymentVersionRecord {
5
5
  readonly active: boolean;
6
6
  readonly deploymentVersion: number;
7
7
  readonly serverVersion?: string;
8
+ /** Soft-delete stamp (ADR 0117). An archived record never resolves as an active deployment. */
9
+ readonly archivedAt?: string;
8
10
  }
9
11
  export interface TenantVersionRef {
10
12
  readonly org: string;
@@ -1 +1 @@
1
- {"version":3,"file":"deployment-versioning.d.ts","sourceRoot":"","sources":["../src/deployment-versioning.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;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AAC,uBAAuB,EAAE,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC,EAC5E,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC,uBAAuB,EAAE,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC,GAC9F,OAAO,CAaT;AAED,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,uBAAuB,EAC1B,CAAC,EAAE,uBAAuB,GACzB,OAAO,CAET;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,uBAAuB,EACnE,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,GAAG,EAAE,gBAAgB,GACpB,CAAC,GAAG,SAAS,CAaf;AAED,wBAAgB,oCAAoC,CAAC,CAAC,SAAS,uBAAuB,EACpF,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACH,MAAM,CAGR"}
@@ -13,7 +13,7 @@ export function sameDeploymentScope(a, b) {
13
13
  return sameTenantRecord(a, b) && a.serverVersion === b.serverVersion;
14
14
  }
15
15
  export function defaultActiveRecord(records, ref) {
16
- const active = records.filter((record) => record.active && sameTenantRecord(record, ref));
16
+ const active = records.filter((record) => record.active && record.archivedAt === undefined && sameTenantRecord(record, ref));
17
17
  const versioned = active
18
18
  .filter((record) => record.serverVersion !== undefined)
19
19
  .sort(compareDeployRecordVersionDescending);
@@ -1 +1 @@
1
- {"version":3,"file":"deployment-versioning.js","sourceRoot":"","sources":["../src/deployment-versioning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAiB5D,MAAM,UAAU,gBAAgB,CAC9B,MAA4E,EAC5E,MAA+F;IAE/F,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;QACpB,OAAO,CACL,MAAM,CAAC,OAAO,KAAK,MAAM,CAAC,GAAG;YAC7B,MAAM,CAAC,OAAO,KAAK,MAAM,CAAC,GAAG;YAC7B,MAAM,CAAC,WAAW,KAAK,MAAM,CAAC,GAAG,CAClC,CAAC;IACJ,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ACL,SAAS,CAAC,CAAC,CAAC;QACZ,MAAM;aACH,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,KAAK,SAAS,CAAC;aACtD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAChE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oCAAoC,CAClD,CAAI,EACJ,CAAI;IAEJ,MAAM,SAAS,GAAG,qBAAqB,CAAC,CAAC,CAAC,aAAuB,EAAE,CAAC,CAAC,aAAuB,CAAC,CAAC;IAC9F,OAAO,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC,iBAAiB,CAAC;AACjF,CAAC"}
@@ -1,8 +1,10 @@
1
1
  export { ensureAuditSchema, PostgresAuditStore } from '@noodle-borg/module-audit';
2
+ export { ARCHIVE_SWEEP_INTERVAL_MS, ArchiveSweeper, type ArchiveSweeperOptions, DEFAULT_ARCHIVE_RETENTION_DAYS, resolveArchiveRetentionDays, } from './archive-sweeper.js';
2
3
  export { type AssetAdapterKind, type AssetConfigInput, type AssetConfigResolution, type AssetQuotaOverride, createAssetStore, type ResolvedAssetConfig, resolveAssetConfig, } from './asset-config.js';
3
4
  export { type AssetStore, type AssetUploadPlan, type AssetUploadTarget, InMemoryAssetStore, type InMemoryAssetStoreOptions, } from './assets.js';
4
5
  export { allowAllGate, bearerToken, type ControlPlaneAuthResult, type ControlPlaneIdentity, constantTimeEqual, type DeployAuthGate, GoogleControlPlaneGate, type GoogleIdTokenVerifier, NoodleOAuthControlPlaneGate, } from './auth/deploy-gate.js';
5
6
  export { type BuildInfo, resolveBuildInfo } from './build-info.js';
7
+ export { COMMERCIAL_PLAN_NAMES, type CommercialPlanCatalog, type CommercialPlanName, commercialPlanPolicyId, DEFAULT_COMMERCIAL_PLAN_CATALOG, isCommercialPlanName, isCommercialPlanPolicyId, planNameForPolicy, resolveCommercialPlanCatalog, } from './commercial-plans.js';
6
8
  export { type CustomerVerifierFactoryOptions, createCustomerVerifierFactory, createFirebaseIdTokenVerifier, } from './customer-verifier.js';
7
9
  export { ORG_DOMAIN_TXT_LABEL, type OrgDomainVerificationResult, type TxtResolver, verifyOrgDomainDns, } from './domain-verification.js';
8
10
  export { type EnsureFreeTierDefaultOptions, ensureFreeTierDefault, FREE_TIER_PLAN, FREE_TIER_POLICY_ID, } from './free-tier.js';
@@ -20,5 +22,5 @@ export { InMemoryControlPlaneStore } from './store/control-plane.js';
20
22
  export { PostgresArtifactStore, type PostgresStoreOptions } from './store/postgres.js';
21
23
  export { ensureStateHandleSchema, PostgresStateHandleStore, type PostgresStateHandleStoreOptions, } from './store/postgres-state-handles.js';
22
24
  export { InMemoryUserAppLogStore, type InMemoryUserAppLogStoreOptions, type UserAppLogEvent, type UserAppLogFilter, type UserAppLogInput, type UserAppLogLevel, type UserAppLogSink, type UserAppLogStore, } from './store/user-app-logs.js';
23
- export { type ArtifactStore, CONFIG_NAME_PATTERN, type ConfigScope, type ConfigStore, type ConfigValueMetadata, type ControlPlaneStore, DEPLOYMENT_ID_PATTERN, type DeploymentSummary, type DeployRecord, DOMAIN_PATTERN, InMemoryArtifactStore, InMemoryConfigStore, JsonFileArtifactStore, type ManagedConfigKind, type OrgDomainRecord, type OrgInvitationRecord, type OrgMemberRecord, type OrgRecord, type OrgRole, resolveConfigScope, type SecretEnvelope, type SignupAllowlistKind, type SignupAllowlistRecord, SLUG_PATTERN, scopeChain, type TenantAuthConfig, type TenantRef, validateConfigName, validateConfigScope, validateDomain, validateOrgRole, validateSignupAllowlistKind, validateSlug, validateTenantRef, } from './store.js';
25
+ export { type AppArchiveResult, type AppRestoreResult, type ArtifactStore, CONFIG_NAME_PATTERN, type ConfigScope, type ConfigStore, type ConfigValueMetadata, type ControlPlaneStore, DEPLOYMENT_ID_PATTERN, type DeploymentListFilter, type DeploymentSummary, type DeployRecord, DOMAIN_PATTERN, InMemoryArtifactStore, InMemoryConfigStore, JsonFileArtifactStore, type ManagedConfigKind, type OrgDomainRecord, type OrgInvitationRecord, type OrgMemberRecord, type OrgRecord, type OrgRole, resolveConfigScope, type SecretEnvelope, type SignupAllowlistKind, type SignupAllowlistRecord, SLUG_PATTERN, scopeChain, type TenantAuthConfig, type TenantRef, validateConfigName, validateConfigScope, validateDomain, validateOrgRole, validateSignupAllowlistKind, validateSlug, validateTenantRef, } from './store.js';
24
26
  //# sourceMappingURL=index.d.ts.map