@bevel-software/platform-core-frontend 0.34.0 → 0.36.1

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 (86) hide show
  1. package/package.json +2 -2
  2. package/src/core/CoreAppShell.tsx +40 -97
  3. package/src/core/KnowledgeSurface.tsx +92 -0
  4. package/src/core/__tests__/CoreAppShell.root-claims.test.tsx +280 -0
  5. package/src/core/registry.ts +110 -2
  6. package/src/index.ts +3 -0
  7. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +1 -1
  8. package/src/modules/access/api.ts +24 -4
  9. package/src/modules/access/hooks/useFileAccess.ts +1 -1
  10. package/src/modules/access/index.ts +1 -1
  11. package/src/modules/admin/index.ts +1 -1
  12. package/src/modules/agents/components/ConnectAsChoice.tsx +7 -0
  13. package/src/modules/audit/__tests__/AuditLogPage.test.tsx +4 -3
  14. package/src/modules/audit/components/AuditLogPage.tsx +6 -4
  15. package/src/modules/audit/components/principal-grouping.ts +49 -49
  16. package/src/modules/auth/index.ts +1 -1
  17. package/src/modules/change-requests/__tests__/ChangeRequestDialog.sync-banner.test.tsx +1 -1
  18. package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +6 -6
  19. package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +8 -8
  20. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +1 -1
  21. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +1 -1
  22. package/src/modules/git/__tests__/GitSyncFailedBanner.test.tsx +1 -1
  23. package/src/modules/git/__tests__/pr.api.test.ts +3 -3
  24. package/src/modules/git/components/FileHistoryPanel.tsx +1 -1
  25. package/src/modules/git/components/GitSyncFailedBanner.tsx +1 -1
  26. package/src/modules/git/services/git.api.ts +1 -1
  27. package/src/modules/git/services/pr-prompts.ts +1 -1
  28. package/src/modules/layout/state/layout.context.ts +8 -0
  29. package/src/modules/library/__tests__/SkillPage.test.tsx +5 -5
  30. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +11 -0
  31. package/src/modules/library/__tests__/ToolVarRow.test.tsx +160 -5
  32. package/src/modules/library/components/tool-page/ToolVarRow.tsx +103 -28
  33. package/src/modules/library/services/library.api.ts +2 -2
  34. package/src/modules/onboarding/__tests__/onboarding.test.tsx +8 -8
  35. package/src/modules/onboarding/state/agent-connection.ts +1 -1
  36. package/src/modules/pr/services/pr-merge.api.ts +1 -1
  37. package/src/modules/pr/services/pr-open.api.ts +1 -1
  38. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +96 -30
  39. package/src/modules/secrets-vault/components/IncludeToggle.tsx +29 -0
  40. package/src/modules/secrets-vault/components/ManagedConnectorCard.tsx +189 -0
  41. package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.managed.test.tsx +212 -0
  42. package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +10 -0
  43. package/src/modules/secrets-vault/components/__tests__/ManagedConnectorCard.test.tsx +182 -0
  44. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +3 -0
  45. package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +1 -0
  46. package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +1 -0
  47. package/src/modules/secrets-vault/index.ts +2 -0
  48. package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +1 -0
  49. package/src/modules/secrets-vault/services/connect.api.ts +46 -5
  50. package/src/modules/secrets-vault/services/tool-secrets.api.ts +21 -3
  51. package/src/modules/secrets-vault/utils/managed-card-state.ts +61 -0
  52. package/src/modules/setup/utils/__tests__/root-folders.test.ts +5 -1
  53. package/src/modules/setup/utils/root-folders.ts +2 -2
  54. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +8 -1
  55. package/src/modules/toolbar/components/Toolbar.tsx +1 -1
  56. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +39 -13
  57. package/src/modules/{workflow → version-control}/hooks/__tests__/useFileLock.test.tsx +10 -10
  58. package/src/modules/{workflow → version-control}/hooks/__tests__/useFileLock.wire.test.tsx +1 -1
  59. package/src/modules/{workflow → version-control}/hooks/useEventBusSubscription.ts +2 -2
  60. package/src/modules/{workflow → version-control}/hooks/useFileLock.ts +1 -1
  61. package/src/modules/{workflow → version-control}/index.ts +2 -2
  62. package/src/modules/{workflow → version-control}/services/__tests__/lock.api.test.ts +1 -1
  63. package/src/modules/{workflow → version-control}/state/EventBusProvider.tsx +6 -6
  64. package/src/modules/{workflow → version-control}/state/event-bus.context.ts +4 -4
  65. package/src/modules/workspace/components/FileExplorer.tsx +96 -41
  66. package/src/modules/workspace/components/FileRoute.tsx +24 -1
  67. package/src/modules/workspace/components/FileViewer.tsx +2 -2
  68. package/src/modules/workspace/components/KbPageHeader.tsx +1 -1
  69. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +191 -21
  70. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +50 -2
  71. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +5 -5
  72. package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +5 -5
  73. package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +9 -9
  74. package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +7 -7
  75. package/src/modules/workspace/hooks/useImageRevision.ts +1 -1
  76. package/src/modules/workspace/hooks/useWorkspaceState.ts +2 -2
  77. package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +9 -9
  78. package/src/modules/workspace/utils/__tests__/fileTree.test.ts +9 -1
  79. package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +32 -48
  80. package/src/modules/workspace/utils/fileTree.ts +10 -2
  81. package/src/modules/workspace/utils/treeConfirm.ts +25 -29
  82. /package/src/modules/{workflow → version-control}/services/lock.api.ts +0 -0
  83. /package/src/modules/{workflow → version-control}/state/ChangeRequestStaleBinder.tsx +0 -0
  84. /package/src/modules/{workflow → version-control}/state/EventBusFocusBinder.tsx +0 -0
  85. /package/src/modules/{workflow → version-control}/state/__tests__/EventBusProvider.storage.test.tsx +0 -0
  86. /package/src/modules/{workflow → version-control}/state/__tests__/EventBusProvider.watch.test.tsx +0 -0
@@ -247,7 +247,7 @@ describe('suggestedPages', () => {
247
247
  dir('knowledge-base', [
248
248
  dir('knowledge-base/KnowledgeBase', [
249
249
  dir('knowledge-base/KnowledgeBase/Data', [page('knowledge-base/KnowledgeBase/Data/rows.md')]),
250
- dir('knowledge-base/KnowledgeBase/Pipelines', [page('knowledge-base/KnowledgeBase/Pipelines/run.md')]),
250
+ dir('knowledge-base/KnowledgeBase/Workflows', [page('knowledge-base/KnowledgeBase/Workflows/run.md')]),
251
251
  dir('knowledge-base/KnowledgeBase/Skills', [page('knowledge-base/KnowledgeBase/Skills/x.md')]),
252
252
  dir('knowledge-base/KnowledgeBase/Team', [page('knowledge-base/KnowledgeBase/Team/People.md')]),
253
253
  ]),
@@ -354,6 +354,14 @@ describe('treeHasVisibleEntries', () => {
354
354
  expect(treeHasVisibleEntries(d('.', [d('kb', [f('kb/a.md')])]), 'kb')).toBe(true);
355
355
  });
356
356
 
357
+ it('does not count a hidden root, nor anything in it', () => {
358
+ const claimed = (name: string) => name.toLowerCase() === 'agents';
359
+ expect(treeHasVisibleEntries(kb(d('kb/Agents', [f('kb/Agents/a.md')])), 'kb', claimed)).toBe(false);
360
+ expect(treeHasVisibleEntries(d('.', [d('kb', [d('kb/Agents', [f('kb/Agents/a.md')])])]), 'kb', claimed)).toBe(false);
361
+ expect(treeHasVisibleEntries(kb(d('kb/Agents', [f('kb/Agents/a.md')]), d('kb/Legal')), 'kb', claimed)).toBe(true);
362
+ expect(treeHasVisibleEntries(kb(d('kb/Agents', [f('kb/Agents/a.md')])), 'kb')).toBe(true);
363
+ });
364
+
357
365
  it('counts nothing outside the checkout, and nothing when there is no checkout', () => {
358
366
  const strays = [d('KnowledgeBase', [f('KnowledgeBase/Planted.md')]), f('Stray.docx')];
359
367
  expect(treeHasVisibleEntries(d('.', [...strays, d('kb', [d('kb/KnowledgeBase')])]), 'kb')).toBe(false);
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect, afterEach } from 'vitest';
2
2
  import { DEFAULT_KB_LAYOUT, configureKbLayout } from '@bevel-software/platform-shared';
3
- import type { AccessPrincipalRef, PathPrincipals } from '../../../access/api';
3
+ import type { AccessPrincipalRef, HolderChangeRef, HolderChanges } from '../../../access';
4
4
  import type { FileTreeEntry } from '@bevel-software/platform-shared';
5
5
  import {
6
6
  accessChangeLines,
@@ -45,29 +45,26 @@ describe('deleteSentence', () => {
45
45
  * What the move confirmation says about access. The tester who failed the
46
46
  * previous move warning asked for names — "these people would lose the
47
47
  * following access, these people would gain the following access" — so these
48
- * cases are the sentences, not the resolution: the resolver's before and after
49
- * lists go in, the lines the dialog reads go out.
48
+ * cases are the sentences, not the resolution: the resolver's own changes
49
+ * (the server's `prospectiveHolderChanges`, the same answer the agent's
50
+ * `move_file` gives) go in, the lines the dialog reads go out.
50
51
  */
51
52
 
52
53
  const group = (name: string): AccessPrincipalRef => ({ kind: 'group', name });
53
54
  const role = (name: string): AccessPrincipalRef => ({ kind: 'role', name });
54
55
  const person = (name: string, email: string): AccessPrincipalRef => ({ kind: 'person', name, email });
55
56
  const plugin = (token: string): AccessPrincipalRef => ({ kind: 'plugin', name: token });
57
+ const reads = (p: AccessPrincipalRef): HolderChangeRef => ({ ...p, verb: 'read' });
58
+ const edits = (p: AccessPrincipalRef): HolderChangeRef => ({ ...p, verb: 'write' });
56
59
 
57
60
  /** The layout is module state shared by the whole file; each test that names one puts the defaults back. */
58
61
  afterEach(() => configureKbLayout({ ...DEFAULT_KB_LAYOUT }));
59
62
 
60
- const side = (read: AccessPrincipalRef[], write: AccessPrincipalRef[] = []): PathPrincipals => ({
61
- read,
62
- write,
63
- });
63
+ const changes = (lose: HolderChangeRef[], gain: HolderChangeRef[] = []): HolderChanges => ({ lose, gain });
64
64
 
65
65
  describe('accessChangeLines', () => {
66
66
  it('names who loses access, by verb', () => {
67
- const change = accessChangeLines(
68
- side([group('Engineering')], [group('Engineering')]),
69
- side([], []),
70
- );
67
+ const change = accessChangeLines(changes([reads(group('Engineering')), edits(group('Engineering'))]));
71
68
 
72
69
  expect(change.lose).toEqual([
73
70
  'Engineering: can no longer open',
@@ -77,98 +74,85 @@ describe('accessChangeLines', () => {
77
74
  });
78
75
 
79
76
  it('names who gains access, by verb', () => {
80
- const change = accessChangeLines(side([], []), side([group('Product')], [group('Product')]));
77
+ const change = accessChangeLines(changes([], [reads(group('Product')), edits(group('Product'))]));
81
78
 
82
79
  expect(change.lose).toEqual([]);
83
80
  expect(change.gain).toEqual(['Product: can open', 'Product: can edit']);
84
81
  });
85
82
 
86
83
  it('lists both blocks when the move costs one group and serves another', () => {
87
- const change = accessChangeLines(side([group('Engineering')]), side([group('Product')]));
84
+ const change = accessChangeLines(changes([reads(group('Engineering'))], [reads(group('Product'))]));
88
85
 
89
86
  expect(change.lose).toEqual(['Engineering: can no longer open']);
90
87
  expect(change.gain).toEqual(['Product: can open']);
91
88
  });
92
89
 
93
- it('reports no change at all when both sides resolve the same', () => {
94
- const both = side([group('Engineering'), person('Ali Raza', 'ali@x.io')], [group('Engineering')]);
95
-
96
- expect(accessChangeLines(both, both)).toEqual({ lose: [], gain: [] });
97
- });
98
-
99
- it('is unmoved by the order the resolver happens to list principals in', () => {
100
- const before = side([group('Engineering'), group('Product')]);
101
- const after = side([group('Product'), group('Engineering')]);
102
-
103
- expect(accessChangeLines(before, after)).toEqual({ lose: [], gain: [] });
90
+ it('reports no change at all when the resolver found none', () => {
91
+ expect(accessChangeLines(changes([], []))).toEqual({ lose: [], gain: [] });
104
92
  });
105
93
 
106
94
  it('names a directly granted person, by the name on the grant', () => {
107
- const change = accessChangeLines(side([person('Ali Raza', 'ali@x.io')]), side([]));
95
+ const change = accessChangeLines(changes([reads(person('Ali Raza', 'ali@x.io'))]));
108
96
 
109
97
  expect(change.lose).toEqual(['Ali Raza: can no longer open']);
110
98
  });
111
99
 
112
- it('matches a person on their address, whatever name each side carries', () => {
100
+ it('is one person at one address, whatever name each change carries', () => {
101
+ // The resolver names a person by address; the label follows the first spelling.
113
102
  const change = accessChangeLines(
114
- side([person('Ali Raza', 'ali@x.io')]),
115
- side([person('ali@x.io', 'ALI@x.io')]),
103
+ changes([reads(person('Ali Raza', 'ali@x.io')), edits(person('ali@x.io', 'ALI@x.io'))]),
116
104
  );
117
105
 
118
- expect(change).toEqual({ lose: [], gain: [] });
106
+ expect(change.lose).toEqual(['Ali Raza: can no longer open', 'Ali Raza: can no longer edit']);
119
107
  });
120
108
 
121
109
  it('falls back to a nameless person’s address rather than an empty line', () => {
122
- const change = accessChangeLines(side([]), side([person('', 'ali@x.io')]));
110
+ const change = accessChangeLines(changes([], [reads(person('', 'ali@x.io'))]));
123
111
 
124
112
  expect(change.gain).toEqual(['ali@x.io: can open']);
125
113
  });
126
114
 
127
115
  it('keeps a group and a same-named role apart — they are different principals', () => {
128
- const change = accessChangeLines(side([group('Design')]), side([role('Design')]));
116
+ const change = accessChangeLines(changes([reads(group('Design'))], [reads(role('Design'))]));
129
117
 
130
118
  expect(change.lose).toEqual(['Design: can no longer open']);
131
119
  expect(change.gain).toEqual(['Design: can open']);
132
120
  });
133
121
 
134
122
  it('names a plugin principal as the share sheet does', () => {
135
- const change = accessChangeLines(side([]), side([plugin('plugin/GTM/read')]));
123
+ const change = accessChangeLines(changes([], [reads(plugin('plugin/GTM/read'))]));
136
124
 
137
125
  expect(change.gain).toEqual(['GTM · readers: can open']);
138
126
  });
139
127
 
140
128
  it('names the built-in everyone role Everyone', () => {
141
- const change = accessChangeLines(side([role('everyone')]), side([]));
129
+ const change = accessChangeLines(changes([reads(role('everyone'))]));
142
130
 
143
131
  expect(change.lose).toEqual(['Everyone: can no longer open']);
144
132
  });
145
133
 
146
- it('puts one principal’s two verbs together, opening before editing', () => {
134
+ it('puts one principal’s two verbs together, opening before editing, whatever order the changes came in', () => {
147
135
  const change = accessChangeLines(
148
- side([group('Engineering'), group('Ops')], [group('Ops')]),
149
- side([]),
136
+ changes([edits(group('Ops')), reads(group('Engineering')), reads(group('Ops'))]),
150
137
  );
151
138
 
152
139
  expect(change.lose).toEqual([
153
- 'Engineering: can no longer open',
154
140
  'Ops: can no longer open',
155
141
  'Ops: can no longer edit',
142
+ 'Engineering: can no longer open',
156
143
  ]);
157
144
  });
158
145
 
159
146
  it('lists a principal in both blocks when it trades one verb for another', () => {
160
- const change = accessChangeLines(
161
- side([group('Engineering')], [group('Engineering')]),
162
- side([group('Engineering')], []),
163
- );
147
+ const change = accessChangeLines(changes([edits(group('Engineering'))], [reads(group('Engineering'))]));
164
148
 
165
149
  expect(change.lose).toEqual(['Engineering: can no longer edit']);
166
- expect(change.gain).toEqual([]);
150
+ expect(change.gain).toEqual(['Engineering: can open']);
167
151
  });
168
152
 
169
153
  it('shows six lines and folds the rest into "and N more"', () => {
170
- const many = Array.from({ length: 9 }, (_, i) => group(`Team ${i + 1}`));
171
- const change = accessChangeLines(side(many), side([]));
154
+ const many = Array.from({ length: 9 }, (_, i) => reads(group(`Team ${i + 1}`)));
155
+ const change = accessChangeLines(changes(many));
172
156
 
173
157
  expect(change.lose).toHaveLength(7);
174
158
  expect(change.lose[5]).toBe('Team 6: can no longer open');
@@ -176,16 +160,16 @@ describe('accessChangeLines', () => {
176
160
  });
177
161
 
178
162
  it('caps at six without a count when there are exactly six', () => {
179
- const six = Array.from({ length: 6 }, (_, i) => group(`Team ${i + 1}`));
180
- const change = accessChangeLines(side([]), side(six));
163
+ const six = Array.from({ length: 6 }, (_, i) => reads(group(`Team ${i + 1}`)));
164
+ const change = accessChangeLines(changes([], six));
181
165
 
182
166
  expect(change.gain).toHaveLength(6);
183
167
  expect(change.gain.at(-1)).toBe('Team 6: can open');
184
168
  });
185
169
 
186
170
  it('caps each block on its own', () => {
187
- const losers = Array.from({ length: 8 }, (_, i) => group(`Old ${i + 1}`));
188
- const change = accessChangeLines(side(losers), side([group('Product')]));
171
+ const losers = Array.from({ length: 8 }, (_, i) => reads(group(`Old ${i + 1}`)));
172
+ const change = accessChangeLines(changes(losers, [reads(group('Product'))]));
189
173
 
190
174
  expect(change.lose.at(-1)).toBe('and 2 more');
191
175
  expect(change.gain).toEqual(['Product: can open']);
@@ -10,7 +10,7 @@ import { isAccessRulesFile as isAccessRulesPath } from './display-file-name';
10
10
  // RESERVED is not the same as CREATED (see kb-layout.ts): core only seeds
11
11
  // KnowledgeBase/, Skills/ and Plugins/, but every reserved name renders as its
12
12
  // own root when present — a distribution that owns the execution layer seeds
13
- // Data/, Agents/ and Pipelines/, and a KB that has them must not see them
13
+ // Data/, Agents/ and Workflows/, and a KB that has them must not see them
14
14
  // folded into Knowledge as stray content. A function, not a module-scope set:
15
15
  // three of the names are configurable and arrive after this module loads.
16
16
  export const KB_ROOT_DIRS = {
@@ -54,12 +54,20 @@ export function checkoutRoot(
54
54
  *
55
55
  * Read from the checkout down, like every other surface. A workspace whose
56
56
  * checkout is missing shows nothing, whatever else was written beside it.
57
+ *
58
+ * `hiddenRoot` names the top-level folders the tree does not show (the roots
59
+ * an app claims, `AppDef.roots`): nothing in them is on screen here.
57
60
  */
58
- export function treeHasVisibleEntries(tree: FileTreeEntry | null, kbDirName: string | null): boolean {
61
+ export function treeHasVisibleEntries(
62
+ tree: FileTreeEntry | null,
63
+ kbDirName: string | null,
64
+ hiddenRoot: (name: string) => boolean = () => false,
65
+ ): boolean {
59
66
  const kbRoot = checkoutRoot(tree, kbDirName);
60
67
  if (!kbRoot) return false;
61
68
  return (kbRoot.children ?? []).some((c) => {
62
69
  if (c.type === 'file') return c.name !== '.bevelignore';
70
+ if (hiddenRoot(c.name)) return false;
63
71
  return !KB_ROOT_DIRS.has(c.name) || (c.children?.length ?? 0) > 0;
64
72
  });
65
73
  }
@@ -12,7 +12,8 @@ import {
12
12
  parsePluginPrincipalToken,
13
13
  pluginPrincipalLabel,
14
14
  type AccessPrincipalRef,
15
- type PathPrincipals,
15
+ type HolderChangeRef,
16
+ type HolderChanges,
16
17
  type ProspectiveAccess,
17
18
  } from '../../access';
18
19
  import { KB_ROOT_DIRS } from './fileTree';
@@ -238,44 +239,39 @@ function capped(lines: string[]): string[] {
238
239
  }
239
240
 
240
241
  /**
241
- * Who loses and who gains access in one move: per verb, the principals
242
- * present before and absent after, and absent before and present after.
242
+ * The lines of who loses and who gains access in one move, from the
243
+ * resolver's own verdicts (`changes`, the server's `prospectiveHolderChanges`
244
+ * — the same answer the agent's `move_file` gives). Nothing is derived here
245
+ * from the holder lists: those name grants, so a diff of them misses a
246
+ * person the destination denies by name and shows a writer leaving a folder
247
+ * everyone reads as losing `read`.
243
248
  *
244
- * Lines are grouped by principal in the order the lists name them — the
245
- * resolver's order, collectives before directly granted people — and within a
246
- * principal, opening before editing. A principal that loses one verb and
247
- * gains another appears in both blocks, which is what happened.
249
+ * Lines are grouped by principal in the order the changes name them — the
250
+ * resolver's order, collectives before people — and within a principal,
251
+ * opening before editing. A principal that loses one verb and gains another
252
+ * appears in both blocks, which is what happened.
248
253
  */
249
- export function accessChangeLines(before: PathPrincipals, after: PathPrincipals): AccessChange {
254
+ export function accessChangeLines(changes: HolderChanges): AccessChange {
250
255
  const lose: string[] = [];
251
256
  const gain: string[] = [];
252
- // First-seen order over every list, so a principal's lines sit together
257
+ // First-seen order over both lists, so a principal's lines sit together
253
258
  // wherever the verb that introduced it came from.
254
259
  const order: AccessPrincipalRef[] = [];
255
260
  const seen = new Set<string>();
256
- for (const side of [before, after]) {
257
- for (const verb of ACCESS_VERBS) {
258
- for (const principal of side[verb]) {
259
- const key = principalKey(principal);
260
- if (seen.has(key)) continue;
261
- seen.add(key);
262
- order.push(principal);
263
- }
264
- }
261
+ for (const change of [...changes.lose, ...changes.gain]) {
262
+ const key = principalKey(change);
263
+ if (seen.has(key)) continue;
264
+ seen.add(key);
265
+ order.push(change);
265
266
  }
266
- const keysOf = (list: AccessPrincipalRef[]) => new Set(list.map(principalKey));
267
- const sides = {
268
- before: { read: keysOf(before.read), write: keysOf(before.write) },
269
- after: { read: keysOf(after.read), write: keysOf(after.write) },
270
- };
267
+ const has = (list: HolderChangeRef[], key: string, verb: 'read' | 'write') =>
268
+ list.some((c) => c.verb === verb && principalKey(c) === key);
271
269
  for (const principal of order) {
272
270
  const key = principalKey(principal);
273
271
  const label = principalLabel(principal);
274
272
  for (const verb of ACCESS_VERBS) {
275
- const had = sides.before[verb].has(key);
276
- const has = sides.after[verb].has(key);
277
- if (had && !has) lose.push(`${label}: can no longer ${VERB_WORD[verb]}`);
278
- if (!had && has) gain.push(`${label}: can ${VERB_WORD[verb]}`);
273
+ if (has(changes.lose, key, verb)) lose.push(`${label}: can no longer ${VERB_WORD[verb]}`);
274
+ if (has(changes.gain, key, verb)) gain.push(`${label}: can ${VERB_WORD[verb]}`);
279
275
  }
280
276
  }
281
277
  return { lose: capped(lose), gain: capped(gain) };
@@ -283,7 +279,7 @@ export function accessChangeLines(before: PathPrincipals, after: PathPrincipals)
283
279
 
284
280
  /** {@link accessChangeLines} over a whole prospective-access answer. */
285
281
  export function accessChangeOf(access: ProspectiveAccess): AccessChange {
286
- return accessChangeLines(access.before, access.after);
282
+ return accessChangeLines(access.changes);
287
283
  }
288
284
 
289
285
  /**
@@ -294,7 +290,7 @@ export function accessChangeOf(access: ProspectiveAccess): AccessChange {
294
290
  * nothing — the dialog never blocks on it, and the server stays the gate.
295
291
  * A move into a folder the caller may not write is REFUSED today: the move
296
292
  * route acquires the write lock on both ends, and the lock gate throws
297
- * AccessDeniedError on a protected branch (`WorkflowService.acquireLock`).
293
+ * AccessDeniedError on a protected branch (`VersionControlService.acquireLock`).
298
294
  * Only uploads are rerouted to a suggestion; a move is not.
299
295
  */
300
296
  export function moveWarnings(opts: {