tywrap 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/README.md +65 -31
  2. package/dist/cli.js +49 -2
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config/index.d.ts +11 -7
  5. package/dist/config/index.d.ts.map +1 -1
  6. package/dist/config/index.js +43 -7
  7. package/dist/config/index.js.map +1 -1
  8. package/dist/core/analyzer.d.ts +1 -0
  9. package/dist/core/analyzer.d.ts.map +1 -1
  10. package/dist/core/analyzer.js +47 -12
  11. package/dist/core/analyzer.js.map +1 -1
  12. package/dist/core/annotation-parser.d.ts +8 -0
  13. package/dist/core/annotation-parser.d.ts.map +1 -0
  14. package/dist/core/annotation-parser.js +409 -0
  15. package/dist/core/annotation-parser.js.map +1 -0
  16. package/dist/core/discovery.d.ts +1 -0
  17. package/dist/core/discovery.d.ts.map +1 -1
  18. package/dist/core/discovery.js +9 -9
  19. package/dist/core/discovery.js.map +1 -1
  20. package/dist/core/generator.d.ts +9 -1
  21. package/dist/core/generator.d.ts.map +1 -1
  22. package/dist/core/generator.js +738 -104
  23. package/dist/core/generator.js.map +1 -1
  24. package/dist/core/mapper.d.ts +9 -7
  25. package/dist/core/mapper.d.ts.map +1 -1
  26. package/dist/core/mapper.js +129 -44
  27. package/dist/core/mapper.js.map +1 -1
  28. package/dist/index.d.ts +23 -7
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +23 -3
  31. package/dist/index.js.map +1 -1
  32. package/dist/runtime/base.d.ts +17 -7
  33. package/dist/runtime/base.d.ts.map +1 -1
  34. package/dist/runtime/base.js +18 -1
  35. package/dist/runtime/base.js.map +1 -1
  36. package/dist/runtime/bounded-context.d.ts +252 -0
  37. package/dist/runtime/bounded-context.d.ts.map +1 -0
  38. package/dist/runtime/bounded-context.js +454 -0
  39. package/dist/runtime/bounded-context.js.map +1 -0
  40. package/dist/runtime/bridge-core.d.ts +1 -0
  41. package/dist/runtime/bridge-core.d.ts.map +1 -1
  42. package/dist/runtime/bridge-core.js +52 -17
  43. package/dist/runtime/bridge-core.js.map +1 -1
  44. package/dist/runtime/bridge-protocol.d.ts +184 -0
  45. package/dist/runtime/bridge-protocol.d.ts.map +1 -0
  46. package/dist/runtime/bridge-protocol.js +344 -0
  47. package/dist/runtime/bridge-protocol.js.map +1 -0
  48. package/dist/runtime/disposable.d.ts +40 -0
  49. package/dist/runtime/disposable.d.ts.map +1 -0
  50. package/dist/runtime/disposable.js +49 -0
  51. package/dist/runtime/disposable.js.map +1 -0
  52. package/dist/runtime/errors.d.ts +10 -0
  53. package/dist/runtime/errors.d.ts.map +1 -1
  54. package/dist/runtime/errors.js +9 -0
  55. package/dist/runtime/errors.js.map +1 -1
  56. package/dist/runtime/http-io.d.ts +91 -0
  57. package/dist/runtime/http-io.d.ts.map +1 -0
  58. package/dist/runtime/http-io.js +195 -0
  59. package/dist/runtime/http-io.js.map +1 -0
  60. package/dist/runtime/http.d.ts +48 -13
  61. package/dist/runtime/http.d.ts.map +1 -1
  62. package/dist/runtime/http.js +60 -73
  63. package/dist/runtime/http.js.map +1 -1
  64. package/dist/runtime/node.d.ts +97 -130
  65. package/dist/runtime/node.d.ts.map +1 -1
  66. package/dist/runtime/node.js +392 -521
  67. package/dist/runtime/node.js.map +1 -1
  68. package/dist/runtime/optimized-node.d.ts +1 -1
  69. package/dist/runtime/optimized-node.d.ts.map +1 -1
  70. package/dist/runtime/optimized-node.js +1 -1
  71. package/dist/runtime/optimized-node.js.map +1 -1
  72. package/dist/runtime/pooled-transport.d.ts +135 -0
  73. package/dist/runtime/pooled-transport.d.ts.map +1 -0
  74. package/dist/runtime/pooled-transport.js +177 -0
  75. package/dist/runtime/pooled-transport.js.map +1 -0
  76. package/dist/runtime/process-io.d.ts +209 -0
  77. package/dist/runtime/process-io.d.ts.map +1 -0
  78. package/dist/runtime/process-io.js +729 -0
  79. package/dist/runtime/process-io.js.map +1 -0
  80. package/dist/runtime/pyodide-io.d.ts +154 -0
  81. package/dist/runtime/pyodide-io.d.ts.map +1 -0
  82. package/dist/runtime/pyodide-io.js +459 -0
  83. package/dist/runtime/pyodide-io.js.map +1 -0
  84. package/dist/runtime/pyodide.d.ts +51 -19
  85. package/dist/runtime/pyodide.d.ts.map +1 -1
  86. package/dist/runtime/pyodide.js +57 -186
  87. package/dist/runtime/pyodide.js.map +1 -1
  88. package/dist/runtime/safe-codec.d.ts +103 -0
  89. package/dist/runtime/safe-codec.d.ts.map +1 -0
  90. package/dist/runtime/safe-codec.js +519 -0
  91. package/dist/runtime/safe-codec.js.map +1 -0
  92. package/dist/runtime/transport.d.ts +191 -0
  93. package/dist/runtime/transport.d.ts.map +1 -0
  94. package/dist/runtime/transport.js +86 -0
  95. package/dist/runtime/transport.js.map +1 -0
  96. package/dist/runtime/validators.d.ts +120 -0
  97. package/dist/runtime/validators.d.ts.map +1 -0
  98. package/dist/runtime/validators.js +229 -0
  99. package/dist/runtime/validators.js.map +1 -0
  100. package/dist/runtime/worker-pool.d.ts +208 -0
  101. package/dist/runtime/worker-pool.d.ts.map +1 -0
  102. package/dist/runtime/worker-pool.js +419 -0
  103. package/dist/runtime/worker-pool.js.map +1 -0
  104. package/dist/types/index.d.ts +51 -1
  105. package/dist/types/index.d.ts.map +1 -1
  106. package/dist/tywrap.d.ts.map +1 -1
  107. package/dist/tywrap.js +227 -328
  108. package/dist/tywrap.js.map +1 -1
  109. package/dist/utils/cache.d.ts.map +1 -1
  110. package/dist/utils/cache.js +53 -5
  111. package/dist/utils/cache.js.map +1 -1
  112. package/dist/utils/codec.d.ts.map +1 -1
  113. package/dist/utils/codec.js +114 -1
  114. package/dist/utils/codec.js.map +1 -1
  115. package/dist/utils/ir-cache.d.ts +28 -0
  116. package/dist/utils/ir-cache.d.ts.map +1 -0
  117. package/dist/utils/ir-cache.js +29 -0
  118. package/dist/utils/ir-cache.js.map +1 -0
  119. package/dist/utils/parallel-processor.d.ts +1 -1
  120. package/dist/utils/parallel-processor.d.ts.map +1 -1
  121. package/dist/utils/parallel-processor.js +111 -40
  122. package/dist/utils/parallel-processor.js.map +1 -1
  123. package/dist/utils/runtime.d.ts +5 -1
  124. package/dist/utils/runtime.d.ts.map +1 -1
  125. package/dist/utils/runtime.js +112 -18
  126. package/dist/utils/runtime.js.map +1 -1
  127. package/package.json +40 -18
  128. package/runtime/python_bridge.py +108 -15
  129. package/runtime/safe_codec.py +344 -0
  130. package/src/cli.ts +61 -2
  131. package/src/config/index.ts +63 -17
  132. package/src/core/analyzer.ts +52 -15
  133. package/src/core/annotation-parser.ts +500 -0
  134. package/src/core/discovery.ts +26 -12
  135. package/src/core/generator.ts +956 -116
  136. package/src/core/mapper.ts +158 -51
  137. package/src/index.ts +78 -6
  138. package/src/runtime/base.ts +18 -26
  139. package/src/runtime/bounded-context.ts +608 -0
  140. package/src/runtime/bridge-core.ts +58 -18
  141. package/src/runtime/bridge-protocol.ts +483 -0
  142. package/src/runtime/disposable.ts +65 -0
  143. package/src/runtime/errors.ts +14 -0
  144. package/src/runtime/http-io.ts +245 -0
  145. package/src/runtime/http.ts +76 -115
  146. package/src/runtime/node.ts +563 -676
  147. package/src/runtime/optimized-node.ts +4 -1
  148. package/src/runtime/pooled-transport.ts +263 -0
  149. package/src/runtime/process-io.ts +930 -0
  150. package/src/runtime/pyodide-io.ts +551 -0
  151. package/src/runtime/pyodide.ts +75 -215
  152. package/src/runtime/safe-codec.ts +651 -0
  153. package/src/runtime/transport.ts +278 -0
  154. package/src/runtime/validators.ts +252 -0
  155. package/src/runtime/worker-pool.ts +559 -0
  156. package/src/types/global.d.ts +11 -1
  157. package/src/types/index.ts +63 -0
  158. package/src/tywrap.ts +279 -358
  159. package/src/utils/cache.ts +59 -5
  160. package/src/utils/codec.ts +122 -1
  161. package/src/utils/ir-cache.ts +51 -0
  162. package/src/utils/parallel-processor.ts +119 -43
  163. package/src/utils/runtime.ts +129 -18
