pleach
Reference

Subpath exports

Every named import path under @pleach/core, what ships from it, and whether it's load-bearing.

@pleach/core ships an ESM-first export map with both import and require entries (the package is type: module; CommonJS consumers get .cjs builds). Below: the named subpaths consumers should rely on, plus the wildcard escape hatch and what it costs you.

Snapshot is for @pleach/core@1.x. The canonical list lives in the package's package.json and is watched by audit:package-export-validation upstream.

Named subpaths

stable means the path is named in the published exports map and watched by the upstream package-export audit. Removal or rename goes through a deprecation cycle. Each subpath ships ESM (.js), CJS (.cjs), and types (.d.ts) — see Dual-format builds.

Substrate runtime

ImportShipsStability
@pleach/coreRoot barrel — SessionRuntime, factories, runtime typesstable
@pleach/core/SessionRuntimeSessionRuntime class, direct entry (barrel sidesteps tree-shaking)stable
@pleach/core/runtimeProcess-scoped registries + module-loader indirectionstable
@pleach/core/runtime/createPleachRuntimecreatePleachRuntime, TurnOrchestrator, host-injection typesstable
@pleach/core/quickstartZero-config starter surface — createPleachRoute (fetch-handler factory), useChat (Pleach-native React hook), <ChatBox /> (unstyled, accessible), defaultPlugin, createBenchmarkPlugin, providerDetection (detectProvider, detectAvailableProviders, DEFAULT_PROVIDER_ENV_VARS, DEFAULT_PROVIDER_PRIORITY). What npx pleach init scaffolds against. See The quickstart subpath.stable

Type subpaths

Narrowed deep-path type entries landed via the pa3prep cluster 15 sweep — type-only deep paths were promoted from wildcard reach to named entries so consumers don't pay the wildcard's instability cost on contracts.

ImportShipsStability
@pleach/core/typesPublic type definitions (re-exports)stable
@pleach/core/types/commandCommand + isCommand brandstable
@pleach/core/types/dynamicAppModulesDynamic-app-module type registrystable
@pleach/core/types/genericGeneric runtime typesstable
@pleach/core/types/singleTurnSingle-turn body contract typesstable
@pleach/core/types/strategiesStrategy registration typesstable

Persistence + state

