@arbidocs/blocks 0.4.127 → 0.4.129
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 +21 -7
- package/dist/{StreamedArtifactEditor-EEYAXJ4H.cjs → StreamedArtifactEditor-TQAND4H5.cjs} +6 -5
- package/dist/StreamedArtifactEditor-TQAND4H5.cjs.map +1 -0
- package/dist/{StreamedArtifactEditor-TDATDYD2.js → StreamedArtifactEditor-XQNANTWM.js} +4 -3
- package/dist/StreamedArtifactEditor-XQNANTWM.js.map +1 -0
- package/dist/agents/index.cjs +213 -213
- package/dist/agents/index.js +2 -2
- package/dist/artifacts/ArtifactCodeView.d.ts +6 -0
- package/dist/artifacts/ArtifactPreview.d.ts +22 -0
- package/dist/artifacts/index.cjs +50 -21
- package/dist/artifacts/index.d.ts +3 -0
- package/dist/artifacts/index.js +2 -1
- package/dist/artifacts/sandbox-policy.d.ts +34 -0
- package/dist/artifacts/sandboxDocument.d.ts +7 -0
- package/dist/calendar/index.cjs +156 -243
- package/dist/calendar/index.cjs.map +1 -1
- package/dist/calendar/index.js +8 -151
- package/dist/calendar/index.js.map +1 -1
- package/dist/chat/index.cjs +90 -73
- package/dist/chat/index.d.ts +1 -0
- package/dist/chat/index.js +3 -2
- package/dist/chat/open-document.d.ts +66 -0
- package/dist/{chunk-INW76PEL.cjs → chunk-2YV7FBLO.cjs} +175 -2
- package/dist/chunk-2YV7FBLO.cjs.map +1 -0
- package/dist/{chunk-DZI7WOUD.cjs → chunk-3BJLNKOB.cjs} +6 -2
- package/dist/chunk-3BJLNKOB.cjs.map +1 -0
- package/dist/{chunk-KELGOCJA.js → chunk-65S53MZK.js} +174 -5
- package/dist/chunk-65S53MZK.js.map +1 -0
- package/dist/{chunk-T6I6ZCBE.js → chunk-6BTCDKCK.js} +6 -3
- package/dist/chunk-6BTCDKCK.js.map +1 -0
- package/dist/{chunk-ZLRQ5K77.cjs → chunk-7423V6RM.cjs} +6 -3
- package/dist/chunk-7423V6RM.cjs.map +1 -0
- package/dist/{chunk-6Z72CXZR.js → chunk-CJBN5HIS.js} +6 -2
- package/dist/chunk-CJBN5HIS.js.map +1 -0
- package/dist/{chunk-XFKF3WRN.cjs → chunk-DZYAAL4H.cjs} +2 -2
- package/dist/{chunk-XFKF3WRN.cjs.map → chunk-DZYAAL4H.cjs.map} +1 -1
- package/dist/chunk-GYCQ3FNL.js +60 -0
- package/dist/chunk-GYCQ3FNL.js.map +1 -0
- package/dist/{chunk-UUXKB3WQ.js → chunk-H2KQ6OSU.js} +2 -2
- package/dist/{chunk-UUXKB3WQ.js.map → chunk-H2KQ6OSU.js.map} +1 -1
- package/dist/{chunk-T2CVFK2I.js → chunk-HSFLEVZY.js} +3 -3
- package/dist/{chunk-T2CVFK2I.js.map → chunk-HSFLEVZY.js.map} +1 -1
- package/dist/{chunk-MCPRNDOJ.cjs → chunk-JLTXVW25.cjs} +3 -3
- package/dist/{chunk-MCPRNDOJ.cjs.map → chunk-JLTXVW25.cjs.map} +1 -1
- package/dist/chunk-NS4JD2VR.js +22 -0
- package/dist/chunk-NS4JD2VR.js.map +1 -0
- package/dist/chunk-SWQX6CTT.cjs +65 -0
- package/dist/chunk-SWQX6CTT.cjs.map +1 -0
- package/dist/chunk-TGJNPKST.js +153 -0
- package/dist/chunk-TGJNPKST.js.map +1 -0
- package/dist/chunk-TGWTLNXW.cjs +177 -0
- package/dist/chunk-TGWTLNXW.cjs.map +1 -0
- package/dist/chunk-VG24E4JJ.cjs +26 -0
- package/dist/chunk-VG24E4JJ.cjs.map +1 -0
- package/dist/components/DroppableContainer.d.ts +6 -0
- package/dist/components/GridRowNavigator.d.ts +29 -0
- package/dist/components/LoadingIndicator.d.ts +21 -0
- package/dist/components/RowNavigatorControls.d.ts +29 -0
- package/dist/components/SharedCell.d.ts +27 -0
- package/dist/connect/docx.cjs +4 -3
- package/dist/connect/docx.cjs.map +1 -1
- package/dist/connect/docx.js +3 -2
- package/dist/connect/docx.js.map +1 -1
- package/dist/connect/index.cjs +22 -20
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +12 -10
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/mail/types.d.ts +2 -6
- package/dist/facts/index.cjs +5 -23
- package/dist/facts/index.cjs.map +1 -1
- package/dist/facts/index.d.ts +0 -1
- package/dist/facts/index.js +6 -22
- package/dist/facts/index.js.map +1 -1
- package/dist/index.cjs +616 -417
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +189 -11
- package/dist/index.js.map +1 -1
- package/dist/sandboxDocument-JLEETIWW.js +71 -0
- package/dist/sandboxDocument-JLEETIWW.js.map +1 -0
- package/dist/sandboxDocument-WQUNODSC.cjs +76 -0
- package/dist/sandboxDocument-WQUNODSC.cjs.map +1 -0
- package/dist/settings/DraggableHeader.d.ts +10 -0
- package/dist/settings/FilterChip.d.ts +15 -0
- package/dist/settings/MessageJsonTree.d.ts +7 -0
- package/dist/settings/index.cjs +248 -5
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.d.ts +3 -0
- package/dist/settings/index.js +247 -7
- package/dist/settings/index.js.map +1 -1
- package/dist/settings/message-schema-hints.d.ts +19 -0
- package/dist/studio/index.cjs +3 -2
- package/dist/studio/index.cjs.map +1 -1
- package/dist/studio/index.js +2 -1
- package/dist/studio/index.js.map +1 -1
- package/dist/workflow-canvas/index.cjs +9 -9
- package/dist/workflow-canvas/index.js +2 -2
- package/dist/workspaces/index.cjs +39 -0
- package/dist/workspaces/index.cjs.map +1 -1
- package/dist/workspaces/index.d.ts +1 -0
- package/dist/workspaces/index.js +36 -1
- package/dist/workspaces/index.js.map +1 -1
- package/dist/workspaces/workspace-type.d.ts +29 -0
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +6 -5
- package/src/docx/README.md +7 -3
- package/dist/StreamedArtifactEditor-EEYAXJ4H.cjs.map +0 -1
- package/dist/StreamedArtifactEditor-TDATDYD2.js.map +0 -1
- package/dist/chunk-6Z72CXZR.js.map +0 -1
- package/dist/chunk-DZI7WOUD.cjs.map +0 -1
- package/dist/chunk-INW76PEL.cjs.map +0 -1
- package/dist/chunk-KELGOCJA.js.map +0 -1
- package/dist/chunk-T6I6ZCBE.js.map +0 -1
- package/dist/chunk-ZLRQ5K77.cjs.map +0 -1
- package/dist/facts/timezone.d.ts +0 -4
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef, useEffect, useSyncExternalStore } from 'react';
|
|
3
|
+
import { parseVersionRef } from '@arbidocs/react/artifacts';
|
|
4
|
+
|
|
5
|
+
// src/chat/open-document.ts
|
|
6
|
+
function savedDocumentIdFor(input) {
|
|
7
|
+
const { documentId, isDraft, isStreaming, isBlobArtifact, documentData } = input;
|
|
8
|
+
if (!documentId || isDraft || isStreaming || isBlobArtifact) return null;
|
|
9
|
+
if (documentData?.wp_type !== "artifact" && !documentData?.file_name?.toLowerCase().endsWith(".docx"))
|
|
10
|
+
return null;
|
|
11
|
+
if (documentData.external_id !== documentId) return null;
|
|
12
|
+
return documentId;
|
|
13
|
+
}
|
|
14
|
+
var entries = [];
|
|
15
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
16
|
+
function subscribe(listener) {
|
|
17
|
+
listeners.add(listener);
|
|
18
|
+
return () => listeners.delete(listener);
|
|
19
|
+
}
|
|
20
|
+
function emit() {
|
|
21
|
+
listeners.forEach((l) => l());
|
|
22
|
+
}
|
|
23
|
+
var top = () => entries[entries.length - 1];
|
|
24
|
+
function useRegisterOpenDocument(registration) {
|
|
25
|
+
const latest = useRef(registration);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
latest.current = registration;
|
|
28
|
+
});
|
|
29
|
+
const { documentId } = registration;
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!documentId) return;
|
|
32
|
+
const entry = { documentId, current: () => latest.current };
|
|
33
|
+
entries = [...entries, entry];
|
|
34
|
+
emit();
|
|
35
|
+
return () => {
|
|
36
|
+
entries = entries.filter((e) => e !== entry);
|
|
37
|
+
emit();
|
|
38
|
+
};
|
|
39
|
+
}, [documentId]);
|
|
40
|
+
}
|
|
41
|
+
function useOpenDocumentId() {
|
|
42
|
+
return useSyncExternalStore(
|
|
43
|
+
subscribe,
|
|
44
|
+
() => top()?.documentId ?? null,
|
|
45
|
+
() => null
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
function takeOpenDocumentForTurn(options) {
|
|
49
|
+
const entry = top();
|
|
50
|
+
if (!entry) return null;
|
|
51
|
+
const { shownId, showLive, workspaceId } = entry.current();
|
|
52
|
+
if (options?.workspaceId && workspaceId && options.workspaceId !== workspaceId) return null;
|
|
53
|
+
if (shownId && shownId !== entry.documentId && parseVersionRef(shownId).docId === entry.documentId)
|
|
54
|
+
showLive?.();
|
|
55
|
+
return entry.documentId;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { savedDocumentIdFor, takeOpenDocumentForTurn, useOpenDocumentId, useRegisterOpenDocument };
|
|
59
|
+
//# sourceMappingURL=chunk-GYCQ3FNL.js.map
|
|
60
|
+
//# sourceMappingURL=chunk-GYCQ3FNL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/chat/open-document.ts"],"names":[],"mappings":";;;;AA2CO,SAAS,mBAAmB,KAAA,EAA0C;AAC3E,EAAA,MAAM,EAAE,UAAA,EAAY,OAAA,EAAS,WAAA,EAAa,cAAA,EAAgB,cAAa,GAAI,KAAA;AAC3E,EAAA,IAAI,CAAC,UAAA,IAAc,OAAA,IAAW,WAAA,IAAe,gBAAgB,OAAO,IAAA;AACpE,EAAA,IACE,YAAA,EAAc,YAAY,UAAA,IAC1B,CAAC,cAAc,SAAA,EAAW,WAAA,EAAY,CAAE,QAAA,CAAS,OAAO,CAAA;AAExD,IAAA,OAAO,IAAA;AAET,EAAA,IAAI,YAAA,CAAa,WAAA,KAAgB,UAAA,EAAY,OAAO,IAAA;AACpD,EAAA,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,OAAA,EAA0D;AAChG,EAAA,MAAM,QAAQ,GAAA,EAAI;AAClB,EAAA,IAAI,CAAC,OAAO,OAAO,IAAA;AACnB,EAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAU,WAAA,EAAY,GAAI,MAAM,OAAA,EAAQ;AACzD,EAAA,IAAI,SAAS,WAAA,IAAe,WAAA,IAAe,OAAA,CAAQ,WAAA,KAAgB,aAAa,OAAO,IAAA;AACvF,EAAA,IACE,OAAA,IACA,YAAY,KAAA,CAAM,UAAA,IAClB,gBAAgB,OAAO,CAAA,CAAE,UAAU,KAAA,CAAM,UAAA;AAEzC,IAAA,QAAA,IAAW;AACb,EAAA,OAAO,KAAA,CAAM,UAAA;AACf","file":"chunk-GYCQ3FNL.js","sourcesContent":["import { useEffect, useRef, useSyncExternalStore } from 'react'\nimport { parseVersionRef } from '@arbidocs/react/artifacts'\n\n/**\n * Drafting mode: the saved document open beside the chat is what a chat turn is about.\n *\n * A viewer registers the document it shows (`useRegisterOpenDocument`); every assistant turn names\n * it (`active_artifact_ext_id`, read with `takeOpenDocumentForTurn` as the question is sent), so the\n * server binds the live document to the turn: a Word document is read on demand and edited as\n * tracked changes in the open editor, and what the assistant saves becomes a child version of it.\n * The request carries a reference, never the content.\n *\n * The open document is always the subject, also while one of its earlier versions is on screen\n * read-only: a version still names its document. Sending a turn then returns the viewer to the live\n * document (`showLive`), where the assistant's edits appear as they are made. (Pinning a specific\n * version as a source is a separate feature: it does not go through here.)\n *\n * A module-level registry (not React context), like `useChatSurface`, so a viewer and a chat agree\n * wherever they sit in the tree; the most recently opened document wins and closing it hands back\n * to the one before.\n */\n\n/** What a viewer knows about the document it shows. */\nexport interface SavedDocumentInput {\n /** The document (`doc-…`), never a version reference. */\n documentId: string | null | undefined\n /** An unsaved draft (client-minted id, no backend record). */\n isDraft: boolean\n /** Still streaming: nothing is persisted yet. */\n isStreaming: boolean\n /** An image, audio or video artifact: there is no text to draft in. */\n isBlobArtifact: boolean\n /** The loaded document record. */\n documentData:\n | { external_id?: string | null; wp_type?: string | null; file_name?: string | null }\n | null\n | undefined\n}\n\n/**\n * The saved, content-backed document a chat can draft in, or null. Only a saved artifact or Word\n * document counts: drafts, an artifact still streaming and blob artifacts do not.\n */\nexport function savedDocumentIdFor(input: SavedDocumentInput): string | null {\n const { documentId, isDraft, isStreaming, isBlobArtifact, documentData } = input\n if (!documentId || isDraft || isStreaming || isBlobArtifact) return null\n if (\n documentData?.wp_type !== 'artifact' &&\n !documentData?.file_name?.toLowerCase().endsWith('.docx')\n )\n return null\n // A stale record of the previously viewed document is not this one.\n if (documentData.external_id !== documentId) return null\n return documentId\n}\n\nexport interface OpenDocumentRegistration {\n /** The saved document the viewer shows (`doc-…`); null or empty registers nothing. */\n documentId: string | null | undefined\n /** What is on screen: the document itself, or one of its earlier versions (`doc-…@v2`). */\n shownId?: string | null\n /** Show the live document again. Called when a turn starts while an earlier version is shown. */\n showLive?: () => void\n /** The workspace the document belongs to; a chat in another workspace does not draft in it. */\n workspaceId?: string | null\n}\n\ninterface Entry {\n documentId: string\n current: () => OpenDocumentRegistration\n}\n\nlet entries: Entry[] = []\nconst listeners = new Set<() => void>()\n\nfunction subscribe(listener: () => void): () => void {\n listeners.add(listener)\n return () => listeners.delete(listener)\n}\n\nfunction emit() {\n listeners.forEach((l) => l())\n}\n\nconst top = (): Entry | undefined => entries[entries.length - 1]\n\n/**\n * Registers the document a viewer shows as the open document while the caller is mounted and\n * `documentId` is set. Pass `savedDocumentIdFor(...)`, or the id of a document known to be saved.\n */\nexport function useRegisterOpenDocument(registration: OpenDocumentRegistration): void {\n const latest = useRef(registration)\n useEffect(() => {\n latest.current = registration\n })\n const { documentId } = registration\n useEffect(() => {\n if (!documentId) return\n const entry: Entry = { documentId, current: () => latest.current }\n entries = [...entries, entry]\n emit()\n return () => {\n entries = entries.filter((e) => e !== entry)\n emit()\n }\n }, [documentId])\n}\n\n/** The open document's id, or null. Re-renders when another document opens or it closes. */\nexport function useOpenDocumentId(): string | null {\n return useSyncExternalStore(\n subscribe,\n () => top()?.documentId ?? null,\n () => null\n )\n}\n\n/**\n * The document an assistant turn about to be sent drafts in, or null. Call it once per turn as the\n * question is sent: when an earlier version of the document is on screen, the viewer returns to the\n * live document, where the assistant's edits appear. With `workspaceId`, a document registered in\n * another workspace is not named (and its viewer is left alone).\n */\nexport function takeOpenDocumentForTurn(options?: { workspaceId?: string | null }): string | null {\n const entry = top()\n if (!entry) return null\n const { shownId, showLive, workspaceId } = entry.current()\n if (options?.workspaceId && workspaceId && options.workspaceId !== workspaceId) return null\n if (\n shownId &&\n shownId !== entry.documentId &&\n parseVersionRef(shownId).docId === entry.documentId\n )\n showLive?.()\n return entry.documentId\n}\n"]}
|
|
@@ -1831,5 +1831,5 @@ function transcriptRuns(items, speakerOf, timeOf, gapMs = 2 * 6e4) {
|
|
|
1831
1831
|
}
|
|
1832
1832
|
|
|
1833
1833
|
export { AssistantToaster, BranchControls, ComposerAccessories, ComposerTools, ContextActionButton, ContextCheckRow, ContextPanelContent, ContextPanelFooter, ContextPanelTabs, ContextPickerList, ContextPickerRow, ContextSearchInput, ContextSelectList, ContextSelectRow, Conversation, ConversationBody, ConversationFilter, ConversationHeader, ConversationHeaderActions, ConversationHistoryPane, ConversationLoading, ConversationMain, ConversationRoot, ConversationSearchView, ConversationSettingsButton, DEFAULT_BRANCH_CONTROLS_LABELS, DEFAULT_CONVERSATION_LAYOUT_LABELS, DEFAULT_CONVERSATION_PARTS_LABELS, DEFAULT_CONVERSATION_SEARCH_LABELS, DEFAULT_DRAFTING_DOC_CHIP_LABELS, DEFAULT_LABEL_PIN_ROW_LABELS, DEFAULT_MODEL_PRICING_TIP_LABELS, DEFAULT_PENDING_ANSWER_BAR_LABELS, DEFAULT_PINNED_DOC_CHIP_LABELS, DEFAULT_SLASH_MENU_LABELS, DEFAULT_THREAD_MAP_LABELS, DraftingDocChip, LabelPinRow, ModelAutoIcon, ModelConfigureButton, ModelDot, ModelMenuDivider, ModelMenuMessage, ModelOption, ModelOptionLabel, ModelPickerPopover, ModelPickerTrigger, ModelPricingTip, ModelTierIcon, ModelTierOption, ModelTriggerContent, NewChatButton, NewPaChatButton, PaModeBadge, PendingAnswerBar, PinnedDocChip, ProvisionalTranscriptLine, SlashMenu, ThreadMap, ThreadMapDiagram, ThreadMapError, ThreadMapLoading, TranscriptLine, flashMessage, getParticipantTints, hasMessageBody, isLongPastedText, transcriptRuns, useDismissibleCard, useLongPaste, useRecipientDraft };
|
|
1834
|
-
//# sourceMappingURL=chunk-
|
|
1835
|
-
//# sourceMappingURL=chunk-
|
|
1834
|
+
//# sourceMappingURL=chunk-H2KQ6OSU.js.map
|
|
1835
|
+
//# sourceMappingURL=chunk-H2KQ6OSU.js.map
|