@empire-builder-kit/nx 1.0.0-rc.40 → 1.0.0-rc.42

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 (58) hide show
  1. package/README.md +26 -10
  2. package/package.json +3 -3
  3. package/src/blueprints/external-sandbox.d.ts +1 -1
  4. package/src/cli/deploy-runtime.d.ts +25 -1
  5. package/src/cli/deploy-runtime.js +120 -4
  6. package/src/cli/dev-command.d.ts +2 -0
  7. package/src/cli/dev-command.js +8 -0
  8. package/src/cli/main.js +20 -6
  9. package/src/cli/personal-secret-runtime.d.ts +12 -0
  10. package/src/cli/personal-secret-runtime.js +18 -3
  11. package/src/cli/secret-terminal.js +1 -1
  12. package/src/container-images.d.ts +1 -1
  13. package/src/container-images.js +1 -1
  14. package/src/developer-agent/operation-registry.d.ts +10 -0
  15. package/src/developer-agent/operation-registry.js +60 -13
  16. package/src/developer-agent/planning.d.ts +8 -1
  17. package/src/developer-agent/planning.js +23 -3
  18. package/src/executors/local-deploy/local-approval.js +1 -1
  19. package/src/executors/sst-lifecycle/governed-native-operation.js +3 -2
  20. package/src/executors/sst-lifecycle/run-sst-command.d.ts +6 -0
  21. package/src/executors/sst-lifecycle/run-sst-command.js +3 -33
  22. package/src/foundation/cost-estimate.d.ts +170 -0
  23. package/src/foundation/cost-estimate.js +683 -0
  24. package/src/generators/preset/tool-versions.d.ts +0 -2
  25. package/src/generators/preset/tool-versions.js +1 -3
  26. package/src/generators/preset/workspace-files-adopter-skills.js +39 -18
  27. package/src/generators/preset/workspace-files-developer-agent.js +83 -27
  28. package/src/generators/preset/workspace-files-shared-operation-claims.d.ts +10 -0
  29. package/src/generators/preset/workspace-files-shared-operation-claims.js +59 -0
  30. package/src/generators/preset/workspace-files-stage-authority.js +13 -2
  31. package/src/generators/preset/workspace-files-thin-deploy.d.ts +10 -0
  32. package/src/generators/preset/workspace-files-thin-deploy.js +54 -20
  33. package/src/generators/preset/workspace-files-thin-docs.js +32 -14
  34. package/src/generators/preset/workspace-files.js +28 -8
  35. package/src/generators/slice/built-in-plan-api-contract-files.js +7 -4
  36. package/src/generators/slice/built-in-plan-authorization-files.js +10 -5
  37. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +933 -249
  38. package/src/generators/slice/built-in-plan-data-files.js +17 -8
  39. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +5 -1
  40. package/src/generators/slice/built-in-plan-frontend-files.js +7 -0
  41. package/src/generators/slice/built-in-plan-infrastructure-files.js +0 -1
  42. package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +8 -3
  43. package/src/generators/slice/built-in-plan-metadata-files.js +2 -1
  44. package/src/generators/slice/built-in-plan-reliability-files.js +4 -1
  45. package/src/generators/slice/built-in-plan-shared.d.ts +2 -2
  46. package/src/generators/slice/built-in-plan-shared.js +2 -2
  47. package/src/generators/slice/built-in-plan-testing-persistence-event-files.d.ts +7 -0
  48. package/src/generators/slice/built-in-plan-testing-persistence-event-files.js +487 -0
  49. package/src/generators/slice/built-in-plan-testing-persistence-files.js +2 -0
  50. package/src/generators/slice/built-in-plan.js +3 -1
  51. package/src/generators/workload/frozen-container.d.ts +1 -1
  52. package/src/git-policy/github-bootstrap.d.ts +9 -0
  53. package/src/git-policy/github-bootstrap.js +16 -2
  54. package/src/local-dev/fleet-inventory.js +18 -10
  55. package/src/local-dev/fleet-launcher.js +2 -2
  56. package/src/secrets/personal-command.d.ts +18 -2
  57. package/src/secrets/personal-command.js +66 -12
  58. package/src/secrets/verification.js +6 -1
@@ -11,12 +11,14 @@ const dependency_overrides_js_1 = require("./dependency-overrides.js");
11
11
  const index_js_1 = require("../../ownership/index.js");
12
12
  const index_js_2 = require("../../frontend-security/index.js");
13
13
  const capability_plan_js_1 = require("../../foundation/capability-plan.js");
14
+ const cost_estimate_js_1 = require("../../foundation/cost-estimate.js");
14
15
  const index_js_3 = require("../../git-policy/index.js");
15
16
  const index_js_4 = require("../../repository-policy/index.js");
16
17
  const index_js_5 = require("../../release/index.js");
17
18
  const index_js_6 = require("../../supply-chain/index.js");
