@poe-platform/safe-bash 0.1.716 → 0.1.717

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.
@@ -116,27 +116,27 @@ function createOwnedConnections(binding, sessionId) {
116
116
  beginBrowserOwnerShutdown(upstreams);
117
117
  disconnect();
118
118
  releasing = finishOwnedBrowserCleanup([
119
- attempt(() => control?.close()),
120
- attempt(() => privacy.close()),
121
- attempt(() => browser?.close()),
122
- attempt(async () => {
123
- try {
124
- await deleteBrowser();
125
- finalizeBrowserOwnerTermination(upstreams, true);
126
- }
127
- catch (error) {
128
- finalizeBrowserOwnerTermination(upstreams, false);
129
- throw error;
130
- }
131
- }),
132
- attempt(async () => {
133
- const outcomes = await Promise.allSettled([...upstreams].map(waitForBrowserSocketClose));
134
- const failures = outcomes
135
- .filter((outcome) => outcome.status === "rejected")
136
- .map((outcome) => outcome.reason);
137
- if (failures.length)
138
- throw new AggregateError(failures, "Owned browser upstream closure failed");
139
- }),
119
+ ["storage control", attempt(() => control?.close())],
120
+ ["private transport", attempt(() => privacy.close())],
121
+ ["public connection", attempt(() => browser?.close())],
122
+ ["provider deletion", attempt(async () => {
123
+ try {
124
+ await deleteBrowser();
125
+ finalizeBrowserOwnerTermination(upstreams, true);
126
+ }
127
+ catch (error) {
128
+ finalizeBrowserOwnerTermination(upstreams, false);
129
+ throw error;
130
+ }
131
+ })],
132
+ ["upstream closure", attempt(async () => {
133
+ const outcomes = await Promise.allSettled([...upstreams].map(waitForBrowserSocketClose));
134
+ const failures = outcomes
135
+ .filter((outcome) => outcome.status === "rejected")
136
+ .map((outcome) => outcome.reason);
137
+ if (failures.length)
138
+ throw new AggregateError(failures, "Owned browser upstream closure failed");
139
+ })],
140
140
  ], AbortSignal.timeout(BROWSER_RELEASE_MS));
141
141
  return releasing;
142
142
  }
@@ -171,7 +171,7 @@ function createOwnedConnections(binding, sessionId) {
171
171
  }
172
172
  async function finishOwnedBrowserCleanup(operations, signal) {
173
173
  const outcomes = [];
174
- const completed = operations.map((operation, index) => operation.then(() => {
174
+ const completed = operations.map(([, operation], index) => operation.then(() => {
175
175
  outcomes[index] = { status: "fulfilled", value: undefined };
176
176
  }, (reason) => {
177
177
  outcomes[index] = { status: "rejected", reason };
@@ -198,8 +198,19 @@ async function finishOwnedBrowserCleanup(operations, signal) {
198
198
  const failures = outcomes
199
199
  .filter((outcome) => outcome.status === "rejected")
200
200
  .map((outcome) => outcome.reason);
201
- if (failures.length)
202
- throw new AggregateError(failures, "Owned browser release failed");
201
+ if (failures.length) {
202
+ const failed = operations
203
+ .filter((_, index) => outcomes[index]?.status === "rejected")
204
+ .map(([phase]) => phase);
205
+ const pending = operations
206
+ .filter((_, index) => outcomes[index] === undefined)
207
+ .map(([phase]) => phase);
208
+ const details = [
209
+ ...(failed.length ? [`failed: ${failed.join(", ")}`] : []),
210
+ ...(pending.length ? [`pending: ${pending.join(", ")}`] : []),
211
+ ];
212
+ throw new AggregateError(failures, `Owned browser release failed (${details.join("; ")})`);
213
+ }
203
214
  }
204
215
  /** Concurrent cleanup paths share one deletion and the same provider outcome. */
205
216
  export function createCloudflareBrowserRelease(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-bash",
3
- "version": "0.1.716",
3
+ "version": "0.1.717",
4
4
  "description": "Extensible virtual shell with pluggable filesystems and streaming commands",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -386,7 +386,7 @@
386
386
  "access": "public"
387
387
  },
388
388
  "dependencies": {
389
- "@poe-platform/safe-fs": "0.1.716",
389
+ "@poe-platform/safe-fs": "0.1.717",
390
390
  "pako": "3.0.1",
391
391
  "@types/node": "^25.2.2",
392
392
  "@noble/hashes": "2.4.0",