@@ -15,6 +15,15 @@ export class BridgeTimeoutError extends BridgeError {
15
15
  }
16
16
  export class BridgeDisposedError extends BridgeError {
17
17
  }
18
+ export class BridgeCodecError extends BridgeError {
19
+ codecPhase;
20
+ valueType;
21
+ constructor(message, options) {
22
+ super(message, { code: options?.code, cause: options?.cause });
23
+ this.codecPhase = options?.codecPhase;
24
+ this.valueType = options?.valueType;
25
+ }
26
+ }
18
27
  export class BridgeExecutionError extends BridgeError {
19
28
  traceback;
20
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/runtime/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,IAAI,CAAU;IACd,YAAY,OAAe,EAAE,OAA4C;QACvE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,CAAC;QAC1B,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;YAClB,IAAoC,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC9D,CAAC;IACH,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,WAAW;CAAG;AACvD,MAAM,OAAO,kBAAmB,SAAQ,WAAW;CAAG;AACtD,MAAM,OAAO,mBAAoB,SAAQ,WAAW;CAAG;AAEvD,MAAM,OAAO,oBAAqB,SAAQ,WAAW;IACnD,SAAS,CAAU;CACpB"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/runtime/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,IAAI,CAAU;IACd,YAAY,OAAe,EAAE,OAA4C;QACvE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,CAAC;QAC1B,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;YAClB,IAAoC,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC9D,CAAC;IACH,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,WAAW;CAAG;AACvD,MAAM,OAAO,kBAAmB,SAAQ,WAAW;CAAG;AACtD,MAAM,OAAO,mBAAoB,SAAQ,WAAW;CAAG;AAEvD,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC/C,UAAU,CAAU;IACpB,SAAS,CAAU;IAEnB,YACE,OAAe,EACf,OAAqF;QAErF,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,OAAO,EAAE,SAAS,CAAC;IACtC,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,WAAW;IACnD,SAAS,CAAU;CACpB"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * HTTP Transport for BridgeProtocol.
3
+ *
4
+ * Provides stateless HTTP POST-based communication with a Python server.
5
+ * Each request is independent - no connection state is maintained.
6
+ *
7
+ * @see https://github.com/bbopen/tywrap/issues/149
8
+ */
9
+ import type { Transport } from './transport.js';
10
+ /**
11
+ * Configuration options for HttpIO transport.
12
+ */
13
+ export interface HttpIOOptions {
14
+ /** Base URL for the Python server (e.g., 'http://localhost:8000') */
15
+ baseURL: string;
16
+ /** Additional headers to include in each request */
17
+ headers?: Record<string, string>;
18
+ /** Default timeout in milliseconds. Default: 30000 (30 seconds) */
19
+ defaultTimeoutMs?: number;
20
+ }
21
+ /**
22
+ * HTTP-based transport for BridgeProtocol.
23
+ *
24
+ * This transport sends protocol messages as HTTP POST requests to a Python
25
+ * server. It is stateless - each request is independent and the transport
26
+ * is always ready after construction.
27
+ *
28
+ * Features:
29
+ * - Stateless design (init/dispose are no-ops)
30
+ * - Timeout handling via AbortController
31
+ * - External signal support for cancellation
32
+ * - Proper error classification
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const transport = new HttpIO({ baseURL: 'http://localhost:8000' });
37
+ * await transport.init(); // No-op but follows Transport contract
38
+ *
39
+ * const response = await transport.send(
40
+ * JSON.stringify({ id: '1', type: 'call', module: 'math', functionName: 'sqrt', args: [16] }),
41
+ * 5000
42
+ * );
43
+ *
44
+ * await transport.dispose(); // Marks as disposed
45
+ * ```
46
+ */
47
+ export declare class HttpIO implements Transport {
48
+ private readonly baseURL;
49
+ private readonly headers;
50
+ private readonly defaultTimeoutMs;
51
+ private _isDisposed;
52
+ constructor(options: HttpIOOptions);
53
+ /**
54
+ * Initialize the transport.
55
+ *
56
+ * HTTP is stateless, so this is a no-op. The transport is ready
57
+ * immediately after construction.
58
+ */
59
+ init(): Promise<void>;
60
+ /**
61
+ * Dispose the transport.
62
+ *
63
+ * Marks the transport as disposed. Subsequent send() calls will fail.
64
+ */
65
+ dispose(): Promise<void>;
66
+ /**
67
+ * Whether the transport is ready to send messages.
68
+ *
69
+ * Returns true unless dispose() has been called.
70
+ */
71
+ get isReady(): boolean;
72
+ /**
73
+ * Send a message to the Python server and wait for the response.
74
+ *
75
+ * @param message - The JSON-encoded protocol message to send
76
+ * @param timeoutMs - Timeout in milliseconds (0 = no timeout, negative = use default)
77
+ * @param signal - Optional AbortSignal for external cancellation
78
+ * @returns The raw response string (JSON-encoded ProtocolResponse)
79
+ *
80
+ * @throws BridgeDisposedError if the transport has been disposed
81
+ * @throws BridgeTimeoutError if the operation times out or is aborted
82
+ * @throws BridgeExecutionError if the server returns a non-2xx status
83
+ * @throws BridgeProtocolError if the response cannot be read
84
+ */
85
+ send(message: string, timeoutMs: number, signal?: AbortSignal): Promise<string>;
86
+ /**
87
+ * Safely read response body as text, returning empty string on failure.
88
+ */
89
+ private safeReadText;
90
+ }
91
+ //# sourceMappingURL=http-io.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-io.d.ts","sourceRoot":"","sources":["../../src/runtime/http-io.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAMhD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAC;IAEhB,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,MAAO,YAAW,SAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,WAAW,CAAS;gBAEhB,OAAO,EAAE,aAAa;IAclC;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;;OAIG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAMD;;;;;;;;;;;;OAYG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAwGrF;;OAEG;YACW,YAAY;CAO3B"}
@@ -0,0 +1,195 @@
1
+ /**
2
+ * HTTP Transport for BridgeProtocol.
3
+ *
4
+ * Provides stateless HTTP POST-based communication with a Python server.
5
+ * Each request is independent - no connection state is maintained.
6
+ *
7
+ * @see https://github.com/bbopen/tywrap/issues/149
8
+ */
9
+ import { BridgeDisposedError, BridgeExecutionError, BridgeProtocolError, BridgeTimeoutError, } from './errors.js';
10
+ // =============================================================================
11
+ // HTTP TRANSPORT
12
+ // =============================================================================
13
+ /**
14
+ * HTTP-based transport for BridgeProtocol.
15
+ *
16
+ * This transport sends protocol messages as HTTP POST requests to a Python
17
+ * server. It is stateless - each request is independent and the transport
18
+ * is always ready after construction.
19
+ *
20
+ * Features:
21
+ * - Stateless design (init/dispose are no-ops)
22
+ * - Timeout handling via AbortController
23
+ * - External signal support for cancellation
24
+ * - Proper error classification
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * const transport = new HttpIO({ baseURL: 'http://localhost:8000' });
29
+ * await transport.init(); // No-op but follows Transport contract
30
+ *
31
+ * const response = await transport.send(
32
+ * JSON.stringify({ id: '1', type: 'call', module: 'math', functionName: 'sqrt', args: [16] }),
33
+ * 5000
34
+ * );
35
+ *
36
+ * await transport.dispose(); // Marks as disposed
37
+ * ```
38
+ */
39
+ export class HttpIO {
40
+ baseURL;
41
+ headers;
42
+ defaultTimeoutMs;
43
+ _isDisposed = false;
44
+ constructor(options) {
45
+ // Normalize URL - remove trailing slash
46
+ this.baseURL = options.baseURL.replace(/\/$/, '');
47
+ this.headers = {
48
+ 'Content-Type': 'application/json',
49
+ ...options.headers,
50
+ };
51
+ this.defaultTimeoutMs = options.defaultTimeoutMs ?? 30000;
52
+ }
53
+ // ===========================================================================
54
+ // LIFECYCLE
55
+ // ===========================================================================
56
+ /**
57
+ * Initialize the transport.
58
+ *
59
+ * HTTP is stateless, so this is a no-op. The transport is ready
60
+ * immediately after construction.
61
+ */
62
+ async init() {
63
+ // HTTP is stateless - nothing to initialize
64
+ }
65
+ /**
66
+ * Dispose the transport.
67
+ *
68
+ * Marks the transport as disposed. Subsequent send() calls will fail.
69
+ */
70
+ async dispose() {
71
+ this._isDisposed = true;
72
+ }
73
+ /**
74
+ * Whether the transport is ready to send messages.
75
+ *
76
+ * Returns true unless dispose() has been called.
77
+ */
78
+ get isReady() {
79
+ return !this._isDisposed;
80
+ }
81
+ // ===========================================================================
82
+ // SEND
83
+ // ===========================================================================
84
+ /**
85
+ * Send a message to the Python server and wait for the response.
86
+ *
87
+ * @param message - The JSON-encoded protocol message to send
88
+ * @param timeoutMs - Timeout in milliseconds (0 = no timeout, negative = use default)
89
+ * @param signal - Optional AbortSignal for external cancellation
90
+ * @returns The raw response string (JSON-encoded ProtocolResponse)
91
+ *
92
+ * @throws BridgeDisposedError if the transport has been disposed
93
+ * @throws BridgeTimeoutError if the operation times out or is aborted
94
+ * @throws BridgeExecutionError if the server returns a non-2xx status
95
+ * @throws BridgeProtocolError if the response cannot be read
96
+ */
97
+ async send(message, timeoutMs, signal) {
98
+ if (this._isDisposed) {
99
+ throw new BridgeDisposedError('Transport has been disposed');
100
+ }
101
+ // Determine effective timeout
102
+ // 0 = no timeout (per interface contract), negative = use default
103
+ const effectiveTimeout = timeoutMs === 0 ? 0 : timeoutMs > 0 ? timeoutMs : this.defaultTimeoutMs;
104
+ // Create abort controller for timeout
105
+ const controller = new AbortController();
106
+ let timeoutId;
107
+ // Set up timeout if enabled
108
+ if (effectiveTimeout > 0) {
109
+ timeoutId = setTimeout(() => {
110
+ controller.abort();
111
+ }, effectiveTimeout);
112
+ }
113
+ // Handle external signal - abort our controller when external aborts
114
+ const externalAbortHandler = () => {
115
+ controller.abort();
116
+ };
117
+ if (signal) {
118
+ // Check if already aborted
119
+ if (signal.aborted) {
120
+ if (timeoutId !== undefined) {
121
+ clearTimeout(timeoutId);
122
+ }
123
+ throw new BridgeTimeoutError('Operation aborted');
124
+ }
125
+ signal.addEventListener('abort', externalAbortHandler, { once: true });
126
+ }
127
+ try {
128
+ const response = await fetch(this.baseURL, {
129
+ method: 'POST',
130
+ headers: this.headers,
131
+ body: message,
132
+ signal: controller.signal,
133
+ });
134
+ // Handle non-2xx status codes
135
+ if (!response.ok) {
136
+ const errorBody = await this.safeReadText(response);
137
+ throw new BridgeExecutionError(`HTTP ${response.status}: ${errorBody || response.statusText}`, { code: `HTTP_${response.status}` });
138
+ }
139
+ // Read response body
140
+ const responseText = await response.text();
141
+ return responseText;
142
+ }
143
+ catch (error) {
144
+ // Handle abort errors (timeout or external signal)
145
+ if (error instanceof Error && error.name === 'AbortError') {
146
+ // Determine if it was timeout or external abort
147
+ if (signal?.aborted) {
148
+ throw new BridgeTimeoutError('Operation aborted');
149
+ }
150
+ throw new BridgeTimeoutError(`Request timed out after ${effectiveTimeout}ms`);
151
+ }
152
+ // Re-throw bridge errors as-is
153
+ if (error instanceof BridgeTimeoutError ||
154
+ error instanceof BridgeExecutionError ||
155
+ error instanceof BridgeProtocolError) {
156
+ throw error;
157
+ }
158
+ // Wrap network errors
159
+ if (error instanceof TypeError) {
160
+ // fetch throws TypeError for network failures
161
+ throw new BridgeExecutionError(`Network error: ${error.message}`, { cause: error });
162
+ }
163
+ // Wrap unknown errors
164
+ const errorMessage = error instanceof Error ? error.message : String(error);
165
+ throw new BridgeExecutionError(`Request failed: ${errorMessage}`, {
166
+ cause: error instanceof Error ? error : undefined,
167
+ });
168
+ }
169
+ finally {
170
+ // Clean up timeout
171
+ if (timeoutId !== undefined) {
172
+ clearTimeout(timeoutId);
173
+ }
174
+ // Clean up external signal listener
175
+ if (signal) {
176
+ signal.removeEventListener('abort', externalAbortHandler);
177
+ }
178
+ }
179
+ }
180
+ // ===========================================================================
181
+ // HELPERS
182
+ // ===========================================================================
183
+ /**
184
+ * Safely read response body as text, returning empty string on failure.
185
+ */
186
+ async safeReadText(response) {
187
+ try {
188
+ return await response.text();
189
+ }
190
+ catch {
191
+ return '';
192
+ }
193
+ }
194
+ }
195
+ //# sourceMappingURL=http-io.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-io.js","sourceRoot":"","sources":["../../src/runtime/http-io.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAqBrB,gFAAgF;AAChF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AAY,CAAC,SAAS,CAAC,CAAC;YAC1B,CAAC;YAED,oCAAoC;YACpC,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;IACH,CAAC;IAED,8EAA8E;IAC9E,UAAU;IACV,8EAA8E;IAE9E;;OAEG;IACK,KAAK,CAAC,YAAY,CAAC,QAAkB;QAC3C,IAAI,CAAC;YACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
@@ -1,22 +1,57 @@
1
1
  /**
2
- * HTTP runtime bridge
2
+ * HTTP runtime bridge for BridgeProtocol.
3
+ *
4
+ * HttpBridge extends BridgeProtocol and uses HttpIO transport for
5
+ * stateless HTTP POST-based communication with a Python server.
6
+ *
7
+ * @see https://github.com/bbopen/tywrap/issues/149
8
+ */
9
+ import { BridgeProtocol } from './bridge-protocol.js';
10
+ import type { CodecOptions } from './safe-codec.js';
11
+ /**
12
+ * Configuration options for HttpBridge.
3
13
  */
4
- import { RuntimeBridge } from './base.js';
5
14
  export interface HttpBridgeOptions {
15
+ /** Base URL for the Python server (e.g., 'http://localhost:8000') */
6
16
  baseURL: string;
17
+ /** Additional headers to include in each request */
7
18
  headers?: Record<string, string>;
19
+ /** Timeout in ms for requests. Default: 30000 (30 seconds) */
8
20
  timeoutMs?: number;
21
+ /** Codec options for validation/serialization */
22
+ codec?: CodecOptions;
9
23
  }
10
- export declare class HttpBridge extends RuntimeBridge {
11
- private readonly baseURL;
12
- private readonly headers;
13
- private readonly timeoutMs;
14
- constructor(options?: HttpBridgeOptions);
15
- call<T = unknown>(module: string, functionName: string, args: unknown[], kwargs?: Record<string, unknown>): Promise<T>;
16
- instantiate<T = unknown>(module: string, className: string, args: unknown[], kwargs?: Record<string, unknown>): Promise<T>;
17
- callMethod<T = unknown>(handle: string, methodName: string, args: unknown[], kwargs?: Record<string, unknown>): Promise<T>;
18
- disposeInstance(handle: string): Promise<void>;
19
- dispose(): Promise<void>;
20
- private post;
24
+ /**
25
+ * HTTP-based runtime bridge for executing Python code.
26
+ *
27
+ * HttpBridge provides a stateless HTTP transport for communication with
28
+ * a Python server. Each request is independent - no connection state is
29
+ * maintained between calls.
30
+ *
31
+ * Features:
32
+ * - Stateless HTTP POST communication
33
+ * - Timeout handling via AbortController
34
+ * - Full SafeCodec validation (NaN/Infinity rejection, key validation)
35
+ * - Automatic Arrow decoding for DataFrames/ndarrays
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const bridge = new HttpBridge({ baseURL: 'http://localhost:8000' });
40
+ * await bridge.init();
41
+ *
42
+ * const result = await bridge.call('math', 'sqrt', [16]);
43
+ * console.log(result); // 4.0
44
+ *
45
+ * await bridge.dispose();
46
+ * ```
47
+ */
48
+ export declare class HttpBridge extends BridgeProtocol {
49
+ /**
50
+ * Create a new HttpBridge instance.
51
+ *
52
+ * @param options - Configuration options for the bridge
53
+ */
54
+ constructor(options: HttpBridgeOptions);
55
+ protected doInit(): Promise<void>;
21
56
  }
22
57
  //# sourceMappingURL=http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/runtime/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA2BD,qBAAa,UAAW,SAAQ,aAAa;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,QAAQ,CAAC,SAAS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C,EAAE,YAAY,CAAC;CACtB;AAMD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,UAAW,SAAQ,cAAc;IAC5C;;;;OAIG;gBACS,OAAO,EAAE,iBAAiB;cAkBtB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAKxC"}
@@ -1,79 +1,66 @@
1
1
  /**
2
- * HTTP runtime bridge
2
+ * HTTP runtime bridge for BridgeProtocol.
3
+ *
4
+ * HttpBridge extends BridgeProtocol and uses HttpIO transport for
5
+ * stateless HTTP POST-based communication with a Python server.
6
+ *
7
+ * @see https://github.com/bbopen/tywrap/issues/149
3
8
  */
4
- import { decodeValueAsync } from '../utils/codec.js';
5
- import { RuntimeBridge } from './base.js';
6
- export class HttpBridge extends RuntimeBridge {
7
- baseURL;
8
- headers;
9
- timeoutMs;
10
- constructor(options = { baseURL: 'http://localhost:8000' }) {
11
- super();
12
- this.baseURL = options.baseURL.replace(/\/$/, '');
13
- this.headers = { 'content-type': 'application/json', ...(options.headers ?? {}) };
14
- this.timeoutMs = options.timeoutMs ?? 30000;
15
- }
16
- async call(module, functionName, args, kwargs) {
17
- const payload = { module, functionName, args, kwargs };
18
- const res = await this.post(`${this.baseURL}/call`, payload);
19
- return (await decodeValueAsync(res));
20
- }
21
- async instantiate(module, className, args, kwargs) {
22
- const payload = { module, className, args, kwargs };
23
- const res = await this.post(`${this.baseURL}/instantiate`, payload);
24
- return (await decodeValueAsync(res));
25
- }
26
- async callMethod(handle, methodName, args, kwargs) {
27
- const payload = { handle, methodName, args, kwargs };
28
- const res = await this.post(`${this.baseURL}/call_method`, payload);
29
- return (await decodeValueAsync(res));
30
- }
31
- async disposeInstance(handle) {
32
- const payload = { handle };
33
- await this.post(`${this.baseURL}/dispose_instance`, payload);
34
- }
35
- async dispose() {
36
- // stateless
37
- }
38
- async post(url, body) {
39
- const controller = typeof AbortController !== 'undefined' ? new AbortController() : undefined;
40
- const timer = controller ? setTimeout(() => controller.abort(), this.timeoutMs) : undefined;
41
- try {
42
- const resp = await fetch(url, {
43
- method: 'POST',
44
- headers: this.headers,
45
- body: JSON.stringify(body),
46
- signal: controller?.signal,
47
- });
48
- if (!resp.ok) {
49
- const text = await safeText(resp);
50
- throw new Error(`HTTP ${resp.status}: ${text || resp.statusText}`);
51
- }
52
- const ct = resp.headers.get('content-type') ?? '';
53
- if (ct.includes('application/json')) {
54
- return (await resp.json());
55
- }
56
- const text = await resp.text();
57
- try {
58
- return JSON.parse(text);
59
- }
60
- catch {
61
- return text;
62
- }
63
- }
64
- finally {
65
- if (timer) {
66
- clearTimeout(timer);
67
- }
68
- }
69
- }
70
- }
71
- async function safeText(resp) {
72
- try {
73
- return await resp.text();
9
+ import { BridgeProtocol } from './bridge-protocol.js';
10
+ import { HttpIO } from './http-io.js';
11
+ import { autoRegisterArrowDecoder } from '../utils/codec.js';
12
+ // =============================================================================
13
+ // HTTP BRIDGE
14
+ // =============================================================================
15
+ /**
16
+ * HTTP-based runtime bridge for executing Python code.
17
+ *
18
+ * HttpBridge provides a stateless HTTP transport for communication with
19
+ * a Python server. Each request is independent - no connection state is
20
+ * maintained between calls.
21
+ *
22
+ * Features:
23
+ * - Stateless HTTP POST communication
24
+ * - Timeout handling via AbortController
25
+ * - Full SafeCodec validation (NaN/Infinity rejection, key validation)
26
+ * - Automatic Arrow decoding for DataFrames/ndarrays
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const bridge = new HttpBridge({ baseURL: 'http://localhost:8000' });
31
+ * await bridge.init();
32
+ *
33
+ * const result = await bridge.call('math', 'sqrt', [16]);
34
+ * console.log(result); // 4.0
35
+ *
36
+ * await bridge.dispose();
37
+ * ```
38
+ */
39
+ export class HttpBridge extends BridgeProtocol {
40
+ /**
41
+ * Create a new HttpBridge instance.
42
+ *
43
+ * @param options - Configuration options for the bridge
44
+ */
45
+ constructor(options) {
46
+ // Create HTTP transport
47
+ const transport = new HttpIO({
48
+ baseURL: options.baseURL,
49
+ headers: options.headers,
50
+ defaultTimeoutMs: options.timeoutMs,
51
+ });
52
+ // Initialize BridgeProtocol with transport and codec options
53
+ const protocolOptions = {
54
+ transport,
55
+ codec: options.codec,
56
+ defaultTimeoutMs: options.timeoutMs,
57
+ };
58
+ super(protocolOptions);
74
59
  }
75
- catch {
76
- return '';
60
+ async doInit() {
61
+ // Best-effort: keep apache-arrow optional and avoid breaking non-Node runtimes.
62
+ await autoRegisterArrowDecoder();
63
+ await super.doInit();
77
64
  }
78
65
  }
79
66
  //# sourceMappingURL=http.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/runtime/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAiC1C,MAAM,OAAO,UAAW,SAAQ,aAAa;IAC1B,OAAO,CAAS;IAChB,OAAO,CAAyB;IAChC,SAAS,CAAS;IAEnC,YAAY,UAA6B,EAAE,OAAO,EAAE,uBAAuB,EAAE;QAC3E,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO,GAAG,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;QAClF,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,IAAI,CACR,MAAc,EACd,YAAoB,EACpB,IAAe,EACf,MAAgC;QAEhC,MAAM,OAAO,GAAoB,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACxE,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,OAAO,EAAE,O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