@norio-office/rich-text 0.7.1 → 0.8.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 (60) hide show
  1. package/README.md +895 -824
  2. package/dist/ai/bridge.d.ts +335 -0
  3. package/dist/ai/consume-stream.d.ts +8 -0
  4. package/dist/ai/executor.d.ts +19 -0
  5. package/dist/ai/index.d.ts +8 -0
  6. package/dist/ai/index.js +4106 -0
  7. package/dist/ai/tools.d.ts +158 -0
  8. package/dist/ai-protocol/index.d.ts +12 -0
  9. package/dist/ai-protocol/index.js +2372 -0
  10. package/dist/ai-protocol/json-schema.d.ts +5 -0
  11. package/dist/ai-protocol/patch.d.ts +77 -0
  12. package/dist/ai-protocol/references.d.ts +11 -0
  13. package/dist/ai-protocol/stream.d.ts +94 -0
  14. package/dist/ai-protocol/tools.d.ts +8 -0
  15. package/dist/ai-protocol/validation.d.ts +20 -0
  16. package/dist/components/RichTextEditor.vue.d.ts +11 -4
  17. package/dist/document/ai-identity.d.ts +4 -0
  18. package/dist/document/nodes/columns-block.d.ts +2 -0
  19. package/dist/document/nodes/countdown-block.d.ts +2 -0
  20. package/dist/document/nodes/formula-block.d.ts +2 -0
  21. package/dist/document/nodes/highlight-block.d.ts +2 -0
  22. package/dist/document/nodes/image-block.d.ts +8 -0
  23. package/dist/document/nodes/link-block.d.ts +2 -0
  24. package/dist/document/nodes/local-file-block.d.ts +2 -0
  25. package/dist/document/nodes/mention.d.ts +2 -0
  26. package/dist/document/nodes/office-code-block.d.ts +1 -0
  27. package/dist/document/nodes/table-cells.d.ts +2 -0
  28. package/dist/document/nodes/themed-table.d.ts +1 -0
  29. package/dist/document/nodes/video-block.d.ts +8 -0
  30. package/dist/document/schema.d.ts +17 -0
  31. package/dist/extensions/ai-identity.d.ts +1 -0
  32. package/dist/extensions/columns-block.d.ts +1 -2
  33. package/dist/extensions/countdown-block.d.ts +1 -2
  34. package/dist/extensions/formula-block.d.ts +1 -2
  35. package/dist/extensions/highlight-block.d.ts +1 -2
  36. package/dist/extensions/image-block.d.ts +4 -8
  37. package/dist/extensions/link-block.d.ts +1 -2
  38. package/dist/extensions/local-file-block.d.ts +1 -2
  39. package/dist/extensions/mention.d.ts +1 -2
  40. package/dist/extensions/video-block.d.ts +4 -8
  41. package/dist/{html2canvas-4hiP1s1t.js → html2canvas-BnDzIoab.js} +112 -126
  42. package/dist/index.js +8343 -7407
  43. package/dist/index.umd.cjs +2196 -1995
  44. package/dist/nordox/index.d.ts +95 -0
  45. package/dist/nordox/index.js +2094 -0
  46. package/dist/{chunk-C_CI6nMA.js → rolldown-runtime-VHNaYcLd.js} +3 -3
  47. package/dist/style.css +1 -1
  48. package/dist/types.d.ts +9 -1
  49. package/docs/ai/README.md +108 -0
  50. package/docs/ai/acceptance-report.md +88 -0
  51. package/docs/ai/capability-matrix.md +43 -0
  52. package/docs/ai/compatibility.md +9 -0
  53. package/docs/icons.md +21 -0
  54. package/examples/ai/browser/App.vue +151 -0
  55. package/examples/ai/browser/index.html +12 -0
  56. package/examples/ai/browser/main.ts +5 -0
  57. package/examples/ai/browser/tsconfig.json +7 -0
  58. package/examples/ai/browser/vite.config.ts +14 -0
  59. package/examples/ai/node.mjs +28 -0
  60. package/package.json +15 -1
