shioricode 0.5.2 → 0.5.3

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 (43) hide show
  1. package/README.md +22 -1
  2. package/dist/BunHttpServer-BvXfeDdm.cjs +375 -0
  3. package/dist/BunPTY-l5TwbZzE.cjs +91 -0
  4. package/dist/BunServices-07vLsX26.cjs +74 -0
  5. package/dist/NodeHttpServer-OQzpZjfj.cjs +4142 -0
  6. package/dist/NodePTY-BNeKL1sW.cjs +86 -0
  7. package/dist/NodeSqliteClient-K1HOOjni.cjs +147 -0
  8. package/dist/SqlError-UTW5yuSG.cjs +262 -0
  9. package/dist/SqliteClient-CVOnk2wf.cjs +125 -0
  10. package/dist/bin.cjs +703700 -0
  11. package/dist/bin.mjs +386 -142
  12. package/dist/client/apple-touch-icon.png +0 -0
  13. package/dist/client/assets/{ArtifactPanel-BPQ8FX7l.js → ArtifactPanel-ClA97FO8.js} +2 -2
  14. package/dist/client/assets/{ChatMarkdown-jcE8Pq97.js → ChatMarkdown-DkldD1_B.js} +2 -2
  15. package/dist/client/assets/{DiffPanel-CPmbtIC0.js → DiffPanel-BYSH-G7M.js} +2 -2
  16. package/dist/client/assets/{DiffPanelShell-CqS9jPrk.js → DiffPanelShell-Ce2wOE9L.js} +2 -2
  17. package/dist/client/assets/{DiffWorkerPoolProvider-CEnxoS9v.js → DiffWorkerPoolProvider-DjSdGkRQ.js} +2 -2
  18. package/dist/client/assets/{NoActiveThreadState-Bt_jFQ4-.js → NoActiveThreadState-CVDfDuF2.js} +2 -2
  19. package/dist/client/assets/{ProviderModelPicker-BRDu3BzU.js → ProviderModelPicker-BFlX8lZL.js} +2 -2
  20. package/dist/client/assets/{SettingsPanels-BX2dAbn4.js → SettingsPanels-_8_YaXgc.js} +2 -2
  21. package/dist/client/assets/{_chat-C_aCgqFw.js → _chat-CQ5UewiP.js} +2 -2
  22. package/dist/client/assets/{_chat._threadId-DLIOcnXQ.js → _chat._threadId-5846z-_l.js} +5 -5
  23. package/dist/client/assets/{_chat.index-B9u7xlCv.js → _chat.index-DI7egWLc.js} +2 -2
  24. package/dist/client/assets/{automations-CJVFqqLv.js → automations-D6SQKJ83.js} +2 -2
  25. package/dist/client/assets/{dialog-BwIZs3EF.js → dialog-CZ2IjObB.js} +2 -2
  26. package/dist/client/assets/{index-DKZPXV4a.js → index-B42nGfCf.js} +4 -4
  27. package/dist/client/assets/{pull-requests-CQHYo-fV.js → pull-requests-DGa0NhIZ.js} +2 -2
  28. package/dist/client/assets/{settings-i7-rb7s9.js → settings-BwPioqTL.js} +2 -2
  29. package/dist/client/assets/{settings.appearance-Dwkl1cOq.js → settings.appearance-DxQzPuf5.js} +2 -2
  30. package/dist/client/assets/{settings.archived-DZPSjNZJ.js → settings.archived-BSqIxOKY.js} +2 -2
  31. package/dist/client/assets/{settings.computer-use-CLy6GP7W.js → settings.computer-use-DuuUffvc.js} +2 -2
  32. package/dist/client/assets/{settings.general-CuNCor2d.js → settings.general-DjIbwGSI.js} +2 -2
  33. package/dist/client/assets/{settings.mcp-DwWQDGSB.js → settings.mcp-CHZOA1L-.js} +2 -2
  34. package/dist/client/assets/{settings.mobile-B73fICiz.js → settings.mobile-D3UiSzxp.js} +2 -2
  35. package/dist/client/assets/{settings.plugins-BjW05gj4.js → settings.plugins-qo7Fls2x.js} +2 -2
  36. package/dist/client/assets/{settings.remote-D_iWhzEN.js → settings.remote-CmdhJhKY.js} +2 -2
  37. package/dist/client/assets/{settings.skills-BCB4uvnE.js → settings.skills-UB5Wtkl5.js} +2 -2
  38. package/dist/client/assets/{settings.theme-builder-CS2XB4es.js → settings.theme-builder-CnwNYRga.js} +2 -2
  39. package/dist/client/favicon-16x16.png +0 -0
  40. package/dist/client/favicon-32x32.png +0 -0
  41. package/dist/client/favicon.ico +0 -0
  42. package/dist/client/index.html +1 -1
  43. package/package.json +38 -5
