@empire-builder-kit/nx 1.0.0-rc.43 → 1.0.0-rc.45

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 (88) hide show
  1. package/package.json +3 -3
  2. package/src/blueprints/external-sandbox.d.ts +1 -1
  3. package/src/cli/main.d.ts +11 -5
  4. package/src/cli/main.js +88 -29
  5. package/src/container-images.d.ts +1 -1
  6. package/src/container-images.js +1 -1
  7. package/src/executors/deployment-plan/deployment-plan.js +5 -1
  8. package/src/executors/deployment-plan/schema.json +1 -1
  9. package/src/executors/fleet/fleet.js +4 -0
  10. package/src/executors/fleet/schema.json +1 -1
  11. package/src/executors/local-deploy/federated-credential-transport.d.ts +4 -3
  12. package/src/executors/local-deploy/federated-credential-transport.js +15 -5
  13. package/src/foundation/cost-estimate.d.ts +8 -3
  14. package/src/foundation/cost-estimate.js +42 -19
  15. package/src/foundation/index.d.ts +1 -0
  16. package/src/foundation/index.js +1 -0
  17. package/src/foundation/local-private-smoke-access.js +6 -0
  18. package/src/foundation/logging.d.ts +3 -1
  19. package/src/foundation/logging.js +8 -1
  20. package/src/foundation/observability.d.ts +42 -0
  21. package/src/foundation/observability.js +181 -0
  22. package/src/foundation/preflight.js +1 -1
  23. package/src/generators/function/function.js +5 -2
  24. package/src/generators/observability-infrastructure.d.ts +2 -0
  25. package/src/generators/observability-infrastructure.js +31 -0
  26. package/src/generators/observability-policy.d.ts +4 -0
  27. package/src/generators/observability-policy.js +23 -0
  28. package/src/generators/preset/dependency-overrides.d.ts +34 -0
  29. package/src/generators/preset/dependency-overrides.js +35 -1
  30. package/src/generators/preset/tool-versions.d.ts +2 -2
  31. package/src/generators/preset/tool-versions.js +2 -2
  32. package/src/generators/preset/workspace-files-adopter-skills.js +28 -17
  33. package/src/generators/preset/workspace-files-agent-development.d.ts +9 -0
  34. package/src/generators/preset/workspace-files-agent-development.js +42 -0
  35. package/src/generators/preset/workspace-files-thin-deploy.js +12 -3
  36. package/src/generators/preset/workspace-files-thin-docs.js +10 -22
  37. package/src/generators/preset/workspace-files.d.ts +3 -0
  38. package/src/generators/preset/workspace-files.js +93 -8
  39. package/src/generators/slice/built-in-plan-alarm-identity.d.ts +173 -0
  40. package/src/generators/slice/built-in-plan-alarm-identity.js +202 -0
  41. package/src/generators/slice/built-in-plan-api-contract-files.js +136 -0
  42. package/src/generators/slice/built-in-plan-database-lifecycle-files.js +1 -1
  43. package/src/generators/slice/built-in-plan-event-contract-literal.d.ts +6 -0
  44. package/src/generators/slice/built-in-plan-event-contract-literal.js +52 -0
  45. package/src/generators/slice/built-in-plan-infrastructure-files.js +304 -144
  46. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.js +2 -2
  47. package/src/generators/slice/built-in-plan-metadata-files.js +33 -1
  48. package/src/generators/slice/built-in-plan-operations-files.js +106 -6
  49. package/src/generators/slice/built-in-plan-project-files.js +1 -0
  50. package/src/generators/slice/built-in-plan-release-files.js +2 -43
  51. package/src/generators/slice/built-in-plan-reliability-files.js +222 -236
  52. package/src/generators/slice/built-in-plan-shared.d.ts +29 -3
  53. package/src/generators/slice/built-in-plan-shared.js +29 -2
  54. package/src/generators/slice/built-in-plan-web-files.js +18 -1
  55. package/src/generators/slice/built-in-plan.js +1 -0
  56. package/src/generators/slice/slice.js +2 -0
  57. package/src/generators/upgrade/upgrade.d.ts +4 -3
  58. package/src/generators/upgrade/upgrade.js +50 -26
  59. package/src/generators/workload/frozen-container.d.ts +1 -1
  60. package/src/generators/workload/service-performance-files.js +22 -5
  61. package/src/generators/workload/workload.js +5 -1
  62. package/src/local-dev/dev-command-core.d.ts +24 -3
  63. package/src/local-dev/dev-command-core.js +124 -12
  64. package/src/local-dev/errors.d.ts +19 -1
  65. package/src/local-dev/errors.js +18 -1
  66. package/src/local-dev/fleet-client.d.ts +64 -6
  67. package/src/local-dev/fleet-client.js +189 -15
  68. package/src/local-dev/fleet-process.d.ts +47 -2
  69. package/src/local-dev/fleet-process.js +248 -31
  70. package/src/local-dev/fleet-runtime.d.ts +37 -0
  71. package/src/local-dev/fleet-runtime.js +127 -69
  72. package/src/local-dev/fleet-session.d.ts +1 -0
  73. package/src/local-dev/fleet-session.js +42 -3
  74. package/src/local-dev/fleet-state.d.ts +5 -0
  75. package/src/local-dev/fleet-state.js +11 -2
  76. package/src/local-dev/fleet-supervisor.d.ts +6 -0
  77. package/src/local-dev/fleet-supervisor.js +49 -1
  78. package/src/local-dev/ports.d.ts +11 -1
  79. package/src/local-dev/ports.js +78 -38
  80. package/src/local-dev/slice-runner.d.ts +19 -1
  81. package/src/local-dev/slice-runner.js +290 -91
  82. package/src/repository-policy/deployment-plan.d.ts +1 -1
  83. package/src/repository-policy/deployment-plan.js +16 -1
  84. package/src/secrets/generated-aws-control-plane.d.ts +11 -1
  85. package/src/secrets/generated-aws-control-plane.js +92 -29
  86. package/src/secrets/operator.d.ts +3 -2
  87. package/src/secrets/operator.js +27 -5
  88. package/src/supply-chain/generated-files.js +9 -0
@@ -43,6 +43,13 @@ function requireWorkspace(value) {
43
43
  }
44
44
  function createManagedLogGroupContract(input) {
45
45
  const component = requireSegment(input.component, 'component');
46
+ const retentionInDays = input.retentionInDays ?? exports.MANAGED_LOG_GROUP_RETENTION_DAYS;
47
+ if (![
48
+ 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557,
49
+ 2922, 3288, 3653,
50
+ ].includes(retentionInDays)) {
51
+ throw new Error('[foundation/logging] Mixed security/receipt log groups require an AWS-supported retention of at least 30 days.');
52
+ }
46
53
  const slice = requireSegment(input.slice, 'slice');
47
54
  const stage = requireSegment(input.stage, 'stage');
48
55
  const workspace = requireWorkspace(input.workspace);
@@ -79,7 +86,7 @@ function createManagedLogGroupContract(input) {
79
86
  },
80
87
  logGroupClass: exports.MANAGED_LOG_GROUP_CLASS,
81
88
  name,
82
- retentionInDays: exports.MANAGED_LOG_GROUP_RETENTION_DAYS,
89
+ retentionInDays,
83
90
  tags: {
84
91
  [exports.MANAGED_LOG_GROUP_TAG_KEYS.component]: component,
85
92
  [exports.MANAGED_LOG_GROUP_TAG_KEYS.managed]: 'true',
@@ -0,0 +1,42 @@
1
+ import { type FoundationStage } from './stages.js';
2
+ export declare const OBSERVABILITY_POLICY_PATH = "ebk.observability.json";
3
+ export declare const OBSERVABILITY_PROFILES: readonly ["cost-optimized", "balanced", "standard"];
4
+ export type ObservabilityProfile = (typeof OBSERVABILITY_PROFILES)[number];
5
+ export type DashboardPolicy = 'none' | 'stage' | 'slice';
6
+ export interface ObservabilityStagePolicy {
7
+ /** Explicitly seeded; an omitted production value requires a supplied capacity profile. */
8
+ profile?: ObservabilityProfile;
9
+ routineSuccessSampleRate?: number;
10
+ diagnosticRetentionDays?: number;
11
+ protectedRetentionDays?: number;
12
+ dashboards?: DashboardPolicy;
13
+ systemLogLevel?: 'WARN' | 'INFO';
14
+ /** Preserve groups with possible historical logs when adapters are disabled. */
15
+ retainDormantComponentLogs?: boolean;
16
+ }
17
+ export interface ObservabilityPolicy {
18
+ schemaVersion: 1;
19
+ stages: Partial<Record<FoundationStage, ObservabilityStagePolicy>>;
20
+ }
21
+ export interface ResolvedObservabilityPolicy {
22
+ profile: ObservabilityProfile;
23
+ routineSuccessSampleRate: number;
24
+ diagnosticRetentionDays: number;
25
+ /** Shared application/security/receipt groups use this floor, not diagnostic retention. */
26
+ protectedRetentionDays: number;
27
+ dashboards: DashboardPolicy;
28
+ systemLogLevel: 'WARN' | 'INFO';
29
+ retainDormantComponentLogs: boolean;
30
+ }
31
+ export declare function parseObservabilityPolicy(value: unknown, activeStages?: readonly FoundationStage[]): ObservabilityPolicy;
32
+ /** New workspaces opt in; a managed upgrade of an older workspace preserves its choices. */
33
+ export declare function defaultObservabilityPolicy(stages: readonly FoundationStage[], options?: {
34
+ preserveLegacy?: boolean;
35
+ productionProfile?: ObservabilityProfile;
36
+ }): ObservabilityPolicy;
37
+ export declare function resolveObservabilityPolicy(input: {
38
+ policy: unknown;
39
+ stage: string;
40
+ productionProfile?: string;
41
+ local?: boolean;
42
+ }): ResolvedObservabilityPolicy;
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OBSERVABILITY_PROFILES = exports.OBSERVABILITY_POLICY_PATH = void 0;
4
+ exports.parseObservabilityPolicy = parseObservabilityPolicy;
5
+ exports.defaultObservabilityPolicy = defaultObservabilityPolicy;
6
+ exports.resolveObservabilityPolicy = resolveObservabilityPolicy;
7
+ const stages_js_1 = require("./stages.js");
8
+ exports.OBSERVABILITY_POLICY_PATH = 'ebk.observability.json';
9
+ exports.OBSERVABILITY_PROFILES = [
10
+ 'cost-optimized',
11
+ 'balanced',
12
+ 'standard',
13
+ ];
14
+ const RETENTION_DAYS = new Set([
15
+ 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557,
16
+ 2922, 3288, 3653,
17
+ ]);
18
+ const STAGE_KEYS = new Set(['development', 'staging', 'production']);
19
+ const FIELD_KEYS = new Set([
20
+ 'profile',
21
+ 'routineSuccessSampleRate',
22
+ 'diagnosticRetentionDays',
23
+ 'protectedRetentionDays',
24
+ 'dashboards',
25
+ 'systemLogLevel',
26
+ 'retainDormantComponentLogs',
27
+ ]);
28
+ const PROFILE_DEFAULTS = {
29
+ 'cost-optimized': {
30
+ sampleRate: 0.05,
31
+ diagnosticDays: 7,
32
+ productionDiagnosticDays: 30,
33
+ dashboards: 'none',
34
+ systemLogLevel: 'WARN',
35
+ },
36
+ balanced: {
37
+ sampleRate: 0.25,
38
+ diagnosticDays: 14,
39
+ productionDiagnosticDays: 30,
40
+ dashboards: 'stage',
41
+ systemLogLevel: 'INFO',
42
+ },
43
+ standard: {
44
+ sampleRate: 1,
45
+ diagnosticDays: 30,
46
+ productionDiagnosticDays: 90,
47
+ dashboards: 'slice',
48
+ systemLogLevel: 'INFO',
49
+ },
50
+ };
51
+ function record(value, label) {
52
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
53
+ throw new Error(`[observability] ${label} must be an object.`);
54
+ }
55
+ return value;
56
+ }
57
+ function parseObservabilityPolicy(value, activeStages) {
58
+ const root = record(value, 'Policy');
59
+ if (root.schemaVersion !== 1 ||
60
+ Object.keys(root).some((key) => !['schemaVersion', 'stages'].includes(key))) {
61
+ throw new Error('[observability] Expected schemaVersion 1 with stages only.');
62
+ }
63
+ const stages = record(root.stages, 'stages');
64
+ if (Object.keys(stages).length === 0)
65
+ throw new Error('[observability] Declare active stages.');
66
+ if (activeStages &&
67
+ (Object.keys(stages).length !== activeStages.length ||
68
+ activeStages.some((stage) => !Object.prototype.hasOwnProperty.call(stages, stage))))
69
+ throw new Error('[observability] Declare exactly the active repository stages: ' +
70
+ activeStages.join(', ') +
71
+ '. Update seeded ebk.observability.json before generation or upgrade.');
72
+ for (const [stage, raw] of Object.entries(stages)) {
73
+ if (!STAGE_KEYS.has(stage))
74
+ throw new Error(`[observability] Unsupported stage ${stage}.`);
75
+ const entry = record(raw, stage);
76
+ if (Object.keys(entry).some((key) => !FIELD_KEYS.has(key)))
77
+ throw new Error(`[observability] Unknown field in ${stage}.`);
78
+ if (entry.profile !== undefined &&
79
+ !exports.OBSERVABILITY_PROFILES.includes(entry.profile))
80
+ throw new Error(`[observability] Invalid profile for ${stage}.`);
81
+ const sample = entry.routineSuccessSampleRate;
82
+ if (sample !== undefined &&
83
+ (typeof sample !== 'number' ||
84
+ !Number.isFinite(sample) ||
85
+ sample < 0 ||
86
+ sample > 1))
87
+ throw new Error(`[observability] ${stage} routineSuccessSampleRate must be between 0 and 1.`);
88
+ for (const key of [
89
+ 'diagnosticRetentionDays',
90
+ 'protectedRetentionDays',
91
+ ]) {
92
+ const days = entry[key];
93
+ if (days !== undefined &&
94
+ (typeof days !== 'number' ||
95
+ !RETENTION_DAYS.has(days) ||
96
+ (key === 'protectedRetentionDays' && days < 30)))
97
+ throw new Error(`[observability] Invalid ${stage} ${key}; protected logs require at least 30 days.`);
98
+ }
99
+ if (entry.dashboards !== undefined &&
100
+ (typeof entry.dashboards !== 'string' ||
101
+ !['none', 'stage', 'slice'].includes(entry.dashboards)))
102
+ throw new Error(`[observability] Invalid dashboard policy for ${stage}.`);
103
+ if (entry.systemLogLevel !== undefined &&
104
+ (typeof entry.systemLogLevel !== 'string' ||
105
+ !['WARN', 'INFO'].includes(entry.systemLogLevel)))
106
+ throw new Error(`[observability] Invalid systemLogLevel for ${stage}.`);
107
+ if (entry.retainDormantComponentLogs !== undefined &&
108
+ typeof entry.retainDormantComponentLogs !== 'boolean')
109
+ throw new Error(`[observability] Invalid retainDormantComponentLogs for ${stage}.`);
110
+ }
111
+ return JSON.parse(JSON.stringify(root));
112
+ }
113
+ /** New workspaces opt in; a managed upgrade of an older workspace preserves its choices. */
114
+ function defaultObservabilityPolicy(stages, options = {}) {
115
+ const value = { schemaVersion: 1, stages: {} };
116
+ for (const stage of stages) {
117
+ value.stages[stage] = options.preserveLegacy
118
+ ? {
119
+ profile: 'standard',
120
+ routineSuccessSampleRate: 1,
121
+ diagnosticRetentionDays: 30,
122
+ protectedRetentionDays: 30,
123
+ dashboards: 'slice',
124
+ systemLogLevel: 'INFO',
125
+ retainDormantComponentLogs: true,
126
+ }
127
+ : stage === 'production'
128
+ ? { profile: options.productionProfile ?? 'cost-optimized' }
129
+ : { profile: stage === 'development' ? 'cost-optimized' : 'balanced' };
130
+ }
131
+ return parseObservabilityPolicy(value);
132
+ }
133
+ function resolveObservabilityPolicy(input) {
134
+ const policy = parseObservabilityPolicy(input.policy);
135
+ const resolved = (0, stages_js_1.resolveFoundationStages)({
136
+ consumerStage: input.stage,
137
+ activeFoundationStages: Object.keys(policy.stages),
138
+ });
139
+ const entry = policy.stages[resolved.foundationStage];
140
+ if (!entry)
141
+ throw new Error('[observability] Resolved Foundation stage has no policy.');
142
+ const inherited = resolved.foundationStage === 'production'
143
+ ? input.productionProfile
144
+ : resolved.foundationStage === 'staging'
145
+ ? 'balanced'
146
+ : 'cost-optimized';
147
+ const profile = resolved.mapped
148
+ ? 'cost-optimized'
149
+ : (entry.profile ?? inherited);
150
+ if (!exports.OBSERVABILITY_PROFILES.includes(profile))
151
+ throw new Error('[observability] Production observability requires an explicit profile or a valid committed production capacity profile.');
152
+ const defaults = PROFILE_DEFAULTS[profile];
153
+ const production = resolved.foundationStage === 'production';
154
+ // Task stages never acquire paid dashboards or verbose cloud system logs just
155
+ // because the shared development stage uses a richer profile.
156
+ // Lean task diagnostics do not authorize shortening explicit retention or
157
+ // removing groups with historical logs. Those preservation choices survive.
158
+ const overrides = resolved.mapped
159
+ ? {
160
+ diagnosticRetentionDays: entry.diagnosticRetentionDays,
161
+ protectedRetentionDays: entry.protectedRetentionDays,
162
+ retainDormantComponentLogs: entry.retainDormantComponentLogs,
163
+ }
164
+ : entry;
165
+ return {
166
+ profile: profile,
167
+ routineSuccessSampleRate: input.local
168
+ ? 1
169
+ : (overrides.routineSuccessSampleRate ?? defaults.sampleRate),
170
+ diagnosticRetentionDays: overrides.diagnosticRetentionDays ??
171
+ (production
172
+ ? defaults.productionDiagnosticDays
173
+ : defaults.diagnosticDays),
174
+ protectedRetentionDays: overrides.protectedRetentionDays ??
175
+ (production && profile === 'standard' ? 90 : 30),
176
+ dashboards: overrides.dashboards ?? defaults.dashboards,
177
+ systemLogLevel: overrides.systemLogLevel ?? defaults.systemLogLevel,
178
+ retainDormantComponentLogs: overrides.retainDormantComponentLogs ?? false,
179
+ };
180
+ }
181
+ //# sourceMappingURL=observability.js.map
@@ -181,7 +181,7 @@ function formatFoundationPreflightReport(report) {
181
181
  report.issues.forEach((issue) => lines.push(` - ${issue}`));
182
182
  if (!report.ok) {
183
183
  lines.push(report.foundationStage === 'development'
184
- ? ' Establish Foundation through ebk deploy development --profile=<approved-profile> --expectedRoleArn=<approved-development-role>; the governed stage lifecycle deploys Foundation before eligible Slices.'
184
+ ? ' Establish Foundation through ebk deploy development --profile=<development-profile> --expectedRoleArn=<role-arn>; the governed stage lifecycle deploys Foundation before eligible Slices.'
185
185
  : ` Establish Foundation through the governed ${report.foundationStage} stage lifecycle under the repository deployment profile; follow its protected deployment runbook.`);
186
186
  }
187
187
  return lines.join('\n');
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createFunctionFilePlan = createFunctionFilePlan;
4
4
  exports.functionGenerator = functionGenerator;
5
+ const observability_infrastructure_js_1 = require("../observability-infrastructure.js");
6
+ const observability_policy_js_1 = require("../observability-policy.js");
5
7
  const node_path_1 = require("node:path");
6
8
  const index_js_1 = require("../../ownership/index.js");
7
9
  const feature_registry_js_1 = require("../feature-registry.js");
@@ -50,9 +52,9 @@ function createFunctionFilePlan(workspace, slice, name, feature = name) {
50
52
  !infrastructureSource.includes(' ...(role ?? {}),')) {
51
53
  throw new Error('Built-in Function infrastructure is missing its native permission integration point.');
52
54
  }
53
- files[infrastructurePath] = infrastructureSource
55
+ files[infrastructurePath] = (0, observability_infrastructure_js_1.renderExtensionObservability)(infrastructureSource
54
56
  .replace(' role?: { role: string },', ' permissions: any,')
55
- .replace(' ...(role ?? {}),', ' permissions,');
57
+ .replace(' ...(role ?? {}),', ' permissions,'));
56
58
  return {
57
59
  files,
58
60
  paths: [
@@ -78,6 +80,7 @@ async function functionGenerator(tree, options) {
78
80
  const workspace = requireName(typeof packageName === 'string' ? packageName : '', 'Workspace name');
79
81
  const slice = requireName(options.slice, 'Product Slice name');
80
82
  const name = requireName(options.name, 'Function name');
83
+ (0, observability_policy_js_1.requireObservabilityPolicyFromTree)(tree);
81
84
  (0, post_generation_install_js_1.assertPostGenerationInstallWorkspaceAvailable)(tree, `generator:function:${slice}:${name}`);
82
85
  const sliceRoot = node_path_1.posix.join('packages', slice);
83
86
  const handlerPath = node_path_1.posix.join(sliceRoot, 'api', `${name}.ts`);
@@ -0,0 +1,2 @@
1
+ /** Apply the same policy to separately generated Function/Service/Job compositions. */
2
+ export declare function renderExtensionObservability(source: string): string;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renderExtensionObservability = renderExtensionObservability;
4
+ /** Apply the same policy to separately generated Function/Service/Job compositions. */
5
+ function renderExtensionObservability(source) {
6
+ const replace = (from, to) => {
7
+ if (!source.includes(from))
8
+ throw new Error('Generated extension is missing its observability integration point.');
9
+ source = source.split(from).join(to);
10
+ };
11
+ replace("import { createManagedLogGroupContract } from '@empire-builder-kit/nx/foundation';", "import { createManagedLogGroupContract, resolveObservabilityPolicy } from '@empire-builder-kit/nx/foundation';\nimport observabilityPolicy from '../../../../ebk.observability.json';");
12
+ replace(' const contract = createManagedLogGroupContract({', ` const observability = resolveObservabilityPolicy({
13
+ policy: observabilityPolicy,
14
+ stage: $app.stage,
15
+ productionProfile: process.env.EBK_PRODUCTION_FOUNDATION_PROFILE,
16
+ local: $dev,
17
+ });
18
+ const contract = createManagedLogGroupContract({
19
+ retentionInDays: observability.protectedRetentionDays,`);
20
+ // These compositions already own their literal environment maps; preserve
21
+ // all application, container-image and configuration bindings.
22
+ replace('EBK_STAGE: $app.stage', 'EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE: String(observability.routineSuccessSampleRate), EBK_STAGE: $app.stage');
23
+ source = source
24
+ .split("systemLogLevel: 'INFO'")
25
+ .join('systemLogLevel: observability.systemLogLevel');
26
+ source = source
27
+ .split(' logGroup: {')
28
+ .join(' logGroup: {\n retentionInDays: contract.retentionInDays,');
29
+ return source;
30
+ }
31
+ //# sourceMappingURL=observability-infrastructure.js.map
@@ -0,0 +1,4 @@
1
+ import type { Tree } from '@nx/devkit';
2
+ import { type ObservabilityPolicy } from '../foundation/observability.js';
3
+ /** Leaf generators must not invent or repair the adopter's seeded policy. */
4
+ export declare function requireObservabilityPolicyFromTree(tree: Tree): ObservabilityPolicy;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requireObservabilityPolicyFromTree = requireObservabilityPolicyFromTree;
4
+ const observability_js_1 = require("../foundation/observability.js");
5
+ const index_js_1 = require("../repository-policy/index.js");
6
+ const tree_policy_js_1 = require("./repository-policy/tree-policy.js");
7
+ /** Leaf generators must not invent or repair the adopter's seeded policy. */
8
+ function requireObservabilityPolicyFromTree(tree) {
9
+ const source = tree.read(observability_js_1.OBSERVABILITY_POLICY_PATH, 'utf8');
10
+ if (source === null) {
11
+ throw new Error(`[observability] ${observability_js_1.OBSERVABILITY_POLICY_PATH} is required before generation or upgrade. Report and apply the workspace upgrade before continuing; leaf generators do not seed this policy.`);
12
+ }
13
+ let value;
14
+ try {
15
+ value = JSON.parse(source);
16
+ }
17
+ catch {
18
+ throw new Error(`[observability] ${observability_js_1.OBSERVABILITY_POLICY_PATH} must be valid JSON. Reconcile the seeded policy before generation or upgrade.`);
19
+ }
20
+ const repositoryPolicy = (0, tree_policy_js_1.readRepositoryOperatingPolicyFromTree)(tree);
21
+ return (0, observability_js_1.parseObservabilityPolicy)(value, (0, index_js_1.activeDeploymentStages)(repositoryPolicy.deploymentProfile));
22
+ }
23
+ //# sourceMappingURL=observability-policy.js.map
@@ -3,6 +3,40 @@ export interface DependencyOverrides {
3
3
  schemaVersion: 1;
4
4
  overrides: Record<string, string>;
5
5
  }
6
+ /**
7
+ * Reviewed Nx and managed OpenNext overrides seeded into a workspace with no
8
+ * `supply-chain/dependency-overrides.json` yet. Each selector names an exact
9
+ * transitive release with a recorded advisory; each target is clean and older
10
+ * than the generated minimum release age. Each default is keyed to the pin it
11
+ * was reviewed against (`nxVersion`, `openNextVersion`), so a spec fails when
12
+ * that pin moves and the entry must be reviewed again. The OpenNext selector is
13
+ * limited to the minifier parent. An existing seeded file always wins over
14
+ * these defaults.
15
+ *
16
+ * A `name@x.y.z` selector is not limited to the `nx` pin. pnpm rewrites every
17
+ * dependency whose declared range includes x.y.z (in practice a caret or tilde
18
+ * range on the same major), so minimatch's `brace-expansion` range `^5.0.5`
19
+ * also resolves 5.0.12. A declared range that excludes x.y.z keeps its own
20
+ * resolution.
21
+ *
22
+ * A parent selector matches only that exact parent release. `nx` declares its
23
+ * dependencies exactly, but `@opennextjs/aws` declares `@node-minify/core` with
24
+ * a caret, so a later 9.x release that still pins glob 10.3.3 would make the
25
+ * OpenNext entry match nothing without any framework change. The generated
26
+ * workspace's protected scan then denies glob 10.3.3, which is the fail-closed
27
+ * signal to review the entry again.
28
+ */
29
+ export declare const DEFAULT_DEPENDENCY_OVERRIDES: {
30
+ readonly nxVersion: "23.2.1";
31
+ readonly openNextVersion: "4.1.12";
32
+ readonly overrides: {
33
+ readonly '@node-minify/core@9.0.2>glob@10.3.3': "10.5.0";
34
+ readonly 'axios@1.18.1': "1.20.0";
35
+ readonly 'brace-expansion@5.0.9': "5.0.12";
36
+ readonly 'follow-redirects@1.16.0': "1.16.1";
37
+ readonly 'smol-toml@1.6.1': "1.9.0";
38
+ };
39
+ };
6
40
  /** Seeded pins are data, never package-manager hooks or alternate registries. */
7
41
  export declare function parseDependencyOverrides(value: unknown): DependencyOverrides;
8
42
  export declare function renderDependencyOverridesYaml(value: DependencyOverrides): string;
@@ -1,11 +1,45 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEPENDENCY_OVERRIDES_PATH = void 0;
3
+ exports.DEFAULT_DEPENDENCY_OVERRIDES = exports.DEPENDENCY_OVERRIDES_PATH = void 0;
4
4
  exports.parseDependencyOverrides = parseDependencyOverrides;
5
5
  exports.renderDependencyOverridesYaml = renderDependencyOverridesYaml;
6
6
  const semver_1 = require("semver");
7
7
  const deterministic_order_js_1 = require("../../deterministic-order.js");
8
8
  exports.DEPENDENCY_OVERRIDES_PATH = 'supply-chain/dependency-overrides.json';
9
+ /**
10
+ * Reviewed Nx and managed OpenNext overrides seeded into a workspace with no
11
+ * `supply-chain/dependency-overrides.json` yet. Each selector names an exact
12
+ * transitive release with a recorded advisory; each target is clean and older
13
+ * than the generated minimum release age. Each default is keyed to the pin it
14
+ * was reviewed against (`nxVersion`, `openNextVersion`), so a spec fails when
15
+ * that pin moves and the entry must be reviewed again. The OpenNext selector is
16
+ * limited to the minifier parent. An existing seeded file always wins over
17
+ * these defaults.
18
+ *
19
+ * A `name@x.y.z` selector is not limited to the `nx` pin. pnpm rewrites every
20
+ * dependency whose declared range includes x.y.z (in practice a caret or tilde
21
+ * range on the same major), so minimatch's `brace-expansion` range `^5.0.5`
22
+ * also resolves 5.0.12. A declared range that excludes x.y.z keeps its own
23
+ * resolution.
24
+ *
25
+ * A parent selector matches only that exact parent release. `nx` declares its
26
+ * dependencies exactly, but `@opennextjs/aws` declares `@node-minify/core` with
27
+ * a caret, so a later 9.x release that still pins glob 10.3.3 would make the
28
+ * OpenNext entry match nothing without any framework change. The generated
29
+ * workspace's protected scan then denies glob 10.3.3, which is the fail-closed
30
+ * signal to review the entry again.
31
+ */
32
+ exports.DEFAULT_DEPENDENCY_OVERRIDES = {
33
+ nxVersion: '23.2.1',
34
+ openNextVersion: '4.1.12',
35
+ overrides: {
36
+ '@node-minify/core@9.0.2>glob@10.3.3': '10.5.0',
37
+ 'axios@1.18.1': '1.20.0',
38
+ 'brace-expansion@5.0.9': '5.0.12',
39
+ 'follow-redirects@1.16.0': '1.16.1',
40
+ 'smol-toml@1.6.1': '1.9.0',
41
+ },
42
+ };
9
43
  function isSelector(value) {
10
44
  const parts = value.split('>');
11
45
  if (parts.length > 2)
@@ -5,9 +5,9 @@
5
5
  * existing workspace explicitly adopts the exact reviewed descriptor.
6
6
  */
7
7
  export declare const WORKSPACE_SST_VERSION: "4.17.1";
8
- export declare const WORKSPACE_NODE_VERSION: "22.23.1";
8
+ export declare const WORKSPACE_NODE_VERSION: "22.23.4";
9
9
  export declare const WORKSPACE_PNPM_VERSION: "11.20.0";
10
- export declare const WORKSPACE_VITEST_VERSION: "4.1.4";
10
+ export declare const WORKSPACE_VITEST_VERSION: "4.1.12";
11
11
  export declare const WORKSPACE_PNPM_SHA512: "9a6f330a95b66446ea088faf1521405a8a01f07fde7124cc9958dfed52d4bb436737e65b08f85f37b46fcba375092558ac51262b816844b22f63406ed166bfee";
12
12
  export declare const WORKSPACE_PNPM_DESCRIPTOR: "pnpm@11.20.0+sha512.9a6f330a95b66446ea088faf1521405a8a01f07fde7124cc9958dfed52d4bb436737e65b08f85f37b46fcba375092558ac51262b816844b22f63406ed166bfee";
13
13
  /**
@@ -8,9 +8,9 @@ exports.WORKSPACE_SST_NPM_INTEGRITY = exports.WORKSPACE_PNPM_DESCRIPTOR = export
8
8
  * existing workspace explicitly adopts the exact reviewed descriptor.
9
9
  */
10
10
  exports.WORKSPACE_SST_VERSION = '4.17.1';
11
- exports.WORKSPACE_NODE_VERSION = '22.23.1';
11
+ exports.WORKSPACE_NODE_VERSION = '22.23.4';
12
12
  exports.WORKSPACE_PNPM_VERSION = '11.20.0';
13
- exports.WORKSPACE_VITEST_VERSION = '4.1.4';
13
+ exports.WORKSPACE_VITEST_VERSION = '4.1.12';
14
14
  exports.WORKSPACE_PNPM_SHA512 = '9a6f330a95b66446ea088faf1521405a8a01f07fde7124cc9958dfed52d4bb436737e65b08f85f37b46fcba375092558ac51262b816844b22f63406ed166bfee';
15
15
  exports.WORKSPACE_PNPM_DESCRIPTOR = `pnpm@${exports.WORKSPACE_PNPM_VERSION}+sha512.${exports.WORKSPACE_PNPM_SHA512}`;
16
16
  /**
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ADOPTER_SKILL_NAMES = void 0;
4
4
  exports.renderAdopterSkillIndex = renderAdopterSkillIndex;
5
5
  exports.renderAdopterSkills = renderAdopterSkills;
6
+ const workspace_files_agent_development_js_1 = require("./workspace-files-agent-development.js");
6
7
  exports.ADOPTER_SKILL_NAMES = [
7
8
  'ebk-orient-plan',
8
9
  'ebk-build-feature',
@@ -107,6 +108,21 @@ intents commit atomically. TTL is eventual cleanup, not an authorization or
107
108
  expiry decision. Events use the same stage/task; never bridge task async work
108
109
  to deployed development.
109
110
 
111
+ For a cross-Slice event, the producer declares it in its seeded
112
+ \`contracts/events.ts\` \`EventContractSchema\`; its own queue rule then also
113
+ receives it, so its seeded consumer acknowledges it. The consumer adds the
114
+ producer's \`@<scope>/<producer>/contracts\` package to its seeded
115
+ \`contracts/dependencies.json\` \`consumes\` with a \`workspace:*\` dependency,
116
+ runs \`pnpm nx run <consumer>:contract-dependencies-sync\`, declares
117
+ \`{ "source": "<producer>", "events": [{ "detailType": "<Type>", "schemaVersions": [1] }] }\`
118
+ in its seeded \`contracts/event-subscriptions.json\`, and extends its seeded
119
+ \`api/event-consumer.ts\` to accept that source, type and every declared
120
+ version. Managed infrastructure adds one rule per source; never edit
121
+ \`infra/product.ts\`. \`contract-dependencies-check\` binds the declaration to
122
+ the producer's schema. Source and detail type are delivery filters, not
123
+ authentication: authorize every effect from the consumer's own data and
124
+ policy. Never carry product data in \`DataLifecycleChanged\`.
125
+
110
126
  Add SQL only when relational constraints, transactions or joins justify it:
111
127
  \`pnpm nx g @empire-builder-kit/nx:sql billing --reason="Ledger requires relational constraints and reporting joins"\`
112
128
  reports the paired changes; review and repeat with \`--apply\`. The generator
@@ -125,18 +141,12 @@ not done merely because its generated file exists or the page loads.
125
141
  body: `# Develop and verify
126
142
 
127
143
  Inspect \`ebk dev doctor\` and \`ebk dev status\` using the account and Region
128
- fixed by committed repository policy and the profile saved by
129
- \`ebk dev configure\`. If doctor reports an expired or missing SSO session, run
130
- \`aws sso login --profile <profile>\`; the human approves the request in the
131
- browser, so the session stays the human's own identity. In a hosted or
132
- headless shell, add \`--use-device-code\` and the human approves the printed
133
- code from their own browser. Confirm \`aws sts get-caller-identity\` reports
134
- that identity, then continue. Never embed access keys, export, copy, or read
135
- credentials from the SSO cache, or assume a separate or stronger principal.
136
- Only an attended agent (local or hosted), one a human is actively directing,
137
- uses that session; an unattended or background agent never receives a human
138
- profile or SSO session. Resolve other readiness failures using the reported
139
- prerequisite; a doctor pass is not feature proof.
144
+ fixed by committed repository policy and the development profile saved by
145
+ \`ebk dev configure\`.
146
+
147
+ ${workspace_files_agent_development_js_1.AGENT_DEVELOPMENT_AUTHORITY}
148
+ Resolve other readiness failures using the reported prerequisite; a doctor pass
149
+ is not feature proof.
140
150
  Development accepts dirty source and does not require a production
141
151
  confirmation, release artifact or full workspace barrier.
142
152
 
@@ -178,7 +188,7 @@ browser check. Prefer \`ebk dev restart\` while iterating and reserve
178
188
  \`ebk dev down\` for the completion boundary.
179
189
 
180
190
  At the completion boundary, settle \`ebk dev down billing\`, then use
181
- \`ebk deploy development billing --profile=<approved-profile> --expectedRoleArn=<exact-role>\`.
191
+ \`ebk deploy development billing --profile=<development-profile> --expectedRoleArn=<exact-role>\`.
182
192
  This selects Foundation then Billing. Omit Slice selectors for complete-stage
183
193
  proof. Verify the deployed Router without hot processes or fallback serving it.
184
194
  Check migration, smoke and cleanup outcomes; failure is not acceptance.
@@ -199,11 +209,12 @@ mutation; source policy is authoritative if deliberately changed later.
199
209
 
200
210
  Use \`ebk deploy development\` for the complete active development stage, or
201
211
  \`ebk deploy development billing\` for Foundation plus one selected Slice.
202
- Pass the human's Identity Center \`--profile\` (typically the one saved by
203
- \`ebk dev configure\`) and the exact stage deployment role from
212
+ Pass the development profile saved by \`ebk dev configure\` as \`--profile\`;
213
+ it chains the human's Identity Center source profile into the exact development
214
+ deployment role. Pass that role from
204
215
  \`docs/stage-deployment-authority.md\` as \`--expectedRoleArn\`; verify
205
- account, Region, stage and current caller. Refresh an expired development
206
- session as in the develop/verify skill. No direct SST or AWS application
216
+ account, Region, stage and current caller. Refresh an expired source session
217
+ as in the develop/verify skill. No direct SST or AWS application
207
218
  mutation. A development deploy runs to completion with no prompt; add
208
219
  \`--json\` for one bounded result on stdout after the run (the receipt this run
209
220
  wrote and each project's outcome). Staging and production refuse \`--json\`.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * One canonical statement of what a coding agent may do in the development
3
+ * stage. The seeded README and Foundation runbook and the managed
4
+ * develop/verify skill interpolate it verbatim so the three copies cannot
5
+ * drift. Any agent, attended or unattended, may use the human's approved
6
+ * development profile for development-stage work; the protected stages,
7
+ * credential handling and denial handling stay fixed.
8
+ */
9
+ export declare const AGENT_DEVELOPMENT_AUTHORITY = "Any coding agent, attended or unattended, may run `ebk dev up`, `restart`,\n`down`, and `ebk deploy development` through EBK/Nx with the human's approved\ndevelopment profile, within the approved task, account, Region, ownership,\ncost, and cleanup limits, without repeated confirmation. The source profile is\nthe human's IAM Identity Center login profile. The development profile is the\none `ebk dev configure` saves and `--profile` receives; it chains the source\nprofile into the exact bounded development deployment role named in\n`docs/stage-deployment-authority.md`. That role assumption is expected; it\ndoes not authorize another role or broader access. An agent on another host\nreceives no copy of either profile or of the SSO cache.\nIf the source session is expired or missing, run\n`aws sso login --profile <source-profile>`, adding `--use-device-code` in a\nheadless shell. The login needs the human's browser approval, so an agent whose\nsource session has expired with no human available stops and reports.\nBefore mutation, run `aws sts get-caller-identity --profile <development-profile>`.\n`Account` must equal the committed development account, `Arn` must be\n`arn:<partition>:sts::<account>:assumed-role/ebk-development-deploy/<session>`,\nan assumed-role session of that exact role, and the Region saved by\n`ebk dev configure` must equal the committed Region. `ebk dev up` checks only\nthe account and Region; `ebk deploy development` also enforces the role.\nNever embed keys, export or copy credentials, read the SSO cache, or broaden\ntrust or policies. A protected observer profile, meaning a read-only staging or\nproduction profile the human may hold for inspection, is never a role source,\nand neither is any other staging or production profile.\nStaging and production stay GitHub-only or human-only, and agents and CI never\nrun `ebk secret set`. A new binding or authority expansion stops for a human\ndecision. A denial from the agent host, EBK, or AWS stops that mutation and\nevery equivalent route: report the exact denial and command, and do not\nre-route through Nx, SST, raw AWS, another profile, or another role. A\nhuman-started Fleet is the fallback.";
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AGENT_DEVELOPMENT_AUTHORITY = void 0;
4
+ /**
5
+ * One canonical statement of what a coding agent may do in the development
6
+ * stage. The seeded README and Foundation runbook and the managed
7
+ * develop/verify skill interpolate it verbatim so the three copies cannot
8
+ * drift. Any agent, attended or unattended, may use the human's approved
9
+ * development profile for development-stage work; the protected stages,
10
+ * credential handling and denial handling stay fixed.
11
+ */
12
+ exports.AGENT_DEVELOPMENT_AUTHORITY = `Any coding agent, attended or unattended, may run \`ebk dev up\`, \`restart\`,
13
+ \`down\`, and \`ebk deploy development\` through EBK/Nx with the human's approved
14
+ development profile, within the approved task, account, Region, ownership,
15
+ cost, and cleanup limits, without repeated confirmation. The source profile is
16
+ the human's IAM Identity Center login profile. The development profile is the
17
+ one \`ebk dev configure\` saves and \`--profile\` receives; it chains the source
18
+ profile into the exact bounded development deployment role named in
19
+ \`docs/stage-deployment-authority.md\`. That role assumption is expected; it
20
+ does not authorize another role or broader access. An agent on another host
21
+ receives no copy of either profile or of the SSO cache.
22
+ If the source session is expired or missing, run
23
+ \`aws sso login --profile <source-profile>\`, adding \`--use-device-code\` in a
24
+ headless shell. The login needs the human's browser approval, so an agent whose
25
+ source session has expired with no human available stops and reports.
26
+ Before mutation, run \`aws sts get-caller-identity --profile <development-profile>\`.
27
+ \`Account\` must equal the committed development account, \`Arn\` must be
28
+ \`arn:<partition>:sts::<account>:assumed-role/ebk-development-deploy/<session>\`,
29
+ an assumed-role session of that exact role, and the Region saved by
30
+ \`ebk dev configure\` must equal the committed Region. \`ebk dev up\` checks only
31
+ the account and Region; \`ebk deploy development\` also enforces the role.
32
+ Never embed keys, export or copy credentials, read the SSO cache, or broaden
33
+ trust or policies. A protected observer profile, meaning a read-only staging or
34
+ production profile the human may hold for inspection, is never a role source,
35
+ and neither is any other staging or production profile.
36
+ Staging and production stay GitHub-only or human-only, and agents and CI never
37
+ run \`ebk secret set\`. A new binding or authority expansion stops for a human
38
+ decision. A denial from the agent host, EBK, or AWS stops that mutation and
39
+ every equivalent route: report the exact denial and command, and do not
40
+ re-route through Nx, SST, raw AWS, another profile, or another role. A
41
+ human-started Fleet is the fallback.`;
42
+ //# sourceMappingURL=workspace-files-agent-development.js.map