@backmatter/studio 0.0.17 → 0.0.19
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/dist/chunks/{UiKitApp-D7vllRQE.js → UiKitApp-B1ANqCac.js} +528 -481
- package/dist/chunks/{WorkspaceRoutes-DH1LD-2Q.js → WorkspaceRoutes-BHNGrf-j.js} +24955 -24119
- package/dist/chunks/{dashboard-Dsaeud2x.js → dashboard-b-W6dGm5.js} +586 -565
- package/dist/chunks/{index-CGMqw2NH.js → index-HYioDjux.js} +104 -104
- package/dist/dashboard.js +2 -2
- package/dist/index.js +166 -159
- package/dist/site-widget.css +25 -6
- package/dist/site-widget.js +6925 -6840
- package/dist/studio.css +171 -42
- package/package.json +2 -2
- package/src/api.ts +44 -1
- package/src/chat/ChatMessage.tsx +4 -4
- package/src/chat/ChatProvider.tsx +6 -0
- package/src/chat/chat-helpers.ts +54 -2
- package/src/chrome/CommandPalette.tsx +3 -3
- package/src/chrome/ContentExplorerSidebar.tsx +421 -74
- package/src/chrome/WorkspaceStatusBar.tsx +24 -24
- package/src/chrome/commit-error.ts +48 -60
- package/src/chrome/commit-failure.tsx +2 -2
- package/src/chrome/content-path-tree.ts +4 -0
- package/src/chrome/explorer-row-menu.ts +28 -0
- package/src/chrome/folder-create-context.ts +14 -0
- package/src/chrome/use-publish-check.ts +75 -0
- package/src/{pages/code-session-routes.ts → content-routes.ts} +6 -6
- package/src/fields/FieldControl.tsx +198 -64
- package/src/fields/LinkFieldInput.tsx +315 -0
- package/src/fields/choose-field-input.ts +5 -0
- package/src/fields/link-targets.ts +60 -0
- package/src/host-path.ts +13 -0
- package/src/pages/CodeSessionPage.tsx +6 -241
- package/src/pages/DocEditorPage.tsx +121 -178
- package/src/pages/EmbedPublishPage.tsx +13 -5
- package/src/pages/GithubConnectPage.tsx +1 -1
- package/src/pages/LoginPage.tsx +67 -5
- package/src/pages/MediaFieldInput.tsx +712 -37
- package/src/pages/MediaGalleryPage.tsx +69 -5
- package/src/pages/PreviewAddress.tsx +293 -0
- package/src/pages/WorkspaceHomePage.tsx +1 -1
- package/src/pages/code-session-boot.ts +0 -12
- package/src/pages/media-selection.ts +79 -0
- package/src/pages/ui-kit/colors.tsx +2 -0
- package/src/pages/ui-kit/fields.tsx +60 -0
- package/src/styles/themes.ts +2 -0
- package/src/styles/tokens.stylex.ts +1 -0
- package/src/ui/Button.tsx +14 -0
- package/src/ui/Field.tsx +12 -1
- package/src/ui/Input.tsx +191 -97
- package/src/ui/popup.ts +13 -6
package/src/chat/chat-helpers.ts
CHANGED
|
@@ -29,10 +29,28 @@ export function isWriteTool(name: string) {
|
|
|
29
29
|
name === "renameDoc" ||
|
|
30
30
|
name === "deleteDoc" ||
|
|
31
31
|
name === "deleteFolder" ||
|
|
32
|
-
name === "moveFolder"
|
|
32
|
+
name === "moveFolder" ||
|
|
33
|
+
name === "revertDoc" ||
|
|
34
|
+
name === "resolveConflict"
|
|
33
35
|
);
|
|
34
36
|
}
|
|
35
37
|
|
|
38
|
+
/** Branch and history tools that change what Studio shows. */
|
|
39
|
+
export function branchToolReloads(name: string, output: unknown): boolean {
|
|
40
|
+
if (name !== "switchBranch" && name !== "undoPublish" && name !== "createBranch") return false;
|
|
41
|
+
return Boolean(output && typeof output === "object" && (output as { ok?: unknown }).ok === true);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A tool failed when it says `ok: false` with a message. A check with problems
|
|
46
|
+
* still succeeded, and a shell command's non-zero exit is its output.
|
|
47
|
+
*/
|
|
48
|
+
export function toolFailed(output: unknown): boolean {
|
|
49
|
+
if (!output || typeof output !== "object") return false;
|
|
50
|
+
const body = output as { ok?: unknown; message?: unknown };
|
|
51
|
+
return body.ok === false && typeof body.message === "string";
|
|
52
|
+
}
|
|
53
|
+
|
|
36
54
|
/** One write tool may record several files, as a folder move or delete does. */
|
|
37
55
|
export function changesInToolOutput(output: unknown): ChatChangeSummary[] {
|
|
38
56
|
if (!output || typeof output !== "object") return [];
|
|
@@ -140,6 +158,40 @@ export function toolLabel(name: string, input: unknown, output: unknown, state:
|
|
|
140
158
|
const to = (input as { to?: string } | undefined)?.to ?? "";
|
|
141
159
|
return running ? `Moving ${from}…` : `Moved ${from} to ${to}`;
|
|
142
160
|
}
|
|
161
|
+
case "listBranches":
|
|
162
|
+
return running ? "Listing branches…" : "Listed branches";
|
|
163
|
+
case "listCommits":
|
|
164
|
+
return running ? "Reading the history…" : "Read the history";
|
|
165
|
+
case "createBranch": {
|
|
166
|
+
const branch = (output as { branch?: string } | undefined)?.branch;
|
|
167
|
+
return running ? "Creating a branch…" : branch ? `Created ${branch}` : "Create branch failed";
|
|
168
|
+
}
|
|
169
|
+
case "switchBranch": {
|
|
170
|
+
const name = (input as { name?: string } | undefined)?.name ?? "";
|
|
171
|
+
return running ? `Switching to ${name}…` : `Switched to ${name}`;
|
|
172
|
+
}
|
|
173
|
+
case "undoPublish": {
|
|
174
|
+
const sha = ((input as { sha?: string } | undefined)?.sha ?? "").slice(0, 7);
|
|
175
|
+
return running ? `Undoing ${sha}…` : `Undid ${sha}`;
|
|
176
|
+
}
|
|
177
|
+
case "getStatus":
|
|
178
|
+
return running ? "Checking status…" : "Checked status";
|
|
179
|
+
case "checkChanges": {
|
|
180
|
+
if (running) return "Checking changes…";
|
|
181
|
+
const problems = (output as { problems?: Array<{ code?: string }> } | undefined)?.problems ?? [];
|
|
182
|
+
const blocking = problems.filter((problem) => problem.code !== "nothing_to_publish");
|
|
183
|
+
if (blocking.length > 0) {
|
|
184
|
+
return blocking.length === 1 ? "Found 1 problem" : `Found ${blocking.length} problems`;
|
|
185
|
+
}
|
|
186
|
+
return problems.length > 0 ? "Nothing to publish" : "Ready to publish";
|
|
187
|
+
}
|
|
188
|
+
case "revertDoc":
|
|
189
|
+
return running ? `Reverting ${doc}…` : `Reverted ${doc}`;
|
|
190
|
+
case "resolveConflict": {
|
|
191
|
+
const theirs = (input as { strategy?: string } | undefined)?.strategy === "theirs";
|
|
192
|
+
if (running) return `Resolving ${doc}…`;
|
|
193
|
+
return theirs ? `Took the branch's version of ${doc}` : `Kept your version of ${doc}`;
|
|
194
|
+
}
|
|
143
195
|
case "commit": {
|
|
144
196
|
if (running) return "Publishing…";
|
|
145
197
|
const published = output as { ok?: boolean; files?: unknown[] } | undefined;
|
|
@@ -408,7 +460,7 @@ export function chatSuggestions(input: {
|
|
|
408
460
|
const type = input.contentTypes[0];
|
|
409
461
|
return [
|
|
410
462
|
type ? `Write a new ${type}` : "What can you help with?",
|
|
411
|
-
"What
|
|
463
|
+
"What's ready to publish?",
|
|
412
464
|
"Find pages mentioning…",
|
|
413
465
|
];
|
|
414
466
|
}
|
|
@@ -163,8 +163,8 @@ export function CommandPalette() {
|
|
|
163
163
|
icon: "commit",
|
|
164
164
|
label:
|
|
165
165
|
conflicts > 0
|
|
166
|
-
? `
|
|
167
|
-
: `
|
|
166
|
+
? `Publish blocked: ${conflicts} ${conflicts === 1 ? "conflict" : "conflicts"}`
|
|
167
|
+
: `Publish ${count} ${count === 1 ? "file" : "files"} to ${git.currentBranch}`,
|
|
168
168
|
hint: conflicts > 0 ? "Resolve conflicts in the editor first" : "Uses the default message",
|
|
169
169
|
run: () => {
|
|
170
170
|
setOpen(false);
|
|
@@ -238,7 +238,7 @@ export function CommandPalette() {
|
|
|
238
238
|
group: "Editing",
|
|
239
239
|
icon: "revert",
|
|
240
240
|
label: "Revert file",
|
|
241
|
-
hint: "Drop my
|
|
241
|
+
hint: "Drop my unpublished changes to this document",
|
|
242
242
|
run: () => {
|
|
243
243
|
setOpen(false);
|
|
244
244
|
void revertDoc();
|