@justanarthur/modo-ui-ai 0.0.0-stage → 0.2.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.
- package/LICENSE +21 -0
- package/LICENSE.fluid-functionalism +21 -0
- package/README.md +105 -2
- package/blocks/conversation/agent-prompt/examples.mdx +44 -0
- package/blocks/conversation/agent-prompt/index.tsx +114 -0
- package/blocks/conversation/composer/draft.css +25 -0
- package/blocks/conversation/composer/draft.tsx +589 -0
- package/blocks/conversation/composer/examples.mdx +114 -0
- package/blocks/conversation/composer/file-preview-tile.tsx +59 -0
- package/blocks/conversation/composer/file-thumbnail.tsx +146 -0
- package/blocks/conversation/composer/index.tsx +517 -0
- package/blocks/conversation/composer/queued-row.tsx +102 -0
- package/blocks/conversation/composer/shared.ts +38 -0
- package/blocks/conversation/composer/suggestion-row.tsx +64 -0
- package/blocks/conversation/composer/use-composer-files.ts +142 -0
- package/blocks/conversation/composer/use-history-nav.ts +60 -0
- package/blocks/conversation/composer/use-message-queue.ts +108 -0
- package/blocks/conversation/composer/use-region-height.ts +34 -0
- package/blocks/conversation/failure-states/examples.mdx +58 -0
- package/blocks/conversation/failure-states/index.tsx +274 -0
- package/blocks/conversation/transcript/examples.mdx +43 -0
- package/blocks/conversation/transcript/index.tsx +204 -0
- package/blocks/conversation/transcript-search/examples.mdx +50 -0
- package/blocks/conversation/transcript-search/index.tsx +469 -0
- package/blocks/dialogs/command-palette/examples.mdx +33 -0
- package/blocks/dialogs/command-palette/index.tsx +232 -0
- package/blocks/dialogs/hook-dialog/examples.mdx +44 -0
- package/blocks/dialogs/hook-dialog/index.tsx +286 -0
- package/blocks/dialogs/mcp-server-dialog/examples.mdx +57 -0
- package/blocks/dialogs/mcp-server-dialog/index.tsx +415 -0
- package/blocks/dialogs/shortcuts-sheet/examples.mdx +36 -0
- package/blocks/dialogs/shortcuts-sheet/index.tsx +186 -0
- package/blocks/panes/artifacts-pane/examples.mdx +23 -0
- package/blocks/panes/artifacts-pane/index.tsx +82 -0
- package/blocks/panes/changes-pane/examples.mdx +23 -0
- package/blocks/panes/changes-pane/index.tsx +248 -0
- package/blocks/panes/file-pane/examples.mdx +13 -0
- package/blocks/panes/file-pane/index.tsx +102 -0
- package/blocks/panes/pr-pane/examples.mdx +13 -0
- package/blocks/panes/pr-pane/index.tsx +191 -0
- package/blocks/panes/side-pane/examples.mdx +58 -0
- package/blocks/panes/side-pane/index.tsx +187 -0
- package/blocks/panes/tasks-pane/examples.mdx +23 -0
- package/blocks/panes/tasks-pane/index.tsx +127 -0
- package/blocks/panes/terminal-pane/examples.mdx +13 -0
- package/blocks/panes/terminal-pane/index.tsx +99 -0
- package/blocks/panes/usage-pane/examples.mdx +13 -0
- package/blocks/panes/usage-pane/index.tsx +75 -0
- package/blocks/profiles/profile-onboarding/examples.mdx +80 -0
- package/blocks/profiles/profile-onboarding/index.tsx +580 -0
- package/blocks/profiles/profile-switcher/examples.mdx +18 -0
- package/blocks/profiles/profile-switcher/index.tsx +197 -0
- package/blocks/profiles/profile-usage/examples.mdx +21 -0
- package/blocks/profiles/profile-usage/index.tsx +127 -0
- package/blocks/sessions/inbox/examples.mdx +35 -0
- package/blocks/sessions/inbox/index.tsx +372 -0
- package/blocks/sessions/session-board/examples.mdx +34 -0
- package/blocks/sessions/session-board/index.tsx +570 -0
- package/blocks/sessions/session-sidebar/examples.mdx +43 -0
- package/blocks/sessions/session-sidebar/index.tsx +442 -0
- package/blocks/settings/extensions/examples.mdx +10 -0
- package/blocks/settings/extensions/index.tsx +72 -0
- package/blocks/settings/hooks/examples.mdx +16 -0
- package/blocks/settings/hooks/index.tsx +127 -0
- package/blocks/settings/mcp-servers/examples.mdx +26 -0
- package/blocks/settings/mcp-servers/index.tsx +204 -0
- package/blocks/settings/memory/examples.mdx +22 -0
- package/blocks/settings/memory/index.tsx +113 -0
- package/blocks/settings/notifications/examples.mdx +8 -0
- package/blocks/settings/notifications/index.tsx +63 -0
- package/blocks/settings/permission-rules/examples.mdx +37 -0
- package/blocks/settings/permission-rules/index.tsx +317 -0
- package/blocks/settings/plugin-catalog/examples.mdx +52 -0
- package/blocks/settings/plugin-catalog/index.tsx +407 -0
- package/blocks/settings/plugins/examples.mdx +10 -0
- package/blocks/settings/plugins/index.tsx +72 -0
- package/blocks/settings/settings-window/examples.mdx +40 -0
- package/blocks/settings/settings-window/index.tsx +188 -0
- package/blocks/settings/worktrees/examples.mdx +17 -0
- package/blocks/settings/worktrees/index.tsx +145 -0
- package/components/conversation/agent-run/examples.mdx +30 -0
- package/components/conversation/agent-run/index.tsx +82 -0
- package/components/conversation/chapter-nav/examples.mdx +30 -0
- package/components/conversation/chapter-nav/index.tsx +123 -0
- package/components/conversation/message/examples.mdx +53 -0
- package/components/conversation/message/index.tsx +128 -0
- package/components/conversation/message/working.tsx +102 -0
- package/components/conversation/reasoning/examples.mdx +22 -0
- package/components/conversation/reasoning/index.tsx +54 -0
- package/components/conversation/recap/examples.mdx +21 -0
- package/components/conversation/recap/index.tsx +67 -0
- package/components/conversation/todo-list/examples.mdx +32 -0
- package/components/conversation/todo-list/index.tsx +106 -0
- package/components/conversation/tool-call/examples.mdx +48 -0
- package/components/conversation/tool-call/index.tsx +142 -0
- package/components/conversation/work-summary/examples.mdx +50 -0
- package/components/conversation/work-summary/index.tsx +87 -0
- package/components/prompts/permission-request/examples.mdx +32 -0
- package/components/prompts/permission-request/index.tsx +74 -0
- package/components/prompts/plan-approval/examples.mdx +37 -0
- package/components/prompts/plan-approval/index.tsx +76 -0
- package/components/prompts/prompt-card/examples.mdx +31 -0
- package/components/prompts/prompt-card/index.tsx +82 -0
- package/components/prompts/question-prompt/examples.mdx +46 -0
- package/components/prompts/question-prompt/index.tsx +118 -0
- package/dist/blocks/conversation/agent-prompt/index.d.ts +7 -0
- package/dist/blocks/conversation/agent-prompt/index.js +13 -0
- package/dist/blocks/conversation/composer/index.d.ts +4 -0
- package/dist/blocks/conversation/composer/index.js +15 -0
- package/dist/blocks/conversation/failure-states/index.d.ts +4 -0
- package/dist/blocks/conversation/failure-states/index.js +8 -0
- package/dist/blocks/conversation/transcript/index.d.ts +50 -0
- package/dist/blocks/conversation/transcript/index.js +17 -0
- package/dist/blocks/conversation/transcript-search/index.d.ts +4 -0
- package/dist/blocks/conversation/transcript-search/index.js +11 -0
- package/dist/blocks/dialogs/command-palette/index.d.ts +5 -0
- package/dist/blocks/dialogs/command-palette/index.js +20 -0
- package/dist/blocks/dialogs/hook-dialog/index.d.ts +3 -0
- package/dist/blocks/dialogs/hook-dialog/index.js +12 -0
- package/dist/blocks/dialogs/mcp-server-dialog/index.d.ts +5 -0
- package/dist/blocks/dialogs/mcp-server-dialog/index.js +12 -0
- package/dist/blocks/dialogs/shortcuts-sheet/index.d.ts +2 -0
- package/dist/blocks/dialogs/shortcuts-sheet/index.js +11 -0
- package/dist/blocks/panes/artifacts-pane/index.d.ts +3 -0
- package/dist/blocks/panes/artifacts-pane/index.js +9 -0
- package/dist/blocks/panes/changes-pane/index.d.ts +3 -0
- package/dist/blocks/panes/changes-pane/index.js +9 -0
- package/dist/blocks/panes/file-pane/index.d.ts +3 -0
- package/dist/blocks/panes/file-pane/index.js +9 -0
- package/dist/blocks/panes/pr-pane/index.d.ts +3 -0
- package/dist/blocks/panes/pr-pane/index.js +10 -0
- package/dist/blocks/panes/side-pane/index.d.ts +5 -0
- package/dist/blocks/panes/side-pane/index.js +21 -0
- package/dist/blocks/panes/tasks-pane/index.d.ts +3 -0
- package/dist/blocks/panes/tasks-pane/index.js +10 -0
- package/dist/blocks/panes/terminal-pane/index.d.ts +3 -0
- package/dist/blocks/panes/terminal-pane/index.js +9 -0
- package/dist/blocks/panes/usage-pane/index.d.ts +4 -0
- package/dist/blocks/panes/usage-pane/index.js +11 -0
- package/dist/blocks/profiles/profile-onboarding/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-onboarding/index.js +11 -0
- package/dist/blocks/profiles/profile-switcher/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-switcher/index.js +11 -0
- package/dist/blocks/profiles/profile-usage/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-usage/index.js +10 -0
- package/dist/blocks/sessions/inbox/index.d.ts +2 -0
- package/dist/blocks/sessions/inbox/index.js +11 -0
- package/dist/blocks/sessions/session-board/index.d.ts +4 -0
- package/dist/blocks/sessions/session-board/index.js +26 -0
- package/dist/blocks/sessions/session-sidebar/index.d.ts +5 -0
- package/dist/blocks/sessions/session-sidebar/index.js +15 -0
- package/dist/blocks/settings/extensions/index.d.ts +2 -0
- package/dist/blocks/settings/extensions/index.js +9 -0
- package/dist/blocks/settings/hooks/index.d.ts +4 -0
- package/dist/blocks/settings/hooks/index.js +9 -0
- package/dist/blocks/settings/mcp-servers/index.d.ts +4 -0
- package/dist/blocks/settings/mcp-servers/index.js +9 -0
- package/dist/blocks/settings/memory/index.d.ts +4 -0
- package/dist/blocks/settings/memory/index.js +8 -0
- package/dist/blocks/settings/notifications/index.d.ts +2 -0
- package/dist/blocks/settings/notifications/index.js +8 -0
- package/dist/blocks/settings/permission-rules/index.d.ts +3 -0
- package/dist/blocks/settings/permission-rules/index.js +10 -0
- package/dist/blocks/settings/plugin-catalog/index.d.ts +2 -0
- package/dist/blocks/settings/plugin-catalog/index.js +11 -0
- package/dist/blocks/settings/plugins/index.d.ts +4 -0
- package/dist/blocks/settings/plugins/index.js +9 -0
- package/dist/blocks/settings/settings-window/index.d.ts +4 -0
- package/dist/blocks/settings/settings-window/index.js +8 -0
- package/dist/blocks/settings/worktrees/index.d.ts +4 -0
- package/dist/blocks/settings/worktrees/index.js +9 -0
- package/dist/components/conversation/agent-run/index.d.ts +3 -0
- package/dist/components/conversation/agent-run/index.js +10 -0
- package/dist/components/conversation/chapter-nav/index.d.ts +2 -0
- package/dist/components/conversation/chapter-nav/index.js +11 -0
- package/dist/components/conversation/message/index.d.ts +2 -0
- package/dist/components/conversation/message/index.js +15 -0
- package/dist/components/conversation/reasoning/index.d.ts +2 -0
- package/dist/components/conversation/reasoning/index.js +8 -0
- package/dist/components/conversation/recap/index.d.ts +2 -0
- package/dist/components/conversation/recap/index.js +9 -0
- package/dist/components/conversation/todo-list/index.d.ts +2 -0
- package/dist/components/conversation/todo-list/index.js +9 -0
- package/dist/components/conversation/tool-call/index.d.ts +3 -0
- package/dist/components/conversation/tool-call/index.js +13 -0
- package/dist/components/conversation/work-summary/index.d.ts +2 -0
- package/dist/components/conversation/work-summary/index.js +10 -0
- package/dist/components/prompts/permission-request/index.d.ts +2 -0
- package/dist/components/prompts/permission-request/index.js +9 -0
- package/dist/components/prompts/plan-approval/index.d.ts +2 -0
- package/dist/components/prompts/plan-approval/index.js +9 -0
- package/dist/components/prompts/prompt-card/index.d.ts +3 -0
- package/dist/components/prompts/prompt-card/index.js +8 -0
- package/dist/components/prompts/question-prompt/index.d.ts +2 -0
- package/dist/components/prompts/question-prompt/index.js +9 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +231 -0
- package/dist/lib/config-parts.d.ts +2 -0
- package/dist/lib/config-parts.js +16 -0
- package/dist/lib/icons.d.ts +2 -0
- package/dist/lib/icons.js +10 -0
- package/dist/lib/pace-bar.d.ts +11 -0
- package/dist/lib/pace-bar.js +6 -0
- package/dist/lib/pace.d.ts +4 -0
- package/dist/lib/pace.js +12 -0
- package/dist/lib/pane-parts.d.ts +25 -0
- package/dist/lib/pane-parts.js +11 -0
- package/dist/lib/row-trigger.d.ts +5 -0
- package/dist/lib/row-trigger.js +7 -0
- package/dist/lib/settings-parts.d.ts +70 -0
- package/dist/lib/settings-parts.js +24 -0
- package/dist/lib/side-pane-types.d.ts +2 -0
- package/dist/lib/side-pane-types.js +1 -0
- package/dist/lib/status-glyph.d.ts +8 -0
- package/dist/lib/status-glyph.js +12 -0
- package/dist/lib/types.d.ts +3 -0
- package/dist/lib/types.js +1 -0
- package/dist/shared/chunk-04a497rr.js +21 -0
- package/dist/shared/chunk-13yf0mza.d.ts +70 -0
- package/dist/shared/chunk-1aq2xzv5.js +558 -0
- package/dist/shared/chunk-1f96cz69.js +45 -0
- package/dist/shared/chunk-1yt061np.d.ts +64 -0
- package/dist/shared/chunk-218qabm5.js +250 -0
- package/dist/shared/chunk-2fk5aq60.js +313 -0
- package/dist/shared/chunk-4248zvmh.js +177 -0
- package/dist/shared/chunk-45rqgey6.d.ts +25 -0
- package/dist/shared/chunk-4n0v64qx.js +179 -0
- package/dist/shared/chunk-4zvhpf2x.js +55 -0
- package/dist/shared/chunk-57hzzmjd.d.ts +67 -0
- package/dist/shared/chunk-58qvny6a.d.ts +29 -0
- package/dist/shared/chunk-5fhkkn39.js +130 -0
- package/dist/shared/chunk-5hw0525a.d.ts +33 -0
- package/dist/shared/chunk-5k6xwqfj.d.ts +68 -0
- package/dist/shared/chunk-5meda998.js +238 -0
- package/dist/shared/chunk-5pqksw7z.js +91 -0
- package/dist/shared/chunk-6220dy5n.js +70 -0
- package/dist/shared/chunk-64bnh22t.d.ts +59 -0
- package/dist/shared/chunk-66sh633m.d.ts +60 -0
- package/dist/shared/chunk-6cmf27g3.d.ts +81 -0
- package/dist/shared/chunk-6g4970a6.d.ts +20 -0
- package/dist/shared/chunk-75zwypyr.d.ts +43 -0
- package/dist/shared/chunk-7rzjmcnh.d.ts +30 -0
- package/dist/shared/chunk-7zvb39cf.d.ts +26 -0
- package/dist/shared/chunk-8mecznyr.js +357 -0
- package/dist/shared/chunk-8pag6vmd.js +255 -0
- package/dist/shared/chunk-8xg5gwwy.js +38 -0
- package/dist/shared/chunk-9kw6m047.d.ts +32 -0
- package/dist/shared/chunk-a4s440b6.js +79 -0
- package/dist/shared/chunk-at0jje23.d.ts +110 -0
- package/dist/shared/chunk-awd573h9.js +34 -0
- package/dist/shared/chunk-b171wjge.d.ts +25 -0
- package/dist/shared/chunk-bh2b5d1z.js +98 -0
- package/dist/shared/chunk-bzs6amnv.js +187 -0
- package/dist/shared/chunk-c36qvrwq.d.ts +30 -0
- package/dist/shared/chunk-c8wp058j.js +153 -0
- package/dist/shared/chunk-cd4f87as.d.ts +28 -0
- package/dist/shared/chunk-cmwby8f9.js +467 -0
- package/dist/shared/chunk-d2t72h4x.d.ts +35 -0
- package/dist/shared/chunk-dh3qy5fj.js +49 -0
- package/dist/shared/chunk-e46apgve.d.ts +40 -0
- package/dist/shared/chunk-ejtknc0w.js +21 -0
- package/dist/shared/chunk-eqajdxn8.js +82 -0
- package/dist/shared/chunk-fbn0h7cr.js +123 -0
- package/dist/shared/chunk-fqhcz6ss.d.ts +29 -0
- package/dist/shared/chunk-g28hweee.d.ts +35 -0
- package/dist/shared/chunk-g88hweqh.d.ts +70 -0
- package/dist/shared/chunk-gewnsgza.js +61 -0
- package/dist/shared/chunk-gkyk663q.d.ts +53 -0
- package/dist/shared/chunk-hd4gtj5z.d.ts +23 -0
- package/dist/shared/chunk-hxjgey30.d.ts +36 -0
- package/dist/shared/chunk-jkkdq1mh.d.ts +213 -0
- package/dist/shared/chunk-jpq101w3.js +91 -0
- package/dist/shared/chunk-k3bv9k1v.d.ts +56 -0
- package/dist/shared/chunk-k5zegxje.d.ts +81 -0
- package/dist/shared/chunk-kreypnzp.d.ts +34 -0
- package/dist/shared/chunk-kw9npka5.js +224 -0
- package/dist/shared/chunk-mrb3fp2f.d.ts +30 -0
- package/dist/shared/chunk-n1qq2wp9.js +6 -0
- package/dist/shared/chunk-n4742y54.js +39 -0
- package/dist/shared/chunk-ndjvdkv7.d.ts +29 -0
- package/dist/shared/chunk-nk4578dr.js +73 -0
- package/dist/shared/chunk-paezqfg1.js +106 -0
- package/dist/shared/chunk-qemm9e3r.d.ts +21 -0
- package/dist/shared/chunk-qhxz1etk.js +96 -0
- package/dist/shared/chunk-qj5ev9ak.js +531 -0
- package/dist/shared/chunk-qnwggvjy.js +150 -0
- package/dist/shared/chunk-r5hz78pb.js +129 -0
- package/dist/shared/chunk-r6nb21kz.d.ts +102 -0
- package/dist/shared/chunk-rjfwje37.d.ts +234 -0
- package/dist/shared/chunk-rqrpvvz4.d.ts +107 -0
- package/dist/shared/chunk-rzajcn44.d.ts +49 -0
- package/dist/shared/chunk-s3r759ec.js +80 -0
- package/dist/shared/chunk-sdtjrw9w.d.ts +98 -0
- package/dist/shared/chunk-sfqvyzcs.d.ts +68 -0
- package/dist/shared/chunk-skg3m9m0.js +56 -0
- package/dist/shared/chunk-szkvrqg1.d.ts +54 -0
- package/dist/shared/chunk-t21t9x7e.js +188 -0
- package/dist/shared/chunk-tc75ng2c.js +235 -0
- package/dist/shared/chunk-tkx1krwc.js +88 -0
- package/dist/shared/chunk-tprdqtb1.d.ts +30 -0
- package/dist/shared/chunk-tv9a1sek.js +137 -0
- package/dist/shared/chunk-tvbd27hg.d.ts +43 -0
- package/dist/shared/chunk-v6yevw62.d.ts +28 -0
- package/dist/shared/chunk-v9q38p0x.js +258 -0
- package/dist/shared/chunk-vd59gzzd.js +86 -0
- package/dist/shared/chunk-vgh4f3sv.js +118 -0
- package/dist/shared/chunk-vjht1zn1.js +391 -0
- package/dist/shared/chunk-vsrkb0sp.d.ts +21 -0
- package/dist/shared/chunk-w5z8qnf8.js +175 -0
- package/dist/shared/chunk-wgvzavx1.js +1488 -0
- package/dist/shared/chunk-whsx7yp9.d.ts +37 -0
- package/dist/shared/chunk-x7az5x1y.d.ts +57 -0
- package/dist/shared/chunk-x9jf26yb.js +318 -0
- package/dist/shared/chunk-xbrrt07s.d.ts +23 -0
- package/dist/shared/chunk-xkchhs2z.js +129 -0
- package/dist/shared/chunk-xzfrskd7.js +202 -0
- package/dist/shared/chunk-y4cj4y54.js +423 -0
- package/dist/shared/chunk-y934at6m.js +7 -0
- package/dist/shared/chunk-zbpwhpjy.d.ts +75 -0
- package/dist/shared/chunk-zfhmbb7n.js +63 -0
- package/dist/shared/chunk-zk0t4vq5.js +71 -0
- package/dist/shared/chunk-znp9gna7.d.ts +23 -0
- package/dist/styles.css +467 -0
- package/index.ts +49 -0
- package/lib/config-parts.tsx +97 -0
- package/lib/icons.tsx +149 -0
- package/lib/pace-bar.tsx +24 -0
- package/lib/pace.ts +74 -0
- package/lib/pane-parts.tsx +76 -0
- package/lib/row-trigger.tsx +44 -0
- package/lib/settings-parts.tsx +232 -0
- package/lib/side-pane-types.ts +75 -0
- package/lib/status-glyph.tsx +25 -0
- package/lib/types.ts +204 -0
- package/mock/demo-reply.tsx +33 -0
- package/mock/demo-session.tsx +150 -0
- package/mock/mock-config.ts +173 -0
- package/mock/mock-extras.ts +288 -0
- package/mock/mock-panes.ts +190 -0
- package/mock/mock-settings.ts +92 -0
- package/mock/mock.ts +548 -0
- package/mock/screen-frame.tsx +49 -0
- package/package.json +114 -4
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the AI app's permissions settings section — the default
|
|
3
|
+
* permission mode, allow / ask / deny rules with their scope, added inline
|
|
4
|
+
* and moved between groups, and the extra directories the sessions may
|
|
5
|
+
* touch.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use client'
|
|
9
|
+
|
|
10
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
11
|
+
import Badge, { type BadgeColor } from '@justanarthur/modo-ui/components/data-display/badge'
|
|
12
|
+
import List from '@justanarthur/modo-ui/components/data-display/list'
|
|
13
|
+
import Input from '@justanarthur/modo-ui/components/inputs/input'
|
|
14
|
+
import Select from '@justanarthur/modo-ui/components/inputs/select'
|
|
15
|
+
import { useControllableState } from '@justanarthur/modo-ui/lib/use-controllable-state'
|
|
16
|
+
import { type ReactNode, useState } from 'react'
|
|
17
|
+
import { type ConfigScope, SCOPES } from '../../../lib/config-parts'
|
|
18
|
+
import { useIcon } from '../../../lib/icons'
|
|
19
|
+
import { Group, ON_HOVER, Section } from '../../../lib/settings-parts'
|
|
20
|
+
|
|
21
|
+
export type PermissionBehavior = 'allow' | 'ask' | 'deny'
|
|
22
|
+
|
|
23
|
+
export type PermissionModeValue = 'default' | 'acceptEdits' | 'plan' | 'bypassPermissions'
|
|
24
|
+
|
|
25
|
+
/** One rule: a tool, optionally with a pattern (`Bash(bun run *)`), what it gets, and where it lives. */
|
|
26
|
+
export interface PermissionRule {
|
|
27
|
+
rule: string
|
|
28
|
+
behavior: PermissionBehavior
|
|
29
|
+
scope: ConfigScope
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Everything the section edits. */
|
|
33
|
+
export interface PermissionSettings {
|
|
34
|
+
mode: PermissionModeValue
|
|
35
|
+
rules: PermissionRule[]
|
|
36
|
+
/** Paths outside the working directory the sessions may read and edit. */
|
|
37
|
+
directories: string[]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const BEHAVIORS: { value: PermissionBehavior; label: string; note: string }[] = [
|
|
41
|
+
{ value: 'allow', label: 'Allow', note: 'Runs without asking.' },
|
|
42
|
+
{ value: 'ask', label: 'Ask', note: 'Asks every time, even where an allow rule matches.' },
|
|
43
|
+
{ value: 'deny', label: 'Deny', note: 'Never runs; deny wins over every other rule.' },
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
const MODES: { value: PermissionModeValue; label: string; note: string }[] = [
|
|
47
|
+
{ value: 'default', label: 'Ask first', note: 'Asks the first time each tool is used.' },
|
|
48
|
+
{ value: 'acceptEdits', label: 'Accept edits', note: 'File edits go through; commands still ask.' },
|
|
49
|
+
{ value: 'plan', label: 'Plan', note: 'Reads and plans; changes nothing until a plan is approved.' },
|
|
50
|
+
{ value: 'bypassPermissions', label: 'Bypass', note: 'Never asks. Only in a sandbox or a container.' },
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
const SCOPE_BADGE: Record<ConfigScope, BadgeColor> = { user: 'gray', project: 'blue', local: 'violet' }
|
|
54
|
+
|
|
55
|
+
// A tool name (or an MCP server / tool) with an optional pattern in parentheses.
|
|
56
|
+
const RULE = /^(?:[A-Z][A-Za-z]*|mcp__[\w-]+(?:__[\w-]+)?)(?:\([^()]+\))?$/
|
|
57
|
+
|
|
58
|
+
const EMPTY: PermissionSettings = { mode: 'default', rules: [], directories: [] }
|
|
59
|
+
|
|
60
|
+
function ruleError(rule: string, rules: PermissionRule[]) {
|
|
61
|
+
if (!rule) return undefined
|
|
62
|
+
if (!RULE.test(rule))
|
|
63
|
+
return 'A tool name, optionally with a pattern: Bash(bun run *), Edit(ui/**), WebFetch(domain:github.com).'
|
|
64
|
+
const clash = rules.find(r => r.rule === rule)
|
|
65
|
+
if (clash) return `Already in ${BEHAVIORS.find(b => b.value === clash.behavior)?.label}.`
|
|
66
|
+
return undefined
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function Picker<T extends string>({
|
|
70
|
+
label,
|
|
71
|
+
options,
|
|
72
|
+
value,
|
|
73
|
+
onValueChange,
|
|
74
|
+
className,
|
|
75
|
+
}: {
|
|
76
|
+
label: string
|
|
77
|
+
options: { value: T; label: string }[]
|
|
78
|
+
value: T
|
|
79
|
+
onValueChange: (value: T) => void
|
|
80
|
+
className?: string
|
|
81
|
+
}) {
|
|
82
|
+
return (
|
|
83
|
+
<Select
|
|
84
|
+
size="compact"
|
|
85
|
+
value={value}
|
|
86
|
+
onValueChange={next => onValueChange(options.find(o => o.value === next)?.value ?? value)}
|
|
87
|
+
>
|
|
88
|
+
<Select.Trigger variant="borderless" aria-label={label} className={className} />
|
|
89
|
+
<Select.Content>
|
|
90
|
+
{options.map((o, i) => (
|
|
91
|
+
<Select.Item key={o.value} index={i} value={o.value}>
|
|
92
|
+
{o.label}
|
|
93
|
+
</Select.Item>
|
|
94
|
+
))}
|
|
95
|
+
</Select.Content>
|
|
96
|
+
</Select>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function Line({ children, actions }: { children: ReactNode; actions: ReactNode }) {
|
|
101
|
+
return (
|
|
102
|
+
<li className="group/row flex h-9 min-w-0 items-center gap-[var(--space-2)] border-b border-border last:border-b-0">
|
|
103
|
+
<span className="flex min-w-0 flex-1 items-center gap-[var(--space-2)]">{children}</span>
|
|
104
|
+
{actions}
|
|
105
|
+
</li>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function Remove({ label, onPress }: { label: string; onPress: () => void }) {
|
|
110
|
+
const Trash = useIcon('trash')
|
|
111
|
+
return (
|
|
112
|
+
<Button variant="ghost" size="icon-compact" aria-label={label} className={ON_HOVER} onClick={onPress}>
|
|
113
|
+
<Trash />
|
|
114
|
+
</Button>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function AddRule({ rules, onAdd }: { rules: PermissionRule[]; onAdd: (rule: PermissionRule) => void }) {
|
|
119
|
+
const [text, setRule] = useState('')
|
|
120
|
+
const rule = text.trim()
|
|
121
|
+
const [behavior, setBehavior] = useState<PermissionBehavior>('allow')
|
|
122
|
+
const [scope, setScope] = useState<ConfigScope>('project')
|
|
123
|
+
const Plus = useIcon('plus')
|
|
124
|
+
const error = ruleError(rule, rules)
|
|
125
|
+
const add = () => {
|
|
126
|
+
if (!rule || error) return
|
|
127
|
+
onAdd({ rule, behavior, scope })
|
|
128
|
+
setRule('')
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<div className="flex flex-col gap-[var(--space-1)]">
|
|
133
|
+
<div className="flex flex-wrap items-center gap-[var(--space-2)]">
|
|
134
|
+
<Input
|
|
135
|
+
variant="bordered"
|
|
136
|
+
size="compact"
|
|
137
|
+
aria-label="New rule"
|
|
138
|
+
placeholder="Bash(bun run *)"
|
|
139
|
+
className="min-w-48 flex-1 font-mono"
|
|
140
|
+
value={text}
|
|
141
|
+
invalid={Boolean(error)}
|
|
142
|
+
onValueChange={setRule}
|
|
143
|
+
onKeyDown={e => e.key === 'Enter' && add()}
|
|
144
|
+
/>
|
|
145
|
+
<Picker label="Rule behavior" options={BEHAVIORS} value={behavior} onValueChange={setBehavior} />
|
|
146
|
+
<Picker label="Rule scope" options={SCOPES} value={scope} onValueChange={setScope} />
|
|
147
|
+
<Button size="compact" variant="secondary" leadingIcon={Plus} disabled={!rule || Boolean(error)} onClick={add}>
|
|
148
|
+
Add rule
|
|
149
|
+
</Button>
|
|
150
|
+
</div>
|
|
151
|
+
{error && <span className="text-caption text-destructive">{error}</span>}
|
|
152
|
+
</div>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function AddDirectory({ directories, onAdd }: { directories: string[]; onAdd: (path: string) => void }) {
|
|
157
|
+
const [text, setPath] = useState('')
|
|
158
|
+
const path = text.trim()
|
|
159
|
+
const Plus = useIcon('plus')
|
|
160
|
+
const taken = directories.includes(path)
|
|
161
|
+
const add = () => {
|
|
162
|
+
if (!path || taken) return
|
|
163
|
+
onAdd(path)
|
|
164
|
+
setPath('')
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<div className="flex flex-col gap-[var(--space-1)] pt-[var(--space-2)]">
|
|
169
|
+
<div className="flex items-center gap-[var(--space-2)]">
|
|
170
|
+
<Input
|
|
171
|
+
variant="bordered"
|
|
172
|
+
size="compact"
|
|
173
|
+
aria-label="New directory"
|
|
174
|
+
placeholder="../../shared-config"
|
|
175
|
+
className="min-w-0 flex-1 font-mono"
|
|
176
|
+
value={text}
|
|
177
|
+
invalid={taken}
|
|
178
|
+
onValueChange={setPath}
|
|
179
|
+
onKeyDown={e => e.key === 'Enter' && add()}
|
|
180
|
+
/>
|
|
181
|
+
<Button size="compact" variant="secondary" leadingIcon={Plus} disabled={!path || taken} onClick={add}>
|
|
182
|
+
Add directory
|
|
183
|
+
</Button>
|
|
184
|
+
</div>
|
|
185
|
+
{taken && <span className="text-caption text-destructive">Already listed.</span>}
|
|
186
|
+
</div>
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
interface PermissionRulesProps {
|
|
191
|
+
/** Controlled settings. Pair with `onChange`. */
|
|
192
|
+
value?: PermissionSettings
|
|
193
|
+
/** Initial settings, for an uncontrolled section. Defaults to the default mode, no rules and no directories. */
|
|
194
|
+
defaultValue?: PermissionSettings
|
|
195
|
+
/** Called with the whole settings whenever a rule, the mode or a directory changes. */
|
|
196
|
+
onChange?: (value: PermissionSettings) => void
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* What the sessions may do without asking: the default permission mode,
|
|
201
|
+
* rules that allow, ask or deny a tool, and directories beyond the repo.
|
|
202
|
+
*
|
|
203
|
+
* A rule is a tool name, optionally with a pattern: `Bash(bun run *)`,
|
|
204
|
+
* `Edit(ui/**)`, `WebFetch(domain:github.com)`, `mcp__github`. Type one on
|
|
205
|
+
* the add line, pick what it gets and where it lives, and it lands in its
|
|
206
|
+
* group; a malformed rule or one already listed is caught as you type. Each
|
|
207
|
+
* rule's badge names its scope (user, project, local); its picker moves it
|
|
208
|
+
* between Allow, Ask and Deny, and the bin removes it (both shown on hover,
|
|
209
|
+
* always on touch). Deny wins over ask, and ask over allow. Works controlled
|
|
210
|
+
* (`value` + `onChange`) or uncontrolled (`defaultValue`).
|
|
211
|
+
*
|
|
212
|
+
* @example {@include ./examples.mdx}
|
|
213
|
+
*/
|
|
214
|
+
export default function PermissionRules({ value, defaultValue = EMPTY, onChange }: PermissionRulesProps) {
|
|
215
|
+
const [settings, setSettings] = useControllableState(value, defaultValue, onChange)
|
|
216
|
+
const set = (patch: Partial<PermissionSettings>) => setSettings({ ...settings, ...patch })
|
|
217
|
+
const setRules = (rules: PermissionRule[]) => set({ rules })
|
|
218
|
+
const mode = MODES.find(m => m.value === settings.mode)
|
|
219
|
+
|
|
220
|
+
return (
|
|
221
|
+
<Section
|
|
222
|
+
title="Permissions"
|
|
223
|
+
lead="What the sessions may do without asking. Project rules come from the repo's .claude/settings.json, local ones from its git-ignored settings.local.json."
|
|
224
|
+
>
|
|
225
|
+
<List className="-ml-[var(--space-2)]">
|
|
226
|
+
<List.Row label="Default mode" description={mode?.note}>
|
|
227
|
+
<Picker
|
|
228
|
+
label="Default mode"
|
|
229
|
+
options={MODES}
|
|
230
|
+
value={settings.mode}
|
|
231
|
+
onValueChange={next => set({ mode: next })}
|
|
232
|
+
/>
|
|
233
|
+
</List.Row>
|
|
234
|
+
</List>
|
|
235
|
+
|
|
236
|
+
<AddRule rules={settings.rules} onAdd={rule => setRules([...settings.rules, rule])} />
|
|
237
|
+
|
|
238
|
+
{BEHAVIORS.map(behavior => {
|
|
239
|
+
const rules = settings.rules.filter(r => r.behavior === behavior.value)
|
|
240
|
+
return (
|
|
241
|
+
<Group
|
|
242
|
+
key={behavior.value}
|
|
243
|
+
title={`${behavior.label} · ${behavior.note}`}
|
|
244
|
+
aside={<span className="tabular-nums">{rules.length}</span>}
|
|
245
|
+
>
|
|
246
|
+
{rules.length === 0 ? (
|
|
247
|
+
<p className="m-0 py-[var(--space-2)] text-body text-muted-foreground">
|
|
248
|
+
No {behavior.label.toLowerCase()} rules.
|
|
249
|
+
</p>
|
|
250
|
+
) : (
|
|
251
|
+
<ul aria-label={behavior.label} className="m-0 flex list-none flex-col p-0">
|
|
252
|
+
{rules.map(rule => (
|
|
253
|
+
<Line
|
|
254
|
+
key={rule.rule}
|
|
255
|
+
actions={
|
|
256
|
+
<>
|
|
257
|
+
<Picker
|
|
258
|
+
label={`Move ${rule.rule}`}
|
|
259
|
+
options={BEHAVIORS}
|
|
260
|
+
value={rule.behavior}
|
|
261
|
+
className={ON_HOVER}
|
|
262
|
+
onValueChange={next =>
|
|
263
|
+
setRules(settings.rules.map(r => (r === rule ? { ...r, behavior: next } : r)))
|
|
264
|
+
}
|
|
265
|
+
/>
|
|
266
|
+
<Remove
|
|
267
|
+
label={`Remove ${rule.rule}`}
|
|
268
|
+
onPress={() => setRules(settings.rules.filter(r => r !== rule))}
|
|
269
|
+
/>
|
|
270
|
+
</>
|
|
271
|
+
}
|
|
272
|
+
>
|
|
273
|
+
<span className="min-w-0 truncate font-mono text-caption text-foreground">{rule.rule}</span>
|
|
274
|
+
<Badge size="compact" color={SCOPE_BADGE[rule.scope]}>
|
|
275
|
+
{rule.scope}
|
|
276
|
+
</Badge>
|
|
277
|
+
</Line>
|
|
278
|
+
))}
|
|
279
|
+
</ul>
|
|
280
|
+
)}
|
|
281
|
+
</Group>
|
|
282
|
+
)
|
|
283
|
+
})}
|
|
284
|
+
|
|
285
|
+
<Group
|
|
286
|
+
title="Additional directories · read and edited like the repo"
|
|
287
|
+
aside={<span className="tabular-nums">{settings.directories.length}</span>}
|
|
288
|
+
>
|
|
289
|
+
{settings.directories.length > 0 && (
|
|
290
|
+
<ul aria-label="Additional directories" className="m-0 flex list-none flex-col p-0">
|
|
291
|
+
{settings.directories.map(path => (
|
|
292
|
+
<Line
|
|
293
|
+
key={path}
|
|
294
|
+
actions={
|
|
295
|
+
<Remove
|
|
296
|
+
label={`Remove ${path}`}
|
|
297
|
+
onPress={() => set({ directories: settings.directories.filter(d => d !== path) })}
|
|
298
|
+
/>
|
|
299
|
+
}
|
|
300
|
+
>
|
|
301
|
+
<span className="min-w-0 truncate font-mono text-caption text-foreground">{path}</span>
|
|
302
|
+
</Line>
|
|
303
|
+
))}
|
|
304
|
+
</ul>
|
|
305
|
+
)}
|
|
306
|
+
<AddDirectory
|
|
307
|
+
directories={settings.directories}
|
|
308
|
+
onAdd={path => set({ directories: [...settings.directories, path] })}
|
|
309
|
+
/>
|
|
310
|
+
</Group>
|
|
311
|
+
</Section>
|
|
312
|
+
)
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export type { PermissionRulesProps }
|
|
316
|
+
|
|
317
|
+
export { PermissionRules }
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import PluginCatalog from './index'
|
|
2
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
3
|
+
import { CATALOG } from '../../../mock/mock-config'
|
|
4
|
+
|
|
5
|
+
# Browse the catalog
|
|
6
|
+
|
|
7
|
+
Press the button: the catalog grows out of it. Search, pick a category, pick a plugin for its README.
|
|
8
|
+
|
|
9
|
+
<PluginCatalog trigger={<Button variant="secondary">Browse catalog</Button>} plugins={CATALOG} />
|
|
10
|
+
|
|
11
|
+
# A plugin's detail
|
|
12
|
+
|
|
13
|
+
The README and the contents (beside the list in the wider dialog); an installed plugin with a newer version offers Update.
|
|
14
|
+
|
|
15
|
+
<div className="flex h-[600px] w-full rounded-xl border border-border bg-background p-6">
|
|
16
|
+
<PluginCatalog.Panel plugins={CATALOG} defaultSelected="pr-review-toolkit" className="flex-1" />
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
# Installing
|
|
20
|
+
|
|
21
|
+
`pending` spins a plugin's button while the app installs it.
|
|
22
|
+
|
|
23
|
+
<div className="flex h-[480px] w-full rounded-xl border border-border bg-background p-6">
|
|
24
|
+
<PluginCatalog.Panel plugins={CATALOG} defaultSelected="playwright" pending={['playwright']} className="flex-1" />
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
# No results
|
|
28
|
+
|
|
29
|
+
Nothing matches: the empty state clears the filters.
|
|
30
|
+
|
|
31
|
+
<div className="flex h-[360px] w-full rounded-xl border border-border bg-background p-6">
|
|
32
|
+
<PluginCatalog.Panel plugins={CATALOG} defaultQuery="kubernetes" className="flex-1" />
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
# Narrow
|
|
36
|
+
|
|
37
|
+
In a narrow window the detail takes the list's place, with a way back.
|
|
38
|
+
|
|
39
|
+
<div className="flex h-[560px] w-[420px] max-w-full rounded-xl border border-border bg-background p-6">
|
|
40
|
+
<PluginCatalog.Panel plugins={CATALOG} defaultSelected="commit-commands" className="flex-1" />
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
# Light and dark
|
|
44
|
+
|
|
45
|
+
<div className="grid w-full gap-3 @5xl:grid-cols-2">
|
|
46
|
+
<div className="light flex h-[480px] rounded-xl border border-border bg-background p-6 text-foreground">
|
|
47
|
+
<PluginCatalog.Panel plugins={CATALOG} defaultSelected="sentry" className="flex-1" />
|
|
48
|
+
</div>
|
|
49
|
+
<div className="dark flex h-[480px] rounded-xl border border-border bg-background p-6 text-foreground">
|
|
50
|
+
<PluginCatalog.Panel plugins={CATALOG} defaultSelected="sentry" className="flex-1" />
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|