Skip to content

Commit 025dce8

Browse files
committed
refactor: flatten package directory names
1 parent 9ab1116 commit 025dce8

274 files changed

Lines changed: 520 additions & 381 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agent/contracts/compatibility-governance.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ Unexpected issues, workarounds, and integration friction encountered during secu
6767
- **THEN** its log entry MUST be updated to indicate resolution and summarize the fix
6868

6969
### Requirement: Run Bridge Type Conformance Tests After Bridge Changes
70-
Any change to files under `packages/secure-exec-nodejs/src/bridge` MUST run bridge type conformance checks via `pnpm run check-types:test` in `packages/secure-exec` before completion.
70+
Any change to files under `packages/nodejs/src/bridge` MUST run bridge type conformance checks via `pnpm run check-types:test` in `packages/secure-exec` before completion.
7171

7272
#### Scenario: Bridge source file is modified
73-
- **WHEN** a commit modifies one or more files in `packages/secure-exec-nodejs/src/bridge`
73+
- **WHEN** a commit modifies one or more files in `packages/nodejs/src/bridge`
7474
- **THEN** `pnpm run check-types:test` MUST be executed and failures MUST be addressed before the change is considered complete
7575

7676
### Requirement: Compatibility Project Matrix Uses Black-Box Node Fixtures
@@ -221,15 +221,15 @@ Changes to runtime or bridge filesystem metadata/rename behavior SHALL update co
221221
- **THEN** the compatibility project-matrix MUST include fixture coverage that exercises the changed behavior under host Node and secure-exec comparison
222222

223223
### Requirement: Governance References Use Canonical Secure-Exec Package Family Naming
224-
Governance artifacts that reference runtime package imports SHALL use the `@secure-exec/*` scoped package names (`@secure-exec/core`, `@secure-exec/nodejs`, `@secure-exec/browser`, `@secure-exec/python`) or the `secure-exec` barrel. Source paths SHALL use the corresponding workspace directories (`packages/secure-exec-core`, `packages/secure-exec-nodejs`, `packages/secure-exec-browser`, `packages/secure-exec-python`, `packages/secure-exec`).
224+
Governance artifacts that reference runtime package imports SHALL use the `@secure-exec/*` scoped package names (`@secure-exec/core`, `@secure-exec/nodejs`, `@secure-exec/browser`, `@secure-exec/python`) or the `secure-exec` barrel. Source paths SHALL use the corresponding workspace directories (`packages/core`, `packages/nodejs`, `packages/browser`, `packages/python`, `packages/secure-exec`).
225225

226226
#### Scenario: Governance guidance references runtime package imports
227227
- **WHEN** a governance document or spec requirement describes runtime package imports
228228
- **THEN** it MUST use the appropriate `@secure-exec/*` scoped package name or the `secure-exec` barrel
229229

230230
#### Scenario: Governance guidance references runtime source paths
231231
- **WHEN** a governance document or spec requirement describes runtime source directories
232-
- **THEN** it MUST use the appropriate `packages/secure-exec-*` workspace path for the component being referenced
232+
- **THEN** it MUST use the appropriate `packages/*` workspace path for the component being referenced
233233

234234
### Requirement: Module-Access Boundary Changes MUST Update Security and Friction Documentation
235235
Any change that introduces or modifies driver-managed host module projection or overlay boundaries MUST update compatibility/friction and security-model documentation in the same change.
@@ -261,7 +261,7 @@ Any change that introduces or modifies runtime log-capture defaults or hook-base
261261
Any change that modifies runtime-driver behavior or runtime orchestration contracts MUST run shared integration suites against both node and browser runtime-driver targets.
262262

263263
#### Scenario: Runtime/driver implementation changes trigger cross-target validation
264-
- **WHEN** a change modifies runtime contracts or driver behavior under `packages/secure-exec-core/src/`, `packages/secure-exec-nodejs/src/`, or `packages/secure-exec-browser/src/`
264+
- **WHEN** a change modifies runtime contracts or driver behavior under `packages/core/src/`, `packages/nodejs/src/`, or `packages/browser/src/`
265265
- **THEN** the change MUST execute shared integration suites for both node and browser targets before completion
266266

267267
#### Scenario: Shared suites are reused between targets

.agent/contracts/isolate-runtime-source-architecture.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
TBD - created by archiving change harden-isolate-runtime-typing-and-layout. Update Purpose after archive.
55
## Requirements
66
### Requirement: Isolate Runtime Source Layout Separates Inject Entrypoints and Shared Modules
7-
The isolate-runtime source tree SHALL organize host-injected entry scripts under `packages/secure-exec-core/isolate-runtime/src/inject/` and shared reusable modules under `packages/secure-exec-core/isolate-runtime/src/common/`.
7+
The isolate-runtime source tree SHALL organize host-injected entry scripts under `packages/core/isolate-runtime/src/inject/` and shared reusable modules under `packages/core/isolate-runtime/src/common/`.
88

99
#### Scenario: Existing inject sources are migrated to canonical layout
1010
- **WHEN** isolate-runtime injection sources are maintained or refactored
11-
- **THEN** entry scripts evaluated by host runtime MUST live under `packages/secure-exec-core/isolate-runtime/src/inject/` and shared helpers/types MUST live under `packages/secure-exec-core/isolate-runtime/src/common/`
11+
- **THEN** entry scripts evaluated by host runtime MUST live under `packages/core/isolate-runtime/src/inject/` and shared helpers/types MUST live under `packages/core/isolate-runtime/src/common/`
1212

1313
#### Scenario: New isolate injection source is added
1414
- **WHEN** contributors introduce a new host-to-isolate injected script
15-
- **THEN** the source file MUST be added under `packages/secure-exec-core/isolate-runtime/src/inject/` and MUST NOT be placed in legacy flat isolate-runtime paths
15+
- **THEN** the source file MUST be added under `packages/core/isolate-runtime/src/inject/` and MUST NOT be placed in legacy flat isolate-runtime paths
1616

1717
### Requirement: Inject Entrypoints SHALL Compile as Standalone Runtime Artifacts
1818
Inject entrypoint files SHALL be compiled into standalone executable source payloads suitable for host runtime injection, including any shared code imported from `src/common`.