package/README.md CHANGED
@@ -20,7 +20,28 @@ sudo shioricode doctor
20
20
  sudo shioricode link connect --name "Build server"
21
21
  ```
22
22
 
23
- `service install` creates a dedicated operating-system account and installs the native background mechanism for the host: systemd on Linux, launchd on macOS, or a startup task on Windows. ShioriCode listens on loopback and keeps a local recovery login.
23
+ `service install` defaults to a dedicated operating-system account and installs the native background mechanism for the host: systemd on Linux, launchd on macOS, or a startup task on Windows. ShioriCode listens on loopback and keeps a local recovery login.
24
+
25
+ Account selection and service paths are explicit CLI options. Reuse the invoking user when you want the service to inherit that user's provider homes and credentials:
26
+
27
+ ```sh
28
+ shioricode service install --account current --no-recovery-login
29
+
30
+ # Or customize a dedicated account and service layout.
31
+ sudo shioricode service install \
32
+ --account dedicated \
33
+ --user shioricode \
34
+ --home-dir /var/lib/shioricode \
35
+ --state-dir /var/lib/shioricode \
36
+ --workspace-dir /srv/shioricode/workspaces \
37
+ --log-file /var/log/shioricode/server.log \
38
+ --service-path /usr/local/bin:/usr/bin:/bin \
39
+ --port 3773 \
40
+ --recovery-username owner \
41
+ --recovery-password-file /root/shioricode-recovery-password
42
+ ```
43
+
44
+ `--account current` installs a per-user systemd service, macOS LaunchAgent, or Windows scheduled task without administrator access. `--account dedicated` installs the system-level service and still requires `sudo`/Administrator. `--no-recovery-login` keeps hosted access GitHub-only; omit it when you also want a direct/Tailscale recovery login. `--recovery-password-file` avoids exposing that password through shell history or the process list. Without either flag, installation generates a recovery password and prints it once. The selected account, paths, and port are persisted so subsequent `service`, `doctor`, `remote`, and `link` commands target the same installation.
24
45
 
25
46
  The command also stages a private, read-only copy of Node and ShioriCode beneath the service data directory. The daemon therefore keeps working even when the npm installation came from NVM, a macOS user directory, or Windows AppData. After upgrading the global npm package, run `service install` again to atomically switch the background service to the new runtime.
26
47
 
@@ -0,0 +1,375 @@
1
+ #!/usr/bin/env node
2
+
3
+ const require_bin = require('./bin.cjs');
4
+ const require_BunServices = require('./BunServices-07vLsX26.cjs');
5
+
6
+ //#region ../../node_modules/@effect/platform-bun/dist/BunHttpPlatform.js
7
+ /**
8
+ * @since 1.0.0
9
+ * @category constructors
10
+ */
11
+ const make$1 = /* @__PURE__ */ require_bin.make$1({
12
+ fileResponse(path, status, statusText, headers, start, end, _contentLength) {
13
+ let file = Bun.file(path);
14
+ if (start > 0 || end !== void 0) file = file.slice(start, end);
15
+ return require_bin.raw(file, {
16
+ headers,
17
+ status,
18
+ statusText
19
+ });
20
+ },
21
+ fileWebResponse(file, status, statusText, headers, _options) {
22
+ return require_bin.raw(file, {
23
+ headers,
24
+ status,
25
+ statusText
26
+ });
27
+ }
28
+ });
29
+ /**
30
+ * @since 1.0.0
31
+ * @category Layers
32
+ */
33
+ const layer$1 = /* @__PURE__ */ require_bin.effect(require_bin.HttpPlatform)(make$1).pipe(/* @__PURE__ */ require_bin.provide(require_BunServices.layer$1), /* @__PURE__ */ require_bin.provide(require_bin.layer$1));
34
+
35
+ //#endregion
36
+ //#region ../../node_modules/@effect/platform-bun/dist/BunStream.js
37
+ /**
38
+ * @since 1.0.0
39
+ */
40
+ /**
41
+ * An optimized version of `Stream.fromReadableStream` that uses the Bun
42
+ * .readMany API to read multiple values at once from a `ReadableStream`.
43
+ *
44
+ * @since 1.0.0
45
+ */
46
+ const fromReadableStream = (options) => require_bin.fromChannel(require_bin.fromTransform(require_bin.fnUntraced(function* (_, scope) {
47
+ const reader = options.evaluate().getReader();
48
+ yield* require_bin.addFinalizer$1(scope, options.releaseLockOnEnd ? require_bin.sync(() => reader.releaseLock()) : require_bin.promise(() => reader.cancel()));
49
+ const readMany = require_bin.callback((resume) => {
50
+ const result = reader.readMany();
51
+ if ("then" in result) result.then((_) => resume(require_bin.succeed(_)), (e) => resume(require_bin.fail$1(options.onError(e))));
52
+ else resume(require_bin.succeed(result));
53
+ });
54
+ return require_bin.flatMap(readMany, function loop({ done: done$1, value }) {
55
+ if (done$1) return require_bin.done();
56
+ else if (!require_bin.isReadonlyArrayNonEmpty(value)) return require_bin.flatMap(readMany, loop);
57
+ return require_bin.succeed(value);
58
+ });
59
+ })));
60
+
61
+ //#endregion
62
+ //#region ../../node_modules/@effect/platform-bun/dist/BunMultipart.js
63
+ /**
64
+ * @since 1.0.0
65
+ * @category Constructors
66
+ */
67
+ const stream = (source) => fromReadableStream({
68
+ evaluate: () => source.body,
69
+ onError: (cause) => require_bin.MultipartError.fromReason("InternalError", cause)
70
+ }).pipe(require_bin.pipeThroughChannel(require_bin.makeChannel(Object.fromEntries(source.headers))));
71
+ /**
72
+ * @since 1.0.0
73
+ * @category Constructors
74
+ */
75
+ const persisted = (source) => require_bin.toPersisted(stream(source));
76
+
77
+ //#endregion
78
+ //#region ../../node_modules/@effect/platform-bun/dist/BunHttpServer.js
79
+ /**
80
+ * @since 1.0.0
81
+ * @category Constructors
82
+ */
83
+ const make = /* @__PURE__ */ require_bin.fnUntraced(function* (options) {
84
+ const scope$1 = yield* require_bin.scope;
85
+ const handlerStack = [function(_request, _server) {
86
+ return new Response("not found", { status: 404 });
87
+ }];
88
+ const server = Bun.serve({
89
+ ...options,
90
+ fetch: handlerStack[0],
91
+ websocket: {
92
+ open(ws) {
93
+ require_bin.doneUnsafe(ws.data.deferred, require_bin.succeed$2(ws));
94
+ },
95
+ message(ws, message) {
96
+ ws.data.run(message);
97
+ },
98
+ close(ws, code, closeReason) {
99
+ code = typeof code === "number" ? code : 1001;
100
+ require_bin.doneUnsafe(ws.data.closeDeferred, require_bin.defaultCloseCodeIsError(code) ? require_bin.fail$2(new require_bin.SocketError({ reason: new require_bin.SocketCloseError({
101
+ code,
102
+ closeReason
103
+ }) })) : require_bin.void_$1);
104
+ }
105
+ }
106
+ });
107
+ const shutdown = yield* require_bin.promise(() => server.stop()).pipe(require_bin.cached);
108
+ const preemptiveShutdown = options.disablePreemptiveShutdown ? require_bin.void_ : require_bin.timeoutOrElse(shutdown, {
109
+ duration: options.gracefulShutdownTimeout ?? require_bin.seconds(20),
110
+ orElse: () => require_bin.void_
111
+ });
112
+ yield* require_bin.addFinalizer$1(scope$1, shutdown);
113
+ return require_bin.make({
114
+ address: {
115
+ _tag: "TcpAddress",
116
+ port: server.port,
117
+ hostname: server.hostname
118
+ },
119
+ serve: require_bin.fnUntraced(function* (httpApp, middleware) {
120
+ const parent = yield* require_bin.fiber;
121
+ const services = parent.services;
122
+ const serveScope = require_bin.getUnsafe(services, require_bin.Scope);
123
+ const scope = require_bin.forkUnsafe(serveScope, "parallel");
124
+ const httpEffect = require_bin.toHandled(httpApp, (request, response) => require_bin.sync(() => {
125
+ request.resolve(makeResponse(request, response, services, scope));
126
+ }), middleware);
127
+ function handler(request, server) {
128
+ return new Promise((resolve, _reject) => {
129
+ const map = new Map(services.mapUnsafe);
130
+ map.set(require_bin.HttpServerRequest.key, new BunServerRequest(request, resolve, removeHost(request.url), server));
131
+ const fiber = require_bin.runIn(require_bin.runForkWith(require_bin.makeUnsafe$3(map))(httpEffect), scope);
132
+ request.signal.addEventListener("abort", () => {
133
+ fiber.interruptUnsafe(parent.id, require_bin.ClientAbort.annotation);
134
+ }, { once: true });
135
+ });
136
+ }
137
+ yield* require_bin.addFinalizerExit(serveScope, () => {
138
+ handlerStack.pop();
139
+ server.reload({ fetch: handlerStack[handlerStack.length - 1] });
140
+ return preemptiveShutdown;
141
+ });
142
+ handlerStack.push(handler);
143
+ server.reload({ fetch: handler });
144
+ })
145
+ });
146
+ });
147
+ const makeResponse = (request, response, services, scope) => {
148
+ const fields = {
149
+ headers: new globalThis.Headers(response.headers),
150
+ status: response.status
151
+ };
152
+ if (!require_bin.isEmpty(response.cookies)) for (const header of require_bin.toSetCookieHeaders(response.cookies)) fields.headers.append("set-cookie", header);
153
+ if (response.statusText !== void 0) fields.statusText = response.statusText;
154
+ if (request.method === "HEAD") return new Response(void 0, fields);
155
+ response = require_bin.scopeTransferToStream(response);
156
+ const body = response.body;
157
+ switch (body._tag) {
158
+ case "Empty": return new Response(void 0, fields);
159
+ case "Uint8Array":
160
+ case "Raw":
161
+ if (body.body instanceof Response) {
162
+ for (const [key, value] of fields.headers.entries()) body.body.headers.set(key, value);
163
+ return body.body;
164
+ }
165
+ return new Response(body.body, fields);
166
+ case "FormData": return new Response(body.formData, fields);
167
+ case "Stream": return new Response(require_bin.toReadableStreamWith(require_bin.unwrap$1(require_bin.withFiber((fiber) => {
168
+ require_bin.runIn(fiber, scope);
169
+ return require_bin.succeed(body.stream);
170
+ })), services), fields);
171
+ }
172
+ };
173
+ /**
174
+ * @since 1.0.0
175
+ * @category Layers
176
+ */
177
+ const layerServer = /* @__PURE__ */ require_bin.flow(make, /* @__PURE__ */ require_bin.effect(require_bin.HttpServer));
178
+ /**
179
+ * @since 1.0.0
180
+ * @category Layers
181
+ */
182
+ const layerHttpServices = /* @__PURE__ */ require_bin.mergeAll(layer$1, require_bin.layerWeak, require_BunServices.layer);
183
+ /**
184
+ * @since 1.0.0
185
+ * @category Layers
186
+ */
187
+ const layer = (options) => require_bin.mergeAll(layerServer(options), layerHttpServices);
188
+ /**
189
+ * @since 1.0.0
190
+ * @category Layers
191
+ */
192
+ const layerTest = /* @__PURE__ */ require_bin.layerTestClient.pipe(/* @__PURE__ */ require_bin.provide(/* @__PURE__ */ require_bin.layer.pipe(/* @__PURE__ */ require_bin.provide(/* @__PURE__ */ require_bin.succeed$1(require_bin.RequestInit)({ keepalive: false })))), /* @__PURE__ */ require_bin.provideMerge(/* @__PURE__ */ layer({ port: 0 })));
193
+ /**
194
+ * @since 1.0.0
195
+ * @category Layers
196
+ */
197
+ const layerConfig = (options) => require_bin.mergeAll(require_bin.effect(require_bin.HttpServer)(require_bin.flatMap(require_bin.unwrap(options).asEffect(), make)), layerHttpServices);
198
+ function wsDefaultRun(_) {
199
+ this.buffer.push(_);
200
+ }
201
+ var BunServerRequest = class BunServerRequest extends require_bin.Class {
202
+ [require_bin.TypeId];
203
+ [require_bin.TypeId$3];
204
+ source;
205
+ resolve;
206
+ url;
207
+ bunServer;
208
+ headersOverride;
209
+ remoteAddressOverride;
210
+ constructor(source, resolve, url, bunServer, headersOverride, remoteAddressOverride) {
211
+ super();
212
+ this[require_bin.TypeId] = require_bin.TypeId;
213
+ this[require_bin.TypeId$3] = require_bin.TypeId$3;
214
+ this.source = source;
215
+ this.resolve = resolve;
216
+ this.url = url;
217
+ this.bunServer = bunServer;
218
+ this.headersOverride = headersOverride;
219
+ this.remoteAddressOverride = remoteAddressOverride;
220
+ }
221
+ toJSON() {
222
+ return require_bin.inspect(this, {
223
+ _id: "HttpServerRequest",
224
+ method: this.method,
225
+ url: this.originalUrl
226
+ });
227
+ }
228
+ modify(options) {
229
+ return new BunServerRequest(this.source, this.resolve, options.url ?? this.url, this.bunServer, options.headers ?? this.headersOverride, "remoteAddress" in options ? options.remoteAddress : this.remoteAddressOverride);
230
+ }
231
+ get method() {
232
+ return this.source.method.toUpperCase();
233
+ }
234
+ get originalUrl() {
235
+ return this.source.url;
236
+ }
237
+ get remoteAddress() {
238
+ return this.remoteAddressOverride ?? require_bin.fromNullishOr(this.bunServer.requestIP(this.source)?.address);
239
+ }
240
+ get headers() {
241
+ this.headersOverride ??= require_bin.fromInput$1(this.source.headers);
242
+ return this.headersOverride;
243
+ }
244
+ cachedCookies;
245
+ get cookies() {
246
+ if (this.cachedCookies) return this.cachedCookies;
247
+ return this.cachedCookies = require_bin.parseHeader(this.headers.cookie ?? "");
248
+ }
249
+ get stream() {
250
+ return this.source.body ? fromReadableStream({
251
+ evaluate: () => this.source.body,
252
+ onError: (cause) => new require_bin.HttpServerError({ reason: new require_bin.RequestParseError({
253
+ request: this,
254
+ cause
255
+ }) })
256
+ }) : require_bin.fail(new require_bin.HttpServerError({ reason: new require_bin.RequestParseError({
257
+ request: this,
258
+ description: "can not create stream from empty body"
259
+ }) }));
260
+ }
261
+ textEffect;
262
+ get text() {
263
+ if (this.textEffect) return this.textEffect;
264
+ this.textEffect = require_bin.runSync(require_bin.cached(require_bin.tryPromise({
265
+ try: () => this.source.text(),
266
+ catch: (cause) => new require_bin.HttpServerError({ reason: new require_bin.RequestParseError({
267
+ request: this,
268
+ cause
269
+ }) })
270
+ })));
271
+ return this.textEffect;
272
+ }
273
+ get json() {
274
+ return require_bin.flatMap(this.text, (_) => require_bin.try_({
275
+ try: () => JSON.parse(_),
276
+ catch: (cause) => new require_bin.HttpServerError({ reason: new require_bin.RequestParseError({
277
+ request: this,
278
+ cause
279
+ }) })
280
+ }));
281
+ }
282
+ get urlParamsBody() {
283
+ return require_bin.flatMap(this.text, (_) => require_bin.try_({
284
+ try: () => require_bin.fromInput(new URLSearchParams(_)),
285
+ catch: (cause) => new require_bin.HttpServerError({ reason: new require_bin.RequestParseError({
286
+ request: this,
287
+ cause
288
+ }) })
289
+ }));
290
+ }
291
+ multipartEffect;
292
+ get multipart() {
293
+ if (this.multipartEffect) return this.multipartEffect;
294
+ this.multipartEffect = require_bin.runSync(require_bin.cached(persisted(this.source)));
295
+ return this.multipartEffect;
296
+ }
297
+ get multipartStream() {
298
+ return stream(this.source);
299
+ }
300
+ arrayBufferEffect;
301
+ get arrayBuffer() {
302
+ if (this.arrayBufferEffect) return this.arrayBufferEffect;
303
+ this.arrayBufferEffect = require_bin.runSync(require_bin.cached(require_bin.tryPromise({
304
+ try: () => this.source.arrayBuffer(),
305
+ catch: (cause) => new require_bin.HttpServerError({ reason: new require_bin.RequestParseError({
306
+ request: this,
307
+ cause
308
+ }) })
309
+ })));
310
+ return this.arrayBufferEffect;
311
+ }
312
+ get upgrade() {
313
+ return require_bin.callback((resume) => {
314
+ const deferred = require_bin.makeUnsafe$2();
315
+ const closeDeferred = require_bin.makeUnsafe$2();
316
+ const semaphore = require_bin.makeUnsafe(1);
317
+ if (!this.bunServer.upgrade(this.source, { data: {
318
+ deferred,
319
+ closeDeferred,
320
+ buffer: [],
321
+ run: wsDefaultRun
322
+ } })) {
323
+ resume(require_bin.fail$1(new require_bin.HttpServerError({ reason: new require_bin.RequestParseError({
324
+ request: this,
325
+ description: "Not an upgradeable ServerRequest"
326
+ }) })));
327
+ return;
328
+ }
329
+ resume(require_bin.map$1(require_bin._await(deferred), (ws) => {
330
+ const write = (chunk) => require_bin.sync(() => {
331
+ if (typeof chunk === "string") ws.sendText(chunk);
332
+ else if (require_bin.isCloseEvent(chunk)) ws.close(chunk.code, chunk.reason);
333
+ else ws.sendBinary(chunk);
334
+ return true;
335
+ });
336
+ const writer = require_bin.succeed(write);
337
+ const runRaw = require_bin.fnUntraced(function* (handler, opts) {
338
+ const set = yield* require_bin.make$4();
339
+ const run = yield* require_bin.runtime(set)();
340
+ function runRaw(data) {
341
+ const result = handler(data);
342
+ if (require_bin.isEffect(result)) run(result);
343
+ }
344
+ ws.data.run = runRaw;
345
+ ws.data.buffer.forEach(runRaw);
346
+ ws.data.buffer.length = 0;
347
+ if (opts?.onOpen) yield* opts.onOpen;
348
+ return yield* require_bin.join(set);
349
+ }, require_bin.scoped, require_bin.onExit((exit) => require_bin.sync(() => ws.close(exit._tag === "Success" ? 1e3 : 1011))), require_bin.raceFirst(require_bin._await(closeDeferred)), semaphore.withPermits(1));
350
+ const encoder = new TextEncoder();
351
+ const run = (handler, opts) => runRaw((data) => typeof data === "string" ? handler(encoder.encode(data)) : handler(data), opts);
352
+ return require_bin.Socket.of({
353
+ [require_bin.TypeId$2]: require_bin.TypeId$2,
354
+ run,
355
+ runRaw,
356
+ writer
357
+ });
358
+ }));
359
+ });
360
+ }
361
+ };
362
+ const removeHost = (url) => {
363
+ if (url[0] === "/") return url;
364
+ const index = url.indexOf("/", url.indexOf("//") + 2);
365
+ return index === -1 ? "/" : url.slice(index);
366
+ };
367
+
368
+ //#endregion
369
+ exports.layer = layer;
370
+ exports.layerConfig = layerConfig;
371
+ exports.layerHttpServices = layerHttpServices;
372
+ exports.layerServer = layerServer;
373
+ exports.layerTest = layerTest;
374
+ exports.make = make;
375
+ //# sourceMappingURL=BunHttpServer-BvXfeDdm.cjs.map
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+
3
+ const require_bin = require('./bin.cjs');
4
+
5
+ //#region src/terminal/Layers/BunPTY.ts
6
+ var BunPtyProcess = class {
7
+ dataListeners = /* @__PURE__ */ new Set();
8
+ exitListeners = /* @__PURE__ */ new Set();
9
+ decoder = new TextDecoder();
10
+ didExit = false;
11
+ constructor(process) {
12
+ this.process = process;
13
+ this.process.exited.then((exitCode) => {
14
+ this.emitExit({
15
+ exitCode: Number.isInteger(exitCode) ? exitCode : 0,
16
+ signal: typeof this.process.signalCode === "number" ? this.process.signalCode : null
17
+ });
18
+ }).catch(() => {
19
+ this.emitExit({
20
+ exitCode: 1,
21
+ signal: null
22
+ });
23
+ });
24
+ }
25
+ get pid() {
26
+ return this.process.pid;
27
+ }
28
+ write(data) {
29
+ if (!this.process.terminal) throw new Error("Bun PTY terminal handle is unavailable");
30
+ this.process.terminal.write(data);
31
+ }
32
+ resize(cols, rows) {
33
+ if (!this.process.terminal?.resize) throw new Error("Bun PTY resize is unavailable");
34
+ this.process.terminal.resize(cols, rows);
35
+ }
36
+ kill(signal) {
37
+ if (!signal) {
38
+ this.process.kill();
39
+ return;
40
+ }
41
+ this.process.kill(signal);
42
+ }
43
+ onData(callback) {
44
+ this.dataListeners.add(callback);
45
+ return () => {
46
+ this.dataListeners.delete(callback);
47
+ };
48
+ }
49
+ onExit(callback) {
50
+ this.exitListeners.add(callback);
51
+ return () => {
52
+ this.exitListeners.delete(callback);
53
+ };
54
+ }
55
+ emitData(data) {
56
+ if (this.didExit) return;
57
+ const text = this.decoder.decode(data, { stream: true });
58
+ if (text.length === 0) return;
59
+ for (const listener of this.dataListeners) listener(text);
60
+ }
61
+ emitExit(event) {
62
+ if (this.didExit) return;
63
+ this.didExit = true;
64
+ const remainder = this.decoder.decode();
65
+ if (remainder.length > 0) for (const listener of this.dataListeners) listener(remainder);
66
+ for (const listener of this.exitListeners) listener(event);
67
+ }
68
+ };
69
+ const layer = require_bin.effect(require_bin.PtyAdapter, require_bin.gen(function* () {
70
+ if (process.platform === "win32") return yield* require_bin.die$1("Bun PTY terminal support is unavailable on Windows. Please use Node.js (e.g. by running `npx t3`) instead.");
71
+ return { spawn: (input) => require_bin.sync(() => {
72
+ let processHandle = null;
73
+ const command = [input.shell, ...input.args ?? []];
74
+ processHandle = new BunPtyProcess(Bun.spawn(command, {
75
+ cwd: input.cwd,
76
+ env: input.env,
77
+ terminal: {
78
+ cols: input.cols,
79
+ rows: input.rows,
80
+ data: (_terminal, data) => {
81
+ processHandle?.emitData(data);
82
+ }
83
+ }
84
+ }));
85
+ return processHandle;
86
+ }) };
87
+ }));
88
+
89
+ //#endregion
90
+ exports.layer = layer;
91
+ //# sourceMappingURL=BunPTY-l5TwbZzE.cjs.map
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+
3
+ const require_bin = require('./bin.cjs');
4
+
5
+ //#region ../../node_modules/@effect/platform-bun/dist/BunFileSystem.js
6
+ /**
7
+ * @since 1.0.0
8
+ */
9
+ /**
10
+ * @since 1.0.0
11
+ * @category layer
12
+ */
13
+ const layer$4 = require_bin.layer$8;
14
+
15
+ //#endregion
16
+ //#region ../../node_modules/@effect/platform-bun/dist/BunPath.js
17
+ /**
18
+ * @since 1.0.0
19
+ */
20
+ /**
21
+ * @since 1.0.0
22
+ * @category layer
23
+ */
24
+ const layer$3 = require_bin.layer$6;
25
+ /**
26
+ * @since 1.0.0
27
+ * @category layer
28
+ */
29
+ const layerPosix = require_bin.layerPosix;
30
+ /**
31
+ * @since 1.0.0
32
+ * @category layer
33
+ */
34
+ const layerWin32 = require_bin.layerWin32;
35
+
36
+ //#endregion
37
+ //#region ../../node_modules/@effect/platform-bun/dist/BunStdio.js
38
+ /**
39
+ * @since 1.0.0
40
+ */
41
+ /**
42
+ * @since 1.0.0
43
+ * @category layer
44
+ */
45
+ const layer$2 = require_bin.layer$5;
46
+
47
+ //#endregion
48
+ //#region ../../node_modules/@effect/platform-bun/dist/BunTerminal.js
49
+ /**
50
+ * @since 1.0.0
51
+ */
52
+ /**
53
+ * @since 1.0.0
54
+ * @category constructors
55
+ */
56
+ const make = require_bin.make$6;
57
+ /**
58
+ * @since 1.0.0
59
+ * @category layers
60
+ */
61
+ const layer$1 = require_bin.layer$4;
62
+
63
+ //#endregion
64
+ //#region ../../node_modules/@effect/platform-bun/dist/BunServices.js
65
+ /**
66
+ * @since 1.0.0
67
+ * @category layer
68
+ */
69
+ const layer = /* @__PURE__ */ require_bin.layer$9.pipe(/* @__PURE__ */ require_bin.provideMerge(/* @__PURE__ */ require_bin.mergeAll(layer$4, layer$3, layer$2, layer$1)));
70
+
71
+ //#endregion
72
+ exports.layer = layer;
73
+ exports.layer$1 = layer$4;
74
+ //# sourceMappingURL=BunServices-07vLsX26.cjs.map