Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,35 @@ import { tywrap } from './tywrap.js';

export type { TywrapConfig } from './config/index.js';
export { defineConfig, resolveConfig } from './config/index.js';
// BoundedContext - unified abstraction for cross-boundary concerns
export { BoundedContext, type ContextState, type ExecuteOptions } from './runtime/bounded-context.js';
export type { Disposable } from './runtime/disposable.js';
export { isDisposable, safeDispose, disposeAll } from './runtime/disposable.js';
export {
ValidationError,
isFiniteNumber,
isPositiveNumber,
isNonNegativeNumber,
isNonEmptyString,
isPlainObject,
assertFiniteNumber,
assertPositive,
assertNonNegative,
assertString,
assertNonEmptyString,
assertArray,
assertObject,
containsSpecialFloat,
assertNoSpecialFloats,
sanitizeForFilename,
containsPathTraversal,
} from './runtime/validators.js';

/**
* @deprecated Use BoundedContext instead. RuntimeBridge will be removed in the next major version.
*/
export { RuntimeBridge } from './runtime/base.js';

export {
BridgeError,
BridgeProtocolError,
Expand Down
44 changes: 18 additions & 26 deletions src/runtime/base.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
/**
* Base runtime bridge
*
* @deprecated Use BoundedContext instead. RuntimeBridge will be removed in the next major version.
*/

import type { RuntimeExecution } from '../types/index.js';
import { BoundedContext } from './bounded-context.js';

export abstract class RuntimeBridge implements RuntimeExecution {
abstract call<T = unknown>(
module: string,
functionName: string,
args: unknown[],
kwargs?: Record<string, unknown>
): Promise<T>;

abstract instantiate<T = unknown>(
module: string,
className: string,
args: unknown[],
kwargs?: Record<string, unknown>
): Promise<T>;

abstract callMethod<T = unknown>(
handle: string,
methodName: string,
args: unknown[],
kwargs?: Record<string, unknown>
): Promise<T>;

abstract disposeInstance(handle: string): Promise<void>;
/**
* @deprecated Use BoundedContext instead. RuntimeBridge will be removed in the next major version.
*
* All bridges now extend BoundedContext which provides:
* - Lifecycle management (init/dispose state machine)
* - Validation helpers
* - Error classification
* - Bounded execution (timeout, retry)
* - Resource ownership tracking
*
* @see BoundedContext
*/
export abstract class RuntimeBridge extends BoundedContext {}

abstract dispose(): Promise<void>;
}
// Re-export BoundedContext for backwards compatibility
export { BoundedContext };
Loading