Repository navigation
feat(cli): load a native application and run it from the CLI - #213
chenxin-yan wants to merge 6 commits into
Conversation
|
Run failed. View the logs →
|
🦋 Changeset detectedLatest commit: 4e752b1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
All reported issues were addressed across 32 files
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
|
Run failed. View the logs →
|
dfa8379 to
6bcb8d2
Compare
|
Run failed. View the logs →
|
6bcb8d2 to
0a13bbb
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the supplied incremental delta from 6bcb8d2 to 0a13bbb, limited to the CLI test script.
- Added a pre-test binary build. Changed the CLI test command to compile
dist/local/mitomebefore Vitest, preventing package-local tests from exercising an absent or stale executable. - Verified both execution paths. All 19 CLI tests passed through Turbo and through direct
bun run testafter workspace prerequisites were built.
gpt-6-astra | 𝕏
0a13bbb to
7f20647
Compare
Add defineMitome to @mitome/core: a typed producer composing an ordinary program with shared infrastructure, Providers, Default and fallback Models, an explicit CLI mapping and serving Hosts. Unclosed requirements are compile errors. acquire builds infrastructure once, provisions the selected Model lazily with ordered configured fallback, serves explicit fresh application-owned Sessions, binds each Turn's own Scope, unwinds partial startup, isolates serving-Host failures and shuts down by closing admission and draining owned work before releasing infrastructure. The mitome CLI gains run, providers and auth status|login|logout, each loading the default export of an explicit --app file. run is one-shot with explicit input/output mapping and a --grace bound on signal shutdown. Codex credential remedies name the shipped auth command; docs, READMEs and the glossary describe the native application and CLI. Refs #184
…o results An explicit Session close detached its Scope from the application before its Turn cleanup finished, so a concurrent shutdown could release shared infrastructure underneath that cleanup. The application now holds a finalizer awaiting one shared close until it completes. The CLI grace timer now also starts when the command's own work ends, so cleanup after ordinary completion or failure is bounded, not only after a signal. Application Effect logs and unreported failures go to stderr, keeping stdout to the rendered result. Refs #184
acquire unwinds a failed startup before it returns, so the CLI's grace, started only once the command's work ended, never covered that unwind and a held infrastructure release hung the process. AcquireOptions gains onShutdown, run once when shutdown begins and before anything is cancelled or released; the CLI starts its deadline there as well. The library still waits for all cleanup; only the CLI exits. Refs #184
…n fails Effect.ensuring keeps closing the application's resources when onShutdown defects or is interrupted, and the docs state that a native Layer's own failed-build rollback runs before shutdown begins.
Exit-aware infrastructure releases now see the startup failure instead of success. Also address review notes on the docs example, the Application glossary entry and test environment restoration.
binary.test.ts spawns dist/local/mitome, which only the build script produces. Turbo builds first, but a direct `bun run test` in packages/cli on a fresh checkout failed with ENOENT, and after source edits it tested a stale binary. The compile takes under a second.
7f20647 to
4e752b1
Compare

Closes #184. Stacked on #211 (→ #207 → #205).
Adds loadable native applications and the CLI that runs them.
What changed
@mitome/core:defineMitome(options). This typed producer composes:parseInput/renderResultmapping,Requirements that are left open are compile errors (see
test/application.types.ts). The original program, Layer and Provider types are preserved.acquire()works in this order:--modelnever falls back. Configured fallbacks are tried in order, and each failed attempt is released before the next.Application:CLI commands:
mitome run --app <file> [--provider] [--model] [--grace] [input],mitome providersandmitome auth status|login|logout. All load the same--appdefault export; there is no implicit discovery.CLI output and exit behaviour:
--grace(default 5s) bounds cleanup after a signal, after normal completion, and after a failed startup. Expiry exits 1.Docs: new
applications.mdxandcli.mdx.CONTEXT.mdno longer lists the deleted vocabulary. Codex credential errors now name the realauth logincommand.Review
The work went through one design review, an initial implementation, and three rounds of independent verification plus spec, standards and simplicity review. That found and fixed:
Session.closedetached its Scope before draining, which could release them under a running cleanup.--gracedidn't always apply. It covered only signals; normal completion and failed-start cleanup are now bounded too.Each fix has a regression test that fails without it.
Known limitation (documented in
cli.mdx): when a native Layer fails while it is being built, Effect rolls back that Layer's own resources before the application can start shutting down. If that rollback hangs,--graceonly bounds it after SIGINT/SIGTERM.Verification
bun run build|check|test -- --forceall exit 0 (core 104, cli 19, providers 381, create-mitome 11 tests).providersandauth status;Not exercised: the interactive OAuth
auth loginflow, and real Providers over the network.