ImportShipsStability
@pleach/core/sessionsSession-state adapters — MemoryAdapter, IndexedDBAdapter, SupabaseAdapterstable
@pleach/core/checkpointingCheckpoint savers — MemorySaver, IndexedDBSaver, SupabaseSaverstable
@pleach/core/syncVersion-vector sync utilitiesstable
@pleach/core/storeKV store — BaseStore, MemoryStore, SupabaseStore, MemoryNamespacesstable
@pleach/core/cacheIn-memory cache backend (createMemoryCacheBackend) + content-hash deriver (deriveContentHashKey, canonicalizeKeyInput, ContentHashKeyInput — re-exported by @pleach/replay/cache)stable
@pleach/core/schemaGenerated row-shape types + SQL bundlestable
@pleach/core/schema/postgres/*.sqlRaw SQL migrations (asset import)stable

Event log + projections

ImportShipsStability
@pleach/core/eventLogEventLogWriter, EventLogClient, hydrateFromEvents, GraphProjection<T>stable
@pleach/core/manifestChat-manifest — createDefaultChatManifestProvider (the [Session Manifest] ledger + section render), checkpoint/reload persistence (stampManifestIntoState, restoreManifestFromState), and chatManifestProjection / foldChatManifest (the manifest as an event-log projection)experimental

Audit, attestation, scrub

ImportShipsStability
@pleach/core/auditAuditableCall ledger primitives + no-op plug-pointsstable
@pleach/core/attestationAttestation module — signer, verifier, canonical envelopestable
@pleach/core/attestation/keyStoresPluggable key-store backends (memory, env, KMS adapters)stable
@pleach/core/attestation/testingTest fixtures + harness for attestation flowsstable
@pleach/core/scrubbersC8 redaction surface — SCRUBBABLE_FIELDS allowlist + scrubber registrystable

Prompts + prompt-builder

ImportShipsStability
@pleach/core/promptsC12 prompt-contribution contract — PromptContributionRegistry, PromptContribution, 41 Phase H universal templatesstable
@pleach/core/prompts/examplesReference prompt contributorsstable
@pleach/core/prompt-builderPhase F generic composition — composeBudgetedPrompt + diagnosticsstable
@pleach/core/prompt-builder/sectionsSection primitivesstable
@pleach/core/prompt-builder/examplesReference section assembliesstable

Safety

ImportShipsStability
@pleach/core/safetySafetyPolicyRegistry, composeSafetyContent, contribution registrystable
@pleach/core/safety/examplesReference safety contributorsstable

Lineage + fingerprint + observability

ImportShipsStability
@pleach/core/lineageLineageTracker + 6 lineage types (Layer-4 lineage primitives)stable
@pleach/core/fingerprintcomputeFingerprint — platform-uniform pure hashstable
@pleach/core/otelOpenTelemetry no-op + adapter seamsstable
@pleach/core/inspectorinspectRuntime, InspectionReport, CapabilityReport, PluginReport, CapabilityDescriptor, the 35 known-capability list (31 modern + 4 deprecated)stable
@pleach/core/harnessTurn-report folding for the headless self-observation loop (the harness chatinit flag + pleach dev plugin-test harness) — foldTurnReport, foldTurnReportFromEvents, createHarnessCapture, projectInspector, diffReports, evaluateAssertions, buildReportMarkdown ({ verbose } for the audit-ledger/runtime-log/tool-card sections), TurnReport. Also the answer-quality battery detectEdgeCases (+ EdgeCaseFinding, hasSubstantiveAnswerBody, PLAN_NARRATION_PATTERNS), the default defaultAnswerSufficiencyBackstop, and the headless-diagnostics pub/sub (getDiagnosticsBus, DiagnosticsBus). See Playground & DevTools.stable
@pleach/core/instrumentationUX-parity probes + observer-vs-legacy divergence telemetrystable, internal-leaning

Strategies + streaming

ImportShipsStability
@pleach/core/strategiesStrategy barrel — fabrication detector + named detectors + guard typesstable
@pleach/core/strategies/fabricationDetectorDirect fabrication detector entrystable
@pleach/core/strategies/fabricationDetectorsNamed fabrication detector cohortstable
@pleach/core/strategies/fabricationGuardTypesGuard type contractsstable
@pleach/core/strategies/hallucinationDetectorHallucinated tool-call detectorstable
@pleach/core/streamingProducer side — StreamManager, asyncEventChannelstable
@pleach/core/streaming/dsmlSanitizerDSML sanitizer (chunk-time amend observer)stable
@pleach/core/streaming/bracketNarratedToolExtractorBracket-narrated tool-call extractorstable
@pleach/core/streaming/hallucinatedToolDetectorHallucinated tool-call detector entrystable
@pleach/core/streaming/streamDegenerationGuardsStream degeneration guard primitivesstable
@pleach/core/finalizationFinalization barrelstable
@pleach/core/finalization/finalizeContentfinalizeContent direct entrystable

Providers

ImportShipsStability
@pleach/core/providersProvider-failure taxonomy + reasoning-only recovery precondition — FailureCategory, FailureClassification, BillingDisposition, ModelUnavailableReason, classifyEmptyStream. The seam recovery arm keys on these; the reasoning-model set + provider string→category matchers stay host-injected (SessionRuntimeConfig.reasoningRecovery). See Providers § Reasoning-only completion recovery.stable

Graph + planning + execution

ImportShipsStability
@pleach/core/graph/planningPlanning substrate — plan-channel utilitiesstable
@pleach/core/engineRetryPolicy, AbortComposer, SuperstepRunner, createPromiseBarrier, shouldTriggerNodestable
@pleach/core/channelsTyped state containers — LastValue, BinaryOperatorAggregate, Topic, EphemeralValue, NamedBarrierstable
@pleach/core/detectorsDetector primitives — syntheticExpansionDetectorstable

Tools + plugins + meta

ImportShipsStability
@pleach/core/toolsToolRegistryWrapper, ToolBatchExecutor, catalog re-exportsstable
@pleach/core/tools/executionTool-execution pipeline stages + resolved-tools registry (recordRegistryResolvedTool, getRegistryResolvedToolNames, hasRegistryResolvedTool, resetRegistryResolvedTools)stable
@pleach/core/pluginsPluginManager + HarnessPlugin interfacestable
@pleach/core/asyncLong-running task orchestration — AsyncTaskManager, executor contract, task reducerstable
@pleach/core/plansPlan substrate — PlanManager, plan/step/revision typesstable
@pleach/core/subagentsConcurrent subagent execution — SubagentManager, LightweightRuntimestable
@pleach/core/memoryAuto-extracted user facts + per-agent memory scopingstable
@pleach/core/queryRead-side query helpersstable

Re-exports

ImportShipsStability
@pleach/core/reactRe-export of @pleach/react — hooks + HarnessProvider + DevToolsstable
@pleach/core/adaptersStorage + streaming adaptersstable

Runtime registries + auth + utils

ImportShipsStability
@pleach/core/runtimeRegistryProcess-scoped runtime registrystable
@pleach/core/guestInterruptBusGuest interrupt bus (registry seam)stable
@pleach/core/guestInterruptCallbackGuest interrupt callback (registry seam)stable
@pleach/core/authAuth providers — ApiKeyAuth, BearerTokenAuth, AuthProviderstable
@pleach/core/utilsUUIDv7, typed EventEmitter, SHA-256 integrity helpersstable
@pleach/core/mockOffline-development substitutes for external services (dev + test paths)stable, internal-leaning

Wildcard

ImportShipsStability
@pleach/core/*Deep paths not yet barrel-namedunstable

stable means: the path is named in the published exports map and watched by the upstream package-export audit. Removal or rename goes through a deprecation cycle.

The wildcard surface

Wildcard imports are unstable

Paths matched by @pleach/core/* resolve today, but renames and removals can land in a minor release. They are watched in WARN-DRIFT mode (non-blocking) — not promoted to FAIL until a path is named. Treat them as a temporary hatch, not a contract.

@pleach/core/* resolves to deep paths under the package's dist/ that aren't behind a named barrel yet. It exists so the published surface doesn't lag the source tree during the named-barrel narrowing project tracked in the upstream pa3prep/ ledger.

The upstream audit:package-export-validation job watches the wildcard's reach:

  • WARN-DRIFT (default) — every wildcard hit not in the published snapshot at scripts/audit/package-export-snapshot.json is reported. Non-blocking per D-PA3P-3 so source-tree changes don't break the build.
  • :strict (publish-day) — promotes WARN-DRIFT to FAIL on any unresolved import, plus walks the declared exports surface. Run before any @pleach/core@1.x rehearsal cut.
  • :update-snapshot — regenerates the snapshot when wildcard reach is intentionally widened or narrowed.

Three rules of thumb when reaching into the wildcard:

  1. It works today. Deep paths under @pleach/core/graph/..., @pleach/core/replay/types, and similar resolve against the published artifact.
  2. It will move. As named barrels land, wildcard paths get superseded. The pa3prep cluster sweeps promote groups of paths to named entries at a time — type-only deep paths landed via cluster 15 (./types/* cohort), and each future cluster narrows the wildcard's reach further.
  3. graph/* is indefinite. The internal graph topology is deliberately not behind a stable barrel. Don't build a public API on top of it.

If a wildcard path is load-bearing for you, open an issue against pleachhq/core asking for it to be named. The named-barrel pipeline takes requests.

Internal surfaces

Not a public import surface

Paths under @pleach/core/internal/… are implementation details, not a supported public API. The internal/ segment is the signal: they resolve today, but they are not stable — they can move or change shape between releases with no deprecation cycle. Don't build against them; use the public alternatives below.

PathWhat it isPublic alternative
@pleach/core/internal/strategies/streamSingleTurn/helpers (+ its safeStringifyArgs, parseToolArgs, forceSynthesisEchoDispatch, imperativeProviderAttemptCallback direct entries)The streamSingleTurn body's own helper barrel — typed contracts (TurnAccumulator, OrchestratorMessage, ProviderFallbackConfig, ToolDefinition) plus runtime utilities the default body uses inline. See streamSingleTurn § The helpers barrel.Public types via the named type subpaths — e.g. ToolDefinition from @pleach/core/types/generic. A custom body registers through the module-loader seam, not by importing these helpers.
@pleach/core/internal/tools/execution/registryResolvedToolsResolved-tools registry surface.@pleach/core/tools/execution re-exports the supported functions (recordRegistryResolvedTool, getRegistryResolvedToolNames, hasRegistryResolvedTool, resetRegistryResolvedTools).

Dual-format builds

Each named subpath ships three artifacts:

{
  "import":  "./dist/sessions/index.js",
  "require": "./dist/sessions/index.cjs",
  "types":   "./dist/sessions/index.d.ts"
}

ESM consumers resolve .js; CommonJS consumers resolve .cjs; TypeScript reads the .d.ts. Bundlers respect sideEffects: false on the package — tree-shaking the runtime is supported and gives roughly a 30% bundle reduction in apps that only import a handful of named subpaths.

First-publish packaging contract

Every @pleach/* package adopts the same baseline at its first 1.x publish. Dual ESM/CJS emit, types-first exports ordering per the Node resolution spec, dir-style tsup entries, and DTS produced by tsc --build against the public surface.

Tarballs ship without sourcemaps. Peer-dep ranges tighten at the 1.x cut. Each package carries a NOTICE, a CHANGELOG.md, npm provenance attestation, and a sideEffects declaration that matches what its modules actually do.

Consumers benefit from knowing the shape: install or import failures debug faster when the resolution order is predictable. Forkers and vendored installs need to hold the line — diverging from the contract breaks the audit gates upstream that enforce it.

For the full write-up — field-by-field package.json requirements, the audit job names, and the migration recipe for pre-1.x packages — see Publishing contract.

Where to go next

On this page