@downcity/plugins 1.0.170 → 1.0.173

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@downcity/plugins",
3
- "version": "1.0.170",
3
+ "version": "1.0.173",
4
4
  "type": "module",
5
5
  "description": "Downcity 内建 plugin 集合包",
6
6
  "main": "./bin/index.js",
@@ -12,8 +12,8 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@downcity/agent": "^1.1.232",
16
- "@downcity/shell": "^0.1.92",
15
+ "@downcity/agent": "^1.1.237",
16
+ "@downcity/shell": "^0.1.95",
17
17
  "ai": "^6.0.193",
18
18
  "better-sqlite3": "^12.10.0",
19
19
  "commander": "^15.0.0",
@@ -164,6 +164,33 @@ test("shell_exec unrestricted approved executes in unrestricted sandbox", async
164
164
  }
165
165
  });
166
166
 
167
+ test("closing shell runtime expires a pending approval", async () => {
168
+ const fixture = await create_fixture();
169
+ const state = createShellRuntimeState({ defaultApprovalTimeoutMs: 10_000 });
170
+ try {
171
+ const pending_result = startShellSession(state, fixture.context, {
172
+ cmd: "printf should-not-run",
173
+ cwd: fixture.root_path,
174
+ shell: "/bin/sh",
175
+ login: false,
176
+ sandbox: "unrestricted",
177
+ reason: "测试 runtime 销毁会兑现 pending approval。",
178
+ ownerContextId: "session_dispose",
179
+ });
180
+ await wait_for_approval(state);
181
+
182
+ await closeAllShellSessions(state, true);
183
+ const result = await pending_result;
184
+
185
+ assert.equal(result.shell.approvalStatus, "expired");
186
+ assert.equal(result.shell.status, "expired");
187
+ assert.equal(state.approvals.size, 0);
188
+ } finally {
189
+ await closeAllShellSessions(state, true);
190
+ await fs.rm(fixture.root_path, { recursive: true, force: true });
191
+ }
192
+ });
193
+
167
194
  test("shell_write unrestricted requires reason", async () => {
168
195
  const fixture = await create_fixture();
169
196
  const state = createShellRuntimeState({