@the-focus-ai/artifacts 1.0.3 → 1.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/README.md +44 -3
- package/dist/src/cli.d.ts +2 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +122 -15
- package/dist/src/cli.js.map +1 -1
- package/dist/src/diff.d.ts +16 -0
- package/dist/src/diff.d.ts.map +1 -0
- package/dist/src/diff.js +90 -0
- package/dist/src/diff.js.map +1 -0
- package/dist/src/http.d.ts +2 -0
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +21 -0
- package/dist/src/http.js.map +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/living-doc.d.ts +163 -0
- package/dist/src/living-doc.d.ts.map +1 -0
- package/dist/src/living-doc.js +566 -0
- package/dist/src/living-doc.js.map +1 -0
- package/dist/src/local-config.d.ts.map +1 -1
- package/dist/src/local-config.js.map +1 -1
- package/dist/src/login-flow.d.ts +1 -0
- package/dist/src/login-flow.d.ts.map +1 -1
- package/dist/src/login-flow.js +1 -1
- package/dist/src/login-flow.js.map +1 -1
- package/dist/src/publication.d.ts +6 -0
- package/dist/src/publication.d.ts.map +1 -1
- package/dist/src/publication.js +29 -0
- package/dist/src/publication.js.map +1 -1
- package/dist/src/remote-api.d.ts +31 -0
- package/dist/src/remote-api.d.ts.map +1 -1
- package/dist/src/remote-api.js +60 -0
- package/dist/src/remote-api.js.map +1 -1
- package/dist/src/storage/living-doc-metadata.d.ts +159 -0
- package/dist/src/storage/living-doc-metadata.d.ts.map +1 -0
- package/dist/src/storage/living-doc-metadata.js +400 -0
- package/dist/src/storage/living-doc-metadata.js.map +1 -0
- package/dist/src/storage/publication-metadata.d.ts +3 -0
- package/dist/src/storage/publication-metadata.d.ts.map +1 -1
- package/dist/src/storage/publication-metadata.js +9 -2
- package/dist/src/storage/publication-metadata.js.map +1 -1
- package/package.json +10 -2
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { type PublisherTokenStore } from "./auth.js";
|
|
2
|
+
import { type CommentOrigin, type LivingDoc, type LivingDocComment, type LivingDocMetadataStore, type LivingDocSuggestion, type SuggestionStatus } from "./storage/living-doc-metadata.js";
|
|
3
|
+
export declare const livingDocViewPrefix = "/d";
|
|
4
|
+
export declare const livingDocReviewPrefix = "/r";
|
|
5
|
+
export declare const maxLivingDocMarkdownBytes: number;
|
|
6
|
+
export declare const maxLivingDocTextBytes: number;
|
|
7
|
+
export interface PublishLivingDocInput {
|
|
8
|
+
markdown: string;
|
|
9
|
+
publisherEmail: string;
|
|
10
|
+
publicBaseUrl: string;
|
|
11
|
+
store: LivingDocMetadataStore;
|
|
12
|
+
title?: string | null;
|
|
13
|
+
opaqueId?: string;
|
|
14
|
+
reviewId?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PublishLivingDocResult {
|
|
17
|
+
opaqueId: string;
|
|
18
|
+
reviewId: string;
|
|
19
|
+
title: string | null;
|
|
20
|
+
viewUrl: string;
|
|
21
|
+
reviewUrl: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function publishLivingDoc(input: PublishLivingDocInput): Promise<PublishLivingDocResult>;
|
|
24
|
+
export interface PullLivingDocInput {
|
|
25
|
+
opaqueId: string;
|
|
26
|
+
publisherEmail: string;
|
|
27
|
+
store: LivingDocMetadataStore;
|
|
28
|
+
}
|
|
29
|
+
export interface PulledComment {
|
|
30
|
+
id: string;
|
|
31
|
+
origin: CommentOrigin;
|
|
32
|
+
author: string | null;
|
|
33
|
+
anchorQuote: string;
|
|
34
|
+
body: string;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
}
|
|
37
|
+
export interface PulledSuggestion {
|
|
38
|
+
id: string;
|
|
39
|
+
anchorQuote: string;
|
|
40
|
+
anchorStart: number | null;
|
|
41
|
+
replacement: string;
|
|
42
|
+
note: string | null;
|
|
43
|
+
status: SuggestionStatus;
|
|
44
|
+
}
|
|
45
|
+
export interface PullLivingDocResult {
|
|
46
|
+
opaqueId: string;
|
|
47
|
+
title: string | null;
|
|
48
|
+
versionNumber: number;
|
|
49
|
+
previousVersionNumber: number | null;
|
|
50
|
+
markdown: string;
|
|
51
|
+
diffFromPreviousVersion: string | null;
|
|
52
|
+
openComments: PulledComment[];
|
|
53
|
+
priorSuggestions: PulledSuggestion[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Cut an immutable Version of the Living Doc and return the current Markdown,
|
|
57
|
+
* a diff versus the previous Version, and the open Reviewer feedback. This is
|
|
58
|
+
* the turn boundary: each pull advances the version number.
|
|
59
|
+
*/
|
|
60
|
+
export declare function pullLivingDocFeedback(input: PullLivingDocInput): Promise<PullLivingDocResult>;
|
|
61
|
+
export interface RespondSuggestionInput {
|
|
62
|
+
anchorQuote: string;
|
|
63
|
+
replacement: string;
|
|
64
|
+
note?: string | null;
|
|
65
|
+
anchorStart?: number | null;
|
|
66
|
+
}
|
|
67
|
+
export interface RespondReplyInput {
|
|
68
|
+
parentCommentId: string;
|
|
69
|
+
body: string;
|
|
70
|
+
}
|
|
71
|
+
export interface RespondLivingDocInput {
|
|
72
|
+
opaqueId: string;
|
|
73
|
+
publisherEmail: string;
|
|
74
|
+
store: LivingDocMetadataStore;
|
|
75
|
+
suggestions?: RespondSuggestionInput[];
|
|
76
|
+
replies?: RespondReplyInput[];
|
|
77
|
+
}
|
|
78
|
+
export interface RespondLivingDocResult {
|
|
79
|
+
opaqueId: string;
|
|
80
|
+
versionNumber: number;
|
|
81
|
+
createdSuggestions: PulledSuggestion[];
|
|
82
|
+
createdReplies: PulledComment[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The agent's half of the round: post span-anchored Suggestions (never applied
|
|
86
|
+
* automatically) and replies to open Comments. Suggestions target the latest
|
|
87
|
+
* pulled Version.
|
|
88
|
+
*/
|
|
89
|
+
export declare function respondToLivingDoc(input: RespondLivingDocInput): Promise<RespondLivingDocResult>;
|
|
90
|
+
export interface RemoveLivingDocInput {
|
|
91
|
+
opaqueId: string;
|
|
92
|
+
publisherEmail: string;
|
|
93
|
+
store: LivingDocMetadataStore;
|
|
94
|
+
}
|
|
95
|
+
export interface RemoveLivingDocResult {
|
|
96
|
+
opaqueId: string;
|
|
97
|
+
status: "removed" | "not-found";
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Removal disables the Living Doc: the View Link and Review Link both stop
|
|
101
|
+
* serving it. This is the kill switch for a leaked Review Link.
|
|
102
|
+
*/
|
|
103
|
+
export declare function removeLivingDoc(input: RemoveLivingDocInput): Promise<RemoveLivingDocResult>;
|
|
104
|
+
export interface ReviewStateResult {
|
|
105
|
+
opaqueId: string;
|
|
106
|
+
title: string | null;
|
|
107
|
+
versionNumber: number;
|
|
108
|
+
markdown: string;
|
|
109
|
+
comments: LivingDocComment[];
|
|
110
|
+
pendingSuggestions: LivingDocSuggestion[];
|
|
111
|
+
}
|
|
112
|
+
export declare function getReviewState(store: LivingDocMetadataStore, reviewId: string): Promise<ReviewStateResult>;
|
|
113
|
+
export declare function saveReviewMarkdown(store: LivingDocMetadataStore, reviewId: string, markdown: string): Promise<LivingDoc>;
|
|
114
|
+
export interface AddReviewerCommentInput {
|
|
115
|
+
anchorQuote: string;
|
|
116
|
+
body: string;
|
|
117
|
+
anchorStart?: number | null;
|
|
118
|
+
anchorEnd?: number | null;
|
|
119
|
+
author?: string | null;
|
|
120
|
+
}
|
|
121
|
+
export declare function addReviewerComment(store: LivingDocMetadataStore, reviewId: string, input: AddReviewerCommentInput): Promise<LivingDocComment>;
|
|
122
|
+
export declare function resolveReviewerComment(store: LivingDocMetadataStore, reviewId: string, commentId: string): Promise<LivingDocComment>;
|
|
123
|
+
export interface DecideSuggestionResult {
|
|
124
|
+
suggestion: LivingDocSuggestion;
|
|
125
|
+
markdown: string;
|
|
126
|
+
applied: boolean;
|
|
127
|
+
occurrenceCount: number;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Accept or reject an agent Suggestion. Accepting applies the change to the
|
|
131
|
+
* live Markdown at the anchored quote — when the quote matches more than one
|
|
132
|
+
* place, the occurrence nearest the Suggestion's anchorStart offset wins. If
|
|
133
|
+
* the quote no longer exists (the Reviewer edited past it), the Suggestion
|
|
134
|
+
* stays pending so its replacement text remains visible on the review surface
|
|
135
|
+
* instead of vanishing with an accepted-but-unapplied status.
|
|
136
|
+
*/
|
|
137
|
+
export declare function decideSuggestion(store: LivingDocMetadataStore, reviewId: string, suggestionId: string, decision: Extract<SuggestionStatus, "accepted" | "rejected">): Promise<DecideSuggestionResult>;
|
|
138
|
+
export interface ServeLivingDocViewInput {
|
|
139
|
+
request: Request;
|
|
140
|
+
store: LivingDocMetadataStore;
|
|
141
|
+
}
|
|
142
|
+
export declare function serveLivingDocViewRequest({ request, store, }: ServeLivingDocViewInput): Promise<Response>;
|
|
143
|
+
export interface HandleAgentApiInput {
|
|
144
|
+
request: Request;
|
|
145
|
+
store: LivingDocMetadataStore;
|
|
146
|
+
tokenStore: PublisherTokenStore;
|
|
147
|
+
publicBaseUrl?: string;
|
|
148
|
+
}
|
|
149
|
+
export declare function handleLivingDocAgentApiRequest({ request, store, tokenStore, publicBaseUrl, }: HandleAgentApiInput): Promise<Response>;
|
|
150
|
+
export interface HandleReviewApiInput {
|
|
151
|
+
request: Request;
|
|
152
|
+
store: LivingDocMetadataStore;
|
|
153
|
+
}
|
|
154
|
+
export declare function handleReviewApiRequest({ request, store, }: HandleReviewApiInput): Promise<Response>;
|
|
155
|
+
export declare function livingDocViewUrl(publicBaseUrl: string, opaqueId: string): string;
|
|
156
|
+
export declare function livingDocReviewUrl(publicBaseUrl: string, reviewId: string): string;
|
|
157
|
+
export declare function opaqueIdFromViewUrl(url: string): string | null;
|
|
158
|
+
export declare function reviewIdFromReviewUrl(url: string): string | null;
|
|
159
|
+
export declare function opaqueIdFromViewReference(reference: string): string;
|
|
160
|
+
export declare function livingDocSafetyHeaders(headers?: HeadersInit): Headers;
|
|
161
|
+
export declare function deriveMarkdownTitle(markdown: string): string | null;
|
|
162
|
+
export declare function createReviewId(): string;
|
|
163
|
+
//# sourceMappingURL=living-doc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"living-doc.d.ts","sourceRoot":"","sources":["../../src/living-doc.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAC;AAE1C,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAI1C,eAAO,MAAM,yBAAyB,QAAkB,CAAC;AACzD,eAAO,MAAM,qBAAqB,QAAY,CAAC;AAc/C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,sBAAsB,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,sBAAsB,CAAC,CAkBjC;AAED,MAAM,WAAW,kBAAkB;IACj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