@tangle-network/agent-app 0.58.15 → 0.58.16
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/VaultPane-RIJM452Y.js +7 -0
- package/dist/assistant/index.js +13 -11
- package/dist/assistant/index.js.map +1 -1
- package/dist/chat-react/index.js +4 -4
- package/dist/chat-routes/index.js +4 -4
- package/dist/chat-store/index.js +2 -2
- package/dist/chunk-B7CL7ENS.js +118 -0
- package/dist/chunk-B7CL7ENS.js.map +1 -0
- package/dist/{chunk-POE5UUUT.js → chunk-BDCATWBV.js} +3 -3
- package/dist/{chunk-NWR5CERQ.js → chunk-FNRUXPXE.js} +2 -2
- package/dist/{chunk-57TTYY6T.js → chunk-GEGCSRYQ.js} +2 -2
- package/dist/{chunk-WTGSLW5X.js → chunk-HTAFI247.js} +4 -4
- package/dist/{chunk-MLG7YSTS.js → chunk-KSLVMA2D.js} +3 -3
- package/dist/{chunk-T5U7LDQW.js → chunk-OFQUM5FP.js} +52 -15
- package/dist/chunk-OFQUM5FP.js.map +1 -0
- package/dist/chunk-PV33JZKV.js +115 -0
- package/dist/chunk-PV33JZKV.js.map +1 -0
- package/dist/{chunk-TUNRLEDH.js → chunk-Q3BLSWYP.js} +2 -2
- package/dist/{chunk-GIBNG64C.js → chunk-S5MKEU2E.js} +2607 -1438
- package/dist/chunk-S5MKEU2E.js.map +1 -0
- package/dist/{chunk-EN5CP7T7.js → chunk-T5PPQPOD.js} +5 -111
- package/dist/chunk-T5PPQPOD.js.map +1 -0
- package/dist/{chunk-DWUBICLW.js → chunk-UGPV7VEW.js} +569 -236
- package/dist/chunk-UGPV7VEW.js.map +1 -0
- package/dist/{chunk-EXBAVMMK.js → chunk-XOBVWCOA.js} +347 -311
- package/dist/chunk-XOBVWCOA.js.map +1 -0
- package/dist/{mention-editor-W2GG2NZ7.js → mention-editor-4D32JTDS.js} +2 -2
- package/dist/preset-cloudflare/index.js +3 -3
- package/dist/profile/index.js +4 -2
- package/dist/profile/index.js.map +1 -1
- package/dist/profile-editor/index.d.ts +185 -0
- package/dist/profile-editor/index.js +18 -0
- package/dist/profile-editor/index.js.map +1 -0
- package/dist/profile-editor/server.d.ts +112 -0
- package/dist/profile-editor/server.js +635 -0
- package/dist/profile-editor/server.js.map +1 -0
- package/dist/public-consultation/index.js +4 -4
- package/dist/skills/frontmatter.d.ts +43 -0
- package/dist/skills/index.d.ts +1 -38
- package/dist/skills/index.js +4 -2
- package/dist/skills-placement/index.js +2 -1
- package/dist/skills-placement/index.js.map +1 -1
- package/dist/stories/fixtures/profile-editor.d.ts +17 -0
- package/dist/studio-react/index.js +3 -3
- package/dist/teams/invitations-api.js +3 -3
- package/dist/vault/VaultPane.d.ts +4 -4
- package/dist/vault/VaultTree.d.ts +39 -0
- package/dist/vault/contracts.d.ts +17 -7
- package/dist/vault/index.d.ts +5 -4
- package/dist/vault/index.js +7 -3
- package/dist/vault/lazy.js +1 -1
- package/dist/web-react/agent-profile-editor.d.ts +63 -1
- package/dist/web-react/agent-profile-files.d.ts +38 -0
- package/dist/web-react/agent-profile-form-kit.d.ts +87 -0
- package/dist/web-react/agent-profile-github-source.d.ts +35 -0
- package/dist/web-react/agent-profile-mcp-servers.d.ts +20 -0
- package/dist/web-react/agent-profile-suggest-input.d.ts +31 -0
- package/dist/web-react/agent-session-controls.d.ts +51 -0
- package/dist/web-react/controls.d.ts +29 -3
- package/dist/web-react/index.d.ts +3 -2
- package/dist/web-react/index.js +23 -15
- package/dist/workspace-react/index.js +4 -4
- package/package.json +11 -1
- package/dist/VaultPane-SPXE7XAC.js +0 -7
- package/dist/chunk-DWUBICLW.js.map +0 -1
- package/dist/chunk-EN5CP7T7.js.map +0 -1
- package/dist/chunk-EXBAVMMK.js.map +0 -1
- package/dist/chunk-GIBNG64C.js.map +0 -1
- package/dist/chunk-T5U7LDQW.js.map +0 -1
- /package/dist/{VaultPane-SPXE7XAC.js.map → VaultPane-RIJM452Y.js.map} +0 -0
- /package/dist/{chunk-POE5UUUT.js.map → chunk-BDCATWBV.js.map} +0 -0
- /package/dist/{chunk-NWR5CERQ.js.map → chunk-FNRUXPXE.js.map} +0 -0
- /package/dist/{chunk-57TTYY6T.js.map → chunk-GEGCSRYQ.js.map} +0 -0
- /package/dist/{chunk-WTGSLW5X.js.map → chunk-HTAFI247.js.map} +0 -0
- /package/dist/{chunk-MLG7YSTS.js.map → chunk-KSLVMA2D.js.map} +0 -0
- /package/dist/{chunk-TUNRLEDH.js.map → chunk-Q3BLSWYP.js.map} +0 -0
- /package/dist/{mention-editor-W2GG2NZ7.js.map → mention-editor-4D32JTDS.js.map} +0 -0
package/dist/chat-react/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ComposerModeControls,
|
|
3
3
|
EntryComposer
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-XOBVWCOA.js";
|
|
5
5
|
import "../chunk-L7MB2LLM.js";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-GEGCSRYQ.js";
|
|
7
|
+
import "../chunk-OFQUM5FP.js";
|
|
8
8
|
import "../chunk-SJWIZT7B.js";
|
|
9
|
-
import "../chunk-MLG6XKPV.js";
|
|
10
9
|
import "../chunk-NJA6X7JI.js";
|
|
10
|
+
import "../chunk-MLG6XKPV.js";
|
|
11
11
|
import "../chunk-MCYJON3F.js";
|
|
12
12
|
import "../chunk-7YA4QNTU.js";
|
|
13
13
|
import "../chunk-GYDFGEJ2.js";
|
|
@@ -64,9 +64,9 @@ import {
|
|
|
64
64
|
rowIdOf,
|
|
65
65
|
storeSupportsDraftPersistence,
|
|
66
66
|
streamChatRouteAsSandboxEvents
|
|
67
|
-
} from "../chunk-
|
|
68
|
-
import "../chunk-YNSPVKMS.js";
|
|
67
|
+
} from "../chunk-FNRUXPXE.js";
|
|
69
68
|
import "../chunk-6VRVRWYN.js";
|
|
69
|
+
import "../chunk-YNSPVKMS.js";
|
|
70
70
|
import "../chunk-3NCPXNBZ.js";
|
|
71
71
|
import "../chunk-53K4S3K6.js";
|
|
72
72
|
import {
|
|
@@ -77,7 +77,8 @@ import {
|
|
|
77
77
|
attachmentInputToPart,
|
|
78
78
|
attachmentKindForMime,
|
|
79
79
|
toChatMessageParts
|
|
80
|
-
} from "../chunk-
|
|
80
|
+
} from "../chunk-HTAFI247.js";
|
|
81
|
+
import "../chunk-ZVEEWGDK.js";
|
|
81
82
|
import {
|
|
82
83
|
ChatTurnInputError,
|
|
83
84
|
DISPATCH_MAX_MEDIA_PARTS,
|
|
@@ -99,7 +100,6 @@ import {
|
|
|
99
100
|
promptPartsByteSize,
|
|
100
101
|
validateSandboxMentionPath
|
|
101
102
|
} from "../chunk-GYDFGEJ2.js";
|
|
102
|
-
import "../chunk-ZVEEWGDK.js";
|
|
103
103
|
import {
|
|
104
104
|
isWorkspaceFileExportable
|
|
105
105
|
} from "../chunk-TXD5HXLE.js";
|
package/dist/chat-store/index.js
CHANGED
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
mentionInputToPart,
|
|
15
15
|
mentionPartsFromMessageParts,
|
|
16
16
|
toChatMessageParts
|
|
17
|
-
} from "../chunk-
|
|
18
|
-
import "../chunk-GYDFGEJ2.js";
|
|
17
|
+
} from "../chunk-HTAFI247.js";
|
|
19
18
|
import "../chunk-ZVEEWGDK.js";
|
|
19
|
+
import "../chunk-GYDFGEJ2.js";
|
|
20
20
|
import "../chunk-TXD5HXLE.js";
|
|
21
21
|
import {
|
|
22
22
|
attachmentPartKey
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseSkillFrontmatter
|
|
3
|
+
} from "./chunk-PV33JZKV.js";
|
|
4
|
+
|
|
5
|
+
// src/profile-editor/index.ts
|
|
6
|
+
var PROFILE_EDITOR_ROUTES = {
|
|
7
|
+
repositories: "github/repositories",
|
|
8
|
+
latest: "github/latest",
|
|
9
|
+
commit: "github/commit",
|
|
10
|
+
files: "github/files",
|
|
11
|
+
check: "github/check",
|
|
12
|
+
mcpCheck: "mcp/check"
|
|
13
|
+
};
|
|
14
|
+
function unavailable(message) {
|
|
15
|
+
return { ok: false, problem: "unavailable", message };
|
|
16
|
+
}
|
|
17
|
+
function createProfileEditorClient({ endpoint, fetch: fetchImpl }) {
|
|
18
|
+
const base = endpoint.replace(/\/+$/, "");
|
|
19
|
+
const send = fetchImpl ?? ((input, init) => globalThis.fetch(input, init));
|
|
20
|
+
async function call(path, init, failure) {
|
|
21
|
+
const query = init.query ? "?" + new URLSearchParams(init.query).toString() : "";
|
|
22
|
+
try {
|
|
23
|
+
const response = await send(`${base}/${path}${query}`, {
|
|
24
|
+
method: init.method ?? "GET",
|
|
25
|
+
signal: init.signal,
|
|
26
|
+
credentials: "same-origin",
|
|
27
|
+
headers: init.body ? { "Content-Type": "application/json" } : void 0,
|
|
28
|
+
body: init.body
|
|
29
|
+
});
|
|
30
|
+
const body = await response.json().catch(() => null);
|
|
31
|
+
if (response.ok && body && typeof body === "object" && "ok" in body) return body;
|
|
32
|
+
const detail = body && typeof body === "object" && "error" in body && typeof body.error === "string" ? body.error : "";
|
|
33
|
+
if (response.status === 401 || response.status === 403) return failure(detail || "You do not have access to check sources for this workspace.");
|
|
34
|
+
return failure(detail || `The source check could not complete (HTTP ${response.status}).`);
|
|
35
|
+
} catch (cause) {
|
|
36
|
+
if (init.signal?.aborted) throw cause;
|
|
37
|
+
return failure("The source check could not reach the server. Check your connection and try again.");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const github = {
|
|
41
|
+
repositories: (signal) => call(PROFILE_EDITOR_ROUTES.repositories, { signal }, unavailable),
|
|
42
|
+
latest: (repository, signal) => call(PROFILE_EDITOR_ROUTES.latest, { signal, query: { repository } }, unavailable),
|
|
43
|
+
commit: (repository, sha, signal) => call(PROFILE_EDITOR_ROUTES.commit, { signal, query: { repository, sha } }, unavailable),
|
|
44
|
+
files: (repository, commit, signal) => call(PROFILE_EDITOR_ROUTES.files, { signal, query: { repository, commit } }, unavailable),
|
|
45
|
+
check: (request, signal) => call(PROFILE_EDITOR_ROUTES.check, { signal, method: "POST", body: JSON.stringify(request) }, unavailable)
|
|
46
|
+
};
|
|
47
|
+
const mcp = {
|
|
48
|
+
check: (server, signal) => call(
|
|
49
|
+
PROFILE_EDITOR_ROUTES.mcpCheck,
|
|
50
|
+
{ signal, method: "POST", body: JSON.stringify({ server }) },
|
|
51
|
+
(message) => ({ ok: false, problem: "unavailable", message, checkedAt: (/* @__PURE__ */ new Date()).toISOString() })
|
|
52
|
+
)
|
|
53
|
+
};
|
|
54
|
+
return { github, mcp };
|
|
55
|
+
}
|
|
56
|
+
var REPOSITORY_SEGMENT = /^[A-Za-z0-9_.-]{1,100}$/;
|
|
57
|
+
function parseGitHubLocation(input) {
|
|
58
|
+
let text = input.trim();
|
|
59
|
+
if (!text) return null;
|
|
60
|
+
const ssh = /^git@github\.com:(.+?)(?:\.git)?$/i.exec(text);
|
|
61
|
+
if (ssh) text = ssh[1];
|
|
62
|
+
else if (/^(https?:\/\/)?(www\.)?github\.com\//i.test(text)) {
|
|
63
|
+
try {
|
|
64
|
+
const url = new URL(/^https?:/i.test(text) ? text : "https://" + text);
|
|
65
|
+
text = url.pathname.replace(/^\/+/, "").replace(/\.git$/, "");
|
|
66
|
+
} catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const [owner, repo, kind, ref, ...rest] = text.split("/").filter(Boolean);
|
|
71
|
+
if (!owner || !repo || !REPOSITORY_SEGMENT.test(owner) || !REPOSITORY_SEGMENT.test(repo) || owner === "." || owner === ".." || repo === "." || repo === "..") return null;
|
|
72
|
+
const repository = `${owner}/${repo.replace(/\.git$/, "")}`;
|
|
73
|
+
if ((kind === "tree" || kind === "blob") && ref) return { repository, ref, ...rest.length ? { path: rest.join("/") } : {} };
|
|
74
|
+
return kind ? null : { repository };
|
|
75
|
+
}
|
|
76
|
+
function isCommitSha(value) {
|
|
77
|
+
return /^[0-9a-f]{40}$/i.test(value);
|
|
78
|
+
}
|
|
79
|
+
function publicHttpsUrlProblem(value) {
|
|
80
|
+
let url;
|
|
81
|
+
try {
|
|
82
|
+
url = new URL(value);
|
|
83
|
+
} catch {
|
|
84
|
+
return "Enter a full URL, such as https://example.com/mcp.";
|
|
85
|
+
}
|
|
86
|
+
if (url.protocol !== "https:") return "Use a public HTTPS address that starts with https://.";
|
|
87
|
+
if (url.username || url.password) return "Remove the credentials from the URL. Use a secret reference in a header instead.";
|
|
88
|
+
if (url.search || url.hash) return "Remove the query and fragment from the URL. Send credentials as a secret reference in a header.";
|
|
89
|
+
const host = url.hostname.toLowerCase();
|
|
90
|
+
if (!host.includes(".") || /^\d+\.\d+\.\d+\.\d+$/.test(host) || host.startsWith("[") || host.endsWith(".local") || host.endsWith(".internal") || host.endsWith(".localhost") || host === "localhost") {
|
|
91
|
+
return "Use a public address. Private, local, and IP addresses are not reachable from here.";
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
function readSkillFrontmatter(content) {
|
|
96
|
+
let parsed;
|
|
97
|
+
try {
|
|
98
|
+
parsed = parseSkillFrontmatter(content.replace(/\r\n/g, "\n"));
|
|
99
|
+
} catch {
|
|
100
|
+
return { ok: false, message: "The file has malformed frontmatter. A skill starts with a --- block that sets name and description." };
|
|
101
|
+
}
|
|
102
|
+
const name = parsed.frontmatter.name?.trim();
|
|
103
|
+
const description = parsed.frontmatter.description?.trim();
|
|
104
|
+
if (!name || !description) {
|
|
105
|
+
return { ok: false, message: "This file is not a skill. A skill file starts with frontmatter that sets name and description." };
|
|
106
|
+
}
|
|
107
|
+
return { ok: true, name, description };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export {
|
|
111
|
+
PROFILE_EDITOR_ROUTES,
|
|
112
|
+
createProfileEditorClient,
|
|
113
|
+
parseGitHubLocation,
|
|
114
|
+
isCommitSha,
|
|
115
|
+
publicHttpsUrlProblem,
|
|
116
|
+
readSkillFrontmatter
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=chunk-B7CL7ENS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/profile-editor/index.ts"],"sourcesContent":["/**\n * Shared contract between the profile editor and the product server that\n * checks what an edit points at: GitHub skill and file sources, and MCP\n * servers. The editor never talks to GitHub or an MCP server itself; the\n * product authenticates the request, picks the credential, and answers through\n * `./profile-editor/server`. This module is browser-safe: types, the wire\n * format, and a fetch client for the product's route.\n */\nimport type { AgentProfileMcpServer } from '@tangle-network/agent-interface/profile'\nimport { parseSkillFrontmatter } from '../skills/frontmatter'\n\n/** Why a GitHub source cannot be used. Each one renders its own message and next step. */\nexport type GitHubSourceProblem =\n /** The workspace has no usable GitHub connection. */\n | 'not-connected'\n /** GitHub answered 404 for the repository: it does not exist, or this connection cannot see it. */\n | 'repository-not-found'\n /** GitHub refused the connection (401/403), for example an expired token or SSO enforcement. */\n | 'no-access'\n /** The commit or branch does not exist in the repository. */\n | 'ref-not-found'\n /** No file exists at the path in the chosen commit. */\n | 'path-not-found'\n /** The path names a folder without a skill file in it. */\n | 'not-a-file'\n /** The file is not an Agent Skill: it lacks `name` and `description` frontmatter. */\n | 'not-a-skill'\n /** The file is larger than the product accepts, or is not UTF-8 text. */\n | 'unsupported-file'\n | 'rate-limited'\n /** GitHub or the product's connection service did not answer, or the operation is not offered. */\n | 'unavailable'\n\nexport interface GitHubSourceFailure {\n ok: false\n problem: GitHubSourceProblem\n /** User-facing explanation with the next step. */\n message: string\n}\n\nexport type GitHubSourceOutcome<T> = { ok: true; value: T } | GitHubSourceFailure\n\nexport interface GitHubRepositorySummary {\n /** `owner/repo`. */\n fullName: string\n private: boolean\n defaultBranch: string\n description?: string\n}\n\nexport interface GitHubCommitSummary {\n /** Full 40-character commit SHA. */\n sha: string\n /** The branch the commit was resolved from, when it was resolved from one. */\n branch?: string\n committedAt?: string\n message?: string\n}\n\nexport interface GitHubFileEntry {\n path: string\n size?: number\n}\n\nexport interface GitHubFileList {\n commit: GitHubCommitSummary\n files: GitHubFileEntry[]\n /** GitHub truncated the listing; paths not listed can still be typed. */\n truncated: boolean\n}\n\nexport type GitHubSourcePurpose = 'skill' | 'file'\n\nexport interface GitHubSourceRequest {\n repository: string\n path: string\n /** Full commit SHA the source is pinned to. */\n commit: string\n purpose: GitHubSourcePurpose\n}\n\nexport interface GitHubSourceCheck {\n repository: string\n /** The checked path. A skill folder resolves to its `SKILL.md`. */\n path: string\n commit: GitHubCommitSummary\n size: number\n /** The file's UTF-8 text, for products that store sources inline. */\n content: string\n /** Frontmatter of a skill file. */\n skill?: { name: string; description: string }\n}\n\n/** GitHub lookups the editor needs, answered by the product with the workspace's connection. */\nexport interface ProfileEditorGitHubPort {\n /** Repositories the connection can read, most recently updated first. */\n repositories(signal?: AbortSignal): Promise<GitHubSourceOutcome<{ repositories: GitHubRepositorySummary[] }>>\n /** The repository and the head commit of its default branch. */\n latest(repository: string, signal?: AbortSignal): Promise<GitHubSourceOutcome<{ repository: GitHubRepositorySummary; commit: GitHubCommitSummary }>>\n /** Confirm a commit SHA exists in the repository. */\n commit(repository: string, sha: string, signal?: AbortSignal): Promise<GitHubSourceOutcome<GitHubCommitSummary>>\n /** Files in the repository at a commit, for path suggestions. */\n files(repository: string, commit: string, signal?: AbortSignal): Promise<GitHubSourceOutcome<GitHubFileList>>\n /** Read and validate the source the editor is about to add. */\n check(request: GitHubSourceRequest, signal?: AbortSignal): Promise<GitHubSourceOutcome<GitHubSourceCheck>>\n}\n\n/** Why an MCP server check failed. */\nexport type McpHealthProblem =\n /** The URL is malformed or uses a scheme the product does not accept. */\n | 'invalid-url'\n /** The product does not connect to this address, for example a private network or plain HTTP. */\n | 'blocked-url'\n /** This product checks remote servers only; a local command is checked when the agent starts it. */\n | 'not-checkable'\n | 'unreachable'\n | 'timeout'\n /** The server asked for credentials the check does not send. */\n | 'auth-required'\n /** The server answered, but not with the MCP protocol. */\n | 'protocol-error'\n | 'unavailable'\n\nexport interface McpTool {\n name: string\n description?: string\n}\n\nexport type McpHealth =\n | { ok: true; tools: McpTool[]; serverName?: string; serverVersion?: string; latencyMs: number; checkedAt: string }\n | { ok: false; problem: McpHealthProblem; message: string; status?: number; checkedAt: string }\n\n/** Connects to an MCP server and lists its tools. The product decides which addresses it will reach. */\nexport interface ProfileEditorMcpPort {\n check(server: AgentProfileMcpServer, signal?: AbortSignal): Promise<McpHealth>\n}\n\n/** The product route's subpaths, relative to the endpoint passed to {@link createProfileEditorClient}. */\nexport const PROFILE_EDITOR_ROUTES = {\n repositories: 'github/repositories',\n latest: 'github/latest',\n commit: 'github/commit',\n files: 'github/files',\n check: 'github/check',\n mcpCheck: 'mcp/check',\n} as const\n\nexport interface ProfileEditorClient {\n github: ProfileEditorGitHubPort\n mcp: ProfileEditorMcpPort\n}\n\nexport interface ProfileEditorClientOptions {\n /** The product route that serves `./profile-editor/server`, for example `/api/workspaces/w1/profile-editor`. */\n endpoint: string\n fetch?: typeof fetch\n}\n\nfunction unavailable(message: string): GitHubSourceFailure {\n return { ok: false, problem: 'unavailable', message }\n}\n\n/** Ports backed by the product route. A transport failure becomes an `unavailable` outcome, never a throw. */\nexport function createProfileEditorClient({ endpoint, fetch: fetchImpl }: ProfileEditorClientOptions): ProfileEditorClient {\n const base = endpoint.replace(/\\/+$/, '')\n const send = fetchImpl ?? ((input: RequestInfo | URL, init?: RequestInit) => globalThis.fetch(input, init))\n\n async function call<T>(path: string, init: RequestInit & { query?: Record<string, string> }, failure: (message: string) => T): Promise<T> {\n const query = init.query ? '?' + new URLSearchParams(init.query).toString() : ''\n try {\n const response = await send(`${base}/${path}${query}`, {\n method: init.method ?? 'GET', signal: init.signal, credentials: 'same-origin',\n headers: init.body ? { 'Content-Type': 'application/json' } : undefined, body: init.body,\n })\n const body = await response.json().catch(() => null) as T | { error?: string } | null\n if (response.ok && body && typeof body === 'object' && 'ok' in body) return body as T\n const detail = body && typeof body === 'object' && 'error' in body && typeof body.error === 'string' ? body.error : ''\n if (response.status === 401 || response.status === 403) return failure(detail || 'You do not have access to check sources for this workspace.')\n return failure(detail || `The source check could not complete (HTTP ${response.status}).`)\n } catch (cause) {\n if (init.signal?.aborted) throw cause\n return failure('The source check could not reach the server. Check your connection and try again.')\n }\n }\n\n const github: ProfileEditorGitHubPort = {\n repositories: signal => call(PROFILE_EDITOR_ROUTES.repositories, { signal }, unavailable),\n latest: (repository, signal) => call(PROFILE_EDITOR_ROUTES.latest, { signal, query: { repository } }, unavailable),\n commit: (repository, sha, signal) => call(PROFILE_EDITOR_ROUTES.commit, { signal, query: { repository, sha } }, unavailable),\n files: (repository, commit, signal) => call(PROFILE_EDITOR_ROUTES.files, { signal, query: { repository, commit } }, unavailable),\n check: (request, signal) => call(PROFILE_EDITOR_ROUTES.check, { signal, method: 'POST', body: JSON.stringify(request) }, unavailable),\n }\n const mcp: ProfileEditorMcpPort = {\n check: (server, signal) => call(PROFILE_EDITOR_ROUTES.mcpCheck, { signal, method: 'POST', body: JSON.stringify({ server }) },\n (message): McpHealth => ({ ok: false, problem: 'unavailable', message, checkedAt: new Date().toISOString() })),\n }\n return { github, mcp }\n}\n\nconst REPOSITORY_SEGMENT = /^[A-Za-z0-9_.-]{1,100}$/\n\n/**\n * Normalize what a person types or pastes into `owner/repo`: a bare name pair,\n * a `github.com` URL (including `/tree/` and `/blob/` links), or an SSH remote.\n * Returns the path and commit-ish a link carries too, so pasting a file link\n * fills every field. Null when the text names no repository.\n */\nexport function parseGitHubLocation(input: string): { repository: string; ref?: string; path?: string } | null {\n let text = input.trim()\n if (!text) return null\n const ssh = /^git@github\\.com:(.+?)(?:\\.git)?$/i.exec(text)\n if (ssh) text = ssh[1]!\n else if (/^(https?:\\/\\/)?(www\\.)?github\\.com\\//i.test(text)) {\n try {\n const url = new URL(/^https?:/i.test(text) ? text : 'https://' + text)\n text = url.pathname.replace(/^\\/+/, '').replace(/\\.git$/, '')\n } catch { return null }\n }\n const [owner, repo, kind, ref, ...rest] = text.split('/').filter(Boolean)\n if (!owner || !repo || !REPOSITORY_SEGMENT.test(owner) || !REPOSITORY_SEGMENT.test(repo) || owner === '.' || owner === '..' || repo === '.' || repo === '..') return null\n const repository = `${owner}/${repo.replace(/\\.git$/, '')}`\n if ((kind === 'tree' || kind === 'blob') && ref) return { repository, ref, ...(rest.length ? { path: rest.join('/') } : {}) }\n return kind ? null : { repository }\n}\n\nexport function isCommitSha(value: string): boolean {\n return /^[0-9a-f]{40}$/i.test(value)\n}\n\n/**\n * The address policy for products that connect only to public HTTPS servers:\n * no credentials in the URL, no IP literals, and no single-label, `.local` or\n * `.internal` hosts. Returns the reason an address is refused, or null.\n */\nexport function publicHttpsUrlProblem(value: string): string | null {\n let url: URL\n try { url = new URL(value) } catch { return 'Enter a full URL, such as https://example.com/mcp.' }\n if (url.protocol !== 'https:') return 'Use a public HTTPS address that starts with https://.'\n if (url.username || url.password) return 'Remove the credentials from the URL. Use a secret reference in a header instead.'\n if (url.search || url.hash) return 'Remove the query and fragment from the URL. Send credentials as a secret reference in a header.'\n const host = url.hostname.toLowerCase()\n if (!host.includes('.') || /^\\d+\\.\\d+\\.\\d+\\.\\d+$/.test(host) || host.startsWith('[') || host.endsWith('.local') ||\n host.endsWith('.internal') || host.endsWith('.localhost') || host === 'localhost') {\n return 'Use a public address. Private, local, and IP addresses are not reachable from here.'\n }\n return null\n}\n\n/** Frontmatter `name` and `description` of an Agent Skill, or the reason the text is not one. */\nexport function readSkillFrontmatter(content: string): { ok: true; name: string; description: string } | { ok: false; message: string } {\n let parsed: ReturnType<typeof parseSkillFrontmatter>\n try { parsed = parseSkillFrontmatter(content.replace(/\\r\\n/g, '\\n')) } catch {\n return { ok: false, message: 'The file has malformed frontmatter. A skill starts with a --- block that sets name and description.' }\n }\n const name = parsed.frontmatter.name?.trim()\n const description = parsed.frontmatter.description?.trim()\n if (!name || !description) {\n return { ok: false, message: 'This file is not a skill. A skill file starts with frontmatter that sets name and description.' }\n }\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AACJ,MAAI;AAAE,aAAS,sBAAsB,QAAQ,QAAQ,SAAS,IAAI,CAAC;AAAA,EAAE,QAAQ;AAC3E,WAAO,EAAE,IAAI,OAAO,SAAS,sGAAsG;AAAA,EACrI;AACA,QAAM,OAAO,OAAO,YAAY,MAAM,KAAK;AAC3C,QAAM,cAAc,OAAO,YAAY,aAAa,KAAK;AACzD,MAAI,CAAC,QAAQ,CAAC,aAAa;AACzB,WAAO,EAAE,IAAI,OAAO,SAAS,iGAAiG;AAAA,EAChI;AACA,SAAO,EAAE,IAAI,MAAM,MAAM,YAAY;AACvC;","names":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActionDialog,
|
|
3
3
|
ActionDialogButton
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Q3BLSWYP.js";
|
|
5
5
|
import {
|
|
6
6
|
OVERLAY_SHADOW,
|
|
7
7
|
PopoverSurface,
|
|
8
8
|
usePopover
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OFQUM5FP.js";
|
|
10
10
|
import {
|
|
11
11
|
UNTITLED_SESSION_LABEL,
|
|
12
12
|
mergeSessionPages,
|
|
@@ -751,4 +751,4 @@ export {
|
|
|
751
751
|
formatSessionTimestamp,
|
|
752
752
|
SessionHistoryPanel
|
|
753
753
|
};
|
|
754
|
-
//# sourceMappingURL=chunk-
|
|
754
|
+
//# sourceMappingURL=chunk-BDCATWBV.js.map
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
mentionInputToPart,
|
|
19
19
|
toChatMessageParts
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-HTAFI247.js";
|
|
21
21
|
import {
|
|
22
22
|
ChatTurnInputError,
|
|
23
23
|
assertPromptPartsWithinCap,
|
|
@@ -1082,4 +1082,4 @@ export {
|
|
|
1082
1082
|
createChatTurnRoutes,
|
|
1083
1083
|
streamChatRouteAsSandboxEvents
|
|
1084
1084
|
};
|
|
1085
|
-
//# sourceMappingURL=chunk-
|
|
1085
|
+
//# sourceMappingURL=chunk-FNRUXPXE.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
usePopover
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OFQUM5FP.js";
|
|
4
4
|
|
|
5
5
|
// src/web-react/popover-dialog.ts
|
|
6
6
|
import { useEffect, useId } from "react";
|
|
@@ -45,4 +45,4 @@ function usePopoverDialog(open, onOpenChange) {
|
|
|
45
45
|
export {
|
|
46
46
|
usePopoverDialog
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
48
|
+
//# sourceMappingURL=chunk-GEGCSRYQ.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
mentionKindForPath
|
|
3
|
-
} from "./chunk-GYDFGEJ2.js";
|
|
4
1
|
import {
|
|
5
2
|
persistedPartToWorkProduct
|
|
6
3
|
} from "./chunk-ZVEEWGDK.js";
|
|
4
|
+
import {
|
|
5
|
+
mentionKindForPath
|
|
6
|
+
} from "./chunk-GYDFGEJ2.js";
|
|
7
7
|
import {
|
|
8
8
|
persistedPartToInteraction
|
|
9
9
|
} from "./chunk-FCON65I2.js";
|
|
@@ -135,4 +135,4 @@ export {
|
|
|
135
135
|
buildAttachmentPromptBlock,
|
|
136
136
|
historyContentWithAttachments
|
|
137
137
|
};
|
|
138
|
-
//# sourceMappingURL=chunk-
|
|
138
|
+
//# sourceMappingURL=chunk-HTAFI247.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
usePopoverDialog
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GEGCSRYQ.js";
|
|
4
4
|
import {
|
|
5
5
|
CheckGlyph,
|
|
6
6
|
OVERLAY_SHADOW,
|
|
7
7
|
PopoverSurface
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OFQUM5FP.js";
|
|
9
9
|
|
|
10
10
|
// src/web-react/workspace-switcher.tsx
|
|
11
11
|
import { useCallback, useState } from "react";
|
|
@@ -116,4 +116,4 @@ export {
|
|
|
116
116
|
WorkspaceSwitcher,
|
|
117
117
|
WorkspaceInitial
|
|
118
118
|
};
|
|
119
|
-
//# sourceMappingURL=chunk-
|
|
119
|
+
//# sourceMappingURL=chunk-KSLVMA2D.js.map
|
|
@@ -185,6 +185,9 @@ var OVERLAY_SHADOW = "shadow-[var(--shadow-overlay)]";
|
|
|
185
185
|
function pickerRootClass(fullWidth) {
|
|
186
186
|
return `relative ${fullWidth ? "flex w-full" : "inline-flex"}`;
|
|
187
187
|
}
|
|
188
|
+
function fieldPickerTriggerClass({ interactive = true } = {}) {
|
|
189
|
+
return `inline-flex h-[var(--control-height)] w-full min-w-0 items-center justify-between gap-2 whitespace-nowrap rounded-lg border border-border bg-[var(--bg-input)] px-3 text-left text-sm font-normal text-foreground transition-[border-color,box-shadow] duration-150 ease-out focus:outline-hidden focus:border-[var(--focus-border)] focus:ring-3 focus:ring-[var(--focus-halo)] disabled:cursor-not-allowed disabled:opacity-50 ${interactive ? "hover:border-[var(--border-strong)] data-[state=open]:border-[var(--focus-border)]" : "cursor-default"}`;
|
|
190
|
+
}
|
|
188
191
|
var QUIET_PICKER_TRIGGER_BASE = "inline-flex h-[var(--control-height-sm,2rem)] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md bg-transparent px-2 text-sm font-normal text-muted-foreground transition focus:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
189
192
|
var QUIET_PICKER_TRIGGER_INTERACTIVE = "hover:bg-accent hover:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground";
|
|
190
193
|
function quietPickerTriggerClass({ interactive = true } = {}) {
|
|
@@ -282,7 +285,8 @@ function ModelPicker({
|
|
|
282
285
|
recommendedLabel = "Recommended",
|
|
283
286
|
priorityGroup,
|
|
284
287
|
variant = "chip",
|
|
285
|
-
triggerContent
|
|
288
|
+
triggerContent,
|
|
289
|
+
defaultOption
|
|
286
290
|
}) {
|
|
287
291
|
const [open, setOpen] = useState(false);
|
|
288
292
|
const [query, setQuery] = useState("");
|
|
@@ -373,13 +377,13 @@ function ModelPicker({
|
|
|
373
377
|
return { priority, recommended, currentSelection, byProvider };
|
|
374
378
|
}, [sortedModels, priorityGroup, value]);
|
|
375
379
|
const select = (modelId) => {
|
|
376
|
-
if (disabled || loading || unavailable) return;
|
|
380
|
+
if (disabled || modelId && (loading || unavailable)) return;
|
|
377
381
|
changeOpen(false);
|
|
378
382
|
triggerRef.current?.focus();
|
|
379
383
|
onChange(modelId);
|
|
380
384
|
};
|
|
381
385
|
const row = (model) => /* @__PURE__ */ jsx(ModelRow, { model, selected: model.id === value, onSelect: () => select(model.id), renderProviderBadge }, model.id);
|
|
382
|
-
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "relative inline-flex min-w-0 max-w-full", children: [
|
|
386
|
+
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: variant === "field" ? "relative flex w-full min-w-0" : "relative inline-flex min-w-0 max-w-full", children: [
|
|
383
387
|
/* @__PURE__ */ jsxs(
|
|
384
388
|
"button",
|
|
385
389
|
{
|
|
@@ -399,13 +403,13 @@ function ModelPicker({
|
|
|
399
403
|
changeOpen(true);
|
|
400
404
|
}
|
|
401
405
|
},
|
|
402
|
-
title: selectedLabel || "Select model",
|
|
406
|
+
title: selectedLabel || defaultOption?.label || "Select model",
|
|
403
407
|
"data-state": expanded ? "open" : "closed",
|
|
404
|
-
className: `${variant === "quiet" ? quietPickerTriggerClass({ interactive: !disabled }) : `inline-flex min-h-[var(--control-height-sm,2rem)] items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition ${disabled ? "" : "hover:bg-accent"}`} max-w-full disabled:cursor-not-allowed disabled:opacity-50`,
|
|
408
|
+
className: `${variant === "field" ? fieldPickerTriggerClass({ interactive: !disabled }) : variant === "quiet" ? quietPickerTriggerClass({ interactive: !disabled }) : `inline-flex min-h-[var(--control-height-sm,2rem)] items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition ${disabled ? "" : "hover:bg-accent"}`} max-w-full disabled:cursor-not-allowed disabled:opacity-50`,
|
|
405
409
|
children: [
|
|
406
|
-
triggerContent ?? /* @__PURE__ */ jsxs(
|
|
410
|
+
triggerContent ?? /* @__PURE__ */ jsxs("span", { className: variant === "field" ? "flex min-w-0 flex-1 items-center gap-2" : "contents", children: [
|
|
407
411
|
/* @__PURE__ */ jsx("span", { className: "shrink-0", "aria-hidden": true, children: selected ? renderProviderBadge ? renderProviderBadge(selected.provider) : /* @__PURE__ */ jsx(ProviderLogo, { provider: selected.provider, size: 16 }) : /* @__PURE__ */ jsx(SparkleGlyph, { className: "h-3.5 w-3.5 text-muted-foreground" }) }),
|
|
408
|
-
/* @__PURE__ */ jsx("span", { className: "max-w-[160px] truncate", children: selectedLabel || "Select model" })
|
|
412
|
+
/* @__PURE__ */ jsx("span", { className: variant === "field" ? `min-w-0 flex-1 truncate ${value ? "" : "text-muted-foreground"}` : "max-w-[160px] truncate", children: selectedLabel || defaultOption?.label || "Select model" })
|
|
409
413
|
] }),
|
|
410
414
|
/* @__PURE__ */ jsx(ChevronDown, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })
|
|
411
415
|
]
|
|
@@ -425,6 +429,8 @@ function ModelPicker({
|
|
|
425
429
|
contentKey,
|
|
426
430
|
triggerRef,
|
|
427
431
|
panelRef,
|
|
432
|
+
matchTriggerWidth: variant === "field",
|
|
433
|
+
side: variant === "field" ? "below" : void 0,
|
|
428
434
|
className: `flex w-[420px] max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-xl border border-card-edge bg-popover text-foreground ${OVERLAY_SHADOW}`,
|
|
429
435
|
children: [
|
|
430
436
|
/* @__PURE__ */ jsx("div", { className: "shrink-0 border-b border-border px-3 py-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-lg border border-strong bg-background px-3 py-2 focus-within:ring-2 focus-within:ring-ring", children: [
|
|
@@ -443,6 +449,20 @@ function ModelPicker({
|
|
|
443
449
|
)
|
|
444
450
|
] }) }),
|
|
445
451
|
/* @__PURE__ */ jsxs("div", { className: "max-h-[520px] min-h-0 overflow-y-auto p-1 pb-2", children: [
|
|
452
|
+
defaultOption && !query.trim() && /* @__PURE__ */ jsxs(
|
|
453
|
+
"button",
|
|
454
|
+
{
|
|
455
|
+
type: "button",
|
|
456
|
+
onClick: () => select(""),
|
|
457
|
+
"aria-pressed": !value,
|
|
458
|
+
className: `flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm transition ${POPOVER_OPTION_FOCUS} ${value ? "hover:bg-accent" : "bg-primary/10 font-medium"}`,
|
|
459
|
+
children: [
|
|
460
|
+
/* @__PURE__ */ jsx(SparkleGlyph, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
461
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1", children: defaultOption.label }),
|
|
462
|
+
!value && /* @__PURE__ */ jsx(CheckGlyph, { className: "h-3.5 w-3.5 shrink-0 text-primary" })
|
|
463
|
+
]
|
|
464
|
+
}
|
|
465
|
+
),
|
|
446
466
|
value && !selected && /* @__PURE__ */ jsxs("div", { className: "mx-2 mb-1 mt-2 rounded-lg bg-secondary px-3 py-2 text-sm", children: [
|
|
447
467
|
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground", children: "Saved model" }),
|
|
448
468
|
/* @__PURE__ */ jsx("p", { className: "break-words [overflow-wrap:anywhere]", children: value }),
|
|
@@ -552,27 +572,42 @@ function EffortMeter({ fill, className }) {
|
|
|
552
572
|
i
|
|
553
573
|
)) });
|
|
554
574
|
}
|
|
555
|
-
function EffortPicker({
|
|
556
|
-
|
|
575
|
+
function EffortPicker({
|
|
576
|
+
value,
|
|
577
|
+
onChange,
|
|
578
|
+
levels = DEFAULT_EFFORT_LEVELS,
|
|
579
|
+
label = "Thinking",
|
|
580
|
+
fullWidth = false,
|
|
581
|
+
variant = "chip",
|
|
582
|
+
disabled = false,
|
|
583
|
+
id,
|
|
584
|
+
"aria-describedby": ariaDescribedBy
|
|
585
|
+
}) {
|
|
586
|
+
const [requestedOpen, setOpen] = useState(false);
|
|
587
|
+
const open = requestedOpen && !disabled;
|
|
557
588
|
const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(open, setOpen);
|
|
589
|
+
const field = variant === "field";
|
|
558
590
|
const panelId = useId();
|
|
559
591
|
const rendered = reconcileEffortLevels(value, levels);
|
|
560
|
-
const isDeclared = (
|
|
592
|
+
const isDeclared = (id2) => levels.some((l) => l.id === id2) && !UNPLACEABLE_LEVEL_IDS.has(id2);
|
|
561
593
|
const selected = rendered.find((l) => l.id === value);
|
|
562
|
-
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: pickerRootClass(fullWidth), children: [
|
|
594
|
+
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: pickerRootClass(fullWidth || field), children: [
|
|
563
595
|
/* @__PURE__ */ jsxs(
|
|
564
596
|
"button",
|
|
565
597
|
{
|
|
566
598
|
type: "button",
|
|
567
599
|
...triggerProps,
|
|
600
|
+
id,
|
|
601
|
+
disabled,
|
|
602
|
+
"aria-describedby": ariaDescribedBy,
|
|
568
603
|
"aria-controls": open ? panelId : void 0,
|
|
569
604
|
onClick: () => setOpen(!open),
|
|
570
605
|
title: label ? `${label} \u2014 how hard the agent reasons before answering` : "Reasoning effort",
|
|
571
606
|
"data-state": open ? "open" : "closed",
|
|
572
|
-
className: `${variant === "quiet" ? quietPickerTriggerClass() : "inline-flex min-h-[var(--control-height-sm,2rem)] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent"} ${fullWidth ? "w-full" : ""}`,
|
|
607
|
+
className: `${field ? fieldPickerTriggerClass({ interactive: !disabled }) : variant === "quiet" ? quietPickerTriggerClass() : "inline-flex min-h-[var(--control-height-sm,2rem)] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent"} ${fullWidth ? "w-full" : ""}`,
|
|
573
608
|
children: [
|
|
574
609
|
/* @__PURE__ */ jsx(BrainGlyph, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
575
|
-
/* @__PURE__ */ jsxs("span", { className: fullWidth ? "flex-1 truncate text-left" : void 0, children: [
|
|
610
|
+
/* @__PURE__ */ jsxs("span", { className: fullWidth || field ? "flex-1 truncate text-left" : void 0, children: [
|
|
576
611
|
label ? /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
577
612
|
label,
|
|
578
613
|
": "
|
|
@@ -598,7 +633,8 @@ function EffortPicker({ value, onChange, levels = DEFAULT_EFFORT_LEVELS, label =
|
|
|
598
633
|
role: "menu",
|
|
599
634
|
triggerRef,
|
|
600
635
|
panelRef,
|
|
601
|
-
matchTriggerWidth: fullWidth,
|
|
636
|
+
matchTriggerWidth: fullWidth || field,
|
|
637
|
+
side: field ? "below" : void 0,
|
|
602
638
|
className: `w-44 overflow-y-auto rounded-xl border border-card-edge bg-popover p-1 ${OVERLAY_SHADOW}`,
|
|
603
639
|
children: rendered.map((l) => /* @__PURE__ */ jsxs(
|
|
604
640
|
"button",
|
|
@@ -635,6 +671,7 @@ export {
|
|
|
635
671
|
POPOVER_OPTION_FOCUS,
|
|
636
672
|
OVERLAY_SHADOW,
|
|
637
673
|
pickerRootClass,
|
|
674
|
+
fieldPickerTriggerClass,
|
|
638
675
|
quietPickerTriggerClass,
|
|
639
676
|
usePending,
|
|
640
677
|
ModelPicker,
|
|
@@ -647,4 +684,4 @@ export {
|
|
|
647
684
|
EffortMeter,
|
|
648
685
|
EffortPicker
|
|
649
686
|
};
|
|
650
|
-
//# sourceMappingURL=chunk-
|
|
687
|
+
//# sourceMappingURL=chunk-OFQUM5FP.js.map
|