Skip to content

perf(build): OS_SKIP_DTS gating + fix optional AI plugin "Cannot find package" skip#1595

Merged
xuyushun441-sys merged 1 commit into
mainfrom
feat/os-skip-dts-gating
Jun 5, 2026
Merged

perf(build): OS_SKIP_DTS gating + fix optional AI plugin "Cannot find package" skip#1595
xuyushun441-sys merged 1 commit into
mainfrom
feat/os-skip-dts-gating

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Implements the framework-side changes tracked in objectstack-ai/cloud#107. The companion cloud PR sets ENV OS_SKIP_DTS=1 in the image build; the big build-time win lives here (framework's build dominates image time).

Part 1 — OS_SKIP_DTS gating (build-time only; default behavior unchanged)

Skip .d.ts emission only when OS_SKIP_DTS is set. Default pnpm build / turbo typecheck / npm publish keep generating full types.

  • 12 tsup configs: dts: truedts: !process.env.OS_SKIP_DTS
  • packages/spec/package.json: skip the separate BUILD_DTS=true tsup pass (~80–90s) when OS_SKIP_DTS is set
  • packages/cli/package.json: cli builds via tsc; 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)

Measured: framework turbo run build ~5m03s → ~1m12s (the @objectstack/spec DTS pass alone is ~80–90s).

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(), meant to silently skip when absent. The old guard only matched Cannot find module / ERR_MODULE_NOT_FOUND, but ESM throws Cannot find package '...' (the code is on err.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 match Cannot find package. Applied to both the AIService and AIStudio guards.

Verification

  • tsc -p tsconfig.build.json --noEmit on the cli package: exit 0 (serve.ts change typechecks).
  • tsup config gating spot-check: default → dts = true; OS_SKIP_DTS=1dts = false.
  • JSON validity confirmed for turbo.json, packages/cli/package.json, packages/spec/package.json.

After merge, bump cloud/.framework-sha to this PR's merge commit.

🤖 Generated with Claude Code

…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>
@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 5, 2026 9:04am

Request Review

@github-actions github-actions Bot added dependencies Pull requests that update a dependency file size/s labels Jun 5, 2026
@xuyushun441-sys xuyushun441-sys merged commit 55ac75d into main Jun 5, 2026
13 checks passed
@xuyushun441-sys xuyushun441-sys deleted the feat/os-skip-dts-gating branch June 5, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants