theokit 0.1.0-alpha.6 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/add-2ZFFGGE4.js +0 -0
- package/dist/aws-lambda-PONVF3UX.js +0 -0
- package/dist/broadcast-QOQGUNNK.js +0 -0
- package/dist/build-IQQYCA3B.js +0 -0
- package/dist/bun-DITMZMKL.js +0 -0
- package/dist/check-PZR67OY5.js +0 -0
- package/dist/chunk-3Q36SEDK.js +0 -0
- package/dist/chunk-5ODOE6EF.js +0 -0
- package/dist/chunk-GQSTRXXB.js +0 -0
- package/dist/{chunk-MCP6Y5BA.js → chunk-JBC7PFV4.js} +25 -1
- package/dist/chunk-JBC7PFV4.js.map +1 -0
- package/dist/chunk-JZ5WEG3S.js +0 -0
- package/dist/chunk-KT3MWNZG.js +0 -0
- package/dist/chunk-O7335ZGH.js +0 -0
- package/dist/chunk-OK2PJOLK.js +105 -0
- package/dist/chunk-OK2PJOLK.js.map +1 -0
- package/dist/chunk-S3JBIFKS.js +0 -0
- package/dist/chunk-WQCPKA2L.js +0 -0
- package/dist/chunk-WZ7CPVQB.js +0 -0
- package/dist/chunk-XMS5VRIK.js +0 -0
- package/dist/chunk-Y5KE6YFP.js +0 -0
- package/dist/chunk-ZK5JCE5J.js +0 -0
- package/dist/cli/index.js +1 -1
- package/dist/cloudflare-RBANU3SE.js +0 -0
- package/dist/configure-agent-registry-6YGTJYBC.js +0 -0
- package/dist/deno-deploy-J7LI6HNL.js +0 -0
- package/dist/dev-VN6WS3CM.js +0 -0
- package/dist/devtools/entry.js +249 -203
- package/dist/devtools/entry.js.map +1 -1
- package/dist/dispatcher-IK3FVMX5.js +8 -0
- package/dist/dispatcher-IK3FVMX5.js.map +1 -0
- package/dist/{dist-UZV7J3YI.js → dist-Q5VBFWVL.js} +251 -89
- package/dist/dist-Q5VBFWVL.js.map +1 -0
- package/dist/docker-EZDA5FT7.js +0 -0
- package/dist/generate-SIO4JSKJ.js +0 -0
- package/dist/info-B3UOXFUF.js +0 -0
- package/dist/lib-NST3PNZX.js +0 -0
- package/dist/netlify-IFY6ZGFV.js +0 -0
- package/dist/node-KWZI3CKV.js +0 -0
- package/dist/proper-lockfile-MVKMQGFK.js +0 -0
- package/dist/registry-BB3UYAOG.js +0 -0
- package/dist/routes-CAGFZKUK.js +0 -0
- package/dist/scan-C2BOKLSY.js +0 -0
- package/dist/schema-MVB2FVK6.js +0 -0
- package/dist/server/cost/index.d.ts +7 -0
- package/dist/server/cost/index.js +1 -1
- package/dist/server/index.js +70 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services-typed-client-ZX5JUHH3.js +0 -0
- package/dist/sqlite-vec-54KB4RD3.js +0 -0
- package/dist/{start-CSLJQXV3.js → start-ZGWW5MOL.js} +3 -3
- package/dist/static-BH6JQNM2.js +0 -0
- package/dist/storage-manager-D5KBXXKB.js +0 -0
- package/dist/theo-cloud-3K4DGB3S.js +0 -0
- package/dist/upgrade-readiness-OHL36FQL.js +0 -0
- package/dist/vercel-RHADE5IP.js +0 -0
- package/dist/vite-plugin-WA3G45YY.js +0 -0
- package/package.json +8 -8
- package/LICENSE +0 -201
- package/dist/chunk-MCP6Y5BA.js.map +0 -1
- package/dist/dist-UZV7J3YI.js.map +0 -1
- /package/dist/{start-CSLJQXV3.js.map → start-ZGWW5MOL.js.map} +0 -0
package/dist/devtools/entry.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CHANNEL_CSRF_WARN,
|
|
3
|
+
CHANNEL_ERROR,
|
|
4
|
+
CHANNEL_MANIFEST,
|
|
5
|
+
CHANNEL_REQUEST,
|
|
6
|
+
CHANNEL_ROUTE_MATCHED,
|
|
7
|
+
RING_BUFFER_CAP,
|
|
8
|
+
STORAGE_VERSION,
|
|
9
|
+
dispatcher,
|
|
10
|
+
initialState
|
|
11
|
+
} from "../chunk-OK2PJOLK.js";
|
|
1
12
|
import "../chunk-DGUM43GV.js";
|
|
2
13
|
|
|
3
14
|
// src/devtools/entry.tsx
|
|
@@ -433,9 +444,121 @@ function Indicator() {
|
|
|
433
444
|
);
|
|
434
445
|
}
|
|
435
446
|
|
|
447
|
+
// src/devtools/components/Tabs/AgentsTab.tsx
|
|
448
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
449
|
+
function formatTime(ts) {
|
|
450
|
+
const d = new Date(ts);
|
|
451
|
+
return d.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit", second: "2-digit" });
|
|
452
|
+
}
|
|
453
|
+
function formatCost(usd) {
|
|
454
|
+
if (usd === 0) return "$0.0000";
|
|
455
|
+
if (usd < 1e-4) return `<$0.0001`;
|
|
456
|
+
return `$${usd.toFixed(4)}`;
|
|
457
|
+
}
|
|
458
|
+
function AgentsTab() {
|
|
459
|
+
const { state, dispatch, styles } = useDevtoolsContext();
|
|
460
|
+
if (state.agentRuns.length === 0) {
|
|
461
|
+
return /* @__PURE__ */ jsxs("div", { style: { color: tokens.colors.textMuted, padding: tokens.spacing.md }, children: [
|
|
462
|
+
"No agent runs yet. Trigger a request to an endpoint using ",
|
|
463
|
+
/* @__PURE__ */ jsx3("code", { children: "trackAgentRun" }),
|
|
464
|
+
" to see it here. (Wired in the saas template; opt-in elsewhere.)"
|
|
465
|
+
] });
|
|
466
|
+
}
|
|
467
|
+
const totalCost = state.agentRuns.reduce((sum, r) => sum + r.costUsd, 0);
|
|
468
|
+
const totalIn = state.agentRuns.reduce((sum, r) => sum + r.tokensInput, 0);
|
|
469
|
+
const totalOut = state.agentRuns.reduce((sum, r) => sum + r.tokensOutput, 0);
|
|
470
|
+
const headerClass = styles.css`
|
|
471
|
+
display: flex;
|
|
472
|
+
align-items: center;
|
|
473
|
+
justify-content: space-between;
|
|
474
|
+
padding: ${tokens.spacing.xs} ${tokens.spacing.sm};
|
|
475
|
+
color: ${tokens.colors.textMuted};
|
|
476
|
+
font-size: ${tokens.font.sizeXs};
|
|
477
|
+
border-bottom: 1px solid ${tokens.colors.borderSubtle};
|
|
478
|
+
`;
|
|
479
|
+
const clearBtn = styles.css`
|
|
480
|
+
appearance: none;
|
|
481
|
+
background: transparent;
|
|
482
|
+
color: ${tokens.colors.textMuted};
|
|
483
|
+
border: 1px solid ${tokens.colors.borderSubtle};
|
|
484
|
+
padding: 2px 6px;
|
|
485
|
+
border-radius: ${tokens.radius.sm};
|
|
486
|
+
cursor: pointer;
|
|
487
|
+
font-size: ${tokens.font.sizeXs};
|
|
488
|
+
&:hover { color: ${tokens.colors.text}; }
|
|
489
|
+
`;
|
|
490
|
+
const tableClass = styles.css`
|
|
491
|
+
width: 100%;
|
|
492
|
+
border-collapse: collapse;
|
|
493
|
+
font-size: ${tokens.font.sizeXs};
|
|
494
|
+
th, td {
|
|
495
|
+
text-align: left;
|
|
496
|
+
padding: 4px 8px;
|
|
497
|
+
border-bottom: 1px solid ${tokens.colors.borderSubtle};
|
|
498
|
+
}
|
|
499
|
+
th {
|
|
500
|
+
color: ${tokens.colors.textMuted};
|
|
501
|
+
font-weight: 500;
|
|
502
|
+
font-size: ${tokens.font.sizeXs};
|
|
503
|
+
}
|
|
504
|
+
tr.status-error td { color: #c92a2a; }
|
|
505
|
+
tr.status-aborted td { color: ${tokens.colors.textMuted}; }
|
|
506
|
+
`;
|
|
507
|
+
return /* @__PURE__ */ jsxs("div", { "data-testid": "devtools-agents-tab", children: [
|
|
508
|
+
/* @__PURE__ */ jsxs("div", { className: headerClass, children: [
|
|
509
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
510
|
+
state.agentRuns.length,
|
|
511
|
+
" run",
|
|
512
|
+
state.agentRuns.length === 1 ? "" : "s",
|
|
513
|
+
" \xB7 ",
|
|
514
|
+
"tokens ",
|
|
515
|
+
totalIn,
|
|
516
|
+
"/",
|
|
517
|
+
totalOut,
|
|
518
|
+
" \xB7 ",
|
|
519
|
+
formatCost(totalCost),
|
|
520
|
+
" total"
|
|
521
|
+
] }),
|
|
522
|
+
/* @__PURE__ */ jsx3(
|
|
523
|
+
"button",
|
|
524
|
+
{
|
|
525
|
+
type: "button",
|
|
526
|
+
className: clearBtn,
|
|
527
|
+
onClick: () => {
|
|
528
|
+
dispatch({ type: "RESET_AGENT_RUNS" });
|
|
529
|
+
},
|
|
530
|
+
children: "clear"
|
|
531
|
+
}
|
|
532
|
+
)
|
|
533
|
+
] }),
|
|
534
|
+
/* @__PURE__ */ jsxs("table", { className: tableClass, children: [
|
|
535
|
+
/* @__PURE__ */ jsx3("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
536
|
+
/* @__PURE__ */ jsx3("th", { children: "Time" }),
|
|
537
|
+
/* @__PURE__ */ jsx3("th", { children: "User" }),
|
|
538
|
+
/* @__PURE__ */ jsx3("th", { children: "Model" }),
|
|
539
|
+
/* @__PURE__ */ jsx3("th", { children: "Tokens (in/out)" }),
|
|
540
|
+
/* @__PURE__ */ jsx3("th", { children: "Cost" }),
|
|
541
|
+
/* @__PURE__ */ jsx3("th", { children: "Status" })
|
|
542
|
+
] }) }),
|
|
543
|
+
/* @__PURE__ */ jsx3("tbody", { children: state.agentRuns.map((run) => /* @__PURE__ */ jsxs("tr", { className: `status-${run.status}`, children: [
|
|
544
|
+
/* @__PURE__ */ jsx3("td", { children: formatTime(run.timestamp) }),
|
|
545
|
+
/* @__PURE__ */ jsx3("td", { children: run.userId }),
|
|
546
|
+
/* @__PURE__ */ jsx3("td", { children: run.model }),
|
|
547
|
+
/* @__PURE__ */ jsxs("td", { children: [
|
|
548
|
+
run.tokensInput,
|
|
549
|
+
"/",
|
|
550
|
+
run.tokensOutput
|
|
551
|
+
] }),
|
|
552
|
+
/* @__PURE__ */ jsx3("td", { children: formatCost(run.costUsd) }),
|
|
553
|
+
/* @__PURE__ */ jsx3("td", { children: run.status })
|
|
554
|
+
] }, run.id)) })
|
|
555
|
+
] })
|
|
556
|
+
] });
|
|
557
|
+
}
|
|
558
|
+
|
|
436
559
|
// src/devtools/components/Tabs/CsrfReadinessTab.tsx
|
|
437
560
|
import { useEffect as useEffect2, useState, useCallback as useCallback2 } from "react";
|
|
438
|
-
import { jsx as
|
|
561
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
439
562
|
function buildTabStyles(styles) {
|
|
440
563
|
return {
|
|
441
564
|
container: styles.css`
|
|
@@ -477,13 +600,13 @@ function ReadinessRow({
|
|
|
477
600
|
rowClass,
|
|
478
601
|
route
|
|
479
602
|
}) {
|
|
480
|
-
return /* @__PURE__ */
|
|
481
|
-
/* @__PURE__ */
|
|
482
|
-
/* @__PURE__ */
|
|
603
|
+
return /* @__PURE__ */ jsxs2("div", { className: rowClass, children: [
|
|
604
|
+
/* @__PURE__ */ jsx4("span", { style: { color: tokens.colors.accent }, children: route.method }),
|
|
605
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
483
606
|
route.path,
|
|
484
|
-
/* @__PURE__ */
|
|
607
|
+
/* @__PURE__ */ jsx4("span", { style: { color: tokens.colors.textMuted, marginLeft: tokens.spacing.sm }, children: route.reason })
|
|
485
608
|
] }),
|
|
486
|
-
/* @__PURE__ */
|
|
609
|
+
/* @__PURE__ */ jsxs2("span", { style: { color: tokens.colors.textMuted }, children: [
|
|
487
610
|
"\xD7",
|
|
488
611
|
String(route.count)
|
|
489
612
|
] })
|
|
@@ -529,24 +652,24 @@ function CsrfReadinessTab() {
|
|
|
529
652
|
}
|
|
530
653
|
}, [fetchData]);
|
|
531
654
|
if (error) {
|
|
532
|
-
return /* @__PURE__ */
|
|
533
|
-
/* @__PURE__ */
|
|
534
|
-
/* @__PURE__ */
|
|
655
|
+
return /* @__PURE__ */ jsxs2("div", { className: cls.container, "data-testid": "devtools-csrf-readiness-error", children: [
|
|
656
|
+
/* @__PURE__ */ jsx4("div", { style: { color: tokens.colors.error.csrf }, children: error }),
|
|
657
|
+
/* @__PURE__ */ jsxs2("p", { style: { color: tokens.colors.textMuted, marginTop: tokens.spacing.sm }, children: [
|
|
535
658
|
"Wire ",
|
|
536
|
-
/* @__PURE__ */
|
|
659
|
+
/* @__PURE__ */ jsx4("code", { children: "csrfReadinessStore" }),
|
|
537
660
|
" in the api-middleware options to enable this tab."
|
|
538
661
|
] })
|
|
539
662
|
] });
|
|
540
663
|
}
|
|
541
664
|
if (data === null) {
|
|
542
|
-
return /* @__PURE__ */
|
|
665
|
+
return /* @__PURE__ */ jsx4("div", { className: cls.container, "data-testid": "devtools-csrf-readiness-loading", children: "Loading\u2026" });
|
|
543
666
|
}
|
|
544
667
|
const isEmpty = data.totalEvents === 0;
|
|
545
668
|
const testid = isEmpty ? "devtools-csrf-readiness-empty" : "devtools-csrf-readiness";
|
|
546
|
-
return /* @__PURE__ */
|
|
547
|
-
/* @__PURE__ */
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
-
/* @__PURE__ */
|
|
669
|
+
return /* @__PURE__ */ jsxs2("div", { className: cls.container, "data-testid": testid, children: [
|
|
670
|
+
/* @__PURE__ */ jsxs2("div", { className: cls.headerRow, children: [
|
|
671
|
+
/* @__PURE__ */ jsx4("strong", { children: isEmpty ? "CSRF Readiness" : `CSRF Readiness \u2014 ${String(data.totalEvents)} event(s) across ${String(data.routes.length)} route(s)` }),
|
|
672
|
+
/* @__PURE__ */ jsx4(
|
|
550
673
|
"button",
|
|
551
674
|
{
|
|
552
675
|
type: "button",
|
|
@@ -559,13 +682,13 @@ function CsrfReadinessTab() {
|
|
|
559
682
|
}
|
|
560
683
|
)
|
|
561
684
|
] }),
|
|
562
|
-
isEmpty ? /* @__PURE__ */
|
|
685
|
+
isEmpty ? /* @__PURE__ */ jsx4("div", { style: { color: tokens.colors.textMuted }, children: "No csrf.warn events recorded. Endpoints are ready for 0.3.0 strict CSRF." }) : data.routes.map((r) => /* @__PURE__ */ jsx4(ReadinessRow, { rowClass: cls.row, route: r }, `${r.method} ${r.path} ${r.reason}`))
|
|
563
686
|
] });
|
|
564
687
|
}
|
|
565
688
|
|
|
566
689
|
// src/devtools/components/ErrorRow.tsx
|
|
567
690
|
import { useState as useState2 } from "react";
|
|
568
|
-
import { jsx as
|
|
691
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
569
692
|
var STACK_DISPLAY_LIMIT = 4096;
|
|
570
693
|
function truncateStackForDisplay(stack, limit = STACK_DISPLAY_LIMIT) {
|
|
571
694
|
if (!stack) return null;
|
|
@@ -643,8 +766,8 @@ function ErrorRow({ error }) {
|
|
|
643
766
|
`;
|
|
644
767
|
const displayedStack = truncateStackForDisplay(error.stack);
|
|
645
768
|
const showDocsLink = typeof error.docsUrl === "string" && error.docsUrl.length > 0;
|
|
646
|
-
return /* @__PURE__ */
|
|
647
|
-
/* @__PURE__ */
|
|
769
|
+
return /* @__PURE__ */ jsxs3("div", { className: containerClass, "data-testid": "devtools-error-row", children: [
|
|
770
|
+
/* @__PURE__ */ jsxs3(
|
|
648
771
|
"button",
|
|
649
772
|
{
|
|
650
773
|
type: "button",
|
|
@@ -655,9 +778,9 @@ function ErrorRow({ error }) {
|
|
|
655
778
|
"aria-expanded": expanded,
|
|
656
779
|
title: error.message,
|
|
657
780
|
children: [
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
-
/* @__PURE__ */
|
|
660
|
-
error.code && /* @__PURE__ */
|
|
781
|
+
/* @__PURE__ */ jsx5("span", { className: iconClass, "aria-hidden": "true", children: typeIcon(error.type) }),
|
|
782
|
+
/* @__PURE__ */ jsx5("span", { className: msgClass, children: error.message }),
|
|
783
|
+
error.code && /* @__PURE__ */ jsx5(
|
|
661
784
|
"span",
|
|
662
785
|
{
|
|
663
786
|
style: {
|
|
@@ -671,8 +794,8 @@ function ErrorRow({ error }) {
|
|
|
671
794
|
]
|
|
672
795
|
}
|
|
673
796
|
),
|
|
674
|
-
expanded && /* @__PURE__ */
|
|
675
|
-
showDocsLink && /* @__PURE__ */
|
|
797
|
+
expanded && /* @__PURE__ */ jsxs3("div", { className: detailsClass, children: [
|
|
798
|
+
showDocsLink && /* @__PURE__ */ jsx5("div", { style: { marginBottom: tokens.spacing.sm }, children: /* @__PURE__ */ jsx5(
|
|
676
799
|
"a",
|
|
677
800
|
{
|
|
678
801
|
href: error.docsUrl,
|
|
@@ -682,7 +805,7 @@ function ErrorRow({ error }) {
|
|
|
682
805
|
children: "Open migration guide"
|
|
683
806
|
}
|
|
684
807
|
) }),
|
|
685
|
-
displayedStack && /* @__PURE__ */
|
|
808
|
+
displayedStack && /* @__PURE__ */ jsx5(
|
|
686
809
|
"pre",
|
|
687
810
|
{
|
|
688
811
|
style: {
|
|
@@ -706,11 +829,11 @@ function ErrorRow({ error }) {
|
|
|
706
829
|
}
|
|
707
830
|
|
|
708
831
|
// src/devtools/components/Tabs/ErrorsTab.tsx
|
|
709
|
-
import { jsx as
|
|
832
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
710
833
|
function ErrorsTab() {
|
|
711
834
|
const { state, dispatch, styles } = useDevtoolsContext();
|
|
712
835
|
if (state.errors.length === 0) {
|
|
713
|
-
return /* @__PURE__ */
|
|
836
|
+
return /* @__PURE__ */ jsx6("div", { style: { color: tokens.colors.textMuted, padding: tokens.spacing.md }, children: "No errors yet. csrf.warn, console.error and unhandled rejections will surface here." });
|
|
714
837
|
}
|
|
715
838
|
const headerClass = styles.css`
|
|
716
839
|
display: flex;
|
|
@@ -732,14 +855,14 @@ function ErrorsTab() {
|
|
|
732
855
|
font-size: ${tokens.font.sizeXs};
|
|
733
856
|
&:hover { color: ${tokens.colors.text}; }
|
|
734
857
|
`;
|
|
735
|
-
return /* @__PURE__ */
|
|
736
|
-
/* @__PURE__ */
|
|
737
|
-
/* @__PURE__ */
|
|
858
|
+
return /* @__PURE__ */ jsxs4("div", { "data-testid": "devtools-errors-tab", children: [
|
|
859
|
+
/* @__PURE__ */ jsxs4("div", { className: headerClass, children: [
|
|
860
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
738
861
|
state.errors.length,
|
|
739
862
|
" error",
|
|
740
863
|
state.errors.length === 1 ? "" : "s"
|
|
741
864
|
] }),
|
|
742
|
-
/* @__PURE__ */
|
|
865
|
+
/* @__PURE__ */ jsx6(
|
|
743
866
|
"button",
|
|
744
867
|
{
|
|
745
868
|
type: "button",
|
|
@@ -751,7 +874,7 @@ function ErrorsTab() {
|
|
|
751
874
|
}
|
|
752
875
|
)
|
|
753
876
|
] }),
|
|
754
|
-
state.errors.map((err) => /* @__PURE__ */
|
|
877
|
+
state.errors.map((err) => /* @__PURE__ */ jsx6(ErrorRow, { error: err }, err.id))
|
|
755
878
|
] });
|
|
756
879
|
}
|
|
757
880
|
|
|
@@ -760,7 +883,7 @@ import { useState as useState4 } from "react";
|
|
|
760
883
|
|
|
761
884
|
// src/devtools/components/JSONExplorer.tsx
|
|
762
885
|
import { useState as useState3 } from "react";
|
|
763
|
-
import { jsx as
|
|
886
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
764
887
|
var PAGE_SIZE = 100;
|
|
765
888
|
var MAX_STRING_DISPLAY = 256;
|
|
766
889
|
function describe(value) {
|
|
@@ -808,26 +931,26 @@ function JSONExplorer({
|
|
|
808
931
|
const keyClass = styles.css`color: ${tokens.colors.accent};`;
|
|
809
932
|
const valClass = styles.css`color: ${tokens.colors.textMuted};`;
|
|
810
933
|
if (value === null || value === void 0 || typeof value !== "object") {
|
|
811
|
-
return /* @__PURE__ */
|
|
812
|
-
/* @__PURE__ */
|
|
934
|
+
return /* @__PURE__ */ jsxs5("div", { className: rowClass, children: [
|
|
935
|
+
/* @__PURE__ */ jsx7("span", { className: keyClass, children: label }),
|
|
813
936
|
":",
|
|
814
937
|
" ",
|
|
815
|
-
/* @__PURE__ */
|
|
938
|
+
/* @__PURE__ */ jsx7("span", { className: valClass, children: describe(value) })
|
|
816
939
|
] });
|
|
817
940
|
}
|
|
818
941
|
const entries = Array.isArray(value) ? value.map((v, i) => [String(i), v]) : Object.entries(value);
|
|
819
942
|
if (entries.length === 0) {
|
|
820
|
-
return /* @__PURE__ */
|
|
821
|
-
/* @__PURE__ */
|
|
943
|
+
return /* @__PURE__ */ jsxs5("div", { className: rowClass, children: [
|
|
944
|
+
/* @__PURE__ */ jsx7("span", { className: keyClass, children: label }),
|
|
822
945
|
":",
|
|
823
946
|
" ",
|
|
824
|
-
/* @__PURE__ */
|
|
947
|
+
/* @__PURE__ */ jsx7("span", { className: valClass, children: Array.isArray(value) ? "[]" : "{}" })
|
|
825
948
|
] });
|
|
826
949
|
}
|
|
827
950
|
const totalPages = Math.ceil(entries.length / PAGE_SIZE);
|
|
828
951
|
const slice = entries.slice(pageIndex * PAGE_SIZE, (pageIndex + 1) * PAGE_SIZE);
|
|
829
|
-
return /* @__PURE__ */
|
|
830
|
-
/* @__PURE__ */
|
|
952
|
+
return /* @__PURE__ */ jsxs5("div", { className: rowClass, children: [
|
|
953
|
+
/* @__PURE__ */ jsxs5(
|
|
831
954
|
"button",
|
|
832
955
|
{
|
|
833
956
|
type: "button",
|
|
@@ -837,15 +960,15 @@ function JSONExplorer({
|
|
|
837
960
|
},
|
|
838
961
|
"aria-expanded": expanded,
|
|
839
962
|
children: [
|
|
840
|
-
/* @__PURE__ */
|
|
841
|
-
/* @__PURE__ */
|
|
842
|
-
/* @__PURE__ */
|
|
963
|
+
/* @__PURE__ */ jsx7("span", { children: expanded ? "\u25BE" : "\u25B8" }),
|
|
964
|
+
/* @__PURE__ */ jsx7("span", { className: keyClass, children: label }),
|
|
965
|
+
/* @__PURE__ */ jsx7("span", { className: valClass, children: describe(value) })
|
|
843
966
|
]
|
|
844
967
|
}
|
|
845
968
|
),
|
|
846
|
-
expanded && /* @__PURE__ */
|
|
847
|
-
slice.map(([k, v]) => /* @__PURE__ */
|
|
848
|
-
totalPages > 1 && /* @__PURE__ */
|
|
969
|
+
expanded && /* @__PURE__ */ jsxs5("div", { children: [
|
|
970
|
+
slice.map(([k, v]) => /* @__PURE__ */ jsx7(JSONExplorer, { label: k, value: v, depth: depth + 1 }, k)),
|
|
971
|
+
totalPages > 1 && /* @__PURE__ */ jsxs5(
|
|
849
972
|
"div",
|
|
850
973
|
{
|
|
851
974
|
className: styles.css`padding-left: ${(depth + 1) * 12}px; color: ${tokens.colors.textMuted}; font-size: ${tokens.font.sizeXs};`,
|
|
@@ -854,7 +977,7 @@ function JSONExplorer({
|
|
|
854
977
|
pageIndex + 1,
|
|
855
978
|
"/",
|
|
856
979
|
totalPages,
|
|
857
|
-
pageIndex > 0 && /* @__PURE__ */
|
|
980
|
+
pageIndex > 0 && /* @__PURE__ */ jsx7(
|
|
858
981
|
"button",
|
|
859
982
|
{
|
|
860
983
|
type: "button",
|
|
@@ -865,7 +988,7 @@ function JSONExplorer({
|
|
|
865
988
|
children: "prev"
|
|
866
989
|
}
|
|
867
990
|
),
|
|
868
|
-
pageIndex < totalPages - 1 && /* @__PURE__ */
|
|
991
|
+
pageIndex < totalPages - 1 && /* @__PURE__ */ jsx7(
|
|
869
992
|
"button",
|
|
870
993
|
{
|
|
871
994
|
type: "button",
|
|
@@ -884,7 +1007,7 @@ function JSONExplorer({
|
|
|
884
1007
|
}
|
|
885
1008
|
|
|
886
1009
|
// src/devtools/components/RequestRow.tsx
|
|
887
|
-
import { jsx as
|
|
1010
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
888
1011
|
function buildRequestRowStyles(styles, request) {
|
|
889
1012
|
return {
|
|
890
1013
|
container: styles.css`
|
|
@@ -973,8 +1096,8 @@ function RequestRow({ request }) {
|
|
|
973
1096
|
const detailsClass = cls.details;
|
|
974
1097
|
const displayDuration = formatDuration(request.durationMs);
|
|
975
1098
|
const displayStatus = request.status === 0 ? "failed" : String(request.status);
|
|
976
|
-
return /* @__PURE__ */
|
|
977
|
-
/* @__PURE__ */
|
|
1099
|
+
return /* @__PURE__ */ jsxs6("div", { className: containerClass, "data-testid": "devtools-request-row", children: [
|
|
1100
|
+
/* @__PURE__ */ jsxs6(
|
|
978
1101
|
"button",
|
|
979
1102
|
{
|
|
980
1103
|
type: "button",
|
|
@@ -985,19 +1108,19 @@ function RequestRow({ request }) {
|
|
|
985
1108
|
"aria-expanded": expanded,
|
|
986
1109
|
title: request.path,
|
|
987
1110
|
children: [
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
/* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
/* @__PURE__ */
|
|
1111
|
+
/* @__PURE__ */ jsx8("span", { className: methodBadge, children: request.method }),
|
|
1112
|
+
/* @__PURE__ */ jsx8("span", { className: pathClass, children: request.path }),
|
|
1113
|
+
/* @__PURE__ */ jsx8("span", { className: statusClass, children: displayStatus }),
|
|
1114
|
+
/* @__PURE__ */ jsx8("span", { className: durClass, children: displayDuration }),
|
|
1115
|
+
/* @__PURE__ */ jsx8("span", { className: traceClass, children: request.traceId.slice(0, 8) })
|
|
993
1116
|
]
|
|
994
1117
|
}
|
|
995
1118
|
),
|
|
996
|
-
expanded && /* @__PURE__ */
|
|
997
|
-
request.csrfWarn && /* @__PURE__ */
|
|
1119
|
+
expanded && /* @__PURE__ */ jsxs6("div", { className: detailsClass, children: [
|
|
1120
|
+
request.csrfWarn && /* @__PURE__ */ jsxs6("div", { style: { color: tokens.colors.error.csrf, marginBottom: tokens.spacing.sm }, children: [
|
|
998
1121
|
"CSRF warn:",
|
|
999
1122
|
" ",
|
|
1000
|
-
/* @__PURE__ */
|
|
1123
|
+
/* @__PURE__ */ jsx8(
|
|
1001
1124
|
"a",
|
|
1002
1125
|
{
|
|
1003
1126
|
href: request.csrfWarn.docsUrl,
|
|
@@ -1008,8 +1131,8 @@ function RequestRow({ request }) {
|
|
|
1008
1131
|
}
|
|
1009
1132
|
)
|
|
1010
1133
|
] }),
|
|
1011
|
-
request.headers && /* @__PURE__ */
|
|
1012
|
-
request.bodyPreview !== void 0 && request.bodyPreview !== "" && /* @__PURE__ */
|
|
1134
|
+
request.headers && /* @__PURE__ */ jsx8(JSONExplorer, { label: "headers", value: request.headers, defaultExpanded: false }),
|
|
1135
|
+
request.bodyPreview !== void 0 && request.bodyPreview !== "" && /* @__PURE__ */ jsxs6(
|
|
1013
1136
|
"div",
|
|
1014
1137
|
{
|
|
1015
1138
|
style: {
|
|
@@ -1022,7 +1145,7 @@ function RequestRow({ request }) {
|
|
|
1022
1145
|
"body",
|
|
1023
1146
|
request.bodyTruncated ? ` (truncated, ${request.bodyLength} bytes)` : "",
|
|
1024
1147
|
":",
|
|
1025
|
-
/* @__PURE__ */
|
|
1148
|
+
/* @__PURE__ */ jsx8("pre", { style: { marginTop: 4, whiteSpace: "pre-wrap", wordBreak: "break-all" }, children: request.bodyPreview })
|
|
1026
1149
|
]
|
|
1027
1150
|
}
|
|
1028
1151
|
)
|
|
@@ -1031,11 +1154,11 @@ function RequestRow({ request }) {
|
|
|
1031
1154
|
}
|
|
1032
1155
|
|
|
1033
1156
|
// src/devtools/components/Tabs/RequestsTab.tsx
|
|
1034
|
-
import { jsx as
|
|
1157
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1035
1158
|
function RequestsTab() {
|
|
1036
1159
|
const { state, dispatch, styles } = useDevtoolsContext();
|
|
1037
1160
|
if (state.requests.length === 0) {
|
|
1038
|
-
return /* @__PURE__ */
|
|
1161
|
+
return /* @__PURE__ */ jsx9("div", { style: { color: tokens.colors.textMuted, padding: tokens.spacing.md }, children: "No requests yet. Make a fetch call in your app to see it here." });
|
|
1039
1162
|
}
|
|
1040
1163
|
const headerClass = styles.css`
|
|
1041
1164
|
display: flex;
|
|
@@ -1057,14 +1180,14 @@ function RequestsTab() {
|
|
|
1057
1180
|
font-size: ${tokens.font.sizeXs};
|
|
1058
1181
|
&:hover { color: ${tokens.colors.text}; }
|
|
1059
1182
|
`;
|
|
1060
|
-
return /* @__PURE__ */
|
|
1061
|
-
/* @__PURE__ */
|
|
1062
|
-
/* @__PURE__ */
|
|
1183
|
+
return /* @__PURE__ */ jsxs7("div", { "data-testid": "devtools-requests-tab", children: [
|
|
1184
|
+
/* @__PURE__ */ jsxs7("div", { className: headerClass, children: [
|
|
1185
|
+
/* @__PURE__ */ jsxs7("span", { children: [
|
|
1063
1186
|
state.requests.length,
|
|
1064
1187
|
" request",
|
|
1065
1188
|
state.requests.length === 1 ? "" : "s"
|
|
1066
1189
|
] }),
|
|
1067
|
-
/* @__PURE__ */
|
|
1190
|
+
/* @__PURE__ */ jsx9(
|
|
1068
1191
|
"button",
|
|
1069
1192
|
{
|
|
1070
1193
|
type: "button",
|
|
@@ -1076,16 +1199,16 @@ function RequestsTab() {
|
|
|
1076
1199
|
}
|
|
1077
1200
|
)
|
|
1078
1201
|
] }),
|
|
1079
|
-
state.requests.map((req) => /* @__PURE__ */
|
|
1202
|
+
state.requests.map((req) => /* @__PURE__ */ jsx9(RequestRow, { request: req }, req.id))
|
|
1080
1203
|
] });
|
|
1081
1204
|
}
|
|
1082
1205
|
|
|
1083
1206
|
// src/devtools/components/Tabs/RoutesTab.tsx
|
|
1084
|
-
import { jsx as
|
|
1207
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1085
1208
|
function RoutesTab() {
|
|
1086
1209
|
const { state, styles } = useDevtoolsContext();
|
|
1087
1210
|
if (!state.routeManifest || state.routeManifest.routes.length === 0) {
|
|
1088
|
-
return /* @__PURE__ */
|
|
1211
|
+
return /* @__PURE__ */ jsx10("div", { style: { color: tokens.colors.textMuted, padding: tokens.spacing.md }, children: "Routes will appear when the manifest loads." });
|
|
1089
1212
|
}
|
|
1090
1213
|
const rowClass = styles.css`
|
|
1091
1214
|
display: flex;
|
|
@@ -1114,9 +1237,9 @@ function RoutesTab() {
|
|
|
1114
1237
|
console.warn("[theo devtools] Editor not configured");
|
|
1115
1238
|
});
|
|
1116
1239
|
}
|
|
1117
|
-
return /* @__PURE__ */
|
|
1240
|
+
return /* @__PURE__ */ jsx10("div", { "data-testid": "devtools-routes-tab", children: state.routeManifest.routes.map((route) => {
|
|
1118
1241
|
const active = state.activeRoutePath === route.path || state.activeChain.includes(route.absoluteFilePath);
|
|
1119
|
-
return /* @__PURE__ */
|
|
1242
|
+
return /* @__PURE__ */ jsxs8(
|
|
1120
1243
|
"button",
|
|
1121
1244
|
{
|
|
1122
1245
|
type: "button",
|
|
@@ -1127,7 +1250,7 @@ function RoutesTab() {
|
|
|
1127
1250
|
},
|
|
1128
1251
|
title: `Open ${route.absoluteFilePath} in editor`,
|
|
1129
1252
|
children: [
|
|
1130
|
-
/* @__PURE__ */
|
|
1253
|
+
/* @__PURE__ */ jsx10(
|
|
1131
1254
|
"span",
|
|
1132
1255
|
{
|
|
1133
1256
|
style: {
|
|
@@ -1137,8 +1260,8 @@ function RoutesTab() {
|
|
|
1137
1260
|
children: active ? "\u25B8" : " "
|
|
1138
1261
|
}
|
|
1139
1262
|
),
|
|
1140
|
-
/* @__PURE__ */
|
|
1141
|
-
/* @__PURE__ */
|
|
1263
|
+
/* @__PURE__ */ jsx10("span", { style: { flex: 1 }, children: route.path }),
|
|
1264
|
+
/* @__PURE__ */ jsx10("span", { style: { color: tokens.colors.textDim, fontSize: tokens.font.sizeXs }, children: route.absoluteFilePath.split("/").slice(-2).join("/") })
|
|
1142
1265
|
]
|
|
1143
1266
|
},
|
|
1144
1267
|
route.absoluteFilePath
|
|
@@ -1147,7 +1270,7 @@ function RoutesTab() {
|
|
|
1147
1270
|
}
|
|
1148
1271
|
|
|
1149
1272
|
// src/devtools/components/Tabs/SettingsTab.tsx
|
|
1150
|
-
import { jsx as
|
|
1273
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1151
1274
|
var POSITIONS = ["top-left", "top-right", "bottom-left", "bottom-right"];
|
|
1152
1275
|
var THEMES = ["light", "dark", "system"];
|
|
1153
1276
|
function SettingsTab() {
|
|
@@ -1168,11 +1291,11 @@ function SettingsTab() {
|
|
|
1168
1291
|
color: ${tokens.colors.text};
|
|
1169
1292
|
font-size: ${tokens.font.sizeSm};
|
|
1170
1293
|
`;
|
|
1171
|
-
return /* @__PURE__ */
|
|
1172
|
-
/* @__PURE__ */
|
|
1173
|
-
/* @__PURE__ */
|
|
1174
|
-
POSITIONS.map((p) => /* @__PURE__ */
|
|
1175
|
-
/* @__PURE__ */
|
|
1294
|
+
return /* @__PURE__ */ jsxs9("div", { "data-testid": "devtools-settings-tab", style: { padding: tokens.spacing.md }, children: [
|
|
1295
|
+
/* @__PURE__ */ jsxs9("fieldset", { className: sectionClass, style: { border: 0, padding: 0, margin: 0 }, children: [
|
|
1296
|
+
/* @__PURE__ */ jsx11("legend", { className: headingClass, children: "Position" }),
|
|
1297
|
+
POSITIONS.map((p) => /* @__PURE__ */ jsxs9("label", { className: radioRowClass, children: [
|
|
1298
|
+
/* @__PURE__ */ jsx11(
|
|
1176
1299
|
"input",
|
|
1177
1300
|
{
|
|
1178
1301
|
type: "radio",
|
|
@@ -1184,13 +1307,13 @@ function SettingsTab() {
|
|
|
1184
1307
|
}
|
|
1185
1308
|
}
|
|
1186
1309
|
),
|
|
1187
|
-
/* @__PURE__ */
|
|
1310
|
+
/* @__PURE__ */ jsx11("span", { children: p })
|
|
1188
1311
|
] }, p))
|
|
1189
1312
|
] }),
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
/* @__PURE__ */
|
|
1192
|
-
THEMES.map((t) => /* @__PURE__ */
|
|
1193
|
-
/* @__PURE__ */
|
|
1313
|
+
/* @__PURE__ */ jsxs9("fieldset", { className: sectionClass, style: { border: 0, padding: 0, margin: 0 }, children: [
|
|
1314
|
+
/* @__PURE__ */ jsx11("legend", { className: headingClass, children: "Theme" }),
|
|
1315
|
+
THEMES.map((t) => /* @__PURE__ */ jsxs9("label", { className: radioRowClass, children: [
|
|
1316
|
+
/* @__PURE__ */ jsx11(
|
|
1194
1317
|
"input",
|
|
1195
1318
|
{
|
|
1196
1319
|
type: "radio",
|
|
@@ -1202,15 +1325,22 @@ function SettingsTab() {
|
|
|
1202
1325
|
}
|
|
1203
1326
|
}
|
|
1204
1327
|
),
|
|
1205
|
-
/* @__PURE__ */
|
|
1328
|
+
/* @__PURE__ */ jsx11("span", { children: t })
|
|
1206
1329
|
] }, t))
|
|
1207
1330
|
] })
|
|
1208
1331
|
] });
|
|
1209
1332
|
}
|
|
1210
1333
|
|
|
1211
1334
|
// src/devtools/components/Panel.tsx
|
|
1212
|
-
import { jsx as
|
|
1213
|
-
var TABS = [
|
|
1335
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1336
|
+
var TABS = [
|
|
1337
|
+
"requests",
|
|
1338
|
+
"routes",
|
|
1339
|
+
"agents",
|
|
1340
|
+
"errors",
|
|
1341
|
+
"csrf-readiness",
|
|
1342
|
+
"settings"
|
|
1343
|
+
];
|
|
1214
1344
|
function buildPanelStyles(styles, vertical, horizontal, verticalOffset) {
|
|
1215
1345
|
return {
|
|
1216
1346
|
panel: styles.css`
|
|
@@ -1295,7 +1425,7 @@ function Panel() {
|
|
|
1295
1425
|
const tabBtnClass = cls.tabBtn;
|
|
1296
1426
|
const closeBtnClass = cls.closeBtn;
|
|
1297
1427
|
const bodyClass = cls.body;
|
|
1298
|
-
return /* @__PURE__ */
|
|
1428
|
+
return /* @__PURE__ */ jsxs10(
|
|
1299
1429
|
"div",
|
|
1300
1430
|
{
|
|
1301
1431
|
role: "dialog",
|
|
@@ -1303,9 +1433,9 @@ function Panel() {
|
|
|
1303
1433
|
"data-theo-devtools-panel": "",
|
|
1304
1434
|
className: panelClass,
|
|
1305
1435
|
children: [
|
|
1306
|
-
/* @__PURE__ */
|
|
1307
|
-
/* @__PURE__ */
|
|
1308
|
-
/* @__PURE__ */
|
|
1436
|
+
/* @__PURE__ */ jsxs10("div", { className: headerClass, children: [
|
|
1437
|
+
/* @__PURE__ */ jsxs10("div", { className: tabsClass, role: "tablist", children: [
|
|
1438
|
+
/* @__PURE__ */ jsx12(
|
|
1309
1439
|
"span",
|
|
1310
1440
|
{
|
|
1311
1441
|
className: styles.css`
|
|
@@ -1315,10 +1445,10 @@ function Panel() {
|
|
|
1315
1445
|
opacity: 0.9;
|
|
1316
1446
|
`,
|
|
1317
1447
|
"aria-hidden": "true",
|
|
1318
|
-
children: /* @__PURE__ */
|
|
1448
|
+
children: /* @__PURE__ */ jsx12(TheoLogo, { size: 16 })
|
|
1319
1449
|
}
|
|
1320
1450
|
),
|
|
1321
|
-
TABS.map((t) => /* @__PURE__ */
|
|
1451
|
+
TABS.map((t) => /* @__PURE__ */ jsx12(
|
|
1322
1452
|
"button",
|
|
1323
1453
|
{
|
|
1324
1454
|
type: "button",
|
|
@@ -1334,7 +1464,7 @@ function Panel() {
|
|
|
1334
1464
|
t
|
|
1335
1465
|
))
|
|
1336
1466
|
] }),
|
|
1337
|
-
/* @__PURE__ */
|
|
1467
|
+
/* @__PURE__ */ jsx12(
|
|
1338
1468
|
"button",
|
|
1339
1469
|
{
|
|
1340
1470
|
type: "button",
|
|
@@ -1347,107 +1477,19 @@ function Panel() {
|
|
|
1347
1477
|
}
|
|
1348
1478
|
)
|
|
1349
1479
|
] }),
|
|
1350
|
-
/* @__PURE__ */
|
|
1351
|
-
state.activeTab === "requests" && /* @__PURE__ */
|
|
1352
|
-
state.activeTab === "routes" && /* @__PURE__ */
|
|
1353
|
-
state.activeTab === "
|
|
1354
|
-
state.activeTab === "
|
|
1355
|
-
state.activeTab === "
|
|
1480
|
+
/* @__PURE__ */ jsxs10("div", { className: bodyClass, "data-testid": "devtools-tab-body", children: [
|
|
1481
|
+
state.activeTab === "requests" && /* @__PURE__ */ jsx12(RequestsTab, {}),
|
|
1482
|
+
state.activeTab === "routes" && /* @__PURE__ */ jsx12(RoutesTab, {}),
|
|
1483
|
+
state.activeTab === "agents" && /* @__PURE__ */ jsx12(AgentsTab, {}),
|
|
1484
|
+
state.activeTab === "errors" && /* @__PURE__ */ jsx12(ErrorsTab, {}),
|
|
1485
|
+
state.activeTab === "csrf-readiness" && /* @__PURE__ */ jsx12(CsrfReadinessTab, {}),
|
|
1486
|
+
state.activeTab === "settings" && /* @__PURE__ */ jsx12(SettingsTab, {})
|
|
1356
1487
|
] })
|
|
1357
1488
|
]
|
|
1358
1489
|
}
|
|
1359
1490
|
);
|
|
1360
1491
|
}
|
|
1361
1492
|
|
|
1362
|
-
// src/devtools/shared.ts
|
|
1363
|
-
var RING_BUFFER_CAP = 50;
|
|
1364
|
-
var MAX_QUEUE_SIZE = 100;
|
|
1365
|
-
var STORAGE_VERSION = 1;
|
|
1366
|
-
var initialState = {
|
|
1367
|
-
open: false,
|
|
1368
|
-
visible: true,
|
|
1369
|
-
position: "bottom-right",
|
|
1370
|
-
theme: "system",
|
|
1371
|
-
activeTab: "requests",
|
|
1372
|
-
requests: [],
|
|
1373
|
-
errors: [],
|
|
1374
|
-
routeManifest: null,
|
|
1375
|
-
activeRoutePath: null,
|
|
1376
|
-
activeChain: []
|
|
1377
|
-
};
|
|
1378
|
-
var CHANNEL_REQUEST = "theo:devtools:request";
|
|
1379
|
-
var CHANNEL_ERROR = "theo:devtools:error";
|
|
1380
|
-
var CHANNEL_CSRF_WARN = "theo:devtools:csrf.warn";
|
|
1381
|
-
var CHANNEL_MANIFEST = "theo:devtools:manifest";
|
|
1382
|
-
var CHANNEL_ROUTE_MATCHED = "theo:devtools:route-matched";
|
|
1383
|
-
|
|
1384
|
-
// src/devtools/dispatcher.ts
|
|
1385
|
-
var _dispatch = null;
|
|
1386
|
-
var _queue = [];
|
|
1387
|
-
function queuable(fn) {
|
|
1388
|
-
return (...args) => {
|
|
1389
|
-
if (_dispatch) {
|
|
1390
|
-
try {
|
|
1391
|
-
fn(_dispatch, ...args);
|
|
1392
|
-
} catch (err) {
|
|
1393
|
-
console.error("[theo devtools] dispatch failed", err);
|
|
1394
|
-
}
|
|
1395
|
-
} else {
|
|
1396
|
-
if (_queue.length >= MAX_QUEUE_SIZE) _queue.shift();
|
|
1397
|
-
_queue.push((d) => {
|
|
1398
|
-
fn(d, ...args);
|
|
1399
|
-
});
|
|
1400
|
-
}
|
|
1401
|
-
};
|
|
1402
|
-
}
|
|
1403
|
-
function flushQueue() {
|
|
1404
|
-
while (_queue.length) {
|
|
1405
|
-
const fn = _queue.shift();
|
|
1406
|
-
if (!fn || !_dispatch) break;
|
|
1407
|
-
try {
|
|
1408
|
-
fn(_dispatch);
|
|
1409
|
-
} catch (err) {
|
|
1410
|
-
console.error("[theo devtools] queued event failed", err);
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
var dispatcher = {
|
|
1415
|
-
onRequest: queuable((d, req) => {
|
|
1416
|
-
d({ type: "REQUEST_ADD", request: req });
|
|
1417
|
-
}),
|
|
1418
|
-
onError: queuable((d, err) => {
|
|
1419
|
-
d({ type: "ERROR_ADD", error: err });
|
|
1420
|
-
}),
|
|
1421
|
-
onCsrfWarn: queuable((d, payload) => {
|
|
1422
|
-
d({ type: "CSRF_WARN", payload });
|
|
1423
|
-
}),
|
|
1424
|
-
onManifestUpdated: queuable((d, manifest) => {
|
|
1425
|
-
d({ type: "MANIFEST_UPDATED", manifest });
|
|
1426
|
-
}),
|
|
1427
|
-
onRouteMatched: queuable((d, path, chain) => {
|
|
1428
|
-
d({ type: "ROUTE_MATCHED", path, chain });
|
|
1429
|
-
}),
|
|
1430
|
-
/**
|
|
1431
|
-
* Wire React's dispatch function in. Idempotent (EC-24): only the
|
|
1432
|
-
* NULL → non-null transition flushes the queue; subsequent non-null
|
|
1433
|
-
* sets just replace the reference (used for StrictMode re-mount).
|
|
1434
|
-
*/
|
|
1435
|
-
setDispatch(d) {
|
|
1436
|
-
const prev = _dispatch;
|
|
1437
|
-
_dispatch = d;
|
|
1438
|
-
if (d && !prev) flushQueue();
|
|
1439
|
-
},
|
|
1440
|
-
/** Testing helper — clear queue + dispatch reference between tests. */
|
|
1441
|
-
_reset() {
|
|
1442
|
-
_dispatch = null;
|
|
1443
|
-
_queue.length = 0;
|
|
1444
|
-
},
|
|
1445
|
-
/** Testing helper — observe queue length. */
|
|
1446
|
-
_queueLength() {
|
|
1447
|
-
return _queue.length;
|
|
1448
|
-
}
|
|
1449
|
-
};
|
|
1450
|
-
|
|
1451
1493
|
// src/devtools/hmr-bridge.ts
|
|
1452
1494
|
function getHot() {
|
|
1453
1495
|
try {
|
|
@@ -1763,10 +1805,14 @@ function devtoolsReducer(state, action) {
|
|
|
1763
1805
|
return { ...state, routeManifest: action.manifest };
|
|
1764
1806
|
case "ROUTE_MATCHED":
|
|
1765
1807
|
return { ...state, activeRoutePath: action.path, activeChain: action.chain };
|
|
1808
|
+
case "AGENT_RUN_ADD":
|
|
1809
|
+
return { ...state, agentRuns: appendCapped(state.agentRuns, action.run) };
|
|
1766
1810
|
case "RESET_REQUESTS":
|
|
1767
1811
|
return { ...state, requests: [] };
|
|
1768
1812
|
case "RESET_ERRORS":
|
|
1769
1813
|
return { ...state, errors: [] };
|
|
1814
|
+
case "RESET_AGENT_RUNS":
|
|
1815
|
+
return { ...state, agentRuns: [] };
|
|
1770
1816
|
default:
|
|
1771
1817
|
return state;
|
|
1772
1818
|
}
|
|
@@ -1799,7 +1845,7 @@ function createStyles(shadowRoot) {
|
|
|
1799
1845
|
}
|
|
1800
1846
|
|
|
1801
1847
|
// src/devtools/Overlay.tsx
|
|
1802
|
-
import { jsx as
|
|
1848
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1803
1849
|
function ActiveRouteTracker() {
|
|
1804
1850
|
useActiveRoute();
|
|
1805
1851
|
return null;
|
|
@@ -1810,7 +1856,7 @@ function ShortcutsTracker() {
|
|
|
1810
1856
|
}
|
|
1811
1857
|
function ThemeVars({ resolved }) {
|
|
1812
1858
|
const css = `:host { color-scheme: ${resolved}; ${buildThemeCssVars(resolved)} }`;
|
|
1813
|
-
return /* @__PURE__ */
|
|
1859
|
+
return /* @__PURE__ */ jsx13("style", { "data-theo-devtools-theme": resolved, children: css });
|
|
1814
1860
|
}
|
|
1815
1861
|
function Overlay({ shadowRoot }) {
|
|
1816
1862
|
const [state, dispatch] = useReducer(
|
|
@@ -1842,17 +1888,17 @@ function Overlay({ shadowRoot }) {
|
|
|
1842
1888
|
sub.unsubscribe();
|
|
1843
1889
|
};
|
|
1844
1890
|
}, []);
|
|
1845
|
-
return /* @__PURE__ */
|
|
1846
|
-
/* @__PURE__ */
|
|
1847
|
-
/* @__PURE__ */
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
1850
|
-
/* @__PURE__ */
|
|
1891
|
+
return /* @__PURE__ */ jsx13(DevtoolsContext.Provider, { value: { shadowRoot, state, dispatch, styles }, children: /* @__PURE__ */ jsxs11(ShadowPortal, { children: [
|
|
1892
|
+
/* @__PURE__ */ jsx13(ThemeVars, { resolved: resolvedTheme }),
|
|
1893
|
+
/* @__PURE__ */ jsx13(ActiveRouteTracker, {}),
|
|
1894
|
+
/* @__PURE__ */ jsx13(ShortcutsTracker, {}),
|
|
1895
|
+
/* @__PURE__ */ jsx13(Indicator, {}),
|
|
1896
|
+
/* @__PURE__ */ jsx13(Panel, {})
|
|
1851
1897
|
] }) });
|
|
1852
1898
|
}
|
|
1853
1899
|
|
|
1854
1900
|
// src/devtools/entry.tsx
|
|
1855
|
-
import { jsx as
|
|
1901
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1856
1902
|
var PORTAL_TAG = "theo-devtools-portal";
|
|
1857
1903
|
function definePortalElement() {
|
|
1858
1904
|
if (typeof customElements === "undefined") return;
|
|
@@ -1879,7 +1925,7 @@ function mount() {
|
|
|
1879
1925
|
shadowRoot.appendChild(reactRootHost);
|
|
1880
1926
|
const root = createRoot(reactRootHost);
|
|
1881
1927
|
root.render(
|
|
1882
|
-
/* @__PURE__ */
|
|
1928
|
+
/* @__PURE__ */ jsx14(StrictMode, { children: /* @__PURE__ */ jsx14(Overlay, { shadowRoot }) })
|
|
1883
1929
|
);
|
|
1884
1930
|
}
|
|
1885
1931
|
if (typeof document !== "undefined") {
|