@bevel-software/platform-core-frontend 0.33.0 → 0.35.0

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 (67) hide show
  1. package/package.json +2 -2
  2. package/src/lib/__tests__/api.test.ts +28 -1
  3. package/src/lib/api.ts +4 -2
  4. package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +53 -1
  5. package/src/modules/access/api.ts +27 -8
  6. package/src/modules/access/components/ManageAccessDialog.tsx +7 -7
  7. package/src/modules/access/index.ts +1 -1
  8. package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +51 -0
  9. package/src/modules/admin/components/DirectoryGroupsPage.tsx +42 -5
  10. package/src/modules/admin/index.ts +1 -1
  11. package/src/modules/admin/services/groups.api.ts +11 -1
  12. package/src/modules/agents/__tests__/useConnectAsChoice.test.ts +56 -0
  13. package/src/modules/agents/components/ConnectAsChoice.tsx +88 -0
  14. package/src/modules/agents/connect-as.ts +15 -0
  15. package/src/modules/agents/index.ts +5 -0
  16. package/src/modules/agents/services/agent-choices.api.ts +39 -0
  17. package/src/modules/agents/useConnectAsChoice.ts +66 -0
  18. package/src/modules/audit/__tests__/AuditLogPage.test.tsx +16 -2
  19. package/src/modules/audit/components/AuditLogPage.tsx +11 -0
  20. package/src/modules/audit/services/audit.api.ts +5 -0
  21. package/src/modules/auth/__tests__/AccountPage.test.tsx +21 -0
  22. package/src/modules/auth/__tests__/account.api.test.ts +69 -0
  23. package/src/modules/auth/components/AccountPage.tsx +8 -2
  24. package/src/modules/auth/index.ts +1 -1
  25. package/src/modules/auth/services/account.api.ts +18 -2
  26. package/src/modules/git/__tests__/BranchSwitcher.test.tsx +0 -14
  27. package/src/modules/git/__tests__/git.api.test.ts +2 -2
  28. package/src/modules/git/hooks/__tests__/useGitState.deleteBranch.test.tsx +1 -1
  29. package/src/modules/library/__tests__/SkillPage.test.tsx +229 -24
  30. package/src/modules/library/__tests__/ToolVarRow.test.tsx +51 -5
  31. package/src/modules/library/components/skill-page/SkillFilePane.tsx +57 -9
  32. package/src/modules/library/components/skill-page/SkillPage.tsx +65 -25
  33. package/src/modules/library/components/tool-page/ToolVarRow.tsx +22 -14
  34. package/src/modules/review/components/MarkdownDiffViewer.tsx +23 -1
  35. package/src/modules/review/components/ReviewPanel.tsx +8 -2
  36. package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +31 -0
  37. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +79 -16
  38. package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +122 -2
  39. package/src/modules/secrets-vault/services/connect.api.ts +20 -5
  40. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +45 -4
  41. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +127 -12
  42. package/src/modules/toolbar/services/external-api-keys.api.ts +5 -2
  43. package/src/modules/workspace/components/FileViewer.tsx +1 -1
  44. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +58 -8
  45. package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +40 -7
  46. package/src/modules/workspace/components/renderers/KbAppLink.tsx +56 -0
  47. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +30 -10
  48. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +37 -40
  49. package/src/modules/workspace/components/renderers/__tests__/HtmlRenderer.links.test.tsx +185 -0
  50. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.sectionReclick.test.tsx +88 -0
  51. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +199 -29
  52. package/src/modules/workspace/components/renderers/__tests__/bridgeHarness.ts +37 -4
  53. package/src/modules/workspace/components/renderers/__tests__/htmlSandbox.test.ts +59 -0
  54. package/src/modules/workspace/components/renderers/__tests__/htmlViewsGuide.test.ts +15 -1
  55. package/src/modules/workspace/components/renderers/__tests__/liveDataReferencePage.test.ts +397 -0
  56. package/src/modules/workspace/components/renderers/htmlSandbox.ts +48 -15
  57. package/src/modules/workspace/components/renderers/htmlToolBridge.ts +19 -0
  58. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +35 -28
  59. package/src/modules/workspace/components/renderers/scrollToHeading.ts +35 -0
  60. package/src/modules/workspace/hooks/__tests__/useLinksOut.test.ts +6 -0
  61. package/src/modules/workspace/hooks/useLinksOut.ts +12 -6
  62. package/src/modules/workspace/index.ts +21 -2
  63. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +262 -25
  64. package/src/modules/workspace/routing/kb-routes.ts +221 -53
  65. package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +32 -48
  66. package/src/modules/workspace/utils/fileTree.ts +1 -1
  67. package/src/modules/workspace/utils/treeConfirm.ts +24 -28
@@ -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
  /**