@@ -0,0 +1,158 @@
1
+ import { JSONContent } from '@tiptap/core';
2
+ import { RichTextExternalReference } from '../ai-protocol/references';
3
+ import { NordoxResourceResolver, RichTextAssetPackaging } from '../nordox';
4
+ import { RichTextAiBridge } from './bridge';
5
+ export type RichTextToolResult<T> = {
6
+ ok: true;
7
+ data: T;
8
+ } | {
9
+ ok: false;
10
+ error: {
11
+ code: string;
12
+ message: string;
13
+ retryable: boolean;
14
+ requiresContextRefresh: boolean;
15
+ };
16
+ };
17
+ export type RichTextToolHost = {
18
+ createDocument(input: {
19
+ title: string;
20
+ document: JSONContent;
21
+ bytes: Uint8Array;
22
+ }): Promise<{
23
+ documentId: string;
24
+ name?: string;
25
+ }>;
26
+ resourceResolver?: NordoxResourceResolver;
27
+ assetPackaging?: RichTextAssetPackaging;
28
+ authorizeExternalReference?: (reference: RichTextExternalReference) => boolean | Promise<boolean>;
29
+ };
30
+ export declare function createRichTextToolHandlers(bridge: RichTextAiBridge, host: RichTextToolHost): {
31
+ richtext_get_capabilities: (input: unknown) => Promise<RichTextToolResult<{
32
+ schemaVersion: string;
33
+ protocolVersion: number;
34
+ streamProtocolVersion: number;
35
+ documentId: string;
36
+ mode: "preview" | "edit";
37
+ collaboration: boolean;
38
+ nodes: string[];
39
+ marks: string[];
40
+ nodeAttributes: {
41
+ [k: string]: {
42
+ [k: string]: {
43
+ default: {} | null;
44
+ };
45
+ };
46
+ };
47
+ markAttributes: {
48
+ [k: string]: {
49
+ [k: string]: {
50
+ default: {} | null;
51
+ };
52
+ };
53
+ };
54
+ nodeAttributeConstraints: {
55
+ [k: string]: Record<string, unknown>;
56
+ };
57
+ markAttributeConstraints: {
58
+ [k: string]: Record<string, unknown>;
59
+ };
60
+ nodeContentRules: {
61
+ [k: string]: {
62
+ content: string | null;
63
+ marks: string | null;
64
+ };
65
+ };
66
+ targetKinds: readonly ["cursor", "textRange", "node", "blockSet", "tableCells", "none"];
67
+ externalDependencies: {
68
+ authorizationConfigured: boolean;
69
+ byteResolverConfigured: boolean;
70
+ media: string;
71
+ mentions: string;
72
+ comments: string;
73
+ embedding: string;
74
+ };
75
+ resourcePackaging: {
76
+ images: string[];
77
+ videos: string[];
78
+ files: string[];
79
+ };
80
+ operations: ("insertContent" | "replaceText" | "replaceFragment" | "setMarks" | "unsetMarks" | "setNodeAttributes" | "unsetNodeAttributes" | "deleteContent" | "moveBlocks" | "transformBlocks" | "tableOperation")[];
81
+ streamModes: string[];
82
+ streamEvents: string[];
83
+ streamLimits: import('../ai-protocol').RichTextStreamLimits;
84
+ streamPreview: {
85
+ localOnly: boolean;
86
+ committedDocumentUnchangedUntilCommit: boolean;
87
+ };
88
+ commitSemantics: string;
89
+ }>>;
90
+ richtext_create_document: (input: unknown) => Promise<RichTextToolResult<{
91
+ byteLength: number;
92
+ format: "nordox";
93
+ name?: string | undefined;
94
+ documentId: string;
95
+ }>>;
96
+ richtext_read_document: (input: unknown) => Promise<RichTextToolResult<{
97
+ outline: {
98
+ documentId: string;
99
+ revision: number;
100
+ blocks: {
101
+ aiId: string | null;
102
+ nodeType: string;
103
+ level: number | null;
104
+ text: string;
105
+ }[];
106
+ truncated: boolean;
107
+ };
108
+ documentId: string;
109
+ revision: number;
110
+ results: {
111
+ text: string;
112
+ truncated: boolean;
113
+ content: any;
114
+ nextCursor: string | null;
115
+ neighbors: {
116
+ before: string;
117
+ after: string;
118
+ } | undefined;
119
+ nodeType: string | undefined;
120
+ parentRef: string | undefined;
121
+ tableRow: number | undefined;
122
+ tableColumn: number | undefined;
123
+ isHeader: boolean | undefined;
124
+ operations: ("insertContent" | "replaceText" | "replaceFragment" | "setMarks" | "unsetMarks" | "setNodeAttributes" | "unsetNodeAttributes" | "deleteContent" | "moveBlocks" | "transformBlocks" | "tableOperation")[];
125
+ tableActions: ("deleteColumn" | "deleteRow" | "mergeCells" | "splitCell" | "insertRowBefore" | "insertRowAfter" | "insertColumnBefore" | "insertColumnAfter" | "setCellContent" | "setCellBackground" | "setTableTheme")[];
126
+ targetRef: string;
127
+ kind: "cursor" | "document" | "node" | "textRange" | "blockSet" | "tableCells";
128
+ }[];
129
+ truncated: boolean;
130
+ }>>;
131
+ richtext_get_selection: (input: unknown) => Promise<RichTextToolResult<import('./bridge').RichTextAiSelectionSnapshot>>;
132
+ richtext_read_target: (input: unknown) => Promise<RichTextToolResult<{
133
+ documentId: string;
134
+ revision: number;
135
+ results: {
136
+ text: string;
137
+ truncated: boolean;
138
+ content: any;
139
+ nextCursor: string | null;
140
+ neighbors: {
141
+ before: string;
142
+ after: string;
143
+ } | undefined;
144
+ nodeType: string | undefined;
145
+ parentRef: string | undefined;
146
+ tableRow: number | undefined;
147
+ tableColumn: number | undefined;
148
+ isHeader: boolean | undefined;
149
+ operations: ("insertContent" | "replaceText" | "replaceFragment" | "setMarks" | "unsetMarks" | "setNodeAttributes" | "unsetNodeAttributes" | "deleteContent" | "moveBlocks" | "transformBlocks" | "tableOperation")[];
150
+ tableActions: ("deleteColumn" | "deleteRow" | "mergeCells" | "splitCell" | "insertRowBefore" | "insertRowAfter" | "insertColumnBefore" | "insertColumnAfter" | "setCellContent" | "setCellBackground" | "setTableTheme")[];
151
+ targetRef: string;
152
+ kind: "cursor" | "document" | "node" | "textRange" | "blockSet" | "tableCells";
153
+ }[];
154
+ truncated: boolean;
155
+ }>>;
156
+ richtext_apply_patch: (input: unknown) => Promise<RichTextToolResult<import('./bridge').RichTextAiApplyResult>>;
157
+ };
158
+ export type RichTextToolHandlers = ReturnType<typeof createRichTextToolHandlers>;
@@ -0,0 +1,12 @@
1
+ export { validateRichTextDocument, migrateRichTextDocument } from './validation';
2
+ export type { RichTextValidationIssue, RichTextValidationResult } from './validation';
3
+ export { validateRichTextPatch } from './patch';
4
+ export type { RichTextPatch, RichTextPatchOperation, RichTextPatchValidationResult, RichTextAttributes, RichTextJsonValue } from './patch';
5
+ export type { RichTextExternalReference } from './references';
6
+ export { RICH_TEXT_SCHEMA_VERSION, getRichTextDocumentSchema } from '../document/schema';
7
+ export { createRichTextStreamBuilder, createRichTextStreamDecoder, validateRichTextStreamEvent, DEFAULT_RICH_TEXT_STREAM_LIMITS, RICH_TEXT_STREAM_PROTOCOL_VERSION, RichTextStreamError, } from './stream';
8
+ export type { RichTextStreamEvent, RichTextStreamLimits, RichTextStreamMode } from './stream';
9
+ export { getRichTextDocumentJsonSchema, getRichTextAiCreatedDocumentJsonSchema, getRichTextPatchJsonSchema, getRichTextStreamEventJsonSchema } from './json-schema';
10
+ export type { RichTextJsonSchema } from './json-schema';
11
+ export { getRichTextToolDefinitions } from './tools';
12
+ export type { RichTextToolDefinition } from './tools';