@book.dev/sdk 1.60.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/README.md +23 -0
- package/dist/account.d.ts +57 -0
- package/dist/account.js +104 -0
- package/dist/account.js.map +1 -0
- package/dist/ai.d.ts +264 -0
- package/dist/ai.js +36 -0
- package/dist/ai.js.map +1 -0
- package/dist/backup.d.ts +52 -0
- package/dist/backup.js +35 -0
- package/dist/backup.js.map +1 -0
- package/dist/bookFolder.d.ts +44 -0
- package/dist/bookFolder.js +98 -0
- package/dist/bookFolder.js.map +1 -0
- package/dist/bookfile.d.ts +42 -0
- package/dist/bookfile.js +159 -0
- package/dist/bookfile.js.map +1 -0
- package/dist/client.d.ts +279 -0
- package/dist/client.js +502 -0
- package/dist/client.js.map +1 -0
- package/dist/connection.d.ts +20 -0
- package/dist/connection.js +77 -0
- package/dist/connection.js.map +1 -0
- package/dist/content.d.ts +38 -0
- package/dist/content.js +107 -0
- package/dist/content.js.map +1 -0
- package/dist/database.d.ts +687 -0
- package/dist/database.js +1082 -0
- package/dist/database.js.map +1 -0
- package/dist/formula.d.ts +41 -0
- package/dist/formula.js +469 -0
- package/dist/formula.js.map +1 -0
- package/dist/forwarding/challenge.d.ts +35 -0
- package/dist/forwarding/challenge.js +45 -0
- package/dist/forwarding/challenge.js.map +1 -0
- package/dist/forwarding/encoding.d.ts +14 -0
- package/dist/forwarding/encoding.js +54 -0
- package/dist/forwarding/encoding.js.map +1 -0
- package/dist/forwarding/forwardingClient.d.ts +76 -0
- package/dist/forwarding/forwardingClient.js +128 -0
- package/dist/forwarding/forwardingClient.js.map +1 -0
- package/dist/forwarding/index.d.ts +5 -0
- package/dist/forwarding/index.js +14 -0
- package/dist/forwarding/index.js.map +1 -0
- package/dist/forwarding/siteKey.d.ts +12 -0
- package/dist/forwarding/siteKey.js +36 -0
- package/dist/forwarding/siteKey.js.map +1 -0
- package/dist/forwarding/tunnelClient.d.ts +56 -0
- package/dist/forwarding/tunnelClient.js +206 -0
- package/dist/forwarding/tunnelClient.js.map +1 -0
- package/dist/forwarding/tunnelProtocol.d.ts +45 -0
- package/dist/forwarding/tunnelProtocol.js +29 -0
- package/dist/forwarding/tunnelProtocol.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/mtime.d.ts +51 -0
- package/dist/mtime.js +84 -0
- package/dist/mtime.js.map +1 -0
- package/dist/pageProperties.d.ts +80 -0
- package/dist/pageProperties.js +97 -0
- package/dist/pageProperties.js.map +1 -0
- package/dist/plugins.d.ts +110 -0
- package/dist/plugins.js +113 -0
- package/dist/plugins.js.map +1 -0
- package/dist/routes.d.ts +89 -0
- package/dist/routes.js +89 -0
- package/dist/routes.js.map +1 -0
- package/dist/sampleDocument.d.ts +25 -0
- package/dist/sampleDocument.js +67 -0
- package/dist/sampleDocument.js.map +1 -0
- package/dist/suggestions.d.ts +126 -0
- package/dist/suggestions.js +21 -0
- package/dist/suggestions.js.map +1 -0
- package/dist/templates.d.ts +35 -0
- package/dist/templates.js +555 -0
- package/dist/templates.js.map +1 -0
- package/dist/types.d.ts +146 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Suggestions + comments: a review layer over a page's content.
|
|
3
|
+
*
|
|
4
|
+
* A SUGGESTION is a proposed change to the document that is NOT applied
|
|
5
|
+
* immediately — it is persisted, surfaced for review (inline in the document
|
|
6
|
+
* and in a side-pane "Review" surface), and applied to the CRDT only when a
|
|
7
|
+
* human accepts it. AI write tools and humans produce the SAME suggestion
|
|
8
|
+
* model: the agent's write tools persist suggestions instead of mutating, and
|
|
9
|
+
* a human "Suggest edit" affordance persists one too.
|
|
10
|
+
*
|
|
11
|
+
* A COMMENT is a general discussion layer: a threaded comment on a suggestion
|
|
12
|
+
* (the suggestion's review thread) OR a standalone comment anchored to a block.
|
|
13
|
+
* Comment bodies are rich text (`TextRun[]`, the same projection the block
|
|
14
|
+
* editor uses), so they support bold/italic/underline/links.
|
|
15
|
+
*
|
|
16
|
+
* The `kind`/`payload` shape of a suggestion mirrors the agent's former
|
|
17
|
+
* `AgentProposal` exactly, so the existing editor-bridge apply path
|
|
18
|
+
* (CRDT-first, savePage fallback) replays a suggestion's `payload` unchanged.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* One run of rich text in a comment body. Structurally identical to the block
|
|
22
|
+
* editor's `TextRun` (a string plus optional inline attributes), defined here
|
|
23
|
+
* so the SDK stays free of any UI dependency. The UI's `TextRun` is assignable
|
|
24
|
+
* to this, and vice-versa.
|
|
25
|
+
*/
|
|
26
|
+
export interface CommentRun {
|
|
27
|
+
t: string;
|
|
28
|
+
a?: {
|
|
29
|
+
b?: boolean;
|
|
30
|
+
i?: boolean;
|
|
31
|
+
u?: boolean;
|
|
32
|
+
s?: boolean;
|
|
33
|
+
/** Link href. */
|
|
34
|
+
a?: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Who authored a suggestion or comment. */
|
|
38
|
+
export type SuggestionAuthorKind = 'ai' | 'human';
|
|
39
|
+
/** The change a suggestion proposes — mirrors the agent write-tool kinds. */
|
|
40
|
+
export type SuggestionKind = 'replace-text' | 'set-cell' | 'insert' | 'delete' | 'set-theme';
|
|
41
|
+
/** Lifecycle of a suggestion. */
|
|
42
|
+
export type SuggestionStatus = 'open' | 'accepted' | 'rejected';
|
|
43
|
+
/**
|
|
44
|
+
* What a suggestion targets. A block-level target carries the `blockId`; a
|
|
45
|
+
* text-range target additionally carries character offsets within that block's
|
|
46
|
+
* text (linear offsets over the block's plain text). A database-cell target
|
|
47
|
+
* carries the database + row + property ids instead.
|
|
48
|
+
*/
|
|
49
|
+
export interface SuggestionTarget {
|
|
50
|
+
/** The block this suggestion edits / inserts after / deletes (text targets). */
|
|
51
|
+
blockId?: string;
|
|
52
|
+
/** Character range within the block's text, when the suggestion is range-scoped. */
|
|
53
|
+
range?: {
|
|
54
|
+
start: number;
|
|
55
|
+
end: number;
|
|
56
|
+
};
|
|
57
|
+
/** Database-cell target (for `set-cell`). */
|
|
58
|
+
databaseId?: string;
|
|
59
|
+
rowId?: string;
|
|
60
|
+
propertyId?: string;
|
|
61
|
+
}
|
|
62
|
+
/** A persisted, reviewable proposed change to a page. */
|
|
63
|
+
export interface StoredSuggestion {
|
|
64
|
+
id: string;
|
|
65
|
+
pageId: string;
|
|
66
|
+
authorKind: SuggestionAuthorKind;
|
|
67
|
+
/** Display name of the author (e.g. "Assistant" or a person's name). */
|
|
68
|
+
authorName: string;
|
|
69
|
+
kind: SuggestionKind;
|
|
70
|
+
target: SuggestionTarget;
|
|
71
|
+
/** Prior value, rendered in the before→after diff (plain text). */
|
|
72
|
+
before: string;
|
|
73
|
+
/** Proposed value, rendered in the before→after diff (plain text). */
|
|
74
|
+
after: string;
|
|
75
|
+
status: SuggestionStatus;
|
|
76
|
+
/**
|
|
77
|
+
* The structured payload the editor bridge replays to apply the change.
|
|
78
|
+
* Same shape as the former agent proposal payloads (e.g.
|
|
79
|
+
* `{pageId, blockId, text}` for replace-text). Kept opaque here so the SDK
|
|
80
|
+
* never needs to know how the CRDT is mutated.
|
|
81
|
+
*/
|
|
82
|
+
payload: Record<string, unknown>;
|
|
83
|
+
createdAt: string;
|
|
84
|
+
updatedAt: string;
|
|
85
|
+
}
|
|
86
|
+
/** Fields accepted when creating a suggestion (id/timestamps/status defaulted). */
|
|
87
|
+
export interface SuggestionInput {
|
|
88
|
+
id?: string;
|
|
89
|
+
pageId: string;
|
|
90
|
+
authorKind: SuggestionAuthorKind;
|
|
91
|
+
authorName: string;
|
|
92
|
+
kind: SuggestionKind;
|
|
93
|
+
target: SuggestionTarget;
|
|
94
|
+
before: string;
|
|
95
|
+
after: string;
|
|
96
|
+
payload: Record<string, unknown>;
|
|
97
|
+
}
|
|
98
|
+
/** Fields accepted when updating a suggestion (only status today). */
|
|
99
|
+
export interface SuggestionUpdate {
|
|
100
|
+
status?: SuggestionStatus;
|
|
101
|
+
}
|
|
102
|
+
/** A threaded comment on a suggestion, or a standalone comment on a block. */
|
|
103
|
+
export interface StoredComment {
|
|
104
|
+
id: string;
|
|
105
|
+
pageId: string;
|
|
106
|
+
/** The suggestion this comment belongs to (a review-thread comment). */
|
|
107
|
+
suggestionId?: string | null;
|
|
108
|
+
/** The block this comment is anchored to (a standalone block comment). */
|
|
109
|
+
blockId?: string | null;
|
|
110
|
+
authorName: string;
|
|
111
|
+
/** Rich-text body (bold/italic/underline/links). */
|
|
112
|
+
body: CommentRun[];
|
|
113
|
+
/** Parent comment id, for nested replies within a thread. */
|
|
114
|
+
parentId?: string | null;
|
|
115
|
+
createdAt: string;
|
|
116
|
+
}
|
|
117
|
+
/** Fields accepted when creating a comment (id/timestamp defaulted). */
|
|
118
|
+
export interface CommentInput {
|
|
119
|
+
id?: string;
|
|
120
|
+
pageId: string;
|
|
121
|
+
suggestionId?: string | null;
|
|
122
|
+
blockId?: string | null;
|
|
123
|
+
authorName: string;
|
|
124
|
+
body: CommentRun[];
|
|
125
|
+
parentId?: string | null;
|
|
126
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Suggestions + comments: a review layer over a page's content.
|
|
3
|
+
*
|
|
4
|
+
* A SUGGESTION is a proposed change to the document that is NOT applied
|
|
5
|
+
* immediately — it is persisted, surfaced for review (inline in the document
|
|
6
|
+
* and in a side-pane "Review" surface), and applied to the CRDT only when a
|
|
7
|
+
* human accepts it. AI write tools and humans produce the SAME suggestion
|
|
8
|
+
* model: the agent's write tools persist suggestions instead of mutating, and
|
|
9
|
+
* a human "Suggest edit" affordance persists one too.
|
|
10
|
+
*
|
|
11
|
+
* A COMMENT is a general discussion layer: a threaded comment on a suggestion
|
|
12
|
+
* (the suggestion's review thread) OR a standalone comment anchored to a block.
|
|
13
|
+
* Comment bodies are rich text (`TextRun[]`, the same projection the block
|
|
14
|
+
* editor uses), so they support bold/italic/underline/links.
|
|
15
|
+
*
|
|
16
|
+
* The `kind`/`payload` shape of a suggestion mirrors the agent's former
|
|
17
|
+
* `AgentProposal` exactly, so the existing editor-bridge apply path
|
|
18
|
+
* (CRDT-first, savePage fallback) replays a suggestion's `payload` unchanged.
|
|
19
|
+
*/
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=suggestions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggestions.js","sourceRoot":"","sources":["../src/suggestions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { DataClient } from './client';
|
|
2
|
+
import type { StoredPage } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The built-in **template gallery**: ready-made pages instantiated client-side
|
|
5
|
+
* through the normal data APIs (no server involvement, same as the sample
|
|
6
|
+
* document). Two shapes:
|
|
7
|
+
*
|
|
8
|
+
* - **Block-doc artifacts** (the five showcases) ship a native block-editor
|
|
9
|
+
* JSON projection in `blockdoc: {blocks}`. They lean on the whole editor:
|
|
10
|
+
* reactive inputs feeding *collapsed* live-code, status lights, info/link/
|
|
11
|
+
* tooltip cards, charts, progress bars, multi-column layouts, callouts, and
|
|
12
|
+
* `divider`/`notes` blocks so every page doubles as a slide deck with
|
|
13
|
+
* speaker notes (see blockeditor/present.ts).
|
|
14
|
+
* - **Databases** (roadmap, field map) ship a schema, views, and sample rows;
|
|
15
|
+
* they back the swimlane and map e2e fixtures.
|
|
16
|
+
*
|
|
17
|
+
* Ids are stable so the gallery, its i18n keys, and the e2e suite can reference
|
|
18
|
+
* a template without depending on display strings.
|
|
19
|
+
*/
|
|
20
|
+
export interface PageTemplate {
|
|
21
|
+
/** Stable identifier (i18n keys + tests hang off this). */
|
|
22
|
+
id: 'grocery-tracker' | 'task-board' | 'reading-list' | 'project-intake' | 'savings-planner' | 'roadmap' | 'field-map';
|
|
23
|
+
/** Emoji shown on the gallery card and applied to the created page. */
|
|
24
|
+
icon: string;
|
|
25
|
+
/** Canonical (English) page name; suffixed when it collides. */
|
|
26
|
+
pageName: string;
|
|
27
|
+
/** Creates the page (and database, if any) and returns the stored page. */
|
|
28
|
+
create: (client: DataClient, name: string) => Promise<StoredPage>;
|
|
29
|
+
}
|
|
30
|
+
export declare const PAGE_TEMPLATES: PageTemplate[];
|
|
31
|
+
/**
|
|
32
|
+
* Instantiate a template: resolve a free page name (retrying past races on the
|
|
33
|
+
* unique-name constraint) and build the page through the client.
|
|
34
|
+
*/
|
|
35
|
+
export declare function instantiateTemplate(client: DataClient, template: PageTemplate): Promise<StoredPage>;
|