@uniqbit/mate-core 1.0.0-canary.2 → 1.0.0-canary.5
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/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/hooks/hooks.json +21 -1
- package/claude-plugin/hooks/session-attention.mjs +10 -0
- package/claude-plugin/hooks/session-end.mjs +9 -0
- package/claude-plugin/hooks/session-guidance.mjs +1 -1
- package/opencode-plugin/src/server.ts +13 -2
- package/opencode-plugin/src/tui.tsx +1 -1
- package/opencode-plugin/tui.tsx +2 -1
- package/package.json +1 -1
- package/src/cli/commands/artifact/delivery/archive.ts +2 -2
- package/src/cli/commands/artifact/delivery/link.ts +22 -5
- package/src/cli/commands/artifact/delivery/output.ts +9 -1
- package/src/cli/commands/artifact/finish/openspec.ts +1 -3
- package/src/cli/commands/companion/companion.ts +1 -1
- package/src/cli/commands/companion/link.ts +36 -4
- package/src/cli/commands/companion/open.ts +40 -12
- package/src/cli/commands/doctor.ts +122 -0
- package/src/cli/commands/session/prepare.ts +32 -4
- package/src/cli/commands/session/registry.ts +90 -0
- package/src/cli/commands/studio/companion-removal.ts +79 -0
- package/src/cli/commands/studio/mate-inventory.ts +1 -1
- package/src/cli/commands/studio/payload.ts +12 -1
- package/src/cli/commands/studio/server.ts +39 -16
- package/src/cli/commands/studio/services.ts +20 -0
- package/src/cli/commands/studio/skill-files.ts +133 -0
- package/src/cli/commands/studio/vault.ts +218 -44
- package/src/cli/commands/studio/views/model.ts +0 -5
- package/src/cli/commands/studio/views/vault/markdown-tree.ts +255 -4
- package/src/cli/commands/unwrap.ts +8 -0
- package/src/cli/commands/update.ts +26 -8
- package/src/cli/commands/vscode/setup.ts +155 -0
- package/src/cli/commands/vscode/vsix.ts +73 -0
- package/src/cli/commands/working/cleanup.ts +34 -10
- package/src/cli/commands/working/worktree.ts +58 -8
- package/src/cli/commands/wrap.ts +33 -7
- package/src/cli/main.ts +9 -2
- package/src/cli/usage.ts +6 -1
- package/src/hooks/companion-instructions.ts +19 -11
- package/src/hooks/hook-io.ts +15 -0
- package/src/hooks/session-banner.ts +5 -3
- package/src/hooks/session-end.ts +10 -0
- package/src/hooks/session-guidance.ts +10 -6
- package/src/hooks/session-prepare.ts +47 -31
- package/src/hooks/session-register.ts +199 -0
- package/src/hooks/tokensave-route.ts +7 -3
- package/src/hooks/validate-artifact-path.ts +9 -2
- package/src/lib/delivery/archive-change.ts +0 -1
- package/src/lib/delivery/branches.ts +15 -0
- package/src/lib/delivery/record-delivery.ts +94 -39
- package/src/lib/delivery/record.ts +30 -28
- package/src/lib/delivery/refresh.ts +37 -17
- package/src/lib/delivery/resolve-branch.ts +258 -37
- package/src/lib/factory/outcomes/index.ts +11 -1
- package/src/lib/factory/runtime.ts +10 -1
- package/src/lib/opencode-server.ts +238 -0
- package/src/lib/orchestrator/adapters/claude.ts +147 -2
- package/src/lib/orchestrator/adapters/opencode.ts +53 -2
- package/src/lib/orchestrator/checkout-adoption.ts +125 -0
- package/src/lib/orchestrator/companion-registry-store.ts +6 -2
- package/src/lib/orchestrator/editor.ts +2 -2
- package/src/lib/orchestrator/framework-context.ts +26 -14
- package/src/lib/orchestrator/global-config-store.ts +11 -0
- package/src/lib/orchestrator/launcher.ts +15 -2
- package/src/lib/orchestrator/projection-claude-links.ts +52 -5
- package/src/lib/orchestrator/projection-claude-skills.ts +28 -2
- package/src/lib/orchestrator/projection-companion-link.ts +12 -1
- package/src/lib/orchestrator/registry-checkouts.ts +177 -0
- package/src/lib/orchestrator/repository-link.ts +216 -57
- package/src/lib/orchestrator/serving-claude-wrap.ts +43 -0
- package/src/lib/orchestrator/session-context-link.ts +11 -5
- package/src/lib/orchestrator/session-prepare.ts +36 -6
- package/src/lib/orchestrator/types.ts +5 -0
- package/src/lib/orchestrator/workspace-inventory.ts +5 -1
- package/src/lib/public-npm.ts +17 -0
- package/src/lib/session-attribution.ts +52 -0
- package/src/lib/session-state.ts +285 -0
- package/src/lib/session-stop.ts +64 -0
- package/src/lib/workset/record.ts +20 -0
- package/src/lib/workset/worktree.ts +85 -17
- package/src/opencode/background-server.ts +145 -0
- package/src/opencode/companion-hooks.ts +3 -1
- package/src/opencode/companion-policy.ts +2 -2
- package/src/opencode/projected-guidance.ts +2 -1
- package/src/opencode/session-register.ts +176 -0
- package/src/opencode/tui.tsx +19 -29
- package/src/runtime/claude-delivery-plan.ts +14 -3
- package/src/runtime/current-branch.ts +10 -0
- package/src/runtime/env.ts +13 -7
- package/src/runtime/git-layout.ts +164 -17
- package/src/runtime/launch-env-guard.ts +65 -0
- package/src/runtime/opencode-server-record.ts +136 -0
- package/src/runtime/projection.ts +40 -6
- package/src/runtime/repo-local.ts +6 -1
- package/src/runtime/serving-claude-wrap.ts +28 -0
- package/src/runtime/session-context.ts +4 -3
- package/src/runtime/session-registry.ts +434 -0
- package/src/runtime/tokensave-route.ts +10 -5
- package/src/runtime/wrap-state.ts +31 -0
- package/src/studio.ts +2 -0
- package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +49 -21
- package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +0 -5
- package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +2 -8
- package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +1 -3
- package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +2 -4
- package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +49 -21
- package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +0 -5
- package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +2 -8
- package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +1 -3
- package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +2 -4
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +404 -30
- package/src/tools/setup/dynamic-plugins/hydrate.ts +4 -3
- package/src/tools/setup/providers/claude-plugin-hooks.ts +26 -0
- package/src/tools/setup/providers/claude.ts +21 -1
- package/studio-dist/client/assets/app-CdPiFv59.css +2 -0
- package/studio-dist/client/assets/button-BIIHE0EQ.js +3 -0
- package/studio-dist/client/assets/companion-view-DM6YyXaR.js +1 -0
- package/studio-dist/client/assets/delivery-path-DELxj0Av.js +1 -0
- package/studio-dist/client/assets/factory-BZy0E8ty.js +4 -0
- package/studio-dist/client/assets/index-B3wkMzjA.js +40 -0
- package/studio-dist/client/assets/markdown-view-pQ2Qp_i5.js +1 -0
- package/studio-dist/client/assets/panel-CbajlC3p.js +1 -0
- package/studio-dist/client/assets/{prepaint-CD5OpmTM.js → prepaint-CwSrpdFA.js} +7 -4
- package/studio-dist/client/assets/react-CN2GSx7x.js +1 -0
- package/studio-dist/client/assets/reports-DllhYQ5_.js +1 -0
- package/studio-dist/client/assets/routes-COm-G3mK.js +1 -0
- package/studio-dist/client/assets/skills-DmWAy-jZ.js +1 -0
- package/studio-dist/client/assets/specs-BG3Wi3ln.js +1 -0
- package/studio-dist/client/assets/steps-DFsH3Neu.js +1 -0
- package/studio-dist/client/assets/vault-B2q1nBY5.js +1 -0
- package/studio-dist/client/assets/warnings-BSXIyuSQ.js +1 -0
- package/studio-dist/client/assets/workflow-DlsQD6Hc.js +1 -0
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-BQKuMdJW.js → __23tanstack-start-server-fn-resolver-M2GBs8s3.js} +179 -9
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +35 -25
- package/studio-dist/server/assets/button-CIJqAhni.js +11929 -0
- package/studio-dist/server/assets/{companion-view-aBady57v.js → companion-view-DISASvdJ.js} +13 -7
- package/studio-dist/server/assets/companions-BYbHWKOZ.js +15 -0
- package/studio-dist/server/assets/delivery-path-C29fBynY.js +654 -0
- package/studio-dist/server/assets/{factory-DT3UzHlh.js → factory-DGPmNGbo.js} +1 -0
- package/studio-dist/server/assets/{factory-D6xnjedJ.js → factory-DUTa0eDs.js} +317 -530
- package/studio-dist/server/assets/markdown-view-Bn7xPdks.js +86 -0
- package/studio-dist/server/assets/panel-3Jmn4awF.js +169 -0
- package/studio-dist/server/assets/{prepaint-BMke0fo1.js → prepaint-DJfTQ_VH.js} +6 -2
- package/studio-dist/server/assets/{react-COs0LHn-.js → react-Ce6dj15C.js} +4 -9
- package/studio-dist/server/assets/reports-C06RXVE2.js +18 -0
- package/studio-dist/server/assets/reports-D6YMqhnO.js +142 -0
- package/studio-dist/server/assets/router-C8MGqlAY.js +13713 -0
- package/studio-dist/server/assets/routes-BcFgvqf7.js +622 -0
- package/studio-dist/server/assets/{shell-CboT2f66.js → shell-DS3wUexh.js} +1 -0
- package/studio-dist/server/assets/skills-BEnOxiDl.js +266 -0
- package/studio-dist/server/assets/skills-CtrBAtX3.js +28 -0
- package/studio-dist/server/assets/specs-C8rv34-5.js +211 -0
- package/studio-dist/server/assets/{start-BW5ovN0k.js → start-h3ICWwd2.js} +4 -1
- package/studio-dist/server/assets/steps-Dq_CwY_s.js +181 -0
- package/studio-dist/server/assets/{vault-BGulVoNh.js → vault-BmWnryh3.js} +16 -1
- package/studio-dist/server/assets/vault-Fvxt2Tzl.js +1032 -0
- package/studio-dist/server/assets/{views-Bd7cRr27.js → views-BgYa-za2.js} +1 -3
- package/studio-dist/server/assets/warnings-DzR6fyZh.js +23 -0
- package/studio-dist/server/assets/workflow-liRYecHk.js +73 -0
- package/studio-dist/server/server.js +3 -157
- package/studio-dist/client/assets/companion-view-Csva26Ir.js +0 -1
- package/studio-dist/client/assets/delivery-path-DJMpRmiY.js +0 -1
- package/studio-dist/client/assets/factory-B7l9ZQyx.js +0 -4
- package/studio-dist/client/assets/index-n6uo_92S.js +0 -40
- package/studio-dist/client/assets/queries-CN3JwMBX.js +0 -1
- package/studio-dist/client/assets/react-CabXf2Ds.js +0 -1
- package/studio-dist/client/assets/report-time-Dc-KOqQu.js +0 -1
- package/studio-dist/client/assets/reports-C01RsnMA.js +0 -1
- package/studio-dist/client/assets/routes-4pbC-2Hj.js +0 -1
- package/studio-dist/client/assets/skills-CihQganl.js +0 -1
- package/studio-dist/client/assets/spec-areas-C2L48N4C.js +0 -1
- package/studio-dist/client/assets/specs-D24_35_K.js +0 -1
- package/studio-dist/client/assets/studio-DKxfi691.css +0 -1
- package/studio-dist/client/assets/studio-queries-rvbJupCy.js +0 -3
- package/studio-dist/client/assets/vault-Bd4CQiTK.js +0 -1
- package/studio-dist/client/assets/warnings-V_Ys51wJ.js +0 -1
- package/studio-dist/client/assets/workflow-BJejeVwQ.js +0 -1
- package/studio-dist/server/assets/delivery-path-BkKNjgkf.js +0 -778
- package/studio-dist/server/assets/queries-Ag2iL8q2.js +0 -107
- package/studio-dist/server/assets/report-time-DAfzln-N.js +0 -8
- package/studio-dist/server/assets/reports-BnUNJVtx.js +0 -126
- package/studio-dist/server/assets/router-BH--drIx.js +0 -4298
- package/studio-dist/server/assets/routes-khSDK1bV.js +0 -361
- package/studio-dist/server/assets/skills-MWYnWoKs.js +0 -106
- package/studio-dist/server/assets/spec-areas-DcnO6vW-.js +0 -16
- package/studio-dist/server/assets/specs-DE3w8hZP.js +0 -155
- package/studio-dist/server/assets/studio-queries-CLnP9kGu.js +0 -3365
- package/studio-dist/server/assets/vault-CuyyhLyB.js +0 -832
- package/studio-dist/server/assets/warnings-BH05rOuG.js +0 -15
- package/studio-dist/server/assets/workflow-BSuIKWqH.js +0 -42
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { A as defaultThrowOnError, j as QueryObserver, k as useBaseQuery, l as shellQuery } from "./studio-queries-CLnP9kGu.js";
|
|
2
|
-
// ../../node_modules/.bun/@tanstack+react-query@5.105.3+cef22a3c7e8b4cef/node_modules/@tanstack/react-query/build/modern/useSuspenseQuery.js
|
|
3
|
-
/**
|
|
4
|
-
* The options for `useSuspenseQuery` are the same as for `useQuery`, except for `throwOnError`, `enabled`, and
|
|
5
|
-
* `placeholderData` — and `queryFn` may not be `skipToken`, since Suspense hooks can't render a "disabled" state.
|
|
6
|
-
*
|
|
7
|
-
* Caveat: cancellation does not work.
|
|
8
|
-
* @param options - The {@link UseSuspenseQueryOptions} to use — the same options as `useQuery`, minus the ones listed above.
|
|
9
|
-
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
10
|
-
* be used.
|
|
11
|
-
* @returns The same object as `useQuery`, except that `data` is guaranteed to be defined, `isPlaceholderData`
|
|
12
|
-
* is missing, and `status` is either `success` or `error` (with the derived flags set accordingly).
|
|
13
|
-
* @remarks Multiple `useSuspenseQuery` calls in the same component suspend serially, causing a request
|
|
14
|
-
* waterfall — each one blocks rendering until it resolves, so the next doesn't even start fetching until then.
|
|
15
|
-
* Use {@link useSuspenseQueries} instead when you have more than one suspenseful query in a component, so they
|
|
16
|
-
* fetch in parallel.
|
|
17
|
-
* @example
|
|
18
|
-
* The query error is thrown if the fetch fails and no cached data exists yet, so an error boundary is
|
|
19
|
-
* required around `<Suspense>`. A failed background refetch instead continues to render the cached data.
|
|
20
|
-
* Use {@link QueryErrorResetBoundary} to let the user retry after such an error:
|
|
21
|
-
* ```tsx
|
|
22
|
-
* import { Suspense } from 'react'
|
|
23
|
-
* import { ErrorBoundary } from 'react-error-boundary'
|
|
24
|
-
* import { QueryErrorResetBoundary, useSuspenseQuery } from '@tanstack/react-query'
|
|
25
|
-
*
|
|
26
|
-
* function Posts() {
|
|
27
|
-
* // `data` is guaranteed to be defined here — no `isPending` check needed.
|
|
28
|
-
* const { data, isFetching } = useSuspenseQuery({
|
|
29
|
-
* queryKey: ['posts'],
|
|
30
|
-
* queryFn: fetchPosts,
|
|
31
|
-
* })
|
|
32
|
-
*
|
|
33
|
-
* return (
|
|
34
|
-
* <div>
|
|
35
|
-
* <h1>Posts {isFetching ? '(refreshing...)' : null}</h1>
|
|
36
|
-
* <ul>
|
|
37
|
-
* {data.map((post) => (
|
|
38
|
-
* <li key={post.id}>{post.title}</li>
|
|
39
|
-
* ))}
|
|
40
|
-
* </ul>
|
|
41
|
-
* </div>
|
|
42
|
-
* )
|
|
43
|
-
* }
|
|
44
|
-
*
|
|
45
|
-
* function App() {
|
|
46
|
-
* return (
|
|
47
|
-
* <QueryErrorResetBoundary>
|
|
48
|
-
* {({ reset }) => (
|
|
49
|
-
* <ErrorBoundary
|
|
50
|
-
* onReset={reset}
|
|
51
|
-
* fallbackRender={({ resetErrorBoundary }) => (
|
|
52
|
-
* <div>
|
|
53
|
-
* There was an error!
|
|
54
|
-
* <button onClick={() => resetErrorBoundary()}>Try again</button>
|
|
55
|
-
* </div>
|
|
56
|
-
* )}
|
|
57
|
-
* >
|
|
58
|
-
* <Suspense fallback={<h1>Loading posts...</h1>}>
|
|
59
|
-
* <Posts />
|
|
60
|
-
* </Suspense>
|
|
61
|
-
* </ErrorBoundary>
|
|
62
|
-
* )}
|
|
63
|
-
* </QueryErrorResetBoundary>
|
|
64
|
-
* )
|
|
65
|
-
* }
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
function useSuspenseQuery(options, queryClient) {
|
|
69
|
-
return useBaseQuery({
|
|
70
|
-
...options,
|
|
71
|
-
enabled: true,
|
|
72
|
-
suspense: true,
|
|
73
|
-
throwOnError: defaultThrowOnError,
|
|
74
|
-
placeholderData: void 0
|
|
75
|
-
}, QueryObserver, queryClient);
|
|
76
|
-
}
|
|
77
|
-
// src/lib/queries.ts
|
|
78
|
-
/** Cached data as it is, however old, else fetched: what `ensureQueryData` returned. */
|
|
79
|
-
function loadHeld(queryClient, options) {
|
|
80
|
-
return queryClient.query({
|
|
81
|
-
...options,
|
|
82
|
-
staleTime: "static"
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* The address's companion when it is registered, else `null`. The layout shows the picker then,
|
|
87
|
-
* so a view loader loads nothing rather than failing the page.
|
|
88
|
-
*/
|
|
89
|
-
async function registeredCompanion(queryClient, search) {
|
|
90
|
-
if (!search.companion) return null;
|
|
91
|
-
return (await loadHeld(queryClient, shellQuery({
|
|
92
|
-
companion: search.companion,
|
|
93
|
-
studioMode: search.studioMode
|
|
94
|
-
}))).selected?.digest ?? null;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* A view loader's data: awaited on the server, so the first response carries it; started but
|
|
98
|
-
* not awaited in the browser, so navigation switches at once and the view suspends meanwhile.
|
|
99
|
-
* Held data is left as it is, so a hover preload reads nothing; the view's own query refreshes
|
|
100
|
-
* it in the background when stale.
|
|
101
|
-
*/
|
|
102
|
-
async function loadView(queryClient, options, onServer = Boolean(true)) {
|
|
103
|
-
if (onServer) return loadHeld(queryClient, options);
|
|
104
|
-
loadHeld(queryClient, options).catch(() => {});
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
export { useSuspenseQuery as i, loadView as n, registeredCompanion as r, loadHeld as t };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// src/lib/report-time.ts
|
|
2
|
-
var pad = (part) => String(part).padStart(2, "0");
|
|
3
|
-
/** A report's local publishing time, the same in every view and independent of the locale. */
|
|
4
|
-
function formatReportTime(createdAt) {
|
|
5
|
-
const at = new Date(createdAt);
|
|
6
|
-
return `${at.getFullYear()}-${pad(at.getMonth() + 1)}-${pad(at.getDate())} ${pad(at.getHours())}:${pad(at.getMinutes())}`;
|
|
7
|
-
}
|
|
8
|
-
export { formatReportTime as t };
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { i as __toESM } from "./rolldown-runtime-DYf_mQCB.js";
|
|
2
|
-
import { n as useQuery } from "./react-COs0LHn-.js";
|
|
3
|
-
import { A as require_react, l as require_jsx_runtime, s as useRouter } from "./__23tanstack-start-server-fn-resolver-BQKuMdJW.js";
|
|
4
|
-
import "./studio-BeltxxKt.js";
|
|
5
|
-
import { g as usePageUi, o as Route, p as useAppearance } from "./router-BH--drIx.js";
|
|
6
|
-
import { t as formatReportTime } from "./report-time-DAfzln-N.js";
|
|
7
|
-
import { c as reportsQuery, x as REPORT_VIEW_PREFIX } from "./studio-queries-CLnP9kGu.js";
|
|
8
|
-
// ../../node_modules/.bun/@tanstack+react-router@1.170.46+7492c01c6988791b/node_modules/@tanstack/react-router/dist/esm/useLocation.js
|
|
9
|
-
/**
|
|
10
|
-
* Read the current location from the router state with optional selection.
|
|
11
|
-
* Useful for subscribing to just the pieces of location you care about.
|
|
12
|
-
*
|
|
13
|
-
* Options:
|
|
14
|
-
* - `select`: Project the `location` object to a derived value
|
|
15
|
-
* - `structuralSharing`: Enable structural sharing for stable references
|
|
16
|
-
*
|
|
17
|
-
* @returns The current location (or selected value).
|
|
18
|
-
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLocationHook
|
|
19
|
-
*/
|
|
20
|
-
function useLocation(opts) {
|
|
21
|
-
const router = useRouter();
|
|
22
|
-
{
|
|
23
|
-
const location = router.stores.location.get();
|
|
24
|
-
return opts?.select ? opts.select(location) : location;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
// src/views/reports/reports-view.tsx
|
|
28
|
-
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
29
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
30
|
-
/** The report the address names, as `#report=<id>`. */
|
|
31
|
-
var REPORT_ID = /(?:^|[#&])report=([0-9a-f]{32})/;
|
|
32
|
-
/** The chosen report while listed, else the one the address names, else the newest. */
|
|
33
|
-
function shownReport(list, chosen, named) {
|
|
34
|
-
const listed = (id) => list.some((report) => report.id === id);
|
|
35
|
-
if (listed(chosen)) return chosen;
|
|
36
|
-
if (listed(named)) return named;
|
|
37
|
-
return list[0]?.id ?? null;
|
|
38
|
-
}
|
|
39
|
-
function reportSrc(id, theme) {
|
|
40
|
-
const scheme = theme === "system" ? "" : `?scheme=${theme}`;
|
|
41
|
-
return `${REPORT_VIEW_PREFIX}${id}${scheme}`;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Hosted reports: the list, and the chosen one in a sandboxed frame. A new report lists as it
|
|
45
|
-
* is published; the frame reloads in the appearance chosen in Studio.
|
|
46
|
-
*/
|
|
47
|
-
function Reports({ companion }) {
|
|
48
|
-
const reports = useQuery(reportsQuery(companion));
|
|
49
|
-
const theme = useAppearance((state) => state.theme);
|
|
50
|
-
const clearReports = usePageUi((state) => state.clearReports);
|
|
51
|
-
const named = REPORT_ID.exec(useLocation({ select: (location) => `#${location.hash}` }))?.[1];
|
|
52
|
-
const [chosen, setChosen] = (0, import_react.useState)(null);
|
|
53
|
-
(0, import_react.useEffect)(clearReports, [clearReports]);
|
|
54
|
-
const list = reports.data ?? [];
|
|
55
|
-
const shown = shownReport(list, chosen, named);
|
|
56
|
-
(0, import_react.useEffect)(() => {
|
|
57
|
-
if (!shown) return;
|
|
58
|
-
try {
|
|
59
|
-
history.replaceState(history.state, "", `#report=${shown}`);
|
|
60
|
-
} catch {}
|
|
61
|
-
}, [shown]);
|
|
62
|
-
const src = shown ? reportSrc(shown, theme) : null;
|
|
63
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
|
|
64
|
-
className: "view-section",
|
|
65
|
-
"data-reports-view": true,
|
|
66
|
-
"aria-label": "Hosted reports",
|
|
67
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
68
|
-
className: "view-summary",
|
|
69
|
-
children: "Reports published by agent sessions Studio started."
|
|
70
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
71
|
-
className: "reports-layout",
|
|
72
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
73
|
-
className: "reports-side",
|
|
74
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
|
|
75
|
-
id: "reports-list",
|
|
76
|
-
className: "reports-list",
|
|
77
|
-
"aria-label": "Reports",
|
|
78
|
-
children: list.map((report) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
79
|
-
type: "button",
|
|
80
|
-
"data-report-id": report.id,
|
|
81
|
-
"aria-pressed": report.id === shown,
|
|
82
|
-
onClick: () => setChosen(report.id),
|
|
83
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
84
|
-
"data-report-title": true,
|
|
85
|
-
children: report.title
|
|
86
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
87
|
-
className: "report-time",
|
|
88
|
-
"data-report-time": true,
|
|
89
|
-
children: formatReportTime(report.createdAt)
|
|
90
|
-
})]
|
|
91
|
-
}) }, report.id))
|
|
92
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
93
|
-
id: "reports-empty",
|
|
94
|
-
className: "empty",
|
|
95
|
-
hidden: list.length > 0,
|
|
96
|
-
children: "No hosted reports yet."
|
|
97
|
-
})]
|
|
98
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
99
|
-
className: "reports-main",
|
|
100
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
101
|
-
className: "reports-bar",
|
|
102
|
-
children: src ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
|
|
103
|
-
id: "reports-open",
|
|
104
|
-
href: src,
|
|
105
|
-
target: "_blank",
|
|
106
|
-
rel: "noopener noreferrer",
|
|
107
|
-
children: "Open in new tab"
|
|
108
|
-
}) : null
|
|
109
|
-
}), src ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("iframe", {
|
|
110
|
-
id: "reports-frame",
|
|
111
|
-
className: "reports-frame",
|
|
112
|
-
title: "Hosted report",
|
|
113
|
-
sandbox: "allow-scripts allow-modals",
|
|
114
|
-
referrerPolicy: "no-referrer",
|
|
115
|
-
src
|
|
116
|
-
}, src) : null]
|
|
117
|
-
})]
|
|
118
|
-
})]
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
// src/routes/reports.tsx?tsr-split=component
|
|
122
|
-
var SplitComponent = function ReportsRoute() {
|
|
123
|
-
const { companion } = Route.useSearch();
|
|
124
|
-
return companion ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Reports, { companion }) : null;
|
|
125
|
-
};
|
|
126
|
-
export { SplitComponent as component };
|