perf(build): OS_SKIP_DTS gating + fix optional AI plugin "Cannot find package" skip#1595
Merged
Merged
Conversation
…in skip Part 1 — OS_SKIP_DTS build-time gating (default behavior unchanged): - 12 tsup configs: dts: true → dts: !process.env.OS_SKIP_DTS - packages/spec/package.json: skip the separate BUILD_DTS=true tsup pass when OS_SKIP_DTS is set (the ~80–90s DTS pass) - packages/cli/package.json: when OS_SKIP_DTS is set, deps have no .d.ts, so build with --noCheck --declaration false to still emit runnable JS (full typecheck preserved by default) - turbo.json: declare OS_SKIP_DTS in globalEnv (Turbo 2.x strict env mode otherwise filters it out; also part of the cache key) Image build (OS_SKIP_DTS=1): framework turbo run build ~5m03s → ~1m12s. Part 2 — fix optional AI plugin "failed to start" false alarm: serve.ts loads @objectstack/service-ai and optional @objectstack/service-ai-studio via importFromHost() and is meant to silently skip when absent. ESM throws "Cannot find package '...'" (code on err.code, not in message), which the old guard didn't match, so control-plane hosts logged a scary error on every boot. Detect missing module via err.code === 'ERR_MODULE_NOT_FOUND' and also match "Cannot find package". Applied to both the AIService and AIStudio guards. Refs objectstack-ai/cloud#107 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the framework-side changes tracked in objectstack-ai/cloud#107. The companion cloud PR sets
ENV OS_SKIP_DTS=1in the image build; the big build-time win lives here (framework's build dominates image time).Part 1 —
OS_SKIP_DTSgating (build-time only; default behavior unchanged)Skip
.d.tsemission only whenOS_SKIP_DTSis set. Defaultpnpm build/turbo typecheck/ npm publish keep generating full types.dts: true→dts: !process.env.OS_SKIP_DTSpackages/spec/package.json: skip the separateBUILD_DTS=true tsuppass (~80–90s) whenOS_SKIP_DTSis setpackages/cli/package.json: cli builds viatsc; whenOS_SKIP_DTSis set, deps have no.d.ts, so build with--noCheck --declaration falseto still emit runnable JS (full typecheck preserved by default)turbo.json: declareOS_SKIP_DTSinglobalEnv(Turbo 2.x strict env mode otherwise filters it out; also part of the cache key)Measured: framework
turbo run build~5m03s → ~1m12s (the@objectstack/specDTS pass alone is ~80–90s).Part 2 — fix optional AI plugin "failed to start" false alarm
serve.tsloads@objectstack/service-aiand optional@objectstack/service-ai-studioviaimportFromHost(), meant to silently skip when absent. The old guard only matchedCannot find module/ERR_MODULE_NOT_FOUND, but ESM throwsCannot find package '...'(the code is onerr.code, not in the message). Control-plane hosts (e.g.apps/cloud) logged a scary[AI Studio] AIStudioPlugin failed to start: Cannot find package ...on every boot.Fix: detect missing module via
err.code === 'ERR_MODULE_NOT_FOUND'and also matchCannot find package. Applied to both the AIService and AIStudio guards.Verification
tsc -p tsconfig.build.json --noEmiton the cli package: exit 0 (serve.ts change typechecks).dts = true;OS_SKIP_DTS=1→dts = false.turbo.json,packages/cli/package.json,packages/spec/package.json.After merge, bump
cloud/.framework-shato this PR's merge commit.🤖 Generated with Claude Code