///
import { T as ToolExecutionErrorSchemaVersion, P as PlayAuthoringContractEdition, a as PlayArtifactKind$1, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-DwYe2C2S.js';
export { d as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-DwYe2C2S.js';
import '@sinclair/typebox';
/**
* Public tool-response contracts shared by the API, SDK, Play bundler, and
* runtime. This is a versioned response transformation contract: a change to
* the persisted public tool-result shape must introduce a new value here and
* have newly built Play artifacts select it. Receipt-cache revisions are
* intentionally separate: ordinary response-contract changes do not refresh
* durable receipts unless the response transformation changed as well.
*/
declare const V2_TOOL_RESPONSE_CONTRACT: "v2-tool-response";
declare const RAW_V2_TOOL_RESPONSE_CONTRACT: "raw-v2";
type ToolResponseContract = typeof V2_TOOL_RESPONSE_CONTRACT | typeof RAW_V2_TOOL_RESPONSE_CONTRACT;
type PlayPackageImport = {
name: string;
version: string | null;
};
type PlayImportPolicy = {
localFiles: string[];
nodeBuiltins: string[];
packages: PlayPackageImport[];
};
type PlayRuntimeFeature = 'artifact_storage' | 'checkpoint_resume' | 'durable_sleep' | 'packaged_files';
type PlayArtifactCompatibility = {
apiVersion: number;
artifactVersion: number;
minRunnerVersion: number;
runtimeFeatures: PlayRuntimeFeature[];
runtimeBackend?: string | null;
/** Missing preserves the legacy schema used before this field existed. */
toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
/** Missing preserves edition 1 for artifacts created before authoring contracts were pinned. */
authoringContractEdition?: PlayAuthoringContractEdition;
/** Missing preserves the raw-only V2 execute response contract. */
toolResponseContract?: ToolResponseContract;
/** Missing preserves the receipt namespace of artifacts created before this revision existed. */
toolResponseReceiptRevision?: string;
};
/** The only executable Play artifact contract. */
type PlayArtifactKind = 'cjs_node20';
type PlayBundleArtifact = {
codeFormat: 'cjs_module';
/** Defaults to cjs_node20 when not present on legacy Node artifacts. */
artifactKind?: PlayArtifactKind;
entryFile: string;
virtualFilename: string;
sourceHash: string;
graphHash: string;
artifactHash: string;
sourceMapHash: string;
bundledCode: string;
sourceMap: string;
importPolicy: PlayImportPolicy;
compatibility: PlayArtifactCompatibility;
generatedAt: number;
cacheHit: boolean;
};
type ImportedPlayDependency = {
filePath: string;
playName: string;
};
type PlayLocalFileReference = {
sourceFragment: string;
logicalPath: string;
absolutePath: string;
bytes: number;
contentHash: string;
contentType: string;
};
type PlayLocalFileDiscoveryError = {
sourceFragment: string;
message: string;
};
type PlayLocalFileDiscoveryResult = {
files: PlayLocalFileReference[];
unresolved: PlayLocalFileDiscoveryError[];
};
type PlayBundlingAdapter = {
projectRoot: string;
/** Optional root used only to make source-graph identity independent of temporary absolute paths. */
sourceIdentityRoot?: string;
nodeModulesDir: string;
cacheDir?: string;
sdkSourceRoot: string;
sdkPackageJson: string;
sdkEntryFile: string;
sdkTypesEntryFile?: string;
discoverPackagedLocalFiles(filePath: string): Promise;
typecheckPlaySource?(input: {
sourceCode: string;
sourcePath: string;
importedFilePaths: string[];
}): Promise | string[];
warnAboutNonDevelopmentBundling?(filePath: string): void;
};
type BundledPlayFileSuccess = {
success: true;
artifact: PlayBundleArtifact;
sourceCode: string;
sourceFiles: Record;
filePath: string;
playName: string | null;
playDescription: string | null;
sandboxRuntimeDeclaration: PlaySandboxRuntimeDeclaration | null;
compilerManifest?: PlayCompilerManifest;
packagedFiles: PlayLocalFileReference[];
unresolvedFileReferences: PlayLocalFileDiscoveryError[];
importedPlayDependencies: ImportedPlayDependency[];
};
type BundledPlayFileFailure = {
success: false;
errors: string[];
filePath: string;
};
type BundledPlayFileResult = BundledPlayFileSuccess | BundledPlayFileFailure;
declare function extractDefinedPlayName(sourceCode: string): string | null;
type BundlePlayFileOptions = {
/** Must be `cjs_node20`; retained as an explicit compile-contract assertion. */
target?: PlayArtifactKind$1;
exportName?: string;
};
declare function createSdkPlayBundlingAdapter(): PlayBundlingAdapter;
declare function bundlePlayFile(filePath: string, options?: BundlePlayFileOptions): Promise;
export { type BundlePlayFileOptions, type BundledPlayFileResult, type BundledPlayFileSuccess, type ImportedPlayDependency, type PlayArtifactCompatibility, type PlayBundleArtifact, type PlayImportPolicy, type PlayLocalFileDiscoveryError, type PlayLocalFileReference, type PlayPackageImport, type PlayRuntimeFeature, bundlePlayFile, createSdkPlayBundlingAdapter, extractDefinedPlayName };