@agimon-ai/po-author 0.0.0-alpha.37 → 0.0.0-alpha.39
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/extensions/web.mjs +8 -8
- package/dist/extensions/web.mjs.map +1 -1
- package/package.json +11 -11
package/dist/extensions/web.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { useStore } from "@tanstack/react-store";
|
|
|
4
4
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Button, CodeEditor, Dot, FileIcon, Markdown, MediaPreview, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, MessageLines, SparklesIcon, StatusBadge, TrashIcon, collapseLines, drawableImageUrl, markdownMediaReview, markdownMediaReviewSlot, svgImageUrl, toolTone } from "@agimon-ai/po-web-components";
|
|
7
|
-
import {
|
|
7
|
+
import { browserTransport } from "@agimon-ai/po-web-security/browser";
|
|
8
8
|
//#region src/types/webAuthor.ts
|
|
9
9
|
const authorChannelType = "author_webmcp";
|
|
10
10
|
//#endregion
|
|
@@ -2173,7 +2173,7 @@ var apiRoutes_default = defineApiRoutes({
|
|
|
2173
2173
|
const api = createApiClient(apiRoutes_default, {
|
|
2174
2174
|
scopes: ["session"],
|
|
2175
2175
|
basePath: "author",
|
|
2176
|
-
transport: (input, init) =>
|
|
2176
|
+
transport: (input, init) => browserTransport.fetch(input, init),
|
|
2177
2177
|
sessionAddress: sessionApiAddress
|
|
2178
2178
|
});
|
|
2179
2179
|
//#endregion
|
|
@@ -2285,7 +2285,7 @@ const artifactApi = createApiClient({ content: {
|
|
|
2285
2285
|
} }, {
|
|
2286
2286
|
scopes: ["session"],
|
|
2287
2287
|
basePath: "artifacts",
|
|
2288
|
-
transport: (input, init) =>
|
|
2288
|
+
transport: (input, init) => browserTransport.fetch(input, init),
|
|
2289
2289
|
sessionAddress: sessionApiAddress
|
|
2290
2290
|
});
|
|
2291
2291
|
/** One document route, with the refusal the reader is shown: the route's own words, or its status. */
|
|
@@ -2301,7 +2301,7 @@ async function documentRequest(method, sessionId, body, signal) {
|
|
|
2301
2301
|
async function loadAuthorDocument(sessionId, path, signal) {
|
|
2302
2302
|
const kind = authorKindForPath(path);
|
|
2303
2303
|
const url = authorSessionFileUrl(sessionId, path);
|
|
2304
|
-
const response = await
|
|
2304
|
+
const response = await browserTransport.fetch(url, { signal });
|
|
2305
2305
|
if (!response.ok) throw new Error(`Author could not open ${path} (${response.status})`);
|
|
2306
2306
|
const sourceSha256 = response.headers.get("X-File-SHA256") ?? void 0;
|
|
2307
2307
|
const format = structuredFormat(path);
|
|
@@ -2359,7 +2359,7 @@ async function croppedImageBytes(documentInput, signal) {
|
|
|
2359
2359
|
if (crop === void 0 || mediaUrl === void 0) throw new Error("This Author image has no crop source.");
|
|
2360
2360
|
const mimeType = imageMimeType(documentInput.path);
|
|
2361
2361
|
if (mimeType === void 0) throw new Error("This image format cannot preserve its encoding after crop.");
|
|
2362
|
-
const response = await
|
|
2362
|
+
const response = await browserTransport.fetch(mediaUrl, {
|
|
2363
2363
|
signal,
|
|
2364
2364
|
cache: "no-store"
|
|
2365
2365
|
});
|
|
@@ -2408,7 +2408,7 @@ async function bytesToSave(sessionId, document, signal) {
|
|
|
2408
2408
|
async function saveAuthorDocument(sessionId, document, signal) {
|
|
2409
2409
|
if (document.path.startsWith("artifact:")) throw new Error("Artifacts are read-only.");
|
|
2410
2410
|
if (document.sourceSha256 === void 0) throw new Error("This Author view has no source digest.");
|
|
2411
|
-
const response = await
|
|
2411
|
+
const response = await browserTransport.fetch(authorSessionFileUrl(sessionId, document.path), {
|
|
2412
2412
|
method: "PUT",
|
|
2413
2413
|
headers: {
|
|
2414
2414
|
"Content-Type": "application/octet-stream",
|
|
@@ -3238,7 +3238,7 @@ function createAuthorHtmlAssets(sessionId, signal) {
|
|
|
3238
3238
|
const load = (path) => {
|
|
3239
3239
|
let pending = cache.get(path);
|
|
3240
3240
|
if (pending === void 0) {
|
|
3241
|
-
pending = Promise.resolve().then(() =>
|
|
3241
|
+
pending = Promise.resolve().then(() => browserTransport.fetch(authorSessionFileUrl(sessionId, path), {
|
|
3242
3242
|
signal,
|
|
3243
3243
|
cache: "no-store"
|
|
3244
3244
|
})).then(async (response) => {
|
|
@@ -3345,7 +3345,7 @@ async function loadAuthorMedia(source, signal, imageData) {
|
|
|
3345
3345
|
let blob;
|
|
3346
3346
|
if (imageData !== void 0) blob = new Blob([Uint8Array.from(atob(imageData), (character) => character.charCodeAt(0))], { type: "image/png" });
|
|
3347
3347
|
else {
|
|
3348
|
-
const response = await
|
|
3348
|
+
const response = await browserTransport.fetch(source, {
|
|
3349
3349
|
signal,
|
|
3350
3350
|
cache: "no-store"
|
|
3351
3351
|
});
|