vite-hub 0.3.1 → 0.4.1
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 +34 -36
- package/dist/_internal/runtime/browser-errors.d.ts +1 -1
- package/dist/_internal/runtime/browser-errors.js +1 -1
- package/dist/{access-F0YP5D5E.js → access-BDST818p.js} +6 -6
- package/dist/{access-policy-BsB3QVe5.d.ts → access-policy-CGXhO3Ee.d.ts} +3 -3
- package/dist/{access-policy-B_DCpZUt.js → access-policy-DjBKLo3c.js} +2 -2
- package/dist/{account-Bsu-LBOF.d.ts → account-BnOAU055.d.ts} +1 -1
- package/dist/{agent-invocations.post-DIm8tJV2.js → agent-invocations.post-CcPvfA0n.js} +7 -7
- package/dist/{agents-DnHexzTJ.js → agents-BDeazoAW.js} +2 -2
- package/dist/{agents-y5hBFHUQ.js → agents-BoWau_ei.js} +1 -1
- package/dist/{auth-BFVHYizM.d.ts → auth-BZOy7obk.d.ts} +2 -2
- package/dist/{auth-types-DWpTBZvp.d.ts → auth-types-CyqhWvYF.d.ts} +1 -1
- package/dist/bin.js +15 -7
- package/dist/{blob-CiUmptIp.d.ts → blob-CFLwMsjH.d.ts} +1 -1
- package/dist/{blob-BRV6_wZa.js → blob-CpvlM8jp.js} +3 -3
- package/dist/cache/operations.d.ts +1 -1
- package/dist/cache/operations.js +2 -2
- package/dist/cache.js +1 -1
- package/dist/choices/vue.d.ts +1 -0
- package/dist/choices/vue.js +2 -0
- package/dist/choices.d.ts +1 -0
- package/dist/choices.js +2 -0
- package/dist/cli-config-UAGTmuFa.js +2 -0
- package/dist/{cli-config-Bpjjfz5j.js → cli-config-wxKjF2Y0.js} +1 -16
- package/dist/console/auth-types.d.ts +1 -1
- package/dist/console/auth.d.ts +1 -1
- package/dist/console/auth.js +1 -1
- package/dist/console/runtime/client/account.d.ts +1 -1
- package/dist/console/runtime/client/account.js +2 -2
- package/dist/console/runtime/client/blob-media.d.ts +1 -1
- package/dist/console/runtime/client/blob-media.js +3 -3
- package/dist/console/runtime/client/comment-thread.js +1 -1
- package/dist/console/runtime/client/content-heads.d.ts +45 -0
- package/dist/console/runtime/client/content-heads.js +58 -0
- package/dist/console/runtime/client/documents.d.ts +2 -2
- package/dist/console/runtime/client/documents.js +1 -1
- package/dist/console/runtime/client/editor.d.ts +1 -1
- package/dist/console/runtime/client/invocation.js +3 -3
- package/dist/console/runtime/client/live.d.ts +1 -1
- package/dist/console/runtime/client/mcp-client.js +1 -1
- package/dist/console/runtime/client/media-library.d.ts +1 -1
- package/dist/console/runtime/client/media-library.js +1 -1
- package/dist/console/runtime/client/media-uploads.d.ts +1 -1
- package/dist/console/runtime/client/media-uploads.js +1 -1
- package/dist/console/runtime/client/operation-view.d.ts +1 -1
- package/dist/console/runtime/client/operation-view.js +2 -2
- package/dist/console/runtime/client/presence.d.ts +1 -1
- package/dist/console/runtime/client/problem.js +2 -2
- package/dist/console/runtime/client/project-link.d.ts +1 -1
- package/dist/console/runtime/client/project-link.js +1 -1
- package/dist/console/runtime/client/project-session.d.ts +2 -2
- package/dist/console/runtime/client/project-session.js +4 -4
- package/dist/console/runtime/client/project.d.ts +1 -1
- package/dist/console/runtime/client/project.js +1 -1
- package/dist/console/runtime/client/publish.d.ts +1 -1
- package/dist/console/runtime/client/rate-limit.js +2 -2
- package/dist/console/runtime/client/read-only.d.ts +1 -1
- package/dist/console/runtime/client/read-only.js +1 -1
- package/dist/console/runtime/client/request.js +1 -1
- package/dist/console/runtime/client/schedule-run.js +2 -2
- package/dist/console/runtime/client/sections.d.ts +1 -1
- package/dist/console/runtime/client/sections.js +1 -1
- package/dist/console/runtime/client/sidebar.ts +1 -1
- package/dist/console/runtime/client/site-access.js +2 -2
- package/dist/console/runtime/client/ticket.js +1 -1
- package/dist/console/runtime/client/workflow.js +2 -2
- package/dist/console/runtime/components/console-content-heads.vue +72 -0
- package/dist/console/runtime/components/console-document-dashboard.vue +43 -35
- package/dist/console/runtime/components/console-documents.vue +1 -0
- package/dist/console/runtime/components/console-markdown-editor.vue +4 -1
- package/dist/console/runtime/components/invocation/agent-invocation.ts +18 -5
- package/dist/console/runtime/components/invocation/internal/input-attachments.ts +69 -0
- package/dist/console/runtime/components/invocation/internal/invocation-activity.ts +67 -12
- package/dist/console/runtime/components/invocation/internal/invocation-conversation.ts +12 -4
- package/dist/console/runtime/components/invocation/invocation.css +16 -0
- package/dist/console/runtime/console-route.js +1 -1
- package/dist/console/runtime/definitions.d.ts +1 -1
- package/dist/console/runtime/definitions.js +1 -1
- package/dist/console/runtime/diagnostics.ts +30 -30
- package/dist/console/runtime/page-tool/page-tool.js +1 -1
- package/dist/console/runtime/public/skills/vitehub/SKILL.md +3 -3
- package/dist/console/runtime/public/skills/vitehub/references/framework-composition.md +1 -1
- package/dist/console/runtime/public/skills/vitehub/references/preview-contract.md +9 -1
- package/dist/console/runtime/public/skills/vitehub/references/primitives/channels.md +1 -1
- package/dist/console/runtime/public/skills/vitehub/references/primitives/database.md +1 -1
- package/dist/console/runtime/public/skills/vitehub/references/primitives/markdown-template.md +3 -3
- package/dist/console/runtime/public/skills/vitehub/references/project-shapes.md +2 -2
- package/dist/console/runtime/public/skills/vitehub/references/sandboxes-hosts.md +4 -4
- package/dist/console/runtime/sections.d.ts +1 -1
- package/dist/console/runtime/sections.js +1 -1
- package/dist/console/runtime/server/access-policy.d.ts +1 -1
- package/dist/console/runtime/server/access-policy.js +1 -1
- package/dist/console/runtime/server/agents.get.js +2 -2
- package/dist/console/runtime/server/auth.d.ts +1 -1
- package/dist/console/runtime/server/auth.js +2 -2
- package/dist/console/runtime/server/blob.d.ts +1 -1
- package/dist/console/runtime/server/blob.js +1 -1
- package/dist/console/runtime/server/channel-replay.d.ts +2 -2
- package/dist/console/runtime/server/channel-replay.js +4 -4
- package/dist/console/runtime/server/database.d.ts +1 -1
- package/dist/console/runtime/server/database.get.d.ts +1 -1
- package/dist/console/runtime/server/database.get.js +2 -2
- package/dist/console/runtime/server/database.js +1 -1
- package/dist/console/runtime/server/definitions.d.ts +1 -1
- package/dist/console/runtime/server/definitions.get.d.ts +3 -3
- package/dist/console/runtime/server/definitions.get.js +3 -3
- package/dist/console/runtime/server/definitions.js +1 -1
- package/dist/console/runtime/server/development.d.ts +2 -2
- package/dist/console/runtime/server/development.js +2 -2
- package/dist/console/runtime/server/documents.d.ts +1 -1
- package/dist/console/runtime/server/documents.js +1 -1
- package/dist/console/runtime/server/env.get.d.ts +1 -1
- package/dist/console/runtime/server/env.get.js +3 -3
- package/dist/console/runtime/server/invocation-capabilities.get.js +2 -2
- package/dist/console/runtime/server/invocation-workspace.get.d.ts +1 -1
- package/dist/console/runtime/server/invocation-workspace.get.js +5 -5
- package/dist/console/runtime/server/invocation.get.d.ts +1 -1
- package/dist/console/runtime/server/invocation.get.js +6 -6
- package/dist/console/runtime/server/invocations.get.js +3 -3
- package/dist/console/runtime/server/logs.get.d.ts +2 -2
- package/dist/console/runtime/server/logs.get.js +5 -5
- package/dist/console/runtime/server/mcp-client-operations.d.ts +1 -1
- package/dist/console/runtime/server/mcp-client-operations.js +3 -3
- package/dist/console/runtime/server/operation-contributions.d.ts +1 -1
- package/dist/console/runtime/server/operation-contributions.js +1 -1
- package/dist/console/runtime/server/page-auth.d.ts +1 -1
- package/dist/console/runtime/server/page-tool.d.ts +1 -1
- package/dist/console/runtime/server/page-tool.js +2 -2
- package/dist/console/runtime/server/rpc.d.ts +2 -2
- package/dist/console/runtime/server/rpc.js +7 -7
- package/dist/console/runtime/server/search.get.js +1 -1
- package/dist/console/runtime/server/sections.d.ts +4 -4
- package/dist/console/runtime/server/sections.get.d.ts +1 -1
- package/dist/console/runtime/server/sections.get.js +5 -5
- package/dist/console/runtime/server/sections.js +3 -3
- package/dist/console/runtime/server/setup.d.ts +3 -3
- package/dist/console/runtime/server/setup.js +2 -2
- package/dist/console/runtime/server/site-entry.d.ts +1 -1
- package/dist/console/runtime/server/site-entry.js +9 -6
- package/dist/console/runtime/server/site-session.d.ts +5 -1
- package/dist/console/runtime/server/site-session.js +1 -1
- package/dist/console/runtime/server/status.get.d.ts +2 -2
- package/dist/console/runtime/server/status.get.js +5 -5
- package/dist/console/runtime/server/tickets.d.ts +1 -1
- package/dist/console/runtime/server/tickets.js +1 -1
- package/dist/console/runtime/server/usage.get.d.ts +2 -2
- package/dist/console/runtime/server/usage.get.js +7 -7
- package/dist/console/runtime/server/workspace-files.get.d.ts +1 -1
- package/dist/console/runtime/server/workspace-files.get.js +3 -3
- package/dist/console/server.d.ts +5 -5
- package/dist/console/server.js +6 -6
- package/dist/console/ui.js +121 -20
- package/dist/{console-route-COvNB_Xj.js → console-route-CBuqZ4wO.js} +1 -1
- package/dist/{database-J7M0B3ED.js → database-BdOBjPkS.js} +1 -1
- package/dist/{database-BVyhAxq-.d.ts → database-DyPVMjp_.d.ts} +1 -1
- package/dist/{definitions-BDRkT5-f.js → definitions-BW6SvmMM.js} +1 -0
- package/dist/{definitions-bepsXY5G.js → definitions-CNq_Shkh.js} +3 -3
- package/dist/{definitions-CxDT8D8Y.d.ts → definitions-DB4LbZ7T.d.ts} +2 -0
- package/dist/{definitions-CGTWTj67.d.ts → definitions-Dbgxfz3I.d.ts} +1 -1
- package/dist/development-W5EwONyL.d.ts +12 -0
- package/dist/{development-BzeSHZGH.js → development-zLxOp-AO.js} +12 -2
- package/dist/{diagnostics-D0DefmQj.js → diagnostics-9U_fYxMy.js} +30 -30
- package/dist/doctor.js +88 -107
- package/dist/{documents-C97WMaJZ.d.ts → documents-BASIRZ91.d.ts} +1 -1
- package/dist/{documents-RVHsQKFw.d.ts → documents-CboVhYFz.d.ts} +3 -3
- package/dist/{documents-DwPfR-fz.js → documents-CjJTCrY8.js} +3 -3
- package/dist/{documents-8US1nUgK.js → documents-qrHHqlNU.js} +1 -1
- package/dist/durability/operations.d.ts +1 -1
- package/dist/durability/operations.js +2 -2
- package/dist/{entries-D48wVEaS.js → entries-Bj-jPs_J.js} +1 -1
- package/dist/{error-diagnostics-C2rjmOlX.js → error-diagnostics-Bm3JKYjz.js} +19 -11
- package/dist/error-diagnostics.ts +19 -11
- package/dist/index.d.ts +15 -2
- package/dist/index.js +8 -4
- package/dist/internal/disabled-redis-driver.js +1 -1
- package/dist/internal/disabled-upstash-driver.js +1 -1
- package/dist/internal/test-loader.js +1 -1
- package/dist/internal/test-server.js +1 -1
- package/dist/{internal-BP_O70ic.d.ts → internal-CO4OqqaS.d.ts} +3 -3
- package/dist/{invocation-page-undo-BkUau8X7.js → invocation-page-undo-DIZ-s3xT.js} +2 -2
- package/dist/{invocations-CsucCJuq.js → invocations-CK_-G540.js} +3 -3
- package/dist/logs/memory.js +1 -1
- package/dist/logs/source.js +1 -1
- package/dist/logs.js +2 -2
- package/dist/{mcp-client-D0mUt18v.js → mcp-client-By4zk0vU.js} +6 -6
- package/dist/{media-wZMY6f2M.js → media-BHpQ-4jw.js} +4 -4
- package/dist/{media-library-CEo-Ye2B.d.ts → media-library-D9ThbXqs.d.ts} +1 -1
- package/dist/{media-library-BChf8XOd.js → media-library-NaOMBKWS.js} +2 -2
- package/dist/{memory-DhirB6SA.js → memory-DTmq-Z6x.js} +2 -2
- package/dist/{nuxt-server-imports-Lnaf5Fe-.js → nuxt-server-imports-DH60Z7LA.js} +3 -2
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +94 -67
- package/dist/{operation-contributions-DflAv5AC.js → operation-contributions-BdS0z3tx.js} +2 -2
- package/dist/{operation-contributions-fZyVo662.d.ts → operation-contributions-DpkO_iSU.d.ts} +1 -1
- package/dist/{operation-definition-Bn8V2hab.js → operation-definition-a5keEpCd.js} +6 -1
- package/dist/{operations-DX9EkHwb.d.ts → operations-B0689BG1.d.ts} +5 -0
- package/dist/operations-CAQmIxGK.js +2 -0
- package/dist/{operations-B6N-ja8x.js → operations-CWP9dF3i.js} +11 -11
- package/dist/{operations-Dj_cp-UK.js → operations-EOdyctDc.js} +1 -1
- package/dist/{optional-owners-Crm6kVS5.js → optional-owners-BNA2OX6z.js} +37 -23
- package/dist/{page-tool-BCRyx3pM.d.ts → page-tool-CRCK1RHV.d.ts} +1 -1
- package/dist/{plugins-DQ8pF-38.js → plugins-B-DpgDPB.js} +1459 -714
- package/dist/{plugins-5uDXr9Km.d.ts → plugins-BqAtIEX2.d.ts} +75 -56
- package/dist/{project-C2dnB9Kf.js → project-C4N_Zcjl.js} +3 -3
- package/dist/{project-5EN7JaXI.d.ts → project-CufkVP1u.d.ts} +2 -2
- package/dist/{project-DOeM0zg3.js → project-DlWTGB7h.js} +1 -1
- package/dist/{project-link-D_XQvBOC.d.ts → project-link-BuOzBH9f.d.ts} +1 -1
- package/dist/{project-link-Qi7nltHM.js → project-link-D-6UefhA.js} +2 -2
- package/dist/{request-yCybBeqT.js → request-DE8w_cSM.js} +8 -3
- package/dist/{request-BUYAlAJl.js → request-DbFfYmCu.js} +2 -2
- package/dist/{runtime-DM8Z6KLT.js → runtime-DQuHg7OO.js} +1 -1
- package/dist/{runtime-DG34DLXc.js → runtime-OsEDfbM9.js} +1 -1
- package/dist/runtime-feature-guard-B64MMW9I.js +140 -0
- package/dist/scan-module-D_3X08mj.js +2 -0
- package/dist/scan-module-Df58L_6T.js +311 -0
- package/dist/{secret-AZLhaNyr.js → secret-Dy5uqvq9.js} +1 -1
- package/dist/{sections-BriKrBgN.d.ts → sections-BogiCmtz.d.ts} +2 -2
- package/dist/{sections-ACHVTCWn.d.ts → sections-CyrXbbkG.d.ts} +4 -4
- package/dist/{sections-4xyBoiar.d.ts → sections-Do7X4Nwt.d.ts} +1 -2
- package/dist/{sections-D6AM5Gy5.js → sections-DumoLKQN.js} +2 -3
- package/dist/{sections-CUJyQA9d.js → sections-et20h8w3.js} +3 -3
- package/dist/{sections.get-1lHjyKCI.d.ts → sections.get-COiLcQ0P.d.ts} +2 -2
- package/dist/seo/runtime.js +1 -1
- package/dist/{server-DbjFYSeU.js → server-BRJE4t-W.js} +2 -2
- package/dist/{setup-DLZFzuLv.d.ts → setup-ZbA1by7W.d.ts} +4 -3
- package/dist/{site-access-Bhsty_v4.js → site-access-BbJUe5QI.js} +1 -1
- package/dist/{site-access-CyRtc0gZ.js → site-access-BmE8HGxs.js} +4 -4
- package/dist/{site-session-Jf21TVw8.js → site-session-odJq1dYa.js} +5 -5
- package/dist/skills/operations.d.ts +1 -1
- package/dist/skills/operations.js +2 -2
- package/dist/skills.d.ts +1 -1
- package/dist/{skills.get-CHQMzSD_.js → skills.get-Bl8cBe8u.js} +2 -2
- package/dist/{source-w9BHUwyO.js → source-D4wWtoHh.js} +1 -1
- package/dist/task/operations.d.ts +1 -1
- package/dist/task/operations.js +2 -2
- package/dist/test/register.js +1 -1
- package/dist/{ticket-RKQF6Wy9.js → ticket-Cudn1dq3.js} +1 -1
- package/dist/{tickets-CfJhT7d0.js → tickets-C_0Fhc00.js} +6 -6
- package/dist/{usage-Bc0YY_ka.js → usage-B4taNt4a.js} +1 -1
- package/dist/{usage-index-CMMT4cXQ.js → usage-index-BsGAFzyq.js} +1 -1
- package/dist/{version-DDRL_OYz.js → version-DNmSsk5r.js} +22 -19
- package/dist/{cli-DjoDGgT4.js → vite-stage-mmtwQIMA.js} +32 -2
- package/dist/{workspace-history-l47NPVSy.js → workspace-history-CraoERnc.js} +1 -1
- package/package.json +93 -93
- package/dist/cli-config--rAg6V-a.js +0 -2
- package/dist/decisions/vue.d.ts +0 -1
- package/dist/decisions/vue.js +0 -2
- package/dist/decisions.d.ts +0 -1
- package/dist/decisions.js +0 -2
- package/dist/development-DgaQ05jw.d.ts +0 -9
- package/dist/operations-H9q0QB2C.js +0 -2
- package/dist/runtime-feature-guard-rpZz1eMF.js +0 -55
- package/dist/scan-module-BTeOuZsp.js +0 -2
- package/dist/scan-module-DlHQ8a0X.js +0 -148
package/dist/console/ui.js
CHANGED
|
@@ -1,8 +1,50 @@
|
|
|
1
|
-
import { a as consoleDuration, l as consoleRelativeTime, r as consoleDateTime } from "../format-BOYlanIZ.js";
|
|
1
|
+
import { a as consoleDuration, l as consoleRelativeTime, r as consoleDateTime, t as consoleBytes } from "../format-BOYlanIZ.js";
|
|
2
2
|
import { JSONUIProvider, Renderer } from "@json-render/vue";
|
|
3
3
|
import { Suspense, computed, defineAsyncComponent, defineComponent, getCurrentInstance, h, nextTick, onBeforeUnmount, onMounted, ref, useId, watch } from "vue";
|
|
4
4
|
import { Markdown, ToolList, useCopy } from "@vite-hub/ui";
|
|
5
5
|
import { useIntervalFn, useMounted, useNow } from "@vueuse/core";
|
|
6
|
+
function rows(value) {
|
|
7
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "object" && item !== null) : [];
|
|
8
|
+
}
|
|
9
|
+
function count(attributes, key, fallback) {
|
|
10
|
+
const value = attributes[key];
|
|
11
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
12
|
+
}
|
|
13
|
+
function noun(items, total) {
|
|
14
|
+
return `${items.every((item) => typeof item.mediaType === "string" && item.mediaType.startsWith("image/")) ? "image" : "attachment"}${total === 1 ? "" : "s"}`;
|
|
15
|
+
}
|
|
16
|
+
/** `Sent 3 images (2.1 MB), skipped 1: byte-budget` */
|
|
17
|
+
function inputAttachmentsTitle(attributes) {
|
|
18
|
+
const sent = rows(attributes["input.attachments.sent"]);
|
|
19
|
+
const skipped = rows(attributes["input.attachments.skipped"]);
|
|
20
|
+
const sentCount = count(attributes, "input.attachments.sentCount", sent.length);
|
|
21
|
+
const skippedCount = count(attributes, "input.attachments.skippedCount", skipped.length);
|
|
22
|
+
const bytes = count(attributes, "input.attachments.sentBytes", sent.reduce((total, item) => total + (item.bytes ?? 0), 0));
|
|
23
|
+
const title = sentCount ? `Sent ${sentCount} ${noun(sent, sentCount)} (${consoleBytes(bytes)})` : `Sent no ${noun(skipped, 2)}`;
|
|
24
|
+
if (!skippedCount) return title;
|
|
25
|
+
const shortened = attributes["vitehub.observation.truncatedAttributes"];
|
|
26
|
+
const shortenedSkips = attributes["vitehub.observation.truncated"] === true && (!Array.isArray(shortened) || shortened.includes("input.attachments.skipped"));
|
|
27
|
+
if (skipped.length < skippedCount || shortenedSkips) return `${title}, skipped ${skippedCount}`;
|
|
28
|
+
const reasons = /* @__PURE__ */ new Map();
|
|
29
|
+
for (const item of skipped) reasons.set(item.reason ?? "unknown", (reasons.get(item.reason ?? "unknown") ?? 0) + 1);
|
|
30
|
+
const list = [...reasons].map(([reason, total]) => total > 1 ? `${reason} (${total})` : reason).join(", ");
|
|
31
|
+
return `${title}, skipped ${skippedCount}${list ? `: ${list}` : ""}`;
|
|
32
|
+
}
|
|
33
|
+
function line(item, outcome) {
|
|
34
|
+
return `- ${outcome}: ${[
|
|
35
|
+
item.name ? `\`${item.name}\`` : void 0,
|
|
36
|
+
item.mediaType,
|
|
37
|
+
item.bytes === void 0 ? void 0 : consoleBytes(item.bytes),
|
|
38
|
+
item.origin === "history" ? "from history" : item.origin === "current" ? "from current input" : void 0,
|
|
39
|
+
item.messageId ? `message \`${item.messageId}\`` : void 0
|
|
40
|
+
].filter(Boolean).join(" · ")}`;
|
|
41
|
+
}
|
|
42
|
+
/** One line per attachment, sent ones first. */
|
|
43
|
+
function inputAttachmentsBody(attributes) {
|
|
44
|
+
const lines = [...rows(attributes["input.attachments.sent"]).map((item) => line(item, "Sent")), ...rows(attributes["input.attachments.skipped"]).map((item) => line(item, `Skipped (${item.reason ?? "unknown"})`))];
|
|
45
|
+
return lines.length ? lines.join("\n") : void 0;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
6
48
|
//#region src/console/runtime/components/invocation/internal/payload-text.ts
|
|
7
49
|
function payloadText(value) {
|
|
8
50
|
if (typeof value === "string") return value;
|
|
@@ -46,6 +88,8 @@ const truncatedContentLabels = {
|
|
|
46
88
|
content: "Details",
|
|
47
89
|
"error.message": "Error",
|
|
48
90
|
input: "Input",
|
|
91
|
+
"input.attachments.sent": "Sent attachments",
|
|
92
|
+
"input.attachments.skipped": "Skipped attachments",
|
|
49
93
|
"input.messages": "Conversation history",
|
|
50
94
|
"input.prompt": "Conversation history",
|
|
51
95
|
"message.content": "Message",
|
|
@@ -93,6 +137,15 @@ function messageText(value) {
|
|
|
93
137
|
});
|
|
94
138
|
return parts.length ? parts.join("") : void 0;
|
|
95
139
|
}
|
|
140
|
+
/** The header line that ViteHub adds to a chat message for the model, such as its time and author, without brackets. */
|
|
141
|
+
function chatMessageHeader(message) {
|
|
142
|
+
if (!Array.isArray(message?.parts)) return;
|
|
143
|
+
for (const part of message.parts) {
|
|
144
|
+
const item = record$1(part);
|
|
145
|
+
if (item?.type !== "data-chat-message-header") continue;
|
|
146
|
+
return stringAttribute(record$1(item.data) ?? {}, "modelText")?.replace(/^\[(.*)\]$/s, "$1") || void 0;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
96
149
|
function messageRole(value) {
|
|
97
150
|
return value === "assistant" || value === "system" || value === "tool" || value === "user" ? value : void 0;
|
|
98
151
|
}
|
|
@@ -260,6 +313,16 @@ function activityKey(observation, anonymousMessageKey) {
|
|
|
260
313
|
const attributes = observation.attributes ?? {};
|
|
261
314
|
return String(attributes["step.id"] ?? attributes["tool.id"] ?? attributes["approval.id"] ?? attributes["model.call.id"] ?? (attributes["message.id"] ? `${String(attributes["message.id"])}:${String(attributes["message.phase"] ?? "message")}` : void 0) ?? (typeof attributes["message.content"] === "string" ? anonymousMessageKey : void 0) ?? `observation:${observation.sequence}`);
|
|
262
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Provider Drivers record model reasoning with `message.phase: "reasoning"`. Invocations recorded
|
|
318
|
+
* before that phase existed stored it as commentary with a `reasoning_text:` or
|
|
319
|
+
* `reasoning_summary_text:` message id, so those ids still read as reasoning.
|
|
320
|
+
*/
|
|
321
|
+
function isReasoningMessage(attributes) {
|
|
322
|
+
if (attributes["message.phase"] === "reasoning") return true;
|
|
323
|
+
const id = attributes["message.id"];
|
|
324
|
+
return attributes["message.phase"] === "commentary" && typeof id === "string" && /^reasoning(?:_summary)?_text:/.test(id);
|
|
325
|
+
}
|
|
263
326
|
function activityKind(observation, attributes, patches) {
|
|
264
327
|
if (patches.length) return "change";
|
|
265
328
|
if (observation.name === "agent.usage.recorded") return "model";
|
|
@@ -285,9 +348,8 @@ function activityKind(observation, attributes, patches) {
|
|
|
285
348
|
if (attributes["tool.name"] || attributes["tool.id"] || observation.name.includes(".tool.")) return "tool";
|
|
286
349
|
if (attributes["approval.id"] || observation.name.includes(".approval.")) return "approval";
|
|
287
350
|
if (observation.type === "error" || observation.name.endsWith(".error")) return "error";
|
|
351
|
+
if (isReasoningMessage(attributes) || observation.name.includes(".reasoning.")) return "reasoning";
|
|
288
352
|
if (attributes["message.phase"] === "commentary") return "message";
|
|
289
|
-
if (attributes["message.phase"] === "reasoning") return "reasoning";
|
|
290
|
-
if (observation.name.includes(".reasoning.")) return "reasoning";
|
|
291
353
|
if (observation.name.includes(".model.")) return "model";
|
|
292
354
|
if (attributes["message.role"] || attributes["message.content"] || attributes["input.prompt"] || attributes["input.messages"] || attributes["result.text"]) return "message";
|
|
293
355
|
if (observation.name.includes(".invocation.")) return "run";
|
|
@@ -325,27 +387,43 @@ function invocationActivities(invocation) {
|
|
|
325
387
|
if (hasAgentMessages && !resultText && (observation.name === "agent.stream.finish" || observation.name === "agent.invocation.finish")) continue;
|
|
326
388
|
if (delta && (role === void 0 || role === "assistant")) assistantDeltaText += delta;
|
|
327
389
|
const inputMessages = Array.isArray(originalAttributes["input.messages"]) ? originalAttributes["input.messages"] : Array.isArray(originalAttributes["input.prompt"]) ? originalAttributes["input.prompt"] : void 0;
|
|
328
|
-
|
|
390
|
+
const trigger = record$1(originalAttributes["input.trigger.message"]);
|
|
391
|
+
const triggerId = trigger && stringAttribute(trigger, "id");
|
|
392
|
+
const recoveredTrigger = trigger && triggerId && !inputMessages?.some((message) => record$1(message)?.id === triggerId) ? trigger : void 0;
|
|
393
|
+
const inputs = recoveredTrigger ? [recoveredTrigger, ...inputMessages ?? []] : inputMessages;
|
|
394
|
+
if (inputs) {
|
|
329
395
|
let lastInputKey;
|
|
330
|
-
|
|
396
|
+
let firstInputKey;
|
|
397
|
+
inputs.forEach((message, index) => {
|
|
331
398
|
const value = record$1(message);
|
|
332
399
|
const body = messageText(value) ?? (Array.isArray(value?.parts) ? "```json\n" + payloadText(value.parts) + "\n```" : void 0);
|
|
333
400
|
const role = messageRole(value?.role);
|
|
334
401
|
if (!body || !role) return;
|
|
335
402
|
const key = `input-message:${observation.sequence}:${index}`;
|
|
403
|
+
const id = value ? stringAttribute(value, "id") : void 0;
|
|
404
|
+
const header = chatMessageHeader(value);
|
|
405
|
+
firstInputKey ??= key;
|
|
336
406
|
lastInputKey = key;
|
|
337
407
|
groups.set(key, [{
|
|
338
408
|
...observation,
|
|
339
409
|
attributes: {
|
|
340
410
|
"message.content": body,
|
|
411
|
+
...header ? { "message.header": header } : {},
|
|
341
412
|
"message.origin": "invocation-input",
|
|
342
|
-
"message.id":
|
|
343
|
-
"message.role": role
|
|
413
|
+
"message.id": id ?? key,
|
|
414
|
+
"message.role": role,
|
|
415
|
+
...triggerId && id === triggerId ? { "message.trigger": true } : {}
|
|
344
416
|
},
|
|
345
417
|
name: "agent.input.message",
|
|
346
|
-
sequence: observation.sequence - (
|
|
418
|
+
sequence: observation.sequence - (inputs.length - index) / (inputs.length + 1)
|
|
347
419
|
}]);
|
|
348
420
|
});
|
|
421
|
+
const omitted = originalAttributes["input.messages.omitted"];
|
|
422
|
+
const firstInput = firstInputKey === void 0 ? void 0 : groups.get(firstInputKey)?.[0];
|
|
423
|
+
if (firstInput && typeof omitted === "number" && omitted > 0) firstInput.attributes = {
|
|
424
|
+
...firstInput.attributes,
|
|
425
|
+
...recoveredTrigger ? { "input.messages.omittedUnplaced": omitted - 1 } : { "input.messages.omitted": omitted }
|
|
426
|
+
};
|
|
349
427
|
const historyTruncation = truncatedContent(observation) === void 0 ? { "vitehub.observation.truncated": true } : truncatedContent(observation).some((key) => key === "input.messages" || key === "input.prompt") ? {
|
|
350
428
|
"vitehub.observation.truncated": true,
|
|
351
429
|
"vitehub.observation.truncatedAttributes": ["input.messages"]
|
|
@@ -356,8 +434,8 @@ function invocationActivities(invocation) {
|
|
|
356
434
|
...historyTruncation
|
|
357
435
|
};
|
|
358
436
|
}
|
|
359
|
-
const attributes =
|
|
360
|
-
if (
|
|
437
|
+
const attributes = inputs === void 0 ? originalAttributes : Object.fromEntries(Object.entries(originalAttributes).filter(([key]) => key !== "input.messages" && key !== "input.prompt" && key !== "input.messages.omitted"));
|
|
438
|
+
if (inputs !== void 0 && Object.keys(attributes).length === 0) continue;
|
|
361
439
|
const isAnonymousMessage = stringAttribute(attributes, "message.content") !== void 0 && !attributes["message.id"];
|
|
362
440
|
const messagePhase = stringAttribute(attributes, "message.phase") ?? "message";
|
|
363
441
|
if (isAnonymousMessage && (!anonymousMessageKey || anonymousMessagePhase !== messagePhase)) {
|
|
@@ -385,7 +463,7 @@ function invocationActivities(invocation) {
|
|
|
385
463
|
for (const observations of groups.values()) {
|
|
386
464
|
if (Math.max(...observations.map((item) => item.sequence)) !== latestMessageSequence) continue;
|
|
387
465
|
if (observations.some(cutsContent)) continue;
|
|
388
|
-
if (!observations.every((item) => item.name.startsWith("agent.message") && (item.attributes?.["message.role"] === void 0 || item.attributes["message.role"] === "assistant") && item.attributes?.["message.phase"] !== "commentary")) continue;
|
|
466
|
+
if (!observations.every((item) => item.name.startsWith("agent.message") && (item.attributes?.["message.role"] === void 0 || item.attributes["message.role"] === "assistant") && item.attributes?.["message.phase"] !== "commentary" && item.attributes?.["message.phase"] !== "reasoning")) continue;
|
|
389
467
|
const text = observations.map((item) => {
|
|
390
468
|
const content = item.attributes?.["message.content"];
|
|
391
469
|
return typeof content === "string" ? content : "";
|
|
@@ -405,7 +483,7 @@ function invocationActivities(invocation) {
|
|
|
405
483
|
const messageBody = sorted.map((item) => item.attributes?.["message.content"]).filter((value) => typeof value === "string").join("");
|
|
406
484
|
const { patches, paths } = fileChanges(attributes);
|
|
407
485
|
const kind = activityKind(first, attributes, paths.length ? paths : patches);
|
|
408
|
-
const failed = sorted.some((item) => item.type === "error" || /\.(error|failed)$/.test(item.name)) || kind === "delivery" && Boolean(stringAttribute(attributes, "error.message")) || attributes["agent.capability.outcome"] === "error";
|
|
486
|
+
const failed = sorted.some((item) => item.type === "error" || /\.(error|failed)$/.test(item.name)) || kind === "delivery" && Boolean(stringAttribute(attributes, "error.message")) || attributes["agent.capability.outcome"] === "error" || attributes["input.steer.outcome"] === "failed";
|
|
409
487
|
const approvalDenied = attributes["approval.approved"] === false;
|
|
410
488
|
const completed = sorted.some((item) => /\.(abort|cancelled|completed|decision|error|failed|finish|recorded)$/.test(item.name));
|
|
411
489
|
const role = messageRole(attributes["message.role"]) ?? (attributes["result.text"] ? "assistant" : kind === "message" ? "user" : void 0);
|
|
@@ -426,7 +504,7 @@ function invocationActivities(invocation) {
|
|
|
426
504
|
};
|
|
427
505
|
const draft = {
|
|
428
506
|
attributes,
|
|
429
|
-
body: patches.join("") || messageBody || activityBody(attributes),
|
|
507
|
+
body: patches.join("") || messageBody || (first.name === "agent.input.attachments" ? inputAttachmentsBody(attributes) : activityBody(attributes)),
|
|
430
508
|
command,
|
|
431
509
|
...durationMs !== void 0 ? { durationMs } : {},
|
|
432
510
|
...endedAt ? { endedAt } : {},
|
|
@@ -498,7 +576,9 @@ function invocationActivityTitle(activity) {
|
|
|
498
576
|
const explicit = activity.attributes["vitehub.activity.title"];
|
|
499
577
|
if (typeof explicit === "string" && explicit.trim()) return explicit.trim();
|
|
500
578
|
if (activity.name === "vitehub.observation.truncated") return "Trace content was truncated";
|
|
579
|
+
if (activity.name === "agent.input.steer") return steerTitle(activity);
|
|
501
580
|
if (activity.name === "vitehub.agent.configured") return agentConfigurationTitle(activity);
|
|
581
|
+
if (activity.name === "agent.input.attachments") return inputAttachmentsTitle(activity.attributes);
|
|
502
582
|
if (activity.skill) return `Read ${activity.skill.name} skill`;
|
|
503
583
|
if (activity.kind === "preparation") return "Prepared session";
|
|
504
584
|
if (activity.kind === "system") return "System configuration";
|
|
@@ -523,6 +603,12 @@ function invocationActivityTitle(activity) {
|
|
|
523
603
|
if (activity.kind === "error" && activity.name.startsWith("agent.invocation.")) return "Session failed";
|
|
524
604
|
return normalizedTitle(activity.name.replace(/\.(start|finish|error|decision|recorded)$/, "").replaceAll(".", " "));
|
|
525
605
|
}
|
|
606
|
+
/** A follow-up chat message that tried to reach this run: `Steer deferred: unsupported`. */
|
|
607
|
+
function steerTitle(activity) {
|
|
608
|
+
const outcome = stringAttribute(activity.attributes, "input.steer.outcome") ?? "attempted";
|
|
609
|
+
const reason = stringAttribute(activity.attributes, "input.steer.reason");
|
|
610
|
+
return `Steer ${outcome}${reason ? `: ${reason}` : ""}`;
|
|
611
|
+
}
|
|
526
612
|
function agentConfigurationTitle(activity) {
|
|
527
613
|
const configuration = record$1(activity.attributes["vitehub.agent.configuration"]);
|
|
528
614
|
if (!configuration) return "Agent configured";
|
|
@@ -1250,13 +1336,18 @@ function buildInvocationConversation(activities) {
|
|
|
1250
1336
|
const promptId = inputActivities[promptActivityIndex(inputActivities)]?.id;
|
|
1251
1337
|
const orderedActivities = inputActivities.filter((activity) => activity.kind !== "message" || isVisibleMessage(activity));
|
|
1252
1338
|
const firstUser = promptActivityIndex(orderedActivities);
|
|
1339
|
+
const prompt = orderedActivities[firstUser];
|
|
1253
1340
|
const lastUser = orderedActivities.findLastIndex((activity) => activity.kind === "message" && activity.role === "user");
|
|
1254
|
-
const lastAssistant = orderedActivities.findLastIndex((activity, index) => index > lastUser && activity.kind === "message" && activity.role === "assistant" && activity.attributes["message.phase"] !== "commentary");
|
|
1341
|
+
const lastAssistant = orderedActivities.findLastIndex((activity, index) => index > lastUser && activity.kind === "message" && activity.role === "assistant" && activity.attributes["message.phase"] !== "commentary" && (prompt?.attributes["message.trigger"] !== true || activity.attributes["message.origin"] !== "invocation-input"));
|
|
1255
1342
|
const tail = orderedActivities.slice(firstUser + 1);
|
|
1256
1343
|
const finalBody = lastAssistant >= 0 ? orderedActivities[lastAssistant].body?.trim() : void 0;
|
|
1257
1344
|
const answers = new Set(uniqueDeliveredAnswers(tail, new Set(finalBody ? [finalBody] : [])));
|
|
1345
|
+
const omittedHistory = Math.max(0, ...activities.map((activity) => Number(activity.attributes["input.messages.omitted"]) || 0));
|
|
1346
|
+
const omittedUnplacedHistory = Math.max(0, ...activities.map((activity) => Number(activity.attributes["input.messages.omittedUnplaced"]) || 0));
|
|
1258
1347
|
const metadata = {
|
|
1259
1348
|
deliveredAnswerCount: answers.size,
|
|
1349
|
+
omittedHistory,
|
|
1350
|
+
...omittedUnplacedHistory ? { omittedUnplacedHistory } : {},
|
|
1260
1351
|
promptId
|
|
1261
1352
|
};
|
|
1262
1353
|
if (firstUser < 0 && !orderedActivities.some(isDeliveredAnswer)) return {
|
|
@@ -1266,7 +1357,6 @@ function buildInvocationConversation(activities) {
|
|
|
1266
1357
|
};
|
|
1267
1358
|
const history = orderedActivities.slice(0, Math.max(firstUser, 0)).filter(isVisibleMessage);
|
|
1268
1359
|
const workBeforePrompt = orderedActivities.slice(0, Math.max(firstUser, 0)).filter((activity) => activity.kind !== "message");
|
|
1269
|
-
const prompt = orderedActivities[firstUser];
|
|
1270
1360
|
if (lastAssistant >= 0 && orderedActivities.slice(lastAssistant + 1).some((activity) => activity.kind === "message" && activity.role === "assistant" && activity.attributes["message.phase"] === "commentary")) {
|
|
1271
1361
|
const beforeAnswer = orderedActivities.slice(firstUser + 1, lastAssistant).filter((activity) => !repeatsPrompt(activity, prompt));
|
|
1272
1362
|
const followup = orderedActivities.slice(lastAssistant);
|
|
@@ -1296,7 +1386,7 @@ function buildInvocationConversation(activities) {
|
|
|
1296
1386
|
}
|
|
1297
1387
|
function withoutInitialDriverEcho(activities) {
|
|
1298
1388
|
const lastInput = activities.findLastIndex((activity) => activity.attributes["message.origin"] === "invocation-input");
|
|
1299
|
-
const prompt = activities[lastInput];
|
|
1389
|
+
const prompt = activities.find((activity) => activity.attributes["message.trigger"] === true) ?? activities[lastInput];
|
|
1300
1390
|
if (!prompt || prompt.role !== "user") return activities;
|
|
1301
1391
|
const firstMessage = activities.findIndex((activity, index) => index > lastInput && activity.kind === "message");
|
|
1302
1392
|
const echo = activities[firstMessage];
|
|
@@ -1308,6 +1398,8 @@ function repeatsPrompt(activity, prompt) {
|
|
|
1308
1398
|
return Boolean(promptMessageId) && activity !== prompt && activity.kind === "message" && activity.role === "user" && activity.attributes["input.mode"] !== "steer" && stringAttribute(activity.attributes, "message.id") === promptMessageId && (activity.body?.trim() ?? "") === (prompt.body?.trim() ?? "");
|
|
1309
1399
|
}
|
|
1310
1400
|
function promptActivityIndex(activities) {
|
|
1401
|
+
const triggerPrompt = activities.findIndex((activity) => activity.attributes["message.trigger"] === true);
|
|
1402
|
+
if (triggerPrompt >= 0) return triggerPrompt;
|
|
1311
1403
|
for (let index = 0; index < activities.length; index += 1) {
|
|
1312
1404
|
const activity = activities[index];
|
|
1313
1405
|
if (activity.kind === "message" && activity.role === "user" && activity.name !== "agent.input.message" && activity.attributes["input.mode"] !== "steer") return index;
|
|
@@ -1762,6 +1854,7 @@ function renderMessage(activity, expanded, toggleExpanded, messageRendering, ins
|
|
|
1762
1854
|
}, [
|
|
1763
1855
|
progressNote ? h("span", { "data-slot": "visually-hidden" }, `${roleLabel} message`) : h("span", { class: "vh-invocation-message__role" }, roleLabel),
|
|
1764
1856
|
activity.attributes["input.mode"] === "steer" ? h("small", { class: "vh-invocation-message__method" }, "Steered") : null,
|
|
1857
|
+
typeof activity.attributes["message.header"] === "string" ? h("small", { class: "vh-invocation-message__header" }, activity.attributes["message.header"]) : null,
|
|
1765
1858
|
h("div", {
|
|
1766
1859
|
class: "vh-invocation-message__content",
|
|
1767
1860
|
"data-collapsed": collapsible && !isExpanded ? "true" : void 0
|
|
@@ -2638,12 +2731,16 @@ function renderWorkSummary(activities, invocation, expanded, open, setOpen, togg
|
|
|
2638
2731
|
detailsOpen && steps.length ? h("ol", { class: "vh-invocation-work__activities" }, renderActivitySequence(steps, invocation, expanded, toggleExpanded, inspect, messageRendering, openActivities, setActivityOpen, true)) : null
|
|
2639
2732
|
])]);
|
|
2640
2733
|
}
|
|
2641
|
-
function renderPreviousMessages(messages, invocation, expanded, toggleExpanded, inspect, messageRendering, openActivities, setActivityOpen) {
|
|
2642
|
-
if (!messages.length) return null;
|
|
2734
|
+
function renderPreviousMessages(messages, omitted, invocation, expanded, toggleExpanded, inspect, messageRendering, openActivities, setActivityOpen) {
|
|
2735
|
+
if (!messages.length && !omitted) return null;
|
|
2736
|
+
const total = messages.length + omitted;
|
|
2643
2737
|
return h("li", {
|
|
2644
2738
|
class: "vh-invocation-history",
|
|
2645
2739
|
key: "invocation-history"
|
|
2646
|
-
}, [h("details", { class: "vh-invocation-history__details" }, [h("summary", { class: "vh-invocation-history__summary" }, [h("span", `${
|
|
2740
|
+
}, [h("details", { class: "vh-invocation-history__details" }, [h("summary", { class: "vh-invocation-history__summary" }, [h("span", `${total} previous ${total === 1 ? "message" : "messages"}`), renderDisclosureChevron("vh-invocation-history__disclosure")]), h("ol", { class: "vh-invocation-history__messages" }, [omitted ? h("li", {
|
|
2741
|
+
class: "vh-invocation-history__omitted",
|
|
2742
|
+
key: "omitted"
|
|
2743
|
+
}, `${omitted} earlier ${omitted === 1 ? "message" : "messages"} not recorded`) : null, ...renderActivitySequence(messages, invocation, expanded, toggleExpanded, inspect, messageRendering, openActivities, setActivityOpen)])])]);
|
|
2647
2744
|
}
|
|
2648
2745
|
function invocationPromptMetadata(invocation, promptId) {
|
|
2649
2746
|
if (promptId === void 0) return {};
|
|
@@ -2658,7 +2755,11 @@ function invocationPromptMetadata(invocation, promptId) {
|
|
|
2658
2755
|
function renderInvocationActivities(conversation, invocation, expanded, workOpen, setWorkOpen, toggleExpanded, inspect, messageRendering, openActivities, setActivityOpen) {
|
|
2659
2756
|
if (conversation.kind === "activities") return renderActivitySequence(conversation.activities, invocation, expanded, toggleExpanded, inspect, messageRendering, openActivities, setActivityOpen);
|
|
2660
2757
|
return [
|
|
2661
|
-
renderPreviousMessages(conversation.history, invocation, expanded, toggleExpanded, inspect, messageRendering, openActivities, setActivityOpen),
|
|
2758
|
+
renderPreviousMessages(conversation.history, conversation.omittedHistory, invocation, expanded, toggleExpanded, inspect, messageRendering, openActivities, setActivityOpen),
|
|
2759
|
+
conversation.omittedUnplacedHistory ? h("li", {
|
|
2760
|
+
class: "vh-invocation-history__omitted",
|
|
2761
|
+
key: "omitted-unplaced"
|
|
2762
|
+
}, `${conversation.omittedUnplacedHistory} ${conversation.omittedUnplacedHistory === 1 ? "message" : "messages"} not recorded`) : null,
|
|
2662
2763
|
conversation.prompt ? renderInvocationActivity(conversation.prompt, expanded, toggleExpanded, inspect, messageRendering, openActivities, setActivityOpen) : null,
|
|
2663
2764
|
renderWorkSummary(conversation.work, invocation, expanded, workOpen, setWorkOpen, toggleExpanded, inspect, messageRendering, openActivities, setActivityOpen),
|
|
2664
2765
|
...conversation.answers.map((activity) => renderInvocationActivity(activity, expanded, toggleExpanded, inspect, messageRendering, openActivities, setActivityOpen)),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as viteHubErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as viteHubErrorDiagnostics } from "./error-diagnostics-Bm3JKYjz.js";
|
|
2
2
|
import { decodeRouteSegment, encodeRouteSegment } from "@vite-hub/runtime";
|
|
3
3
|
//#region src/console/runtime/console-route.ts
|
|
4
4
|
const consoleDatabasesSchemaPath = "/databases/:database/schema/diagram";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as viteHubErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as viteHubErrorDiagnostics } from "./error-diagnostics-Bm3JKYjz.js";
|
|
2
2
|
import { n as consoleState } from "./internal-BreyUsQ6.js";
|
|
3
3
|
//#region src/console/runtime/server/database.ts
|
|
4
4
|
function installConsoleDatabase(projectRoot, databases, names) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ConsoleDatabaseEntry, r as ConsoleDatabaseInspection } from "./internal-
|
|
1
|
+
import { n as ConsoleDatabaseEntry, r as ConsoleDatabaseInspection } from "./internal-CO4OqqaS.js";
|
|
2
2
|
//#region src/console/runtime/server/database.d.ts
|
|
3
3
|
declare function installConsoleDatabase(projectRoot: string, databases: Record<string, ConsoleDatabaseEntry>, names: readonly string[]): ConsoleDatabaseInspection;
|
|
4
4
|
declare function getConsoleDatabase(): ConsoleDatabaseInspection;
|
|
@@ -261,6 +261,7 @@ function parseConsoleDocumentHint(value) {
|
|
|
261
261
|
function parseConsoleDocumentSetup(value) {
|
|
262
262
|
const source = record(value);
|
|
263
263
|
const setup = {};
|
|
264
|
+
if (source?.sourceHeadsOnly === true) setup.sourceHeadsOnly = true;
|
|
264
265
|
for (const key of ["access", "schedule"]) {
|
|
265
266
|
const hint = parseConsoleDocumentHint(source?.[key]);
|
|
266
267
|
if (hint) setup[key] = hint;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as viteHubErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import { a as parseConsoleDocumentSetup, o as parseConsoleRecordActivity, s as parseConsoleRecordLink } from "./definitions-
|
|
3
|
-
import { x as isConsoleSectionId } from "./sections-
|
|
1
|
+
import { t as viteHubErrorDiagnostics } from "./error-diagnostics-Bm3JKYjz.js";
|
|
2
|
+
import { a as parseConsoleDocumentSetup, o as parseConsoleRecordActivity, s as parseConsoleRecordLink } from "./definitions-BW6SvmMM.js";
|
|
3
|
+
import { x as isConsoleSectionId } from "./sections-DumoLKQN.js";
|
|
4
4
|
import { n as consoleState, t as consoleSchedulesKey } from "./internal-BreyUsQ6.js";
|
|
5
5
|
//#region src/console/runtime/server/definitions.ts
|
|
6
6
|
function copyFields(fields) {
|
|
@@ -204,6 +204,8 @@ interface ConsoleDocumentHint {
|
|
|
204
204
|
}
|
|
205
205
|
/** What the project lacks for some editor features. It mirrors `ViteHubConsoleDocumentSetup`. */
|
|
206
206
|
interface ConsoleDocumentSetup {
|
|
207
|
+
/** The project has GitHub Sources but no document collections. */
|
|
208
|
+
sourceHeadsOnly?: true;
|
|
207
209
|
/** No user can read anything because the owner has no access policy. */
|
|
208
210
|
access?: ConsoleDocumentHint;
|
|
209
211
|
/** Nothing runs scheduled publishes. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as ConsoleRecord, t as ConsoleContributedSection, v as ConsoleSectionCatalog } from "./definitions-
|
|
1
|
+
import { m as ConsoleRecord, t as ConsoleContributedSection, v as ConsoleSectionCatalog } from "./definitions-DB4LbZ7T.js";
|
|
2
2
|
import { ScheduleDefinitionRegistry } from "@vite-hub/schedule";
|
|
3
3
|
//#region src/console/runtime/server/definitions.d.ts
|
|
4
4
|
/** Copies request-time records so that the reader cannot change the response after it returns. */
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { r as OperationContext } from "./operations-B0689BG1.js";
|
|
2
|
+
//#region src/console/runtime/server/development.d.ts
|
|
3
|
+
/** Development output also records the project root and the Setup endpoint route; production output never has them. */
|
|
4
|
+
declare function installConsoleDevelopment(projectRoot: string, development: boolean, setupRoute?: string): void;
|
|
5
|
+
/** The `development` and `projectRoot` of an operation call. Only a development build names its project root. */
|
|
6
|
+
declare function consoleDevelopmentContext(): Pick<OperationContext, "development" | "projectRoot">;
|
|
7
|
+
/** The route of the dev Setup endpoints. Undefined outside a development server. */
|
|
8
|
+
declare function consoleSetupRoute(): string | undefined;
|
|
9
|
+
/** Unconfigured and production output refuse framing, regardless of runtime NODE_ENV. */
|
|
10
|
+
declare function isConsoleDevelopmentBuild(): boolean;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { isConsoleDevelopmentBuild as i, consoleSetupRoute as n, installConsoleDevelopment as r, consoleDevelopmentContext as t };
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import { n as consoleState } from "./internal-BreyUsQ6.js";
|
|
2
2
|
//#region src/console/runtime/server/development.ts
|
|
3
|
-
/** Development output also records the Setup endpoint route; production output never
|
|
3
|
+
/** Development output also records the project root and the Setup endpoint route; production output never has them. */
|
|
4
4
|
function installConsoleDevelopment(projectRoot, development, setupRoute) {
|
|
5
5
|
const state = consoleState();
|
|
6
6
|
state.development = development;
|
|
7
|
+
state.projectRoot = development ? projectRoot : void 0;
|
|
7
8
|
state.setupRoute = development ? setupRoute : void 0;
|
|
8
9
|
}
|
|
10
|
+
/** The `development` and `projectRoot` of an operation call. Only a development build names its project root. */
|
|
11
|
+
function consoleDevelopmentContext() {
|
|
12
|
+
const development = isConsoleDevelopmentBuild();
|
|
13
|
+
const { projectRoot } = consoleState();
|
|
14
|
+
return development && projectRoot ? {
|
|
15
|
+
development,
|
|
16
|
+
projectRoot
|
|
17
|
+
} : { development };
|
|
18
|
+
}
|
|
9
19
|
/** The route of the dev Setup endpoints. Undefined outside a development server. */
|
|
10
20
|
function consoleSetupRoute() {
|
|
11
21
|
return isConsoleDevelopmentBuild() ? consoleState().setupRoute : void 0;
|
|
@@ -15,4 +25,4 @@ function isConsoleDevelopmentBuild() {
|
|
|
15
25
|
return consoleState().development === true;
|
|
16
26
|
}
|
|
17
27
|
//#endregion
|
|
18
|
-
export {
|
|
28
|
+
export { isConsoleDevelopmentBuild as i, consoleSetupRoute as n, installConsoleDevelopment as r, consoleDevelopmentContext as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
2
|
//#region src/console/runtime/diagnostics.ts
|
|
3
|
-
const consoleGuide = "https://vitehub.dev/docs/
|
|
3
|
+
const consoleGuide = "https://vitehub.dev/docs/console";
|
|
4
4
|
const code = (why, fix, docs, action) => ({
|
|
5
5
|
why: ({ message }) => message?.trim() || why,
|
|
6
6
|
fix,
|
|
@@ -13,35 +13,35 @@ const code = (why, fix, docs, action) => ({
|
|
|
13
13
|
* response has no body, such as a `401` from host middleware.
|
|
14
14
|
*/
|
|
15
15
|
const consoleDiagnostics = /*#__PURE__*/ defineDiagnostics({ codes: {
|
|
16
|
-
CONSOLE_SIGN_IN_REQUIRED: code("You are not signed in, or your session ended.", "Sign in again.", `${consoleGuide}#
|
|
17
|
-
CONSOLE_ACCESS_DENIED: code("The Console access policy rejected this account.", "Sign in with an account that the access policy allows, or ask the Console owner for access.", `${consoleGuide}#
|
|
18
|
-
CONSOLE_DEVELOPMENT_ONLY: code("The Console endpoint without Console options runs only on the development server.", "For production, set console: true, and set the VITEHUB_CONSOLE_KEY_<NAME> line that the ViteHub Console shows when you link the app.", `${consoleGuide}#
|
|
19
|
-
CONSOLE_ACCESS_NOT_CONFIGURED: code("Console access is not configured. The server has no Console access policy.", "Build the app with the ViteHub plugin, so the generated Console output installs its access policy.", `${consoleGuide}#
|
|
20
|
-
CONSOLE_ORIGIN_REJECTED: code("The request did not come from the Console origin.", "Open the Console from its own URL. A proxy must forward the public Host and Origin headers.", `${consoleGuide}#
|
|
21
|
-
CONSOLE_SIGNATURE_MISSING: code("This app takes only signed Console requests, and this request is not signed.", "Open the app from the ViteHub Console, or set `VITEHUB_CONSOLE_PRIVATE_KEY_<NAME>` for the CLI. `vitehub secret console-key` prints a new key pair; set its public key on the app.", `${consoleGuide}
|
|
22
|
-
CONSOLE_SIGNATURE_INVALID: code("The signature does not match the request.", "Use the private key whose public key is in the `VITEHUB_CONSOLE_KEY_<NAME>` that the signature names. If the Console linked the app again, set the new line that its setup page shows.", `${consoleGuide}
|
|
23
|
-
CONSOLE_SIGNATURE_STALE: code("The request was signed more than 5 minutes before or after the app clock.", "Sync the clock of the machine that signs, then send the request again.", `${consoleGuide}
|
|
24
|
-
CONSOLE_SIGNATURE_ORIGIN: code("The request was signed for another origin, or the app has no trusted origin.", "Link the app with the URL that serves it. A Node.js server must set `vitehub({ publicUrl })` to its public URL for signed requests.", `${consoleGuide}
|
|
25
|
-
CONSOLE_SIGNATURE_BODY: code("The request body is not the body that was signed.", "Send the body bytes that the signature covers. A proxy must not change the body of `POST /_vitehub/rpc`.", `${consoleGuide}
|
|
26
|
-
CONSOLE_KEY_UNKNOWN: code("The app has no public key with the name that the signature names.", "Set the `VITEHUB_CONSOLE_KEY_<NAME>` line from the Console setup page, or from `vitehub secret console-key`, on the app. Then restart or deploy the server.", `${consoleGuide}
|
|
27
|
-
CONSOLE_KEY_NOT_CONFIGURED: code("`console: true` needs a `VITEHUB_CONSOLE_KEY_<NAME>` variable in the server environment.", "Link the app in the ViteHub Console and set the line that it shows, or run `vitehub secret console-key` and set its public key line. On Cloudflare, run `wrangler secret put VITEHUB_CONSOLE_KEY_<NAME>`. Then restart or deploy the server.", `${consoleGuide}
|
|
28
|
-
CONSOLE_KEY_MALFORMED: code("A `VITEHUB_CONSOLE_KEY_<NAME>` variable is not an Ed25519 public key.", "Set the value to the 43 base64url characters that the Console setup page or `vitehub secret console-key` prints, with no quotes or spaces. Then restart or deploy the server.", `${consoleGuide}
|
|
29
|
-
CONSOLE_SITE_SECRET_MISSING: code("Site access without Auth seals the browser's cookie with VITEHUB_SECRET, and the app has none.", "Set VITEHUB_SECRET on the server. Generate one with `openssl rand -base64 32`, then restart or deploy.", `${consoleGuide}#
|
|
30
|
-
CONSOLE_TICKET_INVALID: code("This one-time link expired, was used, or was changed.", "Open the page again from the ViteHub Console. Each link works once, within 60 seconds.", `${consoleGuide}#one-time-links`, "docs"),
|
|
31
|
-
CONSOLE_TICKET_MISMATCH: code("This one-time link was made for another person or another app.", "Open the page from the ViteHub Console in the browser where you are signed in to the app with the email of your Console account.", `${consoleGuide}#one-time-links`, "docs"),
|
|
32
|
-
CONSOLE_TICKET_NO_PERSON: code("A one-time link opens the app as the person who asks for it, and this call names no person. A `vitehub` command signs its calls with a key, not as a person.", "Make the link in the ViteHub Console, where you are signed in. On a development server, which the Console cannot reach, invite the browser as a guest: `vitehub site invite <name> --grants <role>`.", `${consoleGuide}#site-access-from-the-terminal`, "docs"),
|
|
33
|
-
CONSOLE_TICKET_STORE_MISSING: code("One-time links need a store that every instance of the app shares, and the app has none.", "Add app Auth with a Database, such as `defineAuth({ database: authDatabase() })`, then run `vitehub database migrate`. Its verification table keeps each link until it is used. Without Auth, use a default KV store on Redis, Upstash, or the `database` driver.", `${consoleGuide}#one-time-links`, "docs"),
|
|
34
|
-
CONSOLE_LOOPBACK_ONLY: code("The development Console without signed calls accepts only requests from this machine.", "Call it from this machine, such as with `vitehub` commands, or remove console.auth so the app takes calls that the ViteHub Console and the CLI sign.", `${consoleGuide}#
|
|
35
|
-
CONSOLE_MCP_UNREACHABLE: code("The MCP server did not answer, or it failed the MCP handshake.", "Check that the server runs and that the URL is its Streamable HTTP endpoint, such as /mcp.", `${consoleGuide}
|
|
36
|
-
CONSOLE_MCP_SIGNED_OUT: code("The MCP server rejects the credentials of this connection.", "Sign in again. For a token, connect again with a new one.", `${consoleGuide}
|
|
37
|
-
CONSOLE_MCP_AUTHORIZATION_FAILED: code("The OAuth sign-in with the MCP server failed.", "Start the sign-in again. The server must publish RFC 9728 metadata that names an authorization server with client registration.", `${consoleGuide}
|
|
38
|
-
CONSOLE_MCP_KEY_INVALID: code("VITEHUB_CONSOLE_MCP_KEY is not 32 random bytes, so the Console cannot seal MCP connections.", "Set VITEHUB_CONSOLE_MCP_KEY to 32 random bytes as base64 or hex, such as the output of openssl rand -base64 32.", `${consoleGuide}#
|
|
39
|
-
CONSOLE_MCP_KV_REQUIRED: code("VITEHUB_CONSOLE_MCP_KEY is set, but the app has no configured default KV store for MCP connections.", "Set kv: true in vitehub(), or configure a default KV store, then rebuild the app.", `${consoleGuide}#
|
|
40
|
-
CONSOLE_REQUEST_INVALID: code("The server cannot read this Console request.", "Reload the Console. If this continues, deploy the Console and the server from the same build.", `${consoleGuide}#fix-common-failures`, "reload"),
|
|
41
|
-
CONSOLE_NOT_FOUND: code("The item does not exist, or the server removed it.", "Reload the Console to see the current data.", `${consoleGuide}#fix-common-failures`, "reload"),
|
|
42
|
-
CONSOLE_CONFLICT: code("The data changed after the Console loaded it.", "Reload the Console, then try again.", `${consoleGuide}#fix-common-failures`, "reload"),
|
|
43
|
-
CONSOLE_UNAVAILABLE: code("The server did not answer. It can be restarting, offline, or rate limited.", "Wait a moment, then try again.", `${consoleGuide}#fix-common-failures`, "retry"),
|
|
44
|
-
CONSOLE_REQUEST_FAILED: code("The server could not complete the request.", "Try again. If this continues, read the server logs for this request.", `${consoleGuide}#fix-common-failures`, "retry")
|
|
16
|
+
CONSOLE_SIGN_IN_REQUIRED: code("You are not signed in, or your session ended.", "Sign in again.", `${consoleGuide}/access#who-can-call-the-endpoint`, "sign-in"),
|
|
17
|
+
CONSOLE_ACCESS_DENIED: code("The Console access policy rejected this account.", "Sign in with an account that the access policy allows, or ask the Console owner for access.", `${consoleGuide}/access#who-can-call-the-endpoint`, "docs"),
|
|
18
|
+
CONSOLE_DEVELOPMENT_ONLY: code("The Console endpoint without Console options runs only on the development server.", "For production, set console: true, and set the VITEHUB_CONSOLE_KEY_<NAME> line that the ViteHub Console shows when you link the app.", `${consoleGuide}/access#who-can-call-the-endpoint`, "docs"),
|
|
19
|
+
CONSOLE_ACCESS_NOT_CONFIGURED: code("Console access is not configured. The server has no Console access policy.", "Build the app with the ViteHub plugin, so the generated Console output installs its access policy.", `${consoleGuide}/access#who-can-call-the-endpoint`, "docs"),
|
|
20
|
+
CONSOLE_ORIGIN_REJECTED: code("The request did not come from the Console origin.", "Open the Console from its own URL. A proxy must forward the public Host and Origin headers.", `${consoleGuide}/access#who-can-call-the-endpoint`, "docs"),
|
|
21
|
+
CONSOLE_SIGNATURE_MISSING: code("This app takes only signed Console requests, and this request is not signed.", "Open the app from the ViteHub Console, or set `VITEHUB_CONSOLE_PRIVATE_KEY_<NAME>` for the CLI. `vitehub secret console-key` prints a new key pair; set its public key on the app.", `${consoleGuide}/signed-requests`, "docs"),
|
|
22
|
+
CONSOLE_SIGNATURE_INVALID: code("The signature does not match the request.", "Use the private key whose public key is in the `VITEHUB_CONSOLE_KEY_<NAME>` that the signature names. If the Console linked the app again, set the new line that its setup page shows.", `${consoleGuide}/signed-requests`, "docs"),
|
|
23
|
+
CONSOLE_SIGNATURE_STALE: code("The request was signed more than 5 minutes before or after the app clock.", "Sync the clock of the machine that signs, then send the request again.", `${consoleGuide}/signed-requests`, "retry"),
|
|
24
|
+
CONSOLE_SIGNATURE_ORIGIN: code("The request was signed for another origin, or the app has no trusted origin.", "Link the app with the URL that serves it. A Node.js server must set `vitehub({ publicUrl })` to its public URL for signed requests.", `${consoleGuide}/signed-requests`, "docs"),
|
|
25
|
+
CONSOLE_SIGNATURE_BODY: code("The request body is not the body that was signed.", "Send the body bytes that the signature covers. A proxy must not change the body of `POST /_vitehub/rpc`.", `${consoleGuide}/signed-requests`, "docs"),
|
|
26
|
+
CONSOLE_KEY_UNKNOWN: code("The app has no public key with the name that the signature names.", "Set the `VITEHUB_CONSOLE_KEY_<NAME>` line from the Console setup page, or from `vitehub secret console-key`, on the app. Then restart or deploy the server.", `${consoleGuide}/signed-requests`, "docs"),
|
|
27
|
+
CONSOLE_KEY_NOT_CONFIGURED: code("`console: true` needs a `VITEHUB_CONSOLE_KEY_<NAME>` variable in the server environment.", "Link the app in the ViteHub Console and set the line that it shows, or run `vitehub secret console-key` and set its public key line. On Cloudflare, run `wrangler secret put VITEHUB_CONSOLE_KEY_<NAME>`. Then restart or deploy the server.", `${consoleGuide}/signed-requests`, "docs"),
|
|
28
|
+
CONSOLE_KEY_MALFORMED: code("A `VITEHUB_CONSOLE_KEY_<NAME>` variable is not an Ed25519 public key.", "Set the value to the 43 base64url characters that the Console setup page or `vitehub secret console-key` prints, with no quotes or spaces. Then restart or deploy the server.", `${consoleGuide}/signed-requests`, "docs"),
|
|
29
|
+
CONSOLE_SITE_SECRET_MISSING: code("Site access without Auth seals the browser's cookie with VITEHUB_SECRET, and the app has none.", "Set VITEHUB_SECRET on the server. Generate one with `openssl rand -base64 32`, then restart or deploy.", `${consoleGuide}/site-access#site-access-without-auth`, "docs"),
|
|
30
|
+
CONSOLE_TICKET_INVALID: code("This one-time link expired, was used, or was changed.", "Open the page again from the ViteHub Console. Each link works once, within 60 seconds.", `${consoleGuide}/site-access#one-time-links`, "docs"),
|
|
31
|
+
CONSOLE_TICKET_MISMATCH: code("This one-time link was made for another person or another app.", "Open the page from the ViteHub Console in the browser where you are signed in to the app with the email of your Console account.", `${consoleGuide}/site-access#one-time-links`, "docs"),
|
|
32
|
+
CONSOLE_TICKET_NO_PERSON: code("A one-time link opens the app as the person who asks for it, and this call names no person. A `vitehub` command signs its calls with a key, not as a person.", "Make the link in the ViteHub Console, where you are signed in. On a development server, which the Console cannot reach, invite the browser as a guest: `vitehub site invite <name> --grants <role>`.", `${consoleGuide}/site-access#site-access-from-the-terminal`, "docs"),
|
|
33
|
+
CONSOLE_TICKET_STORE_MISSING: code("One-time links need a store that every instance of the app shares, and the app has none.", "Add app Auth with a Database, such as `defineAuth({ database: authDatabase() })`, then run `vitehub database migrate`. Its verification table keeps each link until it is used. Without Auth, use a default KV store on Redis, Upstash, or the `database` driver.", `${consoleGuide}/site-access#one-time-links`, "docs"),
|
|
34
|
+
CONSOLE_LOOPBACK_ONLY: code("The development Console without signed calls accepts only requests from this machine.", "Call it from this machine, such as with `vitehub` commands, or remove console.auth so the app takes calls that the ViteHub Console and the CLI sign.", `${consoleGuide}/access#who-can-call-the-endpoint`, "docs"),
|
|
35
|
+
CONSOLE_MCP_UNREACHABLE: code("The MCP server did not answer, or it failed the MCP handshake.", "Check that the server runs and that the URL is its Streamable HTTP endpoint, such as /mcp.", `${consoleGuide}/mcp-client`, "retry"),
|
|
36
|
+
CONSOLE_MCP_SIGNED_OUT: code("The MCP server rejects the credentials of this connection.", "Sign in again. For a token, connect again with a new one.", `${consoleGuide}/mcp-client`, "docs"),
|
|
37
|
+
CONSOLE_MCP_AUTHORIZATION_FAILED: code("The OAuth sign-in with the MCP server failed.", "Start the sign-in again. The server must publish RFC 9728 metadata that names an authorization server with client registration.", `${consoleGuide}/mcp-client`, "docs"),
|
|
38
|
+
CONSOLE_MCP_KEY_INVALID: code("VITEHUB_CONSOLE_MCP_KEY is not 32 random bytes, so the Console cannot seal MCP connections.", "Set VITEHUB_CONSOLE_MCP_KEY to 32 random bytes as base64 or hex, such as the output of openssl rand -base64 32.", `${consoleGuide}/mcp-client#keep-connections-across-restarts`, "docs"),
|
|
39
|
+
CONSOLE_MCP_KV_REQUIRED: code("VITEHUB_CONSOLE_MCP_KEY is set, but the app has no configured default KV store for MCP connections.", "Set kv: true in vitehub(), or configure a default KV store, then rebuild the app.", `${consoleGuide}/mcp-client#keep-connections-across-restarts`, "docs"),
|
|
40
|
+
CONSOLE_REQUEST_INVALID: code("The server cannot read this Console request.", "Reload the Console. If this continues, deploy the Console and the server from the same build.", `${consoleGuide}/limits-and-errors#fix-common-failures`, "reload"),
|
|
41
|
+
CONSOLE_NOT_FOUND: code("The item does not exist, or the server removed it.", "Reload the Console to see the current data.", `${consoleGuide}/limits-and-errors#fix-common-failures`, "reload"),
|
|
42
|
+
CONSOLE_CONFLICT: code("The data changed after the Console loaded it.", "Reload the Console, then try again.", `${consoleGuide}/limits-and-errors#fix-common-failures`, "reload"),
|
|
43
|
+
CONSOLE_UNAVAILABLE: code("The server did not answer. It can be restarting, offline, or rate limited.", "Wait a moment, then try again.", `${consoleGuide}/limits-and-errors#fix-common-failures`, "retry"),
|
|
44
|
+
CONSOLE_REQUEST_FAILED: code("The server could not complete the request.", "Try again. If this continues, read the server logs for this request.", `${consoleGuide}/limits-and-errors#fix-common-failures`, "retry")
|
|
45
45
|
} });
|
|
46
46
|
const consoleDiagnosticCodes = new Set(Object.keys(consoleDiagnostics));
|
|
47
47
|
function isConsoleDiagnosticCode(value) {
|