@xmodelin/dsh-collab-sessions 0.0.2 → 0.0.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 (3) hide show
  1. package/client.js +13 -10
  2. package/index.js +6 -5
  3. package/package.json +2 -2
package/client.js CHANGED
@@ -299,12 +299,7 @@ window.__ModuleLoader__.load({
299
299
  if (summary === undefined) return false
300
300
  const values = summary.projectionValues ?? state?.projectionsBySession?.[summary.id]?.values
301
301
  const preset = values?.agentPreset
302
- const workdir = typeof values?.workingDirectory === 'string'
303
- ? values.workingDirectory.replace(/\\/gu, '/')
304
- : ''
305
- return preset === 'collab'
306
- || preset === 'supervisor'
307
- || workdir.includes('.dsh-collab/sessions/')
302
+ return preset === 'collab' || preset === 'supervisor'
308
303
  }
309
304
 
310
305
  const CSS = [
@@ -711,7 +706,15 @@ window.__ModuleLoader__.load({
711
706
  ? t('panel.loading')
712
707
  : (selected.length === 2 ? null : t('panel.selectTwo'))
713
708
 
714
- const pairRows = pairs.map(pair => h('div', {
709
+ const visiblePairs = pairs.filter(pair => (
710
+ sorted.some(summary => summary.id === pair.a)
711
+ && sorted.some(summary => summary.id === pair.b)
712
+ ))
713
+ const visiblePending = pendingGrants.filter(grant => (
714
+ sorted.some(summary => summary.id === grant.from)
715
+ && sorted.some(summary => summary.id === grant.to)
716
+ ))
717
+ const pairRows = visiblePairs.map(pair => h('div', {
715
718
  key: `${pair.a}|${pair.b}`,
716
719
  className: 'dsh-collab-auth-row',
717
720
  },
@@ -732,7 +735,7 @@ window.__ModuleLoader__.load({
732
735
  },
733
736
  }, confirmRevoke === `pair:${pair.a}|${pair.b}` ? t('panel.confirmRevoke') : t('panel.revoke'))))
734
737
 
735
- const pendingRows = pendingGrants.map(grant => h('div', {
738
+ const pendingRows = visiblePending.map(grant => h('div', {
736
739
  key: `pending:${grant.from}|${grant.to}`,
737
740
  className: 'dsh-collab-auth-row',
738
741
  },
@@ -784,7 +787,7 @@ window.__ModuleLoader__.load({
784
787
  },
785
788
  h('div', { className: 'dsh-collab-auth-list' },
786
789
  loading ? h('p', { className: 'dsh-collab-auth-muted' }, t('panel.loading')) : null,
787
- !loading && pairs.length === 0 && pendingGrants.length === 0
790
+ !loading && visiblePairs.length === 0 && visiblePending.length === 0
788
791
  ? h('p', { className: 'dsh-collab-auth-muted' }, t('panel.emptyPairs'))
789
792
  : null,
790
793
  ...pairRows,
@@ -839,7 +842,7 @@ window.__ModuleLoader__.load({
839
842
  h('p', { className: 'dsh-collab-auth-desc' }, t('panel.description'))),
840
843
  h('div', { className: 'dsh-collab-auth-tabs-row' },
841
844
  h('div', { className: 'dsh-collab-auth-tabs', role: 'tablist' },
842
- tabButton('pairs', t('panel.pairsTab'), pairs.length),
845
+ tabButton('pairs', t('panel.pairsTab'), visiblePairs.length),
843
846
  tabButton('sessions', t('panel.sessionsTab'), sorted.length)),
844
847
  h('div', { className: 'dsh-collab-auth-tabs-actions' },
845
848
  h('button', {
package/index.js CHANGED
@@ -442,15 +442,16 @@ export function apply(ctx, config = {}) {
442
442
  const deliveryInFlight = new Set()
443
443
  let noticeFlushInFlight = false
444
444
  /** Human-facing authorization operations shared by the UI Remote and commands. */
445
+ const isKnownCollab = (id) => collabSessions.has(id)
446
+ || registry.get(id)?.preset === PRESET
447
+ || registry.get(id)?.preset === SUPERVISOR
445
448
  const collabAdmin = {
446
449
  listAuth: () => ({
447
- pairs: auth.listPairs(),
448
- pending: auth.listPending(),
450
+ pairs: auth.listPairs().filter(pair => isKnownCollab(pair.a) && isKnownCollab(pair.b)),
451
+ pending: auth.listPending().filter(grant => isKnownCollab(grant.from) && isKnownCollab(grant.to)),
449
452
  }),
450
453
  authorize: (a, b) => {
451
- const known = (id) => collabSessions.has(id)
452
- || (registry.get(id)?.preset === 'collab' || registry.get(id)?.preset === 'supervisor')
453
- if (!known(a) || !known(b)) throw new Error('authorization requires two known collaboration sessions')
454
+ if (!isKnownCollab(a) || !isKnownCollab(b)) throw new Error('authorization requires two known collaboration sessions')
454
455
  auth.authorize(a, b, 'ui')
455
456
  return collabAdmin.listAuth()
456
457
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmodelin/dsh-collab-sessions",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "description": "Left-sidebar entry that creates collaboration sessions with a private/communication workspace layout and session-to-session messaging.",
6
6
  "exports": {
@@ -58,6 +58,6 @@
58
58
  "dsh": "^0.2.2-rc.5"
59
59
  },
60
60
  "dependencies": {
61
- "@xmodelin/dsh-collab-auth-api": "0.0.2"
61
+ "@xmodelin/dsh-collab-auth-api": "0.0.3"
62
62
  }
63
63
  }