@arbidocs/blocks 0.4.3 → 0.4.5
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/README.md +25 -0
- package/dist/agents/definitions/AgentCreator.d.ts +11 -2
- package/dist/agents/definitions/index.d.ts +1 -0
- package/dist/agents/definitions/persona.d.ts +16 -0
- package/dist/agents/index.cjs +202 -150
- package/dist/agents/index.js +6 -6
- package/dist/agents/tasks/TaskRunsDialog.d.ts +15 -3
- package/dist/agents/tasks/index.d.ts +1 -0
- package/dist/agents/tasks/taskRequest.d.ts +61 -0
- package/dist/artifacts/ArtifactCompareBar.d.ts +33 -0
- package/dist/artifacts/ArtifactEditor.d.ts +64 -0
- package/dist/artifacts/ArtifactEditorBody.d.ts +34 -0
- package/dist/artifacts/ArtifactRedlineView.d.ts +57 -0
- package/dist/artifacts/ArtifactToolbar.d.ts +53 -0
- package/dist/artifacts/ArtifactVersionBar.d.ts +42 -0
- package/dist/{files → artifacts}/RedlineParts.d.ts +4 -0
- package/dist/artifacts/editor/ArtifactMarkdownEditor.d.ts +39 -0
- package/dist/artifacts/editor/index.cjs +89 -0
- package/dist/artifacts/editor/index.cjs.map +1 -0
- package/dist/artifacts/editor/index.d.ts +1 -0
- package/dist/artifacts/editor/index.js +86 -0
- package/dist/artifacts/editor/index.js.map +1 -0
- package/dist/artifacts/index.cjs +807 -0
- package/dist/artifacts/index.cjs.map +1 -0
- package/dist/artifacts/index.d.ts +8 -0
- package/dist/artifacts/index.js +787 -0
- package/dist/artifacts/index.js.map +1 -0
- package/dist/chat/index.cjs +54 -54
- package/dist/chat/index.js +2 -2
- package/dist/{chunk-XKKGGUU2.cjs → chunk-3MIQASHO.cjs} +4 -4
- package/dist/{chunk-XKKGGUU2.cjs.map → chunk-3MIQASHO.cjs.map} +1 -1
- package/dist/{chunk-B673CCW5.js → chunk-3PJCET7H.js} +3 -3
- package/dist/{chunk-B673CCW5.js.map → chunk-3PJCET7H.js.map} +1 -1
- package/dist/{chunk-VXOGANFJ.cjs → chunk-3PZPRAAR.cjs} +189 -34
- package/dist/chunk-3PZPRAAR.cjs.map +1 -0
- package/dist/{chunk-AAY5ASZD.js → chunk-5XTZFH65.js} +170 -28
- package/dist/chunk-5XTZFH65.js.map +1 -0
- package/dist/{chunk-JPO3F4J7.js → chunk-6YHWXMPQ.js} +3 -3
- package/dist/{chunk-JPO3F4J7.js.map → chunk-6YHWXMPQ.js.map} +1 -1
- package/dist/{chunk-TYZUCAT7.js → chunk-7YADKWZT.js} +43 -6
- package/dist/chunk-7YADKWZT.js.map +1 -0
- package/dist/{chunk-SYDHKKRZ.cjs → chunk-IZHWP6WQ.cjs} +47 -5
- package/dist/chunk-IZHWP6WQ.cjs.map +1 -0
- package/dist/{chunk-ZVPTFTGV.cjs → chunk-MVNCQDDE.cjs} +4 -4
- package/dist/{chunk-ZVPTFTGV.cjs.map → chunk-MVNCQDDE.cjs.map} +1 -1
- package/dist/{chunk-NJL4LIXX.js → chunk-NPKGUQU5.js} +4 -4
- package/dist/{chunk-NJL4LIXX.js.map → chunk-NPKGUQU5.js.map} +1 -1
- package/dist/{chunk-ATXPAD6S.cjs → chunk-YLOKCIQJ.cjs} +3 -3
- package/dist/{chunk-ATXPAD6S.cjs.map → chunk-YLOKCIQJ.cjs.map} +1 -1
- package/dist/collaboration/contacts/AddContactsParts.d.ts +9 -4
- package/dist/collaboration/contacts/index.d.ts +1 -0
- package/dist/collaboration/contacts/parseEmails.d.ts +26 -0
- package/dist/collaboration/index.cjs +51 -31
- package/dist/collaboration/index.js +1 -1
- package/dist/connect/index.cjs +18 -18
- package/dist/connect/index.js +4 -4
- package/dist/facts/index.cjs +1 -1
- package/dist/facts/index.js +1 -1
- package/dist/files/ViewerChrome.d.ts +0 -45
- package/dist/files/ViewerParts.d.ts +0 -19
- package/dist/files/index.cjs +4 -436
- package/dist/files/index.cjs.map +1 -1
- package/dist/files/index.d.ts +2 -4
- package/dist/files/index.js +8 -428
- package/dist/files/index.js.map +1 -1
- package/dist/home/index.cjs +19 -19
- package/dist/home/index.js +4 -4
- package/dist/index.cjs +411 -339
- package/dist/index.js +13 -13
- package/dist/settings/index.cjs +3 -3
- package/dist/settings/index.js +3 -3
- package/dist/shell/index.cjs +10 -10
- package/dist/shell/index.js +2 -2
- package/dist/site/index.cjs +5 -5
- package/dist/site/index.js +1 -1
- package/dist/studio/index.cjs +8 -8
- package/dist/studio/index.js +6 -6
- package/package.json +25 -4
- package/dist/chunk-AAY5ASZD.js.map +0 -1
- package/dist/chunk-SYDHKKRZ.cjs.map +0 -1
- package/dist/chunk-TYZUCAT7.js.map +0 -1
- package/dist/chunk-VXOGANFJ.cjs.map +0 -1
- /package/dist/{files → artifacts}/VersionTimeline.d.ts +0 -0
package/README.md
CHANGED
|
@@ -65,6 +65,8 @@ Every capability is its own entry, so a bundler only loads what you use:
|
|
|
65
65
|
| `@arbidocs/blocks` | Light root: theme, primitives, chat, shell, auth, retrieval, agents, citations, collaboration, site blocks | none (zustand, dompurify) |
|
|
66
66
|
| `/chat`, `/shell`, `/auth`, `/retrieval`, `/citations`, `/collaboration`, `/agents`, `/timeline`, `/site` | one capability each | none |
|
|
67
67
|
| `/files`, `/facts` | document grid, facts table | `ag-grid-*` |
|
|
68
|
+
| `/artifacts` | artifact editor, version bar, track changes | none |
|
|
69
|
+
| `/artifacts/editor` | rich-text (markdown) editing surface | `@mdxeditor/editor` (optional peer) |
|
|
68
70
|
| `/home`, `/workspaces` | dashboard, workspace cards and forms | `@dnd-kit/*` |
|
|
69
71
|
| `/settings` | settings, billing, modals | `cmdk` |
|
|
70
72
|
| `/connect` | demo/live connection layer | `@tanstack/react-query` |
|
|
@@ -112,6 +114,29 @@ const { isDockAvailable } = useChatSurface()
|
|
|
112
114
|
```
|
|
113
115
|
|
|
114
116
|
Theme the user bubble with `--chat-user-bubble` and `--chat-user-bubble-foreground` (HSL triplets).
|
|
117
|
+
## Edit an artifact, save versions, compare
|
|
118
|
+
|
|
119
|
+
`/artifacts` is the surface for an AI-drafted document the user may edit: a toolbar (Edit, Cancel,
|
|
120
|
+
Compare, Save as a new version), a version bar ("Version 2 of 3", a list, Compare with previous),
|
|
121
|
+
and Word-style track changes between two versions with a per-change undo. It is presentational:
|
|
122
|
+
state comes from `useArtifactSession` in `@arbidocs/react/artifacts`, and the editor and redline are
|
|
123
|
+
slots.
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import { ArtifactEditor, ArtifactRedlineView } from '@arbidocs/blocks/artifacts'
|
|
127
|
+
import { ArtifactMarkdownEditor } from '@arbidocs/blocks/artifacts/editor'
|
|
128
|
+
import { renderArtifactMarkdown, useArtifactSession } from '@arbidocs/react/artifacts'
|
|
129
|
+
import '@mdxeditor/editor/style.css'
|
|
130
|
+
|
|
131
|
+
const s = useArtifactSession({ workspaceId, docId, onSaved: ({ docId: next }) => next && open(next) })
|
|
132
|
+
<ArtifactEditor {...s.view} onOpenVersion={open} renderMarkdown={renderArtifactMarkdown}
|
|
133
|
+
editor={<ArtifactMarkdownEditor {...s.editorProps} />}
|
|
134
|
+
redline={<ArtifactRedlineView {...s.redlineProps} renderMarkdown={renderArtifactMarkdown} />} />
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Every part takes `labels` and `testIds`; Mod+S saves while editing; touch targets are 44px. The
|
|
138
|
+
editor needs `@mdxeditor/editor` (optional peer) and is heavy (mount it behind `lazy`) and needs the global `Prism` defined before it loads (`@lexical/code` reads it while it evaluates): in the module that lazily imports the editor, import first a side-effect module with `import Prism from 'prismjs'; globalThis.Prism = Prism`. A library cannot order that reliably across bundlers.
|
|
139
|
+
See `examples/custom-ui/ArtifactPage.tsx` for a custom editing surface on in-memory data.
|
|
115
140
|
|
|
116
141
|
## Editorial site parts
|
|
117
142
|
|
|
@@ -52,6 +52,8 @@ export interface AgentCreatorLabels {
|
|
|
52
52
|
workspaceAccess: string;
|
|
53
53
|
workspaceAccessHint: string;
|
|
54
54
|
workspaceAlready: string;
|
|
55
|
+
/** Accessible name of the revoke button next to an already-granted workspace. */
|
|
56
|
+
revokeWorkspace: (workspaceName: string) => string;
|
|
55
57
|
noWorkspacesToGrant: string;
|
|
56
58
|
name: string;
|
|
57
59
|
nameHint: string;
|
|
@@ -94,8 +96,15 @@ export interface AgentCreatorProps {
|
|
|
94
96
|
id: string;
|
|
95
97
|
name: string;
|
|
96
98
|
}>;
|
|
97
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* Workspaces the agent can already read: shown ticked and fixed. Without `onRevokeWorkspace`
|
|
101
|
+
* they cannot be undone here; with it each gets a remove button.
|
|
102
|
+
*/
|
|
98
103
|
grantedWorkspaceIds?: string[];
|
|
104
|
+
/** Take back a granted workspace (the host revokes, then refreshes `grantedWorkspaceIds`). */
|
|
105
|
+
onRevokeWorkspace?: (workspaceId: string) => void;
|
|
106
|
+
/** The workspace whose revoke is in flight; its button is disabled. */
|
|
107
|
+
revokingWorkspaceId?: string;
|
|
99
108
|
/** One-click avatar (or anything that sits beside the name). */
|
|
100
109
|
avatar?: ReactNode | ((values: AgentCreatorValues) => ReactNode);
|
|
101
110
|
types?: AgentTypeOption<string>[];
|
|
@@ -115,4 +124,4 @@ export interface AgentCreatorProps {
|
|
|
115
124
|
* capabilities, a live sentence says what the agent can and cannot do, and the knobs (capability
|
|
116
125
|
* toggles, model, type, avatar, pickers) are folded under Advanced.
|
|
117
126
|
*/
|
|
118
|
-
export declare function AgentCreator({ open, onOpenChange, isEdit, agentName, capabilities, templates, models, workspaces, grantedWorkspaceIds, avatar, types, values: valuesProp, initialValues, onValuesChange, advanced, isSaving, onSubmit, labels, testId, }: AgentCreatorProps): import("react").JSX.Element;
|
|
127
|
+
export declare function AgentCreator({ open, onOpenChange, isEdit, agentName, capabilities, templates, models, workspaces, grantedWorkspaceIds, onRevokeWorkspace, revokingWorkspaceId, avatar, types, values: valuesProp, initialValues, onValuesChange, advanced, isSaving, onSubmit, labels, testId, }: AgentCreatorProps): import("react").JSX.Element;
|
|
@@ -2,3 +2,4 @@ export { AgentCard, DEFAULT_AGENT_CARD_LABELS, type AgentCardProps, type AgentCa
|
|
|
2
2
|
export { AgentGallery, DEFAULT_AGENT_GALLERY_LABELS, type AgentGalleryProps, type AgentGalleryLabels, type AgentGalleryTestIds, } from './AgentGallery';
|
|
3
3
|
export { CapabilityTile, CapabilityGrid, AgentTypeSelector, AgentAvatarField, DEFAULT_AGENT_TYPE_SELECTOR_LABELS, DEFAULT_AGENT_AVATAR_FIELD_LABELS, type AgentTypeSelectorLabels, type AgentAvatarFieldLabels, type AgentAvatarFieldTestIds, type CapabilityTileProps, type AgentTypeOption, type AgentTypeSelectorProps, type AgentAvatarFieldProps, } from './AgentEditorParts';
|
|
4
4
|
export { AgentCreator, DEFAULT_AGENT_CREATOR_LABELS, deriveAgentName, isValidAgentName, summarizeCapabilities, summarizeAgent, type AgentCreatorProps, type AgentCreatorLabels, type AgentCreatorValues, type AgentCapability, type AgentTemplate, } from './AgentCreator';
|
|
5
|
+
export { composePersona, stripPersonaPreamble, agentCreatorToConfigSection, agentConfigSectionToValues, } from './persona';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AgentCreatorValues } from './AgentCreator';
|
|
2
|
+
/**
|
|
3
|
+
* The saved persona tells the agent its own name: "You are Reviewer, an AI agent. <description>".
|
|
4
|
+
* {@link stripPersonaPreamble} takes the preamble off again so the editor shows only what the user wrote.
|
|
5
|
+
*/
|
|
6
|
+
export declare function composePersona(name: string, description: string): string;
|
|
7
|
+
/** The description the user wrote, without the preamble {@link composePersona} adds. */
|
|
8
|
+
export declare function stripPersonaPreamble(persona: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* The `Agents` config section an {@link AgentCreatorValues} form stands for: the persona, the model
|
|
11
|
+
* when one is picked, and one boolean per capability key. Pass it as `sections.Agents` to
|
|
12
|
+
* `useSaveAgentConfig` from `@arbidocs/react`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function agentCreatorToConfigSection(values: Pick<AgentCreatorValues, 'name' | 'persona' | 'modelName' | 'capabilities'>, capabilityKeys: string[]): Record<string, unknown>;
|
|
15
|
+
/** The form values an existing agent's `Agents` config section opens as (edit mode). */
|
|
16
|
+
export declare function agentConfigSectionToValues(section: Record<string, unknown> | undefined, capabilityKeys: string[]): Pick<AgentCreatorValues, 'persona' | 'modelName' | 'capabilities'>;
|