.agent/contracts/node-bridge.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Bridge-exposed filesystem metadata calls (`exists`, `stat`, and typed directory
117117
- **THEN** bridge handling MUST return entry type information without a repeated `readDir` probe for each entry
118118

119119
### Requirement: Bridge Boundary Contracts SHALL Be Defined In A Canonical Shared Type Module
120-
Bridge global keys and host/isolate boundary type contracts SHALL be defined in canonical shared type modules — bridge-contract types in `packages/secure-exec-nodejs/src/bridge-contract.ts` and global-exposure helpers in `packages/secure-exec-core/src/shared/global-exposure.ts` — and reused across host runtime setup and bridge modules.
120+
Bridge global keys and host/isolate boundary type contracts SHALL be defined in canonical shared type modules — bridge-contract types in `packages/nodejs/src/bridge-contract.ts` and global-exposure helpers in `packages/core/src/shared/global-exposure.ts` — and reused across host runtime setup and bridge modules.
121121

122122
#### Scenario: Host runtime injects bridge globals
123123
- **WHEN** host runtime code wires bridge globals into the isolate

.agent/contracts/node-runtime.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ The project SHALL provide a stable sandbox execution interface through `NodeRunt
1818
- **WHEN** a caller invokes `run()` with CommonJS code that assigns to `module.exports`
1919
- **THEN** the result's `exports` field MUST contain the value of `module.exports`
2020

21+
#### Scenario: Run CJS module with file path resolves relative requires from that file
22+
- **WHEN** a caller invokes `run()` with a `filePath` and the module uses `require("./relative-path")`
23+
- **THEN** relative CommonJS resolution MUST use the provided file path's directory as the parent module directory
24+
2125
#### Scenario: Run ESM module and retrieve namespace exports
2226
- **WHEN** a caller invokes `run()` with ESM code that uses `export` declarations
2327
- **THEN** the result's `exports` field MUST contain the module namespace object with all named exports and the `default` export (if declared)
@@ -234,7 +238,7 @@ The Node runtime MUST validate isolate-originated serialized payload size before
234238
- **THEN** the runtime MUST fail the operation with a deterministic overflow error and MUST NOT call `JSON.parse` on that payload
235239

236240
#### Scenario: All isolate-originated parse entry points are guarded
237-
- **WHEN** host runtime code in the Node execution driver (`packages/secure-exec-nodejs/src/execution-driver.ts`) parses isolate-originated JSON payloads for bridged operations
241+
- **WHEN** host runtime code in the Node execution driver (`packages/nodejs/src/execution-driver.ts`) parses isolate-originated JSON payloads for bridged operations
238242
- **THEN** each parse entry point MUST apply the same pre-parse size validation before invoking `JSON.parse`
239243

240244
#### Scenario: In-limit serialized payload preserves existing behavior
@@ -325,7 +329,7 @@ The runtime SHALL publish its execution interface through the `@secure-exec/*` s
325329

326330
#### Scenario: Runtime source is split across focused packages
327331
- **WHEN** contributors update runtime implementation files
328-
- **THEN** shared types and runtime classes MUST live under `packages/secure-exec-core`, Node driver code under `packages/secure-exec-nodejs`, browser driver code under `packages/secure-exec-browser`, Python driver code under `packages/secure-exec-python`, and the barrel re-export layer under `packages/secure-exec`
332+
- **THEN** shared types and runtime classes MUST live under `packages/core`, Node driver code under `packages/nodejs`, browser driver code under `packages/browser`, Python driver code under `packages/python`, and the barrel re-export layer under `packages/secure-exec`
329333

330334
#### Scenario: Barrel package contains no source logic
331335
- **WHEN** contributors inspect `packages/secure-exec/src/`
@@ -339,15 +343,15 @@ Module projection and overlay-based loading SHALL reject native addon artifacts
339343
- **THEN** runtime MUST fail deterministically and MUST NOT execute native addon code
340344

341345
### Requirement: Isolate-Executed Bootstrap Sources MUST Be Static TypeScript Modules
342-
Any source code evaluated inside the isolate for runtime/bootstrap setup MUST originate from static files under `packages/secure-exec-core/isolate-runtime/src/` and MUST be tracked as normal TypeScript source with inject entrypoints rooted in `packages/secure-exec-core/isolate-runtime/src/inject/`.
346+
Any source code evaluated inside the isolate for runtime/bootstrap setup MUST originate from static files under `packages/core/isolate-runtime/src/` and MUST be tracked as normal TypeScript source with inject entrypoints rooted in `packages/core/isolate-runtime/src/inject/`.
343347

344348
#### Scenario: Runtime injects require and bridge bootstrap code
345349
- **WHEN** secure-exec prepares isolate bootstrap code for `require` setup, bridge setup, or related runtime helpers
346350
- **THEN** the injected source MUST come from static isolate-runtime module files rather than ad-hoc inline source assembly in host runtime files
347351

348352
#### Scenario: New isolate injection path is introduced
349353
- **WHEN** a change adds a new host-to-isolate code injection path
350-
- **THEN** the injected code MUST be added as a static `.ts` file under `packages/secure-exec-core/isolate-runtime/src/inject/` in the same change
354+
- **THEN** the injected code MUST be added as a static `.ts` file under `packages/core/isolate-runtime/src/inject/` in the same change
351355

352356
#### Scenario: Existing template-generated bootstrap helper is migrated
353357
- **WHEN** secure-exec migrates helpers such as `getRequireSetupCode`, `getBridgeWithConfig`, or `createInitialBridgeGlobalsCode`
@@ -357,7 +361,7 @@ Any source code evaluated inside the isolate for runtime/bootstrap setup MUST or
357361
The `@secure-exec/core` package build MUST execute isolate-runtime compilation before producing final runtime artifacts, and build orchestration MUST treat isolate-runtime compilation and isolate-runtime typecheck as explicit validation dependencies.
358362

359363
#### Scenario: Package build runs with clean outputs
360-
- **WHEN** `packages/secure-exec-core` is built from a clean workspace
364+
- **WHEN** `packages/core` is built from a clean workspace
361365
- **THEN** the build MUST run a dedicated isolate-runtime compile step before final package build output is produced
362366

363367
#### Scenario: Turbo build graph resolves core build dependencies

.agent/contracts/runtime-driver-test-suite-structure.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Secure-exec runtime-driver integration coverage MUST use the canonical filesyste
1010
- `packages/secure-exec/tests/test-suite/{name}.ts`
1111
- `packages/secure-exec/tests/exec-driver/{name}.test.ts`
1212
- `packages/secure-exec/tests/runtime-driver/{name}.test.ts`
13-
- `packages/secure-exec-core/test/kernel/{name}.test.ts` (kernel unit tests)
13+
- `packages/core/test/kernel/{name}.test.ts` (kernel unit tests)
1414
- `packages/secure-exec/tests/kernel/{name}.test.ts` (kernel cross-runtime integration tests)
1515

1616
#### Scenario: Shared matrix entrypoint exists at canonical path
@@ -48,15 +48,15 @@ Shared suite registration order in the matrix entrypoint MUST be explicit and st
4848
- **THEN** they MUST be imported and invoked in deterministic source order rather than filesystem discovery
4949

5050
### Requirement: Kernel Unit Tests SHALL Use MockRuntimeDriver In Kernel Package
51-
Kernel unit tests that validate kernel subsystem behavior (VFS, FD table, process table, device layer, pipe manager, command registry, permissions) SHALL reside under `packages/secure-exec-core/test/kernel/` and use MockRuntimeDriver for driver interactions.
51+
Kernel unit tests that validate kernel subsystem behavior (VFS, FD table, process table, device layer, pipe manager, command registry, permissions) SHALL reside under `packages/core/test/kernel/` and use MockRuntimeDriver for driver interactions.
5252

5353
#### Scenario: Kernel unit tests live in kernel package
5454
- **WHEN** contributors add or update tests for kernel subsystem behavior
55-
- **THEN** those tests MUST reside under `packages/secure-exec-core/test/kernel/` as `*.test.ts` files
55+
- **THEN** those tests MUST reside under `packages/core/test/kernel/` as `*.test.ts` files
5656

5757
#### Scenario: Kernel unit tests use MockRuntimeDriver
5858
- **WHEN** kernel unit tests need to validate spawn/exec orchestration or command registration
59-
- **THEN** they MUST use a MockRuntimeDriver (from `packages/secure-exec-core/test/kernel/helpers.ts`) that implements the RuntimeDriver interface with controllable behavior, rather than requiring real runtime drivers
59+
- **THEN** they MUST use a MockRuntimeDriver (from `packages/core/test/kernel/helpers.ts`) that implements the RuntimeDriver interface with controllable behavior, rather than requiring real runtime drivers
6060

6161
#### Scenario: Kernel unit tests validate subsystem invariants independently
6262
- **WHEN** kernel unit tests validate FD table, process table, pipe manager, or device layer behavior

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@
5757
- the WasmVM runtime requires standalone WASM binaries in `native/wasmvm/target/wasm32-wasip1/release/commands/`
5858
- build them locally: `cd native/wasmvm && make wasm` (requires Rust nightly + wasm32-wasip1 target + rust-src component + wasm-opt/binaryen)
5959
- the Rust toolchain is pinned in `native/wasmvm/rust-toolchain.toml` — rustup will auto-install it
60-
- CI builds the binaries before tests; a CI-only guard test in `packages/secure-exec-wasmvm/test/driver.test.ts` fails if they're missing
60+
- CI builds the binaries before tests; a CI-only guard test in `packages/wasmvm/test/driver.test.ts` fails if they're missing
6161
- tests gated behind `skipIf(!hasWasmBinaries)` or `skipUnlessWasmBuilt()` will skip locally if binaries aren't built
6262
- see `native/wasmvm/CLAUDE.md` for full build details and architecture
6363

6464
## WasmVM Syscall Coverage
6565

6666
- every function in the `host_process` and `host_user` import modules (declared in `native/wasmvm/crates/wasi-ext/src/lib.rs`) must have at least one C parity test exercising it through libc
67-
- when adding a new host import, add a matching test case to `native/wasmvm/c/programs/syscall_coverage.c` and its parity test in `packages/secure-exec-wasmvm/test/c-parity.test.ts`
67+
- when adding a new host import, add a matching test case to `native/wasmvm/c/programs/syscall_coverage.c` and its parity test in `packages/wasmvm/test/c-parity.test.ts`
6868
- the canonical source of truth for import signatures is `native/wasmvm/crates/wasi-ext/src/lib.rs` — C patches and JS host implementations must match exactly
6969
- C patches in `native/wasmvm/patches/wasi-libc/` must be kept in sync with wasi-ext — ABI drift between C, Rust, and JS is a P0 bug
70-
- permission tier enforcement must cover ALL write/spawn/kill/pipe/dup operations — audit `packages/secure-exec-wasmvm/src/kernel-worker.ts` when adding new syscalls
70+
- permission tier enforcement must cover ALL write/spawn/kill/pipe/dup operations — audit `packages/wasmvm/src/kernel-worker.ts` when adding new syscalls
7171
- `PATCHED_PROGRAMS` in `native/wasmvm/c/Makefile` must include all programs that use `host_process` or `host_user` imports (programs linking the patched sysroot)
7272

7373
## Terminology

docs-internal/arch/kernel-integration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ secure-exec/ ← monorepo root
172172
│ │ │ └── index.ts ← Re-exports kernel + all runtimes + all OS adapters
173173
│ │ └── package.json
174174
│ │
175-
│ ├── secure-exec-typescript/ ← EXISTING: TypeScript compiler tools
175+
│ ├── typescript/ ← EXISTING: TypeScript compiler tools
176176
│ ├── playground/ ← EXISTING: web demo
177177
│ └── website/ ← EXISTING: docs site
178178
@@ -1281,7 +1281,7 @@ secure-exec/ ← monorepo root
12811281
│ │ ├── project-matrix/
12821282
│ │ └── types/
12831283
│ │
1284-
│ ├── secure-exec-typescript/ ← EXISTING: TypeScript compiler tools
1284+
│ ├── typescript/ ← EXISTING: TypeScript compiler tools
12851285
│ ├── playground/ ← EXISTING: web demo
12861286
│ └── website/ ← EXISTING: docs site
12871287

0 commit comments

Comments
 (0)