18
19
  const deterministic_order_js_1 = require("../../deterministic-order.js");
19
20
  const tool_versions_js_1 = require("./tool-versions.js");
21
+ const workspace_files_shared_operation_claims_js_1 = require("./workspace-files-shared-operation-claims.js");
20
22
  const workspace_files_developer_agent_js_1 = require("./workspace-files-developer-agent.js");
21
23
  const workspace_files_ci_acceptance_js_1 = require("./workspace-files-ci-acceptance.js");
22
24
  const workspace_files_ci_install_js_1 = require("./workspace-files-ci-install.js");
@@ -1069,6 +1071,7 @@ const WORKSPACE_SEEDED_PATHS = new Set([
1069
1071
  'docs/stage-deployment-authority.md',
1070
1072
  'docs/workspace-deployment-ownership.md',
1071
1073
  'docs/work-markers.md',
1074
+ workspace_files_shared_operation_claims_js_1.SHARED_OPERATION_CLAIMS_PATH,
1072
1075
  'ebk.repository-policy.json',
1073
1076
  ]);
1074
1077
  exports.WORKSPACE_PACKAGE_MANAGED_JSON_POINTERS = [
@@ -7459,7 +7462,7 @@ jobs:
7459
7462
  fi
7460
7463
  sleep 5
7461
7464
  done
7462
- echo 'No pull-request verification run materialized. Close and reopen the sync pull request as a human, then approve its workflows.'
7465
+ echo "No pull-request verification run materialized; events created with GITHUB_TOKEN may not start workflows. Close and reopen sync pull request #$number with a user credential (a write-access user, or an agent in that user's own gh session: gh pr close $number && gh pr reopen $number), then approve its workflows if GitHub marks them approval-required."
7463
7466
  exit 1
7464
7467
  `,
7465
7468
  'tools/ebk-infrastructure-plan-summary.mjs': `import {
@@ -7706,10 +7709,9 @@ At a local milestone, \`pnpm verify\` checks current source through
7706
7709
  protected Blueprint acceptance. The separate \`${name}:verify\` target and
7707
7710
  protected GitHub workflows retain their committed-history and trust gates.
7708
7711
 
7709
- Human-supplied secret values are a human-only TTY ceremony. Agents and CI must
7710
- never invoke \`ebk secret set\` or \`ebk secret remove\`. They may use
7711
- value-blind metadata, status, verification, and the exact generated-secret
7712
- initializer, which accepts and returns no plaintext value.
7712
+ Human-supplied secret values are entered only by a human. The Developer-Agent workflow
7713
+ below describes the hand-off for \`ebk secret set\` and \`ebk secret remove\` and the
7714
+ value-blind paths agents and CI use.
7713
7715
 
7714
7716
  ## Work markers
7715
7717
 
@@ -7853,7 +7855,21 @@ deployment by themselves. Open \`SECURITY\` and \`BLOCKER\` markers fail staging
7853
7855
  deploy or refresh before AWS access. Protected remove and unlock remain usable for recovery.
7854
7856
  There is no local or silent bypass in this prerelease contract; any future waiver mechanism
7855
7857
  must be committed, reviewable, and auditable.
7858
+
7859
+ ## Shared-operation claims
7860
+
7861
+ \`${workspace_files_shared_operation_claims_js_1.SHARED_OPERATION_CLAIMS_PATH}\` is a seeded claim ledger for operations that only one
7862
+ actor at a time may run: gateway setup, package release, candidate adoption, database
7863
+ replacement, and development deployment. Before starting one, an agent or human reads the
7864
+ current ledger where the other actors record claims; if another open claim names the same
7865
+ operation, it stops and reports the conflict instead of running the operation. Otherwise it
7866
+ records one \`EBK-TODO\` claim with the reference
7867
+ \`PLAN:${workspace_files_shared_operation_claims_js_1.SHARED_OPERATION_CLAIM_PHASE}/<operation>\`, commits it where the others read the
7868
+ ledger, and deletes the claim when the operation and its verification are complete. The
7869
+ work-markers target above lists open claims. Nothing enforces a claim; the ledger is a
7870
+ convention, current only as far as the copy each actor reads.
7856
7871
  `,
7872
+ [workspace_files_shared_operation_claims_js_1.SHARED_OPERATION_CLAIMS_PATH]: (0, workspace_files_shared_operation_claims_js_1.renderSharedOperationClaims)(name),
7857
7873
  'ebk.repository-policy.json': json(initialRepositoryPolicy),
7858
7874
  'nx.json': json({
7859
7875
  $schema: './node_modules/nx/schemas/nx-schema.json',
@@ -8126,8 +8142,8 @@ The machine-readable stage inventory is \`../contracts/costs.json\`; keep this
8126
8142
  seeded decision record aligned with organization-specific budgets and alerts.
8127
8143
 
8128
8144
  - When network/SQL is declared, development uses EC2 NAT, a development bastion,
8129
- and Aurora scale-to-zero.
8130
- ${deploymentProfile === 'starter' ? '' : '- Declared staging network/SQL uses EC2 NAT and Aurora scale-to-zero by default.\n'}- Declared production networking uses managed NAT; production retains protected data. Its explicit Repository
8145
+ and Aurora scale-to-zero (${(0, cost_estimate_js_1.nonproductionAuroraScalingLabel)('development')}).
8146
+ ${deploymentProfile === 'starter' ? '' : `- Declared staging network/SQL uses EC2 NAT and Aurora scale-to-zero (${(0, cost_estimate_js_1.nonproductionAuroraScalingLabel)('staging')}) by default.\n`}- Declared production networking uses managed NAT; production retains protected data. Its explicit Repository
8131
8147
  Operating Policy profile selects cost-optimized (0–2 ACUs, pause after five idle
8132
8148
  minutes), balanced (0.5–4 ACUs, always warm), or standard (2–16 ACUs, always warm).
8133
8149
  Newly generated repositories default to cost-optimized in every deployment profile.
@@ -8139,10 +8155,14 @@ ${deploymentProfile === 'starter' ? '' : '- Declared staging network/SQL uses EC
8139
8155
  upgrade, then opt into cost-optimized separately if cold starts are acceptable.
8140
8156
  - ECS, EventBridge, Cognito, SNS, SSM, and CloudWatch are primarily usage-priced; logs,
8141
8157
  metrics, alarms, and retained data still require active cost review.
8158
+ - Every deployed stage of every Standard Slice, including each personal development
8159
+ stage, adds its own fixed floor: a KMS key, secrets, a machine-to-machine app client,
8160
+ CloudWatch alarms and a dashboard. The estimate below lists it.
8142
8161
 
8143
8162
  Run \`foundation:remove\` only for disposable stages. Production is retained and protected by
8144
8163
  the SST configuration.
8145
- `,
8164
+
8165
+ ${(0, cost_estimate_js_1.renderFoundationCostEstimate)({ deploymentProfile, headingLevel: 2 })}`,
8146
8166
  'packages/foundation/docs/security.md': `# Foundation security contract
8147
8167
 
8148
8168
  - Production resources are retained and protected.
@@ -2017,10 +2017,13 @@ An intentional baseline update requires a reviewed JSON approval:
2017
2017
  pnpm nx run ${name}:api-contract-baseline -- --approval=path/to/approval.json
2018
2018
  \`\`\`
2019
2019
 
2020
- Compatible approvals pin the exact candidate digest and reason. Conditional
2021
- approvals also require semantic-review evidence. Breaking approvals require
2022
- consumer evidence, rollout evidence, and an exact rollout-plan identity and
2023
- digest. Baseline updates never occur during generation or verification.
2020
+ An agent may author the approval file. Compatible approvals pin the exact
2021
+ candidate digest and reason, and the agent may apply them directly during
2022
+ development. Conditional approvals also require semantic-review evidence, and
2023
+ breaking approvals require consumer evidence, rollout evidence, and an exact
2024
+ rollout-plan identity and digest; a human reviews those two classes before the
2025
+ baseline command runs. Baseline updates never occur during generation or
2026
+ verification.
2024
2027
 
2025
2028
  Other Slices may import only \`@<workspace>/${name}/api-contract\`,
2026
2029
  \`@<workspace>/${name}/api-client\`, or the transport-neutral
@@ -1189,18 +1189,23 @@ async function exchange(input: {
1189
1189
  token_type?: unknown;
1190
1190
  };
1191
1191
  const expiresIn = Number(value.expires_in);
1192
- const scopes =
1193
- typeof value.scope === 'string'
1194
- ? value.scope.split(/\\s+/).filter(Boolean)
1195
- : [];
1196
1192
  if (
1197
1193
  typeof value.access_token !== 'string' ||
1198
1194
  value.token_type !== 'Bearer' ||
1199
1195
  !Number.isFinite(expiresIn) ||
1200
- expiresIn < 1
1196
+ expiresIn < 1 ||
1197
+ (value.scope !== undefined && typeof value.scope !== 'string')
1201
1198
  ) {
1202
1199
  throw new Error('Machine token exchange returned an invalid response.');
1203
1200
  }
1201
+ // RFC 6749 section 5.1: an omitted scope is identical to the requested
1202
+ // scope. Amazon Cognito omits it from client_credentials responses and
1203
+ // rejects, never narrows, a scope the client may not use. A returned scope
1204
+ // is still parsed, and createMachineTokenProvider requires the exact set.
1205
+ const scopes =
1206
+ value.scope === undefined
1207
+ ? [...input.scopes]
1208
+ : value.scope.split(/\\s+/).filter(Boolean);
1204
1209
  return {
1205
1210
  accessToken: value.access_token,
1206
1211
  audience: input.audience,