Commit bed1de0
authored
feat: compile-time feature flag for preview/GA consolidation (#1341)
* feat: implement compile-time feature flag for preview/GA branch consolidation
Replace the dual-branch (main/preview) workflow with a single branch using
a compile-time __PREVIEW__ constant. esbuild's define block replaces the
constant at build time, enabling dead code elimination for GA builds while
keeping all harness/preview code in the same source tree.
Key changes:
- Add src/cli/feature-flags.ts with isPreviewEnabled() wrapper
- Configure esbuild define block and vitest define for __PREVIEW__
- Gate harness commands (add tool, remove tool/harness) behind isPreviewEnabled()
- Gate harness UI screens and create flow behind the flag
- Add globalThis shim in index.ts for tsx dev mode
- Update bundle.mjs to produce dual tarballs (GA + preview)
- Support ESBUILD_OUTFILE env var for isolated test builds
- Port all harness-related source files from preview branch
- Add preview-flag.test.ts verifying dead code elimination
* fix: remove unnecessary quotes around __PREVIEW__ key in esbuild config
Prettier requires unquoted object keys when valid identifiers.
* fix: skip harness integration and e2e tests in GA builds
Harness features are gated behind BUILD_PREVIEW=1 and eliminated from
GA bundles. Integration and e2e tests that exercise harness commands
must skip when running against the default (GA) build.
* fix: gate harness options in invoke/create commands and fix remove memory cleanup
- Wrap harness-related CLI options in invoke command behind isPreviewEnabled()
so they don't leak into GA build's --help output
- Wrap harness-related CLI options in create command behind isPreviewEnabled()
- Fix remove harness leaving orphaned memory entries in agentcore.json
- Fix deploy preflight rejecting harness-only projects
- Add integration test for harness re-add after removal
* fix: auto-deploy harness in TUI dev mode before invoking
The TUI path for `agentcore dev` skipped deployment, going straight to
the invoke screen. This caused "No deployed targets found" errors for
users who hadn't manually run `agentcore deploy`. Now uses the existing
useDevDeploy hook to deploy before transitioning to harness invoke mode.
* fix: use queueMicrotask for deploy-to-harness transition in TUI dev
The derived effectiveMode approach didn't trigger re-renders, leaving the
deploy screen stuck after completion. Switch to queueMicrotask + setMode
(matching the preview branch pattern) so the transition fires correctly.
Also handles browser mode by calling onLaunchBrowser after deploy.
* fix: match preview branch deploy UI and persist deployHash
- Deploy screen in TUI dev mode now matches preview branch: shows
"Deploying project resources..." with DeployStatus CFN messages,
filters redundant step, yellow error text, and log path link.
- Persist deployHash in deployed-state.json after successful deploys
so canSkipDeploy can detect unchanged projects and skip re-deploy.
* fix: align harness UX with preview branch
- InvokeScreen: Ctrl+N for new session (was bare N), hint messages
rendered in gray, context-sensitive "Loading..."/"Thinking..." label,
directional scroll arrows instead of numeric range
- DevScreen: disable keyboard input while exiting (!isExiting guard)
- deploy/actions: imperative harness teardown before stack destroy
(gated behind isPreviewEnabled) so harnesses aren't orphaned
- browser-mode: resolve harness traces via resolveAgentOrHarness
instead of ignoring harnessName parameter
- resolve-agent: add resolveHarness and resolveAgentOrHarness helpers
* fix: hint message render order and harness/runtime disambiguation
- isHint check now comes after isExec (matching preview branch) so
exec messages always render as magenta, not gray
- When a project has both runtimes and harnesses and no flag is given,
show a clear error listing both --runtime and --harness options
* fix: route harness invocations and show deploy box in dev mode
The browser in `agentcore dev` could not invoke harnesses because the
/invocations POST handler never checked for harnessName in the request
body. Add early routing to handleHarnessInvocation when present.
The deploy progress box was missing because useDevDeploy did not pass
verbose: true or onResourceEvent to handleDeploy, so the switchableIoHost
was never created and CloudFormation messages never reached the TUI.
Constraint: handleHarnessInvocation handler already existed but was unreachable
Rejected: Adding a separate /harness-invocations endpoint | breaks frontend contract
Confidence: high
Scope-risk: narrow
* fix: serve harness info in status API and fix deploy message flow
The browser frontend could not discover harnesses because /api/status
did not include harness data or selectedHarness in its response.
The deploy box was still not showing because switchableIoHost was only
created with verbose:true, but preview also creates it when
onDeployMessage is provided. Also wire onDeployMessage into the
setOnMessage callback so both callbacks receive deploy events.
Constraint: frontend polls /api/status to discover available targets
Rejected: Separate /api/harnesses endpoint | adds complexity for no benefit
Confidence: high
Scope-risk: narrow
* fix: include harnesses in /api/resources response for browser UI
The frontend Agent Inspector crashes with "Cannot read properties of
undefined (reading 'find')" when switching to a harness because the
/api/resources endpoint was missing the harnesses array entirely.
Constraint: Frontend expects harnesses array with deploymentStatus and deployed fields
Confidence: high
Scope-risk: narrow
* test: add unit tests for harness invocation and status handlers
Covers validation, routing, SSE streaming, error handling, and
the harness fields added to /api/status response.
Confidence: high
Scope-risk: narrow
* test: add unit tests for resolve-agent, change-detection, and harness-mapper
Cover the untested middle-layer logic that routes invocations, decides
whether deploys can be skipped, and maps harness specs to API payloads.
Confidence: high
Scope-risk: narrow
* fix: adjust preview-flag DCE test for keepNames compatibility
The keepNames:true esbuild option (added for better error stacks)
preserves class/function name strings even in dead code paths.
Adjust assertions to check for harness-only module markers that
are fully tree-shaken, rather than name strings that survive.
Confidence: high
Scope-risk: narrow
* fix: pass structured DeployMessage through to TUI instead of plain strings
The dev deploy hook was re-wrapping string messages into DeployMessage
objects with hardcoded values. Now the real message (with actual level,
code, timestamp) flows through directly from CDK.
* fix(harness): populate retrievalConfig from memory strategy namespaces
Includes EPISODIC reflectionNamespaces in the retrieval config so the
harness runtime searches all relevant memory namespaces at inference time.
Also incorporates memorySpec into the deploy hash so namespace changes
trigger a harness update.
Cherry-picked from #1374.
* fix: rewrite dev command to resolve merge conflict with telemetry refactor
The merge conflict resolution left duplicated code blocks and mismatched
braces. Rebuilt from main's withCommandRunTelemetry+recorder pattern and
re-applied preview feature flag gates (harness support, skip-deploy,
TUI picker).
* fix: address PR review feedback from jariy17
- Remove unnecessary `as unknown as` cast in agentcore-control.ts (SDK
already has IndexedKey type)
- Optimize preview build to only re-run esbuild (not full tsc + assets)
- Delete dead code: poll.ts and its test (nothing imports it)
- Error when harness enters FAILED state after create/update instead of
silently returning success
- Add unit tests for harness-deployer (create, update, skip, teardown,
FAILED status, role resolution, retry, polling)
* fix: update release workflows for single-branch preview model
- release.yml: set BUILD_PREVIEW=1 for preview builds
- release-main-and-preview.yml: rewrite as single-PR flow using
preview-version.json for the preview version track (no separate
preview branch needed)
- Remove sync-preview.yml (no preview branch to sync)
- Update preview-version.json to match current npm state (1.0.0-preview.9)
Constraint: preview and GA are both built from main, differentiated by BUILD_PREVIEW env var at esbuild time
Confidence: high
Scope-risk: narrow
* feat: add release_target input to select main, preview, or both
Allows running the release workflow for just main-only, preview-only,
or both together. Jobs are conditionally skipped based on the selection.
Confidence: high
Scope-risk: narrow
* fix: use github.ref_name for release branch selection
Allows triggering the release workflow from any branch via the GitHub
UI branch selector, instead of hardcoding main.
Confidence: high
Scope-risk: narrow
* chore: remove unused BUILD_PREVIEW env from release.yml
Preview releases are handled by release-main-and-preview.yml.
Confidence: high
Scope-risk: narrow1 parent 69b4ce6 commit bed1de0
122 files changed
Lines changed: 11983 additions & 712 deletions
File tree
- .github/workflows
- e2e-tests
- integ-tests
- scripts
- src
- assets
- __tests__/__snapshots__
- cdk
- bin
- lib
- harness
- cli
- __tests__
- aws
- __tests__
- cloudformation
- commands
- add
- create
- deploy
- dev
- invoke
- logs/__tests__
- remove
- external-requirements/__tests__
- logging
- operations
- __tests__
- agent/generate
- deploy
- __tests__
- imperative
- deployers
- __tests__
- dev
- __tests__
- web-ui
- __tests__
- handlers
- fetch-access
- primitives
- __tests__
- telemetry/schemas
- tui
- components
- hooks
- __tests__
- screens
- add
- create
- dev
- harness
- invoke
- remove
- __tests__
- lib
- schemas/io
- schema/schemas
- __tests__
- primitives
- __tests__
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Large diffs are not rendered by default.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments