dsh-delete-session 0.2.5 → 0.2.7

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": "dsh-delete-session",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "Delete sessions from the DSH Web sidebar: adds a Delete action to the session row menu with a risk-consent dialog, sends the session log, workspace accounting and live session state to the system trash (or removes them outright), and, when opted in, quarantines the files the conversation produced.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/client.js CHANGED
@@ -776,6 +776,16 @@ window.__ModuleLoader__.load({
776
776
  // exclusion rule silently hid the bar together with its Cancel button.
777
777
  'body.dsdel-selecting [data-slot="sidebar.footer.action"] > [data-dsh-plugin]{display:none}',
778
778
  'body.dsdel-selecting [data-slot="sidebar.footer.action"] > [class*="_entryRow"]{display:none}',
779
+ // A third shape: entries with no wrapper at all. The slot outlet is
780
+ // `display:contents` and the component is its direct child, so a bare
781
+ // <button> registration (dsh-sidebar-declutter's 收起面板列表) carries
782
+ // neither `data-dsh-plugin` nor an `_entryRow`, and the two rules above
783
+ // missed it. `> button` reaches exactly that shape.
784
+ //
785
+ // The `:not([role="toolbar"])` guard is not decoration: this plugin's own
786
+ // bar announces itself with role="toolbar", so an unguarded `> button`
787
+ // would hide the bar itself if its root ever became a <button>.
788
+ 'body.dsdel-selecting [data-slot="sidebar.footer.action"] > button:not([role="toolbar"]){display:none}',
779
789
  '.dsdel-drop{border:1px dashed var(--dsw-alias-border-l2,rgba(128,128,128,.4));border-radius:8px;color:var(--dsw-alias-label-secondary,inherit)}',
780
790
  '.dsdel-drop-over{border-color:var(--dsw-alias-state-error-primary,#e5484d);border-style:solid;background:rgba(229,72,77,.10);color:var(--dsw-alias-state-error-primary,#e5484d)}',
781
791
  '.dsdel-drop-icon{display:inline-flex;flex:0 0 auto;align-items:center}',
package/src/index.js CHANGED
@@ -36,7 +36,16 @@ const realpathNative = promisify(fs.realpath.native)
36
36
  export const name = 'dsh-delete-session'
37
37
 
38
38
  const ROUTE_PREFIX = '/dsh-delete-session'
39
- const SESSION_ID_RE = /^(session-)?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
39
+ // A session id is an OPAQUE string to DSH: the host's own schema is
40
+ // `z.string().min(1)`, and a named session created in the GUI (`bili-whale`,
41
+ // stored as ~/.dsh/storages/<profile>/sessions/bili-whale.json) is exactly as
42
+ // real as a UUID one. A UUID-only test rejected those with a 400 - the panel
43
+ // then answered "状态加载失败" for a session that plainly exists, and a session
44
+ // list filtered by it hid them. The character class still refuses everything
45
+ // that could leave a path or a URL: `/`, `\`, `..` (the first character must be
46
+ // alphanumeric, so a leading dot is already out), whitespace and control
47
+ // characters.
48
+ const SESSION_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/
40
49
  const MAX_BATCH = 100
41
50
 
42
51
  class HttpError extends Error {
@@ -1220,7 +1229,7 @@ async function planArtifacts(ctx, sessionId, cache, options) {
1220
1229
  }
1221
1230
  const { events, warning } = await readSessionEvents(ctx, sessionId)
1222
1231
  if (warning !== undefined) warnings.push(warning)
1223
- const scan = await collectSessionPaths(events, cwd, cache)
1232
+ const scan = await collectSessionPaths(events, cwd, cache)
1224
1233
  const { created, modified } = scan
1225
1234
  const createdPlan = await classifyPaths(created, cwd, home, options)
1226
1235
  const modifiedPlan = await classifyPaths(modified, cwd, home, options)
@@ -1233,7 +1242,7 @@ async function planArtifacts(ctx, sessionId, cache, options) {
1233
1242
  created: createdPlan.allowed.slice(0, MAX_LISTED),
1234
1243
  modified: modifiedPlan.allowed.slice(0, MAX_LISTED),
1235
1244
  refused: refused.slice(0, MAX_LISTED),
1236
- truncated: scan.overflow
1245
+ truncated: scan.overflow
1237
1246
  || createdPlan.allowed.length > MAX_LISTED
1238
1247
  || modifiedPlan.allowed.length > MAX_LISTED
1239
1248
  || refused.length > MAX_LISTED,