@bendyline/gezel-service 1.1.1 → 1.1.2
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/NOTICE.md +3 -3
- package/dist/bin/gezeld.js +8471 -5311
- package/dist/handboek-content/technical/building-connected-apps-with-gezel-app-sdk.md +78 -0
- package/dist/handboek-content/whats-new/{1.26250.md → 1.26251.md} +5 -5
- package/dist/index-store/static-index-worker.js +160 -51
- package/dist/index.d.ts +416 -71
- package/dist/index.js +8465 -5305
- package/dist/memory/embed-worker.js +132 -4
- package/dist/memory/image-embed-worker.js +14 -5
- package/dist/providers/mlx/python/cache_persist.py +52 -8
- package/dist/providers/mlx/python/gezel_mlx_server.py +44 -1
- package/dist/providers/mlx/python/qwen4_ple.py +159 -0
- package/dist/providers/mlx/python/spec_decode.py +73 -31
- package/dist/providers/mlx/python/tool_call_stream.py +10 -2
- package/dist/providers/mlx/python/tool_grammar.py +16 -0
- package/dist/ui/assets/{AmbientDashboardCard-DcVHxEdC.js → AmbientDashboardCard-_xnAQGnk.js} +1 -1
- package/dist/ui/assets/{AudioEngineSettings-BFM2S1mm.js → AudioEngineSettings-CgXgbX0i.js} +1 -1
- package/dist/ui/assets/{BenchmarksView-84-YeULA.js → BenchmarksView-BlExZpYA.js} +1 -1
- package/dist/ui/assets/CatalogBrowser-DYXUZQ_t.js +1 -0
- package/dist/ui/assets/{ChannelsSettings-7NAVUk4k.js → ChannelsSettings-EH27HcqZ.js} +1 -1
- package/dist/ui/assets/ChatTimelineView-Dn1TNyVn.js +7 -0
- package/dist/ui/assets/{ConnectedAppsPanel-CIgF4Q3R.js → ConnectedAppsPanel-BROry-Y0.js} +1 -1
- package/dist/ui/assets/CraftbookEditor-B2RNJnFf.js +1 -0
- package/dist/ui/assets/{CraftbookScriptEditorView-Ck5tzj3Y.js → CraftbookScriptEditorView-B-vySmHP.js} +1 -1
- package/dist/ui/assets/{CraftbookTabContent-BWg7FhK_.js → CraftbookTabContent-BW_2KC89.js} +1 -1
- package/dist/ui/assets/{CraftbookToolsetSetup-EuFOiUzR.js → CraftbookToolsetSetup-J7rEa835.js} +1 -1
- package/dist/ui/assets/{CraftbooksView-BIzQ1VVn.js → CraftbooksView-BjBUWPGF.js} +1 -1
- package/dist/ui/assets/DiffpackReviewView-CD4qJmgT.js +1 -0
- package/dist/ui/assets/DocumentDetail-SYozruTJ.js +1 -0
- package/dist/ui/assets/DocumentsView-DE7eL49Z.js +1 -0
- package/dist/ui/assets/{Ds4Settings-9soZCSeO.js → Ds4Settings-DGzc7JcD.js} +1 -1
- package/dist/ui/assets/{EmbeddedChat-Cce7nxXT.js → EmbeddedChat-D92TaJQ8.js} +1 -1
- package/dist/ui/assets/{FaceRecognitionCard-BVZyOwB8.js → FaceRecognitionCard-CB1Dt9X4.js} +1 -1
- package/dist/ui/assets/FileMapView-kVBG22FU.js +1 -0
- package/dist/ui/assets/FoldersSettings-BWFQU5B4.js +1 -0
- package/dist/ui/assets/GezelDetail-Br4v42Nv.js +1 -0
- package/dist/ui/assets/{GezelJsonEditor-DXXt165-.js → GezelJsonEditor-B9XEiW5Y.js} +1 -1
- package/dist/ui/assets/GezellenView-DheEBAy4.js +1 -0
- package/dist/ui/assets/{GildeUpdatesCard-CtY8mUTA.js → GildeUpdatesCard-BeIYv09f.js} +1 -1
- package/dist/ui/assets/{GithubSignInChip-DT3l6E0Q.js → GithubSignInChip-eEGCe9ar.js} +1 -1
- package/dist/ui/assets/{HandboekMediaProvider-ByJ4NAzz.js → HandboekMediaProvider-D0zcbbpf.js} +1 -1
- package/dist/ui/assets/HandboekView-p0BZT1rH.js +1 -0
- package/dist/ui/assets/{HistoryView-CkinzFEC.js → HistoryView-CKWcWW-Y.js} +1 -1
- package/dist/ui/assets/{HomeView-DNBrQnwy.js → HomeView-b_TT5oV3.js} +1 -1
- package/dist/ui/assets/{ImageEngineSettings-BfM9HSd_.js → ImageEngineSettings-CJfk4OJ4.js} +1 -1
- package/dist/ui/assets/{ImageRecognitionSettings-CaSQu5Br.js → ImageRecognitionSettings-DzbvZk5S.js} +1 -1
- package/dist/ui/assets/{IncompleteDownloads-C36lTCMG.js → IncompleteDownloads-C8_XyP8O.js} +1 -1
- package/dist/ui/assets/{KnowledgeCatalogsCard-CK9bqdf6.js → KnowledgeCatalogsCard-CHopG_j-.js} +1 -1
- package/dist/ui/assets/KnowledgeView-CXNKZUJq.js +1 -0
- package/dist/ui/assets/{LlamaCppSettings-CdNMHBbp.js → LlamaCppSettings-ohcM7kes.js} +1 -1
- package/dist/ui/assets/{MarkdownField-Dugmfr_e.js → MarkdownField-BX0qsaFq.js} +1 -1
- package/dist/ui/assets/{MemoriesTree-CgFqUNEr.js → MemoriesTree-BPj5Rod8.js} +1 -1
- package/dist/ui/assets/{MicrophoneSettings-DzDe9y1q.js → MicrophoneSettings-CWjeYnfI.js} +1 -1
- package/dist/ui/assets/MlxSettings-Dq6dRpcl.js +1 -0
- package/dist/ui/assets/{ModelPicker-BVkJhNAH.js → ModelPicker-0Ue-eEKj.js} +1 -1
- package/dist/ui/assets/NewPathDialog-BhAZm9dp.js +1 -0
- package/dist/ui/assets/{NewScriptDialog-TEAd0KLl.js → NewScriptDialog-DuryIe50.js} +1 -1
- package/dist/ui/assets/NewTaskDialog-BX24flMY.js +2 -0
- package/dist/ui/assets/{OllamaSettings-CPy2vxyZ.js → OllamaSettings-Boj8Nd1G.js} +1 -1
- package/dist/ui/assets/ProjectChat-Dhw_M5bq.js +5 -0
- package/dist/ui/assets/ProjectConnectionsTab-BwpMQNrg.js +1 -0
- package/dist/ui/assets/{ProjectGitStatusBar-BgHZ2ijN.js → ProjectGitStatusBar-BORGYx5l.js} +1 -1
- package/dist/ui/assets/{ProjectGithubView-BV2uTNU0.js → ProjectGithubView-CTP1BOMv.js} +1 -1
- package/dist/ui/assets/{ProjectMailTab-DLtJdXSL.js → ProjectMailTab-qFmAeV3M.js} +1 -1
- package/dist/ui/assets/{ProjectOverviewView-ZMs9nL5N.js → ProjectOverviewView-Cq1FsoaT.js} +1 -1
- package/dist/ui/assets/{ProjectTimeline-CTPcn4Kc.js → ProjectTimeline-Cqae2Z92.js} +1 -1
- package/dist/ui/assets/ProjectsView-D0uJjUB-.js +7 -0
- package/dist/ui/assets/{RecommendedBadge-iUoisQBi.js → RecommendedBadge-CN1jEmSn.js} +1 -1
- package/dist/ui/assets/{RemoteServersPanel-CTVJ0IRh.js → RemoteServersPanel-CMakvCCM.js} +1 -1
- package/dist/ui/assets/{ScriptEditorTabs-CCDFZjdC.js → ScriptEditorTabs-st6dJePd.js} +2 -2
- package/dist/ui/assets/{ScriptEditorView-CergLqKj.js → ScriptEditorView-BkySh57_.js} +2 -2
- package/dist/ui/assets/{ScriptsView-v7ckdhDi.js → ScriptsView-7uPKwjDB.js} +1 -1
- package/dist/ui/assets/{SecurityComplianceSettings-Bd0-66Gs.js → SecurityComplianceSettings-Tsv_pXfy.js} +1 -1
- package/dist/ui/assets/SessionSwitcher-D0fSeeHO.js +1 -0
- package/dist/ui/assets/SettingsView-cli_z8ZW.js +3 -0
- package/dist/ui/assets/{SquisqIntegration-C5l_OPvD.js → SquisqIntegration-BTZ1kBlg.js} +1 -1
- package/dist/ui/assets/{StorageCleanupDialog-3kv9-2mT.js → StorageCleanupDialog-CDBjl8JQ.js} +1 -1
- package/dist/ui/assets/{StorageUsageCard-7sWTrZFa.js → StorageUsageCard-DXY1j0dZ.js} +1 -1
- package/dist/ui/assets/TaskTabContent-C0P681SL.js +1 -0
- package/dist/ui/assets/TasksView-Ddwz10ri.js +1 -0
- package/dist/ui/assets/{TerminalCodeEditor-ChmdzmCz.js → TerminalCodeEditor-BkNQ6QoQ.js} +2 -2
- package/dist/ui/assets/ToolsetsEditor-KVigemfL.js +8 -0
- package/dist/ui/assets/{TransformToolbarButton-gzIxUBH7.js → TransformToolbarButton-8wfJR1bO.js} +2 -2
- package/dist/ui/assets/{UnrecognizedModels-0hptopv6.js → UnrecognizedModels-BzdU1clO.js} +1 -1
- package/dist/ui/assets/{VideoEngineSettings-BdNzCEdR.js → VideoEngineSettings-f79ff57u.js} +1 -1
- package/dist/ui/assets/{WorkspaceIndexPane-DnsOO916.js → WorkspaceIndexPane-fu5V6o1W.js} +1 -1
- package/dist/ui/assets/{api-C0I7spBl.js → api-CmrgM5Rf.js} +1 -1
- package/dist/ui/assets/chat-thread-memory-8MCtb17Q.js +1 -0
- package/dist/ui/assets/{chunk-6ECMNUIP-BvCy0HUI.js → chunk-6ECMNUIP-D5AA6ozp.js} +1 -1
- package/dist/ui/assets/{chunk-A6N6IN3I-ofeM4l8g.js → chunk-A6N6IN3I-BpxihS5H.js} +1 -1
- package/dist/ui/assets/{chunk-ATWVNF7D-CYuW1Yc6.js → chunk-ATWVNF7D-CKIWh7bN.js} +1 -1
- package/dist/ui/assets/{chunk-UBFT2CDQ-FexGDigd.js → chunk-CW24CH7I-BD0FIooX.js} +1 -1
- package/dist/ui/assets/{chunk-DXYWKZ52-zxe8pjH4.js → chunk-DXYWKZ52-DMKPZnpo.js} +1 -1
- package/dist/ui/assets/chunk-IIQYS2YH-BtDJt4Xr.js +1 -0
- package/dist/ui/assets/{chunk-KGWT454C-v5-l6U5m.js → chunk-KGWT454C-DsQOBuLg.js} +1 -1
- package/dist/ui/assets/{chunk-Q77KNJIN-BLuPdsQF.js → chunk-Q77KNJIN-BdWizq9s.js} +1 -1
- package/dist/ui/assets/{chunk-USU6HTKB-B_p-YcDp.js → chunk-USU6HTKB-DyGZplh4.js} +1 -1
- package/dist/ui/assets/{chunk-UXEANVBI-Bt0kX-0Z.js → chunk-UXEANVBI-BUBXvqyE.js} +1 -1
- package/dist/ui/assets/{chunk-O7JILDEF-CqcO1qaI.js → chunk-X7BNDUNI-D14WIvlD.js} +2 -2
- package/dist/ui/assets/{chunk-AE3IUKMM-mZjzzO8Z.js → chunk-ZSU5DJLX-CrjQf-vs.js} +1 -1
- package/dist/ui/assets/{container-BI8hxN1N.js → container-iFj1r6Hk.js} +1 -1
- package/dist/ui/assets/csv-Di411Mv-.js +1 -0
- package/dist/ui/assets/data-Q05qqAp4.js +1 -0
- package/dist/ui/assets/{dist-APSIK7H3.js → dist-1FNFiksd.js} +3 -3
- package/dist/ui/assets/dist-BMZhqfv7.js +2 -0
- package/dist/ui/assets/dist-CE5CbmDb.js +225 -0
- package/dist/ui/assets/doc-BHcGsJZd.js +587 -0
- package/dist/ui/assets/{document-import-DPK4r8Am.js → document-import-B2Ya6sbf.js} +1 -1
- package/dist/ui/assets/{docx-DRLuCTaC.js → docx-B8Pwz5Ih.js} +1 -1
- package/dist/ui/assets/{epub-a0p2Xb1b.js → epub-BQ4g8Q9j.js} +1 -1
- package/dist/ui/assets/{export-options-BqYFyzWx.js → export-options-Dylv69b3.js} +1 -1
- package/dist/ui/assets/file-browser-BLOPfnS0.js +5 -0
- package/dist/ui/assets/{html-BbQNmJ5X.js → html-BnA7qFwq.js} +1 -1
- package/dist/ui/assets/icons-CyM7Cg4E.js +1 -0
- package/dist/ui/assets/index-DW6qHqhU.css +1 -0
- package/dist/ui/assets/index-DivKnJyx.js +36 -0
- package/dist/ui/assets/{mail-link-CWfsP5Aq.js → mail-link-NtlcX5OE.js} +1 -1
- package/dist/ui/assets/{markdown-ryKA_OmY.js → markdown-CLKH_zzl.js} +1 -1
- package/dist/ui/assets/markdown-baseline-0dqv9qbV.js +1 -0
- package/dist/ui/assets/materialize-G4WC5UG3-xq2dcwS8.js +1 -0
- package/dist/ui/assets/{monaco-base-C0VTMpv-.js → monaco-base-BSvdAweA.js} +1 -1
- package/dist/ui/assets/{monaco-setup-CX8q88c5.js → monaco-setup-CT7LZ0o_.js} +1 -1
- package/dist/ui/assets/{new-project-meta-ZmDPGYzC.js → new-project-meta-5Y9Blozr.js} +1 -1
- package/dist/ui/assets/outside-in-Msmhxf_U.js +3 -0
- package/dist/ui/assets/{pdf-BHrygJa5.js → pdf-C4BhW3zg.js} +1 -1
- package/dist/ui/assets/{pending-drafts-27ujtQxX.js → pending-drafts-BD227X9H.js} +1 -1
- package/dist/ui/assets/{poppetje-CfaAvFkE.js → poppetje-DvCJO36y.js} +3 -3
- package/dist/ui/assets/{pptx-nDW64jAN.js → pptx-B6uaM2s7.js} +3 -3
- package/dist/ui/assets/{run-export-86KzLZ7R.js → run-export-TscWwR6y.js} +2 -2
- package/dist/ui/assets/{standalone-source-7QdiNsDW.js → standalone-source-Cw9SF7Zk.js} +1 -1
- package/dist/ui/assets/storage-Cmhlwx70.js +1 -0
- package/dist/ui/assets/styles-BjDaWeMA.css +1 -0
- package/dist/ui/assets/styles-CqO-rmOt.js +554 -0
- package/dist/ui/assets/{terminal-monaco-setup-Bar-sYKd.js → terminal-monaco-setup-me523-j-.js} +1 -1
- package/dist/ui/assets/{transform-CmAXy0Ck.js → transform-DxJCwK68.js} +1 -1
- package/dist/ui/assets/{use-local-model-manager-D1yiurrC.js → use-local-model-manager-8wvk-I-y.js} +1 -1
- package/dist/ui/assets/{useCompactLayout-BDtPQcDh.js → useCompactLayout-cm4E9Vja.js} +0 -0
- package/dist/ui/assets/{useCopilotAvailability-BHOfHrfT.js → useCopilotAvailability-D9hglSH_.js} +1 -1
- package/dist/ui/assets/{useDiffpacks-B0kYhlWQ.js → useDiffpacks-1BN2XJWg.js} +1 -1
- package/dist/ui/assets/{useGitSync-DOt-ODiw.js → useGitSync-7m9YA7h5.js} +1 -1
- package/dist/ui/assets/{useShowWorkInProgressFeatures-BtpredG7.js → useShowWorkInProgressFeatures-D6QOaTUT.js} +1 -1
- package/dist/ui/assets/{useTotalRamBytes-B8NFM27w.js → useTotalRamBytes-Durk383U.js} +1 -1
- package/dist/ui/assets/{xlsx-B_pu1ZvY.js → xlsx-BbHA9bxA.js} +1 -1
- package/dist/ui/index.html +15 -15
- package/package.json +12 -11
- package/dist/ui/assets/CatalogBrowser-7_jHy5Q3.js +0 -1
- package/dist/ui/assets/ChatTimelineView-Cg_kLK_U.js +0 -7
- package/dist/ui/assets/CraftbookEditor-BKAIsnXv.js +0 -1
- package/dist/ui/assets/DiffpackReviewView-B2a3zgE-.js +0 -1
- package/dist/ui/assets/DocumentDetail-GCYhwQqV.js +0 -1
- package/dist/ui/assets/DocumentsView-Cm3RaQ5N.js +0 -1
- package/dist/ui/assets/FileMapView-BKJovLcL.js +0 -1
- package/dist/ui/assets/FoldersSettings-CuJd2JdE.js +0 -1
- package/dist/ui/assets/GezelDetail-D_KIPDhQ.js +0 -1
- package/dist/ui/assets/GezellenView-BOOW1QQU.js +0 -1
- package/dist/ui/assets/HandboekView-gRzJcIbJ.js +0 -1
- package/dist/ui/assets/KnowledgeView-DJ3cJVHA.js +0 -1
- package/dist/ui/assets/MlxSettings-45mBFHbA.js +0 -1
- package/dist/ui/assets/NewTaskDialog-CIXVunZn.js +0 -2
- package/dist/ui/assets/ProjectChat-BiJRweob.js +0 -5
- package/dist/ui/assets/ProjectConnectionsTab-CQgaIzuv.js +0 -1
- package/dist/ui/assets/ProjectsView-BUdR76n6.js +0 -7
- package/dist/ui/assets/SessionSwitcher-BgZqyiRn.js +0 -1
- package/dist/ui/assets/SettingsView-DLhOYiR5.js +0 -3
- package/dist/ui/assets/TaskTabContent-CG2KmfwV.js +0 -1
- package/dist/ui/assets/TasksView-Dy5Ue4zS.js +0 -1
- package/dist/ui/assets/ToolsetsEditor-J9XxQ5Ms.js +0 -8
- package/dist/ui/assets/chat-thread-memory-CI2-giEq.js +0 -1
- package/dist/ui/assets/chunk-IIQYS2YH-DEkyBlHg.js +0 -1
- package/dist/ui/assets/csv-B0D9jJG2.js +0 -1
- package/dist/ui/assets/data-BIL84EaT.js +0 -1
- package/dist/ui/assets/dist-CJqyWK6E.js +0 -2
- package/dist/ui/assets/dist-DOqbRmFj.js +0 -225
- package/dist/ui/assets/doc-C2Ph2FWI.js +0 -584
- package/dist/ui/assets/document-companion-aDThLOwl.js +0 -1
- package/dist/ui/assets/file-browser-DVyWN0LD.js +0 -5
- package/dist/ui/assets/icons-DWaUNQbT.js +0 -1
- package/dist/ui/assets/index-DDu8nyO6.js +0 -34
- package/dist/ui/assets/index-DEDUSiCx.css +0 -1
- package/dist/ui/assets/markdown-baseline-9B52XlX2.js +0 -1
- package/dist/ui/assets/materialize-G4WC5UG3-BlZQe-88.js +0 -1
- package/dist/ui/assets/outside-in-BmIIeMid.js +0 -3
- package/dist/ui/assets/storage-B-vhjyV2.js +0 -1
- package/dist/ui/assets/styles-BvkZd-EV.js +0 -550
- package/dist/ui/assets/styles-IQ4adxWr.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-CEpd2cAX.js";import{
|
|
1
|
+
import{t as e}from"./jsx-runtime-CEpd2cAX.js";import{bt as t}from"./dist-CE5CbmDb.js";var n=e();function r({manifest:e}){return t(e)?(0,n.jsx)(`span`,{className:`reco-badge`,title:`A recommended on-device model — fully open, tool-capable, and a good default for its size.`,children:`★ Recommended`}):null}export{r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{t as r}from"./api-C0I7spBl.js";import{n as i,t as a}from"./relative-time-B2kBaekd.js";import{t as o}from"./ConfirmDialog-Dt1ed4Fh.js";var s=e(t(),1),c=n();function l(e){return(e.slice(0,16).match(/.{1,4}/g)??[]).join(` `)}function u(e){return e?i(e):`never`}var d={port:``,bindAddress:``,priority:`equal`,allowModels:``,maxConcurrentPerDevice:``,maxChatPerDevice:``,requestsPerMinute:``},ee=[{id:`equal`,label:`Equal`,title:`Remote turns queue like local work`},{id:`below-local`,label:`Local first`,title:`This machine's own work always drains first`},{id:`above-local`,label:`Remote first`,title:`Paired devices get priority over local work`}];function f(e){return{port:e?.port===void 0?``:String(e.port),bindAddress:e?.bindAddress??``,priority:e?.priority??`equal`,allowModels:(e?.allowModels??[]).join(`, `),maxConcurrentPerDevice:e?.limits?.maxConcurrentPerDevice===void 0?``:String(e.limits.maxConcurrentPerDevice),maxChatPerDevice:e?.limits?.maxChatPerDevice===void 0?``:String(e.limits.maxChatPerDevice),requestsPerMinute:e?.limits?.requestsPerMinute===void 0?``:String(e.limits.requestsPerMinute)}}function p(e,t){let n=e=>{let t=Number.parseInt(e.trim(),10);return Number.isFinite(t)&&t>0?t:void 0},r=n(e.port),i=e.bindAddress.trim(),a=e.allowModels.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean),o={},s=n(e.maxConcurrentPerDevice),c=n(e.maxChatPerDevice),l=n(e.requestsPerMinute);return s!==void 0&&(o.maxConcurrentPerDevice=s),c!==void 0&&(o.maxChatPerDevice=c),l!==void 0&&(o.requestsPerMinute=l),{enabled:t,...i?{bindAddress:i}:{},...r===void 0?{}:{port:r},...e.priority===`equal`?{}:{priority:e.priority},...a.length>0?{allowModels:a}:{},...Object.keys(o).length>0?{limits:o}:{}}}function m(){let[e,t]=(0,s.useState)([]),[n,i]=(0,s.useState)(null),[m,h]=(0,s.useState)(!1),[g,_]=(0,s.useState)(void 0),[v,y]=(0,s.useState)(null),[b,x]=(0,s.useState)([]),[S,C]=(0,s.useState)([]),[w,T]=(0,s.useState)(!1),[E,D]=(0,s.useState)(null),[O,k]=(0,s.useState)(null),[A,j]=(0,s.useState)(``),[M,N]=(0,s.useState)(``),[P,F]=(0,s.useState)(null),[I,L]=(0,s.useState)(null),[R,z]=(0,s.useState)(null),[B,V]=(0,s.useState)(d),[H,U]=(0,s.useState)(!1),W=(0,s.useRef)(!1),G=(0,s.useCallback)(e=>{W.current=e,U(e)},[]),K=(0,s.useCallback)(e=>{V(t=>({...t,...e})),G(!0)},[G]),q=(0,s.useCallback)(async()=>{try{let[e,n]=await Promise.all([r.listRemotes(),r.getConfig()]);t(e.remotes),h(!!n.remoteServing?.enabled),_(n.remoteServing?.port),W.current||V(f(n.remoteServing)),D(null)}catch(e){D(e instanceof Error?e.message:String(e))}try{let e=await r.getMachineServing();y(e),h(!!e.config.enabled),_(e.status.port??e.config.port),W.current||V(f(e.config));let[t,n]=await Promise.all([r.listMachineServingGrants(),r.listMachineServingDevices()]);x(t.grants.filter(e=>e.status===`pending`)),C(n.devices)}catch{y(null),x([]),C([])}try{let e=await fetch(`${r.getBaseUrl()}/v1/identity`,{headers:r.authHeader()});if(e.ok){let t=await e.json();i({deviceId:t.deviceId,fingerprint:t.fingerprint})}}catch{}},[]);(0,s.useEffect)(()=>{if(!v){T(!1);return}let e=!1;return(async()=>{try{let t=await fetch(`${r.getBaseUrl()}/v1/apps`,{headers:r.authHeader()});if(!t.ok)return;let n=await t.json();e||T((n.apps??[]).some(e=>e.kind===`device`))}catch{}})(),()=>{e=!0}},[v]),(0,s.useEffect)(()=>{q();let e=window.setInterval(()=>void q(),5e3);return()=>window.clearInterval(e)},[q]);let J=(0,s.useCallback)(async e=>{k(`serving`);try{let t=p(B,e);if(v){let e=await r.updateMachineServing(t);y(e),h(!!e.config.enabled),_(e.status.port??e.config.port),V(f(e.config))}else{let e=await r.updateConfig({remoteServing:t});h(!!e.remoteServing?.enabled),_(e.remoteServing?.port),V(f(e.remoteServing))}G(!1),D(null)}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}},[v,B,G]),Y=(0,s.useCallback)(()=>{G(!1),q()},[G,q]),X=(0,s.useCallback)(async(e,t)=>{k(`grant:${e.id}`);try{t?await r.approveMachineServingGrant(e.id):await r.denyMachineServingGrant(e.id),D(null),await q()}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}},[q]),Z=(0,s.useCallback)(async()=>{if(R){k(`revoke`);try{await r.revokeMachineServingDevice(R.appId),z(null),await q()}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}}},[R,q]),Q=(0,s.useCallback)(async()=>{if(!(!A.trim()||O)){k(`pair`);try{let e=A.trim(),t=await r.inspectRemote({baseUrl:e});F({baseUrl:e,...M.trim()?{displayName:M.trim()}:{},...t}),D(null)}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}}},[A,M,O]),te=(0,s.useCallback)(async()=>{if(P){k(`pair`);try{await r.pairRemote({baseUrl:P.baseUrl,...P.displayName?{displayName:P.displayName}:{},expectedIdentityFingerprint:P.fingerprint,...P.identityChanged?{acceptIdentityChange:!0}:{}}),F(null),j(``),N(``),D(null),await q()}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}}},[P,q]),ne=(0,s.useCallback)(async()=>{if(I){k(`unpair`);try{await r.unpairRemote(I.remoteId),L(null),await q()}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}}},[I,q]),$=v?v.identity.fingerprint:n?.fingerprint??null;return(0,c.jsxs)(`section`,{className:`settings-section`,children:[(0,c.jsx)(`h2`,{children:`Remote Servers`}),(0,c.jsx)(`p`,{className:`muted small`,children:`Run models on another gezel device over your LAN. Pair with a powerful machine to use its big models as if they were local — chat and image/video/audio generation. The agentic loop and your files stay on this device; only the model runs remotely.`}),E&&(0,c.jsx)(`p`,{className:`settings-error`,role:`alert`,children:E}),(0,c.jsxs)(`div`,{className:`settings-subsection`,children:[(0,c.jsx)(`h3`,{children:v?`This machine as a server`:`This device as a server`}),(0,c.jsxs)(`label`,{className:`settings-toggle`,children:[(0,c.jsx)(`input`,{type:`checkbox`,checked:m,disabled:O===`serving`,onChange:e=>void J(e.target.checked)}),(0,c.jsx)(`span`,{children:`Serve my models to paired devices over the LAN`})]}),m?(0,c.jsxs)(`p`,{className:`muted small`,children:[`Other devices on your network can request inference here once you approve their pairing`,v?` below`:` (Connected Apps → Paired devices)`,`. They reach only inference — never your projects or files.`,v?` Served by the machine service, so it keeps working while nobody is logged in.`:``,` `,`Listening on port `,g??6229,`.`]}):(0,c.jsx)(`p`,{className:`muted small`,children:`Off — no other device can run models here.`}),$&&(0,c.jsxs)(`div`,{className:`device-code-block`,children:[(0,c.jsxs)(`span`,{className:`muted small`,children:[v?`This machine's identity code`:`This device's identity code`,` — when you pair from another device, check that it shows the same code:`]}),(0,c.jsx)(`code`,{className:`device-code`,children:l($)}),(0,c.jsxs)(`details`,{className:`device-code-full`,children:[(0,c.jsx)(`summary`,{className:`muted small`,children:`Show the full fingerprint`}),(0,c.jsx)(`code`,{style:{wordBreak:`break-all`},children:$})]})]}),v&&w&&(0,c.jsx)(`p`,{className:`muted small`,children:`Some devices paired with this account's daemon before the machine service took over serving. Those pairings no longer work — ask them to unpair and pair again against this machine's identity code above.`}),(0,c.jsxs)(`div`,{className:`remote-serving-fields`,children:[(0,c.jsxs)(`div`,{className:`remote-serving-field`,children:[(0,c.jsx)(`span`,{className:`muted small`,children:`Port`}),(0,c.jsx)(`input`,{type:`number`,min:1,max:65535,placeholder:`6229`,value:B.port,onChange:e=>K({port:e.target.value})})]}),(0,c.jsxs)(`div`,{className:`remote-serving-field`,children:[(0,c.jsx)(`span`,{className:`muted small`,children:`Network interface (IP)`}),(0,c.jsx)(`input`,{type:`text`,placeholder:`all networks (0.0.0.0)`,value:B.bindAddress,onChange:e=>K({bindAddress:e.target.value})})]}),(0,c.jsxs)(`div`,{className:`remote-serving-field`,children:[(0,c.jsx)(`span`,{className:`muted small`,children:`Max concurrent per device`}),(0,c.jsx)(`input`,{type:`number`,min:1,placeholder:`4`,value:B.maxConcurrentPerDevice,onChange:e=>K({maxConcurrentPerDevice:e.target.value})})]}),(0,c.jsxs)(`div`,{className:`remote-serving-field`,children:[(0,c.jsx)(`span`,{className:`muted small`,children:`Max chat per device`}),(0,c.jsx)(`input`,{type:`number`,min:1,placeholder:`same as concurrent`,value:B.maxChatPerDevice,onChange:e=>K({maxChatPerDevice:e.target.value})})]}),(0,c.jsxs)(`div`,{className:`remote-serving-field`,children:[(0,c.jsx)(`span`,{className:`muted small`,children:`Requests per minute per device`}),(0,c.jsx)(`input`,{type:`number`,min:1,placeholder:`unlimited`,value:B.requestsPerMinute,onChange:e=>K({requestsPerMinute:e.target.value})})]}),(0,c.jsxs)(`div`,{className:`remote-serving-field remote-serving-field-wide`,children:[(0,c.jsxs)(`span`,{className:`muted small`,children:[`Allowed models — comma-separated ids like `,(0,c.jsx)(`code`,{children:`llama-cpp:gemma4-e4b-q4`}),`; empty serves every installed model`]}),(0,c.jsx)(`input`,{type:`text`,placeholder:`all installed models`,value:B.allowModels,onChange:e=>K({allowModels:e.target.value})})]}),(0,c.jsxs)(`div`,{className:`remote-serving-field remote-serving-field-wide`,children:[(0,c.jsx)(`span`,{className:`muted small`,children:`When remote and local work compete`}),(0,c.jsx)(`div`,{className:`gz-tray`,role:`radiogroup`,"aria-label":`Remote work priority`,children:ee.map(e=>(0,c.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":B.priority===e.id,className:`gz-key${B.priority===e.id?` gz-key-active`:``}`,title:e.title,onClick:()=>K({priority:e.id}),children:e.label},e.id))})]})]}),H&&(0,c.jsxs)(`div`,{className:`remote-serving-actions`,children:[(0,c.jsx)(`button`,{type:`button`,className:`primary`,disabled:O!==null,onClick:()=>void J(m),children:O===`serving`?`Applying…`:`Apply server settings`}),(0,c.jsx)(`button`,{type:`button`,disabled:O!==null,onClick:Y,children:`Discard changes`})]})]}),v&&b.length>0&&(0,c.jsxs)(`div`,{className:`settings-subsection`,children:[(0,c.jsx)(`h3`,{children:`Pending pairing requests`}),(0,c.jsx)(`ul`,{className:`settings-list`,children:b.map(e=>(0,c.jsxs)(`li`,{className:`connected-app-row`,children:[(0,c.jsxs)(`div`,{className:`connected-app-meta`,children:[(0,c.jsx)(`div`,{className:`connected-app-name`,children:e.appName}),(0,c.jsxs)(`div`,{className:`muted small`,title:a(e.createdAt),children:[`requested `,u(e.createdAt),` — scopes: `,e.scopes.join(`, `)]})]}),(0,c.jsxs)(`div`,{className:`connected-app-actions`,children:[(0,c.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>void X(e,!0),disabled:O!==null,children:`Approve`}),(0,c.jsx)(`button`,{type:`button`,onClick:()=>void X(e,!1),disabled:O!==null,children:`Deny`})]})]},e.id))})]}),v&&S.length>0&&(0,c.jsxs)(`div`,{className:`settings-subsection`,children:[(0,c.jsx)(`h3`,{children:`Devices paired with this machine`}),(0,c.jsx)(`ul`,{className:`settings-list`,children:S.map(e=>(0,c.jsxs)(`li`,{className:`connected-app-row`,children:[(0,c.jsxs)(`div`,{className:`connected-app-meta`,children:[(0,c.jsx)(`div`,{className:`connected-app-name`,children:e.appName}),(0,c.jsxs)(`div`,{className:`muted small`,title:a(e.lastUsedAt),children:[`paired `,u(e.createdAt),` — last used `,u(e.lastUsedAt)]})]}),(0,c.jsx)(`div`,{className:`connected-app-actions`,children:(0,c.jsx)(`button`,{type:`button`,className:`danger`,onClick:()=>z(e),disabled:O!==null,children:`Revoke`})})]},e.appId))})]}),(0,c.jsxs)(`div`,{className:`settings-subsection`,children:[(0,c.jsx)(`h3`,{children:`Paired servers`}),(0,c.jsxs)(`div`,{className:`remote-pair-form`,children:[(0,c.jsx)(`input`,{type:`text`,placeholder:`https://192.168.1.50:6229`,value:A,onChange:e=>j(e.target.value)}),(0,c.jsx)(`input`,{type:`text`,placeholder:`Name (optional)`,value:M,onChange:e=>N(e.target.value)}),(0,c.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>void Q(),disabled:O!==null||!A.trim(),children:O===`pair`?`Pairing…`:`Pair`})]}),e.length===0?(0,c.jsx)(`p`,{className:`muted small`,children:`No servers paired yet.`}):(0,c.jsx)(`ul`,{className:`settings-list`,children:e.map(e=>(0,c.jsxs)(`li`,{className:`connected-app-row`,children:[(0,c.jsxs)(`div`,{className:`connected-app-meta`,children:[(0,c.jsx)(`div`,{className:`connected-app-name`,children:e.displayName}),(0,c.jsxs)(`div`,{className:`muted small`,title:a(e.lastSeenAt),children:[e.baseUrl,` — identity code`,` `,(0,c.jsx)(`code`,{children:l(e.pinnedIdentityFingerprint)}),` — last seen`,` `,u(e.lastSeenAt)]})]}),(0,c.jsx)(`div`,{className:`connected-app-actions`,children:(0,c.jsx)(`button`,{type:`button`,className:`danger`,onClick:()=>L(e),disabled:O!==null,children:`Unpair`})})]},e.remoteId))})]}),(0,c.jsx)(o,{open:P!==null,title:P?.identityChanged?`Server identity changed`:`Check the identity code`,message:P?(0,c.jsxs)(c.Fragment,{children:[`On the server device, open Settings → Remote Servers and check that it shows this same identity code:`,(0,c.jsxs)(`div`,{className:`device-code-block`,children:[(0,c.jsx)(`code`,{className:`device-code`,children:l(P.fingerprint)}),(0,c.jsxs)(`details`,{className:`device-code-full`,children:[(0,c.jsx)(`summary`,{className:`muted small`,children:`Show the full fingerprint`}),(0,c.jsx)(`code`,{style:{wordBreak:`break-all`},children:P.fingerprint})]})]}),P.identityChanged&&P.existingFingerprint&&(0,c.jsxs)(c.Fragment,{children:[`This is not the code you trusted before. Continue only if you know why it changed — a reinstall or a wiped keychain does this, and so does someone impersonating the server. Previously trusted:`,` `,(0,c.jsx)(`code`,{children:l(P.existingFingerprint)})]})]}):null,confirmLabel:P?.identityChanged?`Trust new identity`:`The code matches`,danger:P?.identityChanged===!0,onConfirm:te,onCancel:()=>F(null)}),(0,c.jsx)(o,{open:I!==null,title:I?`Unpair ${I.displayName}?`:`Unpair server`,message:I?(0,c.jsxs)(c.Fragment,{children:[`This device will forget `,(0,c.jsx)(`strong`,{children:I.displayName}),` and its remote models will disappear from your model picker. You can pair again later.`]}):null,confirmLabel:`Unpair`,danger:!0,onConfirm:ne,onCancel:()=>L(null)}),(0,c.jsx)(o,{open:R!==null,title:R?`Revoke ${R.appName}?`:`Revoke device`,message:R?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`strong`,{children:R.appName}),` will immediately lose access to this machine's models. It can pair again later, which you would approve here.`]}):null,confirmLabel:`Revoke`,danger:!0,onConfirm:Z,onCancel:()=>z(null)})]})}export{m as RemoteServersPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{t as r}from"./api-CmrgM5Rf.js";import{n as i,t as a}from"./relative-time-B2kBaekd.js";import{t as o}from"./ConfirmDialog-Dt1ed4Fh.js";var s=e(t(),1),c=n();function l(e){return(e.slice(0,16).match(/.{1,4}/g)??[]).join(` `)}function u(e){return e?i(e):`never`}var d={port:``,bindAddress:``,priority:`equal`,allowModels:``,maxConcurrentPerDevice:``,maxChatPerDevice:``,requestsPerMinute:``},ee=[{id:`equal`,label:`Equal`,title:`Remote turns queue like local work`},{id:`below-local`,label:`Local first`,title:`This machine's own work always drains first`},{id:`above-local`,label:`Remote first`,title:`Paired devices get priority over local work`}];function f(e){return{port:e?.port===void 0?``:String(e.port),bindAddress:e?.bindAddress??``,priority:e?.priority??`equal`,allowModels:(e?.allowModels??[]).join(`, `),maxConcurrentPerDevice:e?.limits?.maxConcurrentPerDevice===void 0?``:String(e.limits.maxConcurrentPerDevice),maxChatPerDevice:e?.limits?.maxChatPerDevice===void 0?``:String(e.limits.maxChatPerDevice),requestsPerMinute:e?.limits?.requestsPerMinute===void 0?``:String(e.limits.requestsPerMinute)}}function p(e,t){let n=e=>{let t=Number.parseInt(e.trim(),10);return Number.isFinite(t)&&t>0?t:void 0},r=n(e.port),i=e.bindAddress.trim(),a=e.allowModels.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean),o={},s=n(e.maxConcurrentPerDevice),c=n(e.maxChatPerDevice),l=n(e.requestsPerMinute);return s!==void 0&&(o.maxConcurrentPerDevice=s),c!==void 0&&(o.maxChatPerDevice=c),l!==void 0&&(o.requestsPerMinute=l),{enabled:t,...i?{bindAddress:i}:{},...r===void 0?{}:{port:r},...e.priority===`equal`?{}:{priority:e.priority},...a.length>0?{allowModels:a}:{},...Object.keys(o).length>0?{limits:o}:{}}}function m(){let[e,t]=(0,s.useState)([]),[n,i]=(0,s.useState)(null),[m,h]=(0,s.useState)(!1),[g,_]=(0,s.useState)(void 0),[v,y]=(0,s.useState)(null),[b,x]=(0,s.useState)([]),[S,C]=(0,s.useState)([]),[w,T]=(0,s.useState)(!1),[E,D]=(0,s.useState)(null),[O,k]=(0,s.useState)(null),[A,j]=(0,s.useState)(``),[M,N]=(0,s.useState)(``),[P,F]=(0,s.useState)(null),[I,L]=(0,s.useState)(null),[R,z]=(0,s.useState)(null),[B,V]=(0,s.useState)(d),[H,U]=(0,s.useState)(!1),W=(0,s.useRef)(!1),G=(0,s.useCallback)(e=>{W.current=e,U(e)},[]),K=(0,s.useCallback)(e=>{V(t=>({...t,...e})),G(!0)},[G]),q=(0,s.useCallback)(async()=>{try{let[e,n]=await Promise.all([r.listRemotes(),r.getConfig()]);t(e.remotes),h(!!n.remoteServing?.enabled),_(n.remoteServing?.port),W.current||V(f(n.remoteServing)),D(null)}catch(e){D(e instanceof Error?e.message:String(e))}try{let e=await r.getMachineServing();y(e),h(!!e.config.enabled),_(e.status.port??e.config.port),W.current||V(f(e.config));let[t,n]=await Promise.all([r.listMachineServingGrants(),r.listMachineServingDevices()]);x(t.grants.filter(e=>e.status===`pending`)),C(n.devices)}catch{y(null),x([]),C([])}try{let e=await fetch(`${r.getBaseUrl()}/v1/identity`,{headers:r.authHeader()});if(e.ok){let t=await e.json();i({deviceId:t.deviceId,fingerprint:t.fingerprint})}}catch{}},[]);(0,s.useEffect)(()=>{if(!v){T(!1);return}let e=!1;return(async()=>{try{let t=await fetch(`${r.getBaseUrl()}/v1/apps`,{headers:r.authHeader()});if(!t.ok)return;let n=await t.json();e||T((n.apps??[]).some(e=>e.kind===`device`))}catch{}})(),()=>{e=!0}},[v]),(0,s.useEffect)(()=>{q();let e=window.setInterval(()=>void q(),5e3);return()=>window.clearInterval(e)},[q]);let J=(0,s.useCallback)(async e=>{k(`serving`);try{let t=p(B,e);if(v){let e=await r.updateMachineServing(t);y(e),h(!!e.config.enabled),_(e.status.port??e.config.port),V(f(e.config))}else{let e=await r.updateConfig({remoteServing:t});h(!!e.remoteServing?.enabled),_(e.remoteServing?.port),V(f(e.remoteServing))}G(!1),D(null)}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}},[v,B,G]),Y=(0,s.useCallback)(()=>{G(!1),q()},[G,q]),X=(0,s.useCallback)(async(e,t)=>{k(`grant:${e.id}`);try{t?await r.approveMachineServingGrant(e.id):await r.denyMachineServingGrant(e.id),D(null),await q()}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}},[q]),Z=(0,s.useCallback)(async()=>{if(R){k(`revoke`);try{await r.revokeMachineServingDevice(R.appId),z(null),await q()}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}}},[R,q]),Q=(0,s.useCallback)(async()=>{if(!(!A.trim()||O)){k(`pair`);try{let e=A.trim(),t=await r.inspectRemote({baseUrl:e});F({baseUrl:e,...M.trim()?{displayName:M.trim()}:{},...t}),D(null)}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}}},[A,M,O]),te=(0,s.useCallback)(async()=>{if(P){k(`pair`);try{await r.pairRemote({baseUrl:P.baseUrl,...P.displayName?{displayName:P.displayName}:{},expectedIdentityFingerprint:P.fingerprint,...P.identityChanged?{acceptIdentityChange:!0}:{}}),F(null),j(``),N(``),D(null),await q()}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}}},[P,q]),ne=(0,s.useCallback)(async()=>{if(I){k(`unpair`);try{await r.unpairRemote(I.remoteId),L(null),await q()}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}}},[I,q]),$=v?v.identity.fingerprint:n?.fingerprint??null;return(0,c.jsxs)(`section`,{className:`settings-section`,children:[(0,c.jsx)(`h2`,{children:`Remote Servers`}),(0,c.jsx)(`p`,{className:`muted small`,children:`Run models on another gezel device over your LAN. Pair with a powerful machine to use its big models as if they were local — chat and image/video/audio generation. The agentic loop and your files stay on this device; only the model runs remotely.`}),E&&(0,c.jsx)(`p`,{className:`settings-error`,role:`alert`,children:E}),(0,c.jsxs)(`div`,{className:`settings-subsection`,children:[(0,c.jsx)(`h3`,{children:v?`This machine as a server`:`This device as a server`}),(0,c.jsxs)(`label`,{className:`settings-toggle`,children:[(0,c.jsx)(`input`,{type:`checkbox`,checked:m,disabled:O===`serving`,onChange:e=>void J(e.target.checked)}),(0,c.jsx)(`span`,{children:`Serve my models to paired devices over the LAN`})]}),m?(0,c.jsxs)(`p`,{className:`muted small`,children:[`Other devices on your network can request inference here once you approve their pairing`,v?` below`:` (Connected Apps → Paired devices)`,`. They reach only inference — never your projects or files.`,v?` Served by the machine service, so it keeps working while nobody is logged in.`:``,` `,`Listening on port `,g??6229,`.`]}):(0,c.jsx)(`p`,{className:`muted small`,children:`Off — no other device can run models here.`}),$&&(0,c.jsxs)(`div`,{className:`device-code-block`,children:[(0,c.jsxs)(`span`,{className:`muted small`,children:[v?`This machine's identity code`:`This device's identity code`,` — when you pair from another device, check that it shows the same code:`]}),(0,c.jsx)(`code`,{className:`device-code`,children:l($)}),(0,c.jsxs)(`details`,{className:`device-code-full`,children:[(0,c.jsx)(`summary`,{className:`muted small`,children:`Show the full fingerprint`}),(0,c.jsx)(`code`,{style:{wordBreak:`break-all`},children:$})]})]}),v&&w&&(0,c.jsx)(`p`,{className:`muted small`,children:`Some devices paired with this account's daemon before the machine service took over serving. Those pairings no longer work — ask them to unpair and pair again against this machine's identity code above.`}),(0,c.jsxs)(`div`,{className:`remote-serving-fields`,children:[(0,c.jsxs)(`div`,{className:`remote-serving-field`,children:[(0,c.jsx)(`span`,{className:`muted small`,children:`Port`}),(0,c.jsx)(`input`,{type:`number`,min:1,max:65535,placeholder:`6229`,value:B.port,onChange:e=>K({port:e.target.value})})]}),(0,c.jsxs)(`div`,{className:`remote-serving-field`,children:[(0,c.jsx)(`span`,{className:`muted small`,children:`Network interface (IP)`}),(0,c.jsx)(`input`,{type:`text`,placeholder:`all networks (0.0.0.0)`,value:B.bindAddress,onChange:e=>K({bindAddress:e.target.value})})]}),(0,c.jsxs)(`div`,{className:`remote-serving-field`,children:[(0,c.jsx)(`span`,{className:`muted small`,children:`Max concurrent per device`}),(0,c.jsx)(`input`,{type:`number`,min:1,placeholder:`4`,value:B.maxConcurrentPerDevice,onChange:e=>K({maxConcurrentPerDevice:e.target.value})})]}),(0,c.jsxs)(`div`,{className:`remote-serving-field`,children:[(0,c.jsx)(`span`,{className:`muted small`,children:`Max chat per device`}),(0,c.jsx)(`input`,{type:`number`,min:1,placeholder:`same as concurrent`,value:B.maxChatPerDevice,onChange:e=>K({maxChatPerDevice:e.target.value})})]}),(0,c.jsxs)(`div`,{className:`remote-serving-field`,children:[(0,c.jsx)(`span`,{className:`muted small`,children:`Requests per minute per device`}),(0,c.jsx)(`input`,{type:`number`,min:1,placeholder:`unlimited`,value:B.requestsPerMinute,onChange:e=>K({requestsPerMinute:e.target.value})})]}),(0,c.jsxs)(`div`,{className:`remote-serving-field remote-serving-field-wide`,children:[(0,c.jsxs)(`span`,{className:`muted small`,children:[`Allowed models — comma-separated ids like `,(0,c.jsx)(`code`,{children:`llama-cpp:gemma4-e4b-q4`}),`; empty serves every installed model`]}),(0,c.jsx)(`input`,{type:`text`,placeholder:`all installed models`,value:B.allowModels,onChange:e=>K({allowModels:e.target.value})})]}),(0,c.jsxs)(`div`,{className:`remote-serving-field remote-serving-field-wide`,children:[(0,c.jsx)(`span`,{className:`muted small`,children:`When remote and local work compete`}),(0,c.jsx)(`div`,{className:`gz-tray`,role:`radiogroup`,"aria-label":`Remote work priority`,children:ee.map(e=>(0,c.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":B.priority===e.id,className:`gz-key${B.priority===e.id?` gz-key-active`:``}`,title:e.title,onClick:()=>K({priority:e.id}),children:e.label},e.id))})]})]}),H&&(0,c.jsxs)(`div`,{className:`remote-serving-actions`,children:[(0,c.jsx)(`button`,{type:`button`,className:`primary`,disabled:O!==null,onClick:()=>void J(m),children:O===`serving`?`Applying…`:`Apply server settings`}),(0,c.jsx)(`button`,{type:`button`,disabled:O!==null,onClick:Y,children:`Discard changes`})]})]}),v&&b.length>0&&(0,c.jsxs)(`div`,{className:`settings-subsection`,children:[(0,c.jsx)(`h3`,{children:`Pending pairing requests`}),(0,c.jsx)(`ul`,{className:`settings-list`,children:b.map(e=>(0,c.jsxs)(`li`,{className:`connected-app-row`,children:[(0,c.jsxs)(`div`,{className:`connected-app-meta`,children:[(0,c.jsx)(`div`,{className:`connected-app-name`,children:e.appName}),(0,c.jsxs)(`div`,{className:`muted small`,title:a(e.createdAt),children:[`requested `,u(e.createdAt),` — scopes: `,e.scopes.join(`, `)]})]}),(0,c.jsxs)(`div`,{className:`connected-app-actions`,children:[(0,c.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>void X(e,!0),disabled:O!==null,children:`Approve`}),(0,c.jsx)(`button`,{type:`button`,onClick:()=>void X(e,!1),disabled:O!==null,children:`Deny`})]})]},e.id))})]}),v&&S.length>0&&(0,c.jsxs)(`div`,{className:`settings-subsection`,children:[(0,c.jsx)(`h3`,{children:`Devices paired with this machine`}),(0,c.jsx)(`ul`,{className:`settings-list`,children:S.map(e=>(0,c.jsxs)(`li`,{className:`connected-app-row`,children:[(0,c.jsxs)(`div`,{className:`connected-app-meta`,children:[(0,c.jsx)(`div`,{className:`connected-app-name`,children:e.appName}),(0,c.jsxs)(`div`,{className:`muted small`,title:a(e.lastUsedAt),children:[`paired `,u(e.createdAt),` — last used `,u(e.lastUsedAt)]})]}),(0,c.jsx)(`div`,{className:`connected-app-actions`,children:(0,c.jsx)(`button`,{type:`button`,className:`danger`,onClick:()=>z(e),disabled:O!==null,children:`Revoke`})})]},e.appId))})]}),(0,c.jsxs)(`div`,{className:`settings-subsection`,children:[(0,c.jsx)(`h3`,{children:`Paired servers`}),(0,c.jsxs)(`div`,{className:`remote-pair-form`,children:[(0,c.jsx)(`input`,{type:`text`,placeholder:`https://192.168.1.50:6229`,value:A,onChange:e=>j(e.target.value)}),(0,c.jsx)(`input`,{type:`text`,placeholder:`Name (optional)`,value:M,onChange:e=>N(e.target.value)}),(0,c.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>void Q(),disabled:O!==null||!A.trim(),children:O===`pair`?`Pairing…`:`Pair`})]}),e.length===0?(0,c.jsx)(`p`,{className:`muted small`,children:`No servers paired yet.`}):(0,c.jsx)(`ul`,{className:`settings-list`,children:e.map(e=>(0,c.jsxs)(`li`,{className:`connected-app-row`,children:[(0,c.jsxs)(`div`,{className:`connected-app-meta`,children:[(0,c.jsx)(`div`,{className:`connected-app-name`,children:e.displayName}),(0,c.jsxs)(`div`,{className:`muted small`,title:a(e.lastSeenAt),children:[e.baseUrl,` — identity code`,` `,(0,c.jsx)(`code`,{children:l(e.pinnedIdentityFingerprint)}),` — last seen`,` `,u(e.lastSeenAt)]})]}),(0,c.jsx)(`div`,{className:`connected-app-actions`,children:(0,c.jsx)(`button`,{type:`button`,className:`danger`,onClick:()=>L(e),disabled:O!==null,children:`Unpair`})})]},e.remoteId))})]}),(0,c.jsx)(o,{open:P!==null,title:P?.identityChanged?`Server identity changed`:`Check the identity code`,message:P?(0,c.jsxs)(c.Fragment,{children:[`On the server device, open Settings → Remote Servers and check that it shows this same identity code:`,(0,c.jsxs)(`div`,{className:`device-code-block`,children:[(0,c.jsx)(`code`,{className:`device-code`,children:l(P.fingerprint)}),(0,c.jsxs)(`details`,{className:`device-code-full`,children:[(0,c.jsx)(`summary`,{className:`muted small`,children:`Show the full fingerprint`}),(0,c.jsx)(`code`,{style:{wordBreak:`break-all`},children:P.fingerprint})]})]}),P.identityChanged&&P.existingFingerprint&&(0,c.jsxs)(c.Fragment,{children:[`This is not the code you trusted before. Continue only if you know why it changed — a reinstall or a wiped keychain does this, and so does someone impersonating the server. Previously trusted:`,` `,(0,c.jsx)(`code`,{children:l(P.existingFingerprint)})]})]}):null,confirmLabel:P?.identityChanged?`Trust new identity`:`The code matches`,danger:P?.identityChanged===!0,onConfirm:te,onCancel:()=>F(null)}),(0,c.jsx)(o,{open:I!==null,title:I?`Unpair ${I.displayName}?`:`Unpair server`,message:I?(0,c.jsxs)(c.Fragment,{children:[`This device will forget `,(0,c.jsx)(`strong`,{children:I.displayName}),` and its remote models will disappear from your model picker. You can pair again later.`]}):null,confirmLabel:`Unpair`,danger:!0,onConfirm:ne,onCancel:()=>L(null)}),(0,c.jsx)(o,{open:R!==null,title:R?`Revoke ${R.appName}?`:`Revoke device`,message:R?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`strong`,{children:R.appName}),` will immediately lose access to this machine's models. It can pair again later, which you would approve here.`]}):null,confirmLabel:`Revoke`,danger:!0,onConfirm:Z,onCancel:()=>z(null)})]})}export{m as RemoteServersPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-setup-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-setup-CT7LZ0o_.js","assets/dist-CE5CbmDb.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-DeTXJU-n.js","assets/preload-helper-Czpn1I53.js","assets/chunk-V4NBQF5C-D9I4DV9v.js","assets/iconLabel-uMn49Ame.js","assets/iconLabel-Bdh_-Hrb.css","assets/codiconStyles-104B1IQ5.js","assets/codiconStyles-Bp1tMeMk.css","assets/editor.api-DShZZcgD.js","assets/editor-BOOlEWca.css","assets/monaco-Cvm179Eb.css","assets/monaco-base-BSvdAweA.js","assets/index-DivKnJyx.js","assets/jsx-runtime-CEpd2cAX.js","assets/react-dom-OL4w_gzs.js","assets/dist-BMZhqfv7.js","assets/api-CmrgM5Rf.js","assets/primitives-CWrGZpPI.js","assets/Tabs-jE0Z5Tzd.js","assets/NewPathDialog-BhAZm9dp.js","assets/DropdownMenu-DlrvEmoV.js","assets/dist-Q59u9cBl.js","assets/relative-time-B2kBaekd.js","assets/FileTypeIcon-Cwzl1GkZ.js","assets/model-context-DBqdK0PS.js","assets/model-memory-copy-Ds9w1uJE.js","assets/StorageCleanupDialog-CDBjl8JQ.js","assets/poppetje-DvCJO36y.js","assets/safe-svg-image-NbuPaBIv.js","assets/ConfirmDialog-Dt1ed4Fh.js","assets/model-inventory-ykSm_IT5.js","assets/doc-BHcGsJZd.js","assets/chunk-X7BNDUNI-D14WIvlD.js","assets/chunk-BAOV476U-CEOFYt8X.js","assets/chunk-4VOD55SX-BFSSw0c8.js","assets/chunk-GAZKTT4R-w1SNypWQ.js","assets/chunk-CW24CH7I-BD0FIooX.js","assets/chunk-XRW6P7IF-BeQQgMVK.js","assets/chunk-7ZAAICW4-BsCpYJH6.js","assets/markdown-CLKH_zzl.js","assets/schemas-BvLZUsGm.js","assets/chunk-6ECMNUIP-D5AA6ozp.js","assets/inlineIconMarker-BQI2HLeD.js","assets/chunk-TT6ENR6T-BOA-qiwP.js","assets/chunk-DQRELU4S--U9FIVtY.js","assets/new-project-meta-5Y9Blozr.js","assets/chunk-ZSU5DJLX-CrjQf-vs.js","assets/index-DW6qHqhU.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{$ as r,It as i,Ot as a,_n as o,hn as s,vn as c,wt as l}from"./dist-CE5CbmDb.js";import{i as u,n as d,r as f,t as p}from"./Tabs-jE0Z5Tzd.js";import{t as m}from"./preload-helper-Czpn1I53.js";import{t as h}from"./GezelJsonEditor-B9XEiW5Y.js";import{Ct as g}from"./index-DivKnJyx.js";var _=e(t(),1),v=n();function y(e){e.trigger(`gezel-preamble`,`editor.fold`,{selectionLines:[1]})}var b=(0,_.forwardRef)(function({projectId:e,scriptName:t,initialSource:n,collapsePreambleOnMount:r,readOnly:i,onChangeContent:a,onSave:o,onProblems:s,onReady:c},l){let u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(null),[h,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(null),C=g(),w=(0,_.useRef)(a),T=(0,_.useRef)(o),E=(0,_.useRef)(s),D=(0,_.useRef)(c);(0,_.useEffect)(()=>{w.current=a,T.current=o,E.current=s,D.current=c},[a,o,s,c]);let O=(0,_.useRef)(n),k=(0,_.useRef)(r??!1),A=(0,_.useRef)(C);return A.current=C,(0,_.useEffect)(()=>{let n=!1,r=[];return(async()=>{let a;try{a=await m(()=>import(`./monaco-setup-CT7LZ0o_.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49]));let{api:e}=await m(async()=>{let{api:e}=await import(`./api-CmrgM5Rf.js`).then(e=>e.n);return{api:e}},__vite__mapDeps([18,2,17,1]));await a.ensureScriptTypescript(()=>e.getSdkTypes())}catch(e){n||S(e.message);return}if(n||!u.current)return;let o=a.monaco;d.current=o;let s=a.scriptModelUri(e,t);o.editor.getModel(s)?.dispose();let c=o.editor.createModel(O.current,`typescript`,s);p.current=c;let l=o.editor.create(u.current,{model:c,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,tabSize:2,fixedOverflowWidgets:!0,readOnly:i??!1});f.current=l,o.editor.setTheme(A.current===`dark`?`gezel-dark`:`gezel-light`),k.current&&y(l),r.push(c.onDidChangeContent(()=>w.current?.(c.getValue()))),l.addCommand(o.KeyMod.CtrlCmd|o.KeyCode.KeyS,()=>T.current?.()),r.push(o.editor.onDidChangeMarkers(e=>{if(!e.some(e=>e.toString()===s.toString()))return;let t=o.editor.getModelMarkers({resource:s});E.current?.(t.map(e=>({severity:e.severity===o.MarkerSeverity.Error?`error`:e.severity===o.MarkerSeverity.Warning?`warning`:`info`,message:e.message,line:e.startLineNumber,column:e.startColumn})))})),b(!0),D.current?.()})(),()=>{n=!0;for(let e of r)e.dispose();f.current?.dispose(),f.current=null,p.current?.dispose(),p.current=null}},[e,t,i]),(0,_.useEffect)(()=>{d.current?.editor.setTheme(C===`dark`?`gezel-dark`:`gezel-light`)},[C]),(0,_.useImperativeHandle)(l,()=>({getValue:()=>p.current?.getValue()??null,setValue:e=>p.current?.setValue(e),revealLine:e=>{f.current?.revealLineInCenter(e),f.current?.setPosition({lineNumber:e,column:1}),f.current?.focus()},focus:()=>f.current?.focus(),collapsePreamble:()=>{f.current&&y(f.current)},setServerDiagnostics:e=>{let t=d.current,n=p.current;!t||!n||t.editor.setModelMarkers(n,`gezel-save`,e.map(e=>({severity:e.severity===`error`?t.MarkerSeverity.Error:e.severity===`warning`?t.MarkerSeverity.Warning:t.MarkerSeverity.Info,message:e.message,startLineNumber:e.line??1,startColumn:e.column??1,endLineNumber:e.line??1,endColumn:e.column?e.column+1:1})))}}),[]),(0,v.jsxs)(`div`,{className:`script-code-editor`,children:[!h&&!x&&(0,v.jsx)(`p`,{className:`muted small`,children:`Loading editor…`}),x&&(0,v.jsxs)(`p`,{className:`script-code-editor__error`,children:[`Editor failed to load: `,x]}),(0,v.jsx)(`div`,{ref:u,className:`script-code-editor__host`})]})});function x({value:e,onChange:t,readOnly:n,issues:r}){return(0,v.jsxs)(`div`,{className:`script-meta-form`,children:[(0,v.jsx)(h,{schema:(0,_.useMemo)(()=>O(),[]),value:e,onChange:n?void 0:e=>t(e??{}),density:`compact`}),r&&r.length>0&&(0,v.jsx)(`ul`,{className:`script-meta-form__issues small`,children:r.map((e,t)=>(0,v.jsx)(`li`,{className:`error`,children:e},`${t}:${e}`))})]})}var S={type:`string`,title:`Name`,pattern:`^[a-zA-Z][\\w-]*$`,squisq:{width:`half`,help:`Becomes a key on the input/output object.`}},C={type:`string`,title:`Description`,squisq:{control:`multiline`,help:`What it is, for teammates and the test-run form.`}},w={type:`boolean`,title:`Required`},T={type:`string`,squisq:{control:`multiline`,help:`JSON (parsed on save).`}};function E(e,t,n){return{type:`object`,title:t,required:[`name`,`type`,`description`],properties:{name:S,type:{type:`string`,const:e,title:`Type`,squisq:{width:`half`}},description:C,required:w,...n}}}function D(e,t,n){return{type:`object`,title:t,required:[`name`,`type`,`description`],properties:{name:S,type:{type:`string`,const:e,title:`Type`,squisq:{width:`half`}},description:C,...n}}}function O(){return{type:`object`,required:[`name`,`description`],properties:{name:{type:`string`,title:`Script name`,pattern:`^[a-zA-Z][\\w-]*$`,squisq:{width:`half`,help:`Letters, digits, _ or -; must start with a letter.`}},description:{type:`string`,title:`Description`,minLength:10,squisq:{control:`multiline`,help:`At least 10 characters.`}},kind:{type:`string`,title:`Kind`,enum:[`action`,`gate`],default:`action`,squisq:{control:`segmented`,width:`half`,enumLabels:{action:`Action`,gate:`Gate`},help:`Gate scripts return a decision for a step gate.`}},inputs:{type:`array`,title:`Inputs`,squisq:{control:`card-stack`,addLabel:`Add input`,itemLabel:{fromField:`name`}},items:{type:`object`,required:[`name`,`type`,`description`],oneOf:[E(`string`,`Text`,{default:{type:`string`,title:`Default`},pattern:{type:`string`,title:`Pattern (regex)`},multiline:{type:`boolean`,title:`Multiline`}}),E(`number`,`Number`,{default:{type:`number`,title:`Default`},min:{type:`number`,title:`Min`,squisq:{width:`third`}},max:{type:`number`,title:`Max`,squisq:{width:`third`}},integer:{type:`boolean`,title:`Integer only`,squisq:{width:`third`}}}),E(`boolean`,`Boolean`,{default:{type:`boolean`,title:`Default`}}),E(`choice`,`Choice`,{default:{type:`string`,title:`Default`},options:{type:`array`,title:`Options`,minItems:1,squisq:{control:`card-stack`,addLabel:`Add option`,itemLabel:{fromField:`value`}},items:{type:`object`,required:[`value`],properties:{value:{type:`string`,title:`Value`,squisq:{width:`half`}},label:{type:`string`,title:`Label`,squisq:{width:`half`}}}}}}),E(`ref`,`Reference`,{kind:{type:`string`,title:`Refers to`,enum:[`gezel`,`task`,`artifact`,`document`],squisq:{control:`segmented`}}}),E(`json`,`JSON`,{defaultJson:{...T,title:`Default (JSON)`},schemaJson:{...T,title:`Schema (JSON)`}})]}},outputs:{type:`array`,title:`Outputs`,squisq:{control:`card-stack`,addLabel:`Add output`,itemLabel:{fromField:`name`}},items:{type:`object`,required:[`name`,`type`,`description`],oneOf:[D(`string`,`Text`,{nullable:{type:`boolean`,title:`Nullable`}}),D(`number`,`Number`,{nullable:{type:`boolean`,title:`Nullable`}}),D(`boolean`,`Boolean`,{nullable:{type:`boolean`,title:`Nullable`}}),D(`array`,`Array`,{itemType:{type:`string`,title:`Item type`,enum:[`string`,`number`,`boolean`,`object`],squisq:{control:`segmented`}}}),D(`object`,`Object`,{schemaJson:{...T,title:`Schema (JSON)`}}),D(`json`,`JSON`,{schemaJson:{...T,title:`Schema (JSON)`}})]}},requires:{type:`array`,title:`Allowed to (capabilities)`,squisq:{control:`chip-bin`,addLabel:`Add capability`,help:`e.g. network, llm, tasks.write, credential:github.token`},items:{type:`string`}}}}}var k=(0,_.forwardRef)(function({projectId:e,scriptName:t,initialSource:n,initialMeta:m,readOnly:h,onChangeContent:g,onSave:y,onProblems:S,onReady:C},w){let T=(0,_.useRef)(null),E=(0,_.useRef)(n),D=(0,_.useRef)(o(n)),O=(0,_.useRef)(!1),k=(0,_.useRef)(!1),A=(0,_.useRef)(0),[j,M]=(0,_.useState)(`script`),N=(0,_.useMemo)(()=>{if(m)return{value:a(m),ok:!0};let e=i(D.current.metaText);return e.ok?{value:a(e.meta),ok:!0}:{value:null,ok:!1}},[]),[P,F]=(0,_.useState)(N.value),[I,L]=(0,_.useState)(N.ok),[R,z]=(0,_.useState)([]),B=D.current.found,V=e=>{A.current++,T.current?.setValue(e),T.current?.collapsePreamble(),A.current--},H=()=>{let e=i(D.current.metaText);e.ok?(F(a(e.meta)),z([]),L(!0)):L(!1)},U=e=>{A.current>0||(E.current=e,D.current=o(e),k.current=!0,g?.(e))},W=e=>{F(e);let t=r(e);if(!t.ok){z(t.issues);return}z([]);let n=s(t.meta);D.current={...D.current,metaText:n,found:!0};let i=c({preamble:D.current.preamble,metaText:l(D.current),body:D.current.body});E.current=i,O.current=!0,g?.(i)},G=e=>{e===`script`&&O.current?(V(E.current),O.current=!1):e===`properties`&&k.current&&(H(),k.current=!1),M(e)};(0,_.useImperativeHandle)(w,()=>({getValue:()=>E.current,setValue:e=>{E.current=e,D.current=o(e),V(e),H(),O.current=!1,k.current=!1,g?.(e)},revealLine:e=>{j!==`script`&&G(`script`),T.current?.revealLine(e)},focus:()=>T.current?.focus(),setServerDiagnostics:e=>T.current?.setServerDiagnostics(e)}),[j]);let K=!B||!I;return(0,v.jsx)(`div`,{className:`script-editor-tabs`,children:(0,v.jsxs)(f,{value:j,onValueChange:e=>G(e),children:[(0,v.jsxs)(d,{"aria-label":`Script editor`,children:[(0,v.jsx)(u,{value:`script`,children:`Script`}),(0,v.jsx)(u,{value:`properties`,disabled:K,children:`Properties`})]}),(0,v.jsx)(p,{value:`script`,forceMount:!0,className:`script-editor-tabs__panel`,children:(0,v.jsx)(b,{ref:T,projectId:e,scriptName:t,initialSource:n,collapsePreambleOnMount:!0,readOnly:h,onChangeContent:U,onSave:y,onProblems:S,onReady:C})}),(0,v.jsx)(p,{value:`properties`,forceMount:!0,className:`script-editor-tabs__panel`,children:K||!P?(0,v.jsx)(`p`,{className:`placeholder small`,children:`The meta block can't be shown as a form — expand the setup section at the top of the Script tab and edit it there.`}):(0,v.jsx)(x,{value:P,onChange:W,readOnly:h,issues:R})})]})})});export{k as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{Mt as r,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{Mt as r,Nt as i}from"./dist-CE5CbmDb.js";import{t as a}from"./dist-BMZhqfv7.js";import{t as o}from"./api-CmrgM5Rf.js";import{i as s,n as c,r as ee,t as l}from"./Tabs-jE0Z5Tzd.js";import"./primitives-CWrGZpPI.js";import{t as te}from"./ConfirmDialog-Dt1ed4Fh.js";import{t as ne}from"./ScriptEditorTabs-st6dJePd.js";import{a as u,i as re,n as ie,o as ae,r as oe,s as d}from"./pending-drafts-BD227X9H.js";var f=e(t(),1),p=n(),m=new Map;function h(e){return`gezel:script-draft:${e}`}function se(e){let t=m.get(e);if(t!==void 0)return t;try{return window.localStorage.getItem(h(e))}catch{return null}}function g(e,t){m.set(e,t);try{window.localStorage.setItem(h(e),t)}catch{}}function ce(e){m.delete(e);try{window.localStorage.removeItem(h(e))}catch{}}function _(){m.clear()}var v=[{kind:`craftbook`,marker:`// @gezel-craftbook:`},{kind:`import`,marker:`// @gezel-import:`}];function le(e){for(let{kind:t,marker:n}of v){if(!e.startsWith(n))continue;let r=e.indexOf(`
|
|
2
2
|
`);return{kind:t,ref:(r===-1?e:e.slice(0,r)).slice(n.length).trim()}}return null}function ue(e){if(!v.some(({marker:t})=>e.startsWith(t)))return e;let t=e.indexOf(`
|
|
3
|
-
`);return t===-1?``:e.slice(t+1)}function de(e){return e?.includes(`did not declare it in meta.requires`)?/capability:\s*([\w.:-]+)/.exec(e)?.[1]??null:null}function fe(e,t){let n=/requires:\s*\[([^\]]*)\]/.exec(e);if(!n)return null;let r=(n[1]??``).trim().length>0?`requires: [${n[1]}, '${t}']`:`requires: ['${t}']`;return e.slice(0,n.index)+r+e.slice(n.index+n[0].length)}function pe(e,t){let n=[];for(let a of e)for(let e of a.craftbook.steps){let o={taskRef:a.ref,taskTitle:a.title,stepName:e.name};
|
|
3
|
+
`);return t===-1?``:e.slice(t+1)}function de(e){return e?.includes(`did not declare it in meta.requires`)?/capability:\s*([\w.:-]+)/.exec(e)?.[1]??null:null}function fe(e,t){let n=/requires:\s*\[([^\]]*)\]/.exec(e);if(!n)return null;let r=(n[1]??``).trim().length>0?`requires: [${n[1]}, '${t}']`:`requires: ['${t}']`;return e.slice(0,n.index)+r+e.slice(n.index+n[0].length)}function pe(e,t){let n=[];for(let a of e)for(let e of a.craftbook.steps){let o={taskRef:a.ref,taskTitle:a.title,stepName:e.name};r(e.onEnter).some(e=>e.name===t)&&n.push({...o,moment:`enter`}),e.gate&&i(e.gate).scripts.some(e=>e.name===t)&&n.push({...o,moment:`gate`}),r(e.onExit).some(e=>e.name===t)&&n.push({...o,moment:`exit`})}return n}function y({projectId:e,scriptName:t,scope:n}){let r=`${n?`${n}:`:``}${e}/${t}`,i=(0,f.useRef)(null),h=n===`standard`,[_,v]=(0,f.useState)(null),[y,he]=(0,f.useState)(null),b=(0,f.useRef)(``),[x,S]=(0,f.useState)(!1),[C,ge]=(0,f.useState)(!1),[_e,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(void 0),[D,O]=(0,f.useState)(!0),[ve,ye]=(0,f.useState)([]),[k,be]=(0,f.useState)([]),[A,j]=(0,f.useState)(null),[M,N]=(0,f.useState)(null),[P,xe]=(0,f.useState)(!1),[Se,F]=(0,f.useState)(!1),[Ce,I]=(0,f.useState)(!1),[L,we]=(0,f.useState)([]),[R,z]=(0,f.useState)(`about`),[Te,B]=(0,f.useState)(null),[V,H]=(0,f.useState)({}),[Ee,De]=(0,f.useState)(!1),[Oe,U]=(0,f.useState)(null),[W,ke]=(0,f.useState)(null),[Ae,je]=(0,f.useState)(null),[Me,Ne]=(0,f.useState)(!1),G=(0,f.useRef)(null),K=(0,f.useRef)(null),q=(0,f.useCallback)(()=>{G.current&&clearTimeout(G.current),G.current=null,K.current=null,ce(r)},[r]);(0,f.useEffect)(()=>()=>{if(!G.current)return;clearTimeout(G.current),G.current=null;let e=K.current;K.current=null,e!==null&&g(r,e)},[r]),(0,f.useEffect)(()=>{let a=!1;return(n===`standard`?o.getStandardScriptSource(t):n===`user`?o.getUserScriptSource(t):o.getProjectScriptSource(e,t)).then(n=>{if(a)return;let s=se(r);b.current=n.source,v(s!==null&&s!==n.source?{...n,source:s}:n),S(s!==null&&s!==n.source),I(s!==null&&s!==n.source),E(n.meta),O(!n.metaError),N(n.provenance??null),n.metaError&&ye([{severity:`error`,source:`meta`,message:n.metaError}]),n.meta&&H(u(n.meta));let c=ie(r);c&&(B(`busy`),o.draftProjectScript(e,{name:t,description:c}).then(({source:e})=>{a||(B(null),i.current?i.current.setValue(e):(v(t=>t&&{...t,source:e}),S(!0),m.set(r,e)))}).catch(()=>{a||B(`failed`)}))}).catch(e=>{a||he(e.message)}),o.listProjectTasks(e).then(e=>{a||we(pe(e.tasks,t))}).catch(()=>{}),()=>{a=!0}},[e,t,n,r]);let J=(0,f.useCallback)(e=>{let t=e!==b.current;if(S(t),!t){q();return}m.set(r,e),K.current=e,G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{G.current=null,K.current=null,g(r,e)},500)},[r,q]),Y=(0,f.useCallback)(async(r={})=>{let a=i.current?.getValue();if(a==null||!_)return!1;ge(!0),w(null);try{if(n===`standard`)return!1;let s={name:t,source:a,baseHash:r.overrideHash??_.hash},c=n===`user`?await o.saveUserScriptSource(s):await o.saveProjectScriptSource(e,s);return c.status===`conflict`?(j({currentHash:c.currentHash,currentSource:c.currentSource}),!1):(b.current=a,v({..._,source:a,hash:c.hash}),S(!1),I(!1),q(),j(null),O(c.metaOk),c.meta&&(E(c.meta),H(e=>({...u(c.meta),...e}))),ye(c.diagnostics),i.current?.setServerDiagnostics(c.diagnostics),N(le(a)),c.metaOk)}catch(e){return w(e.message),!1}finally{ge(!1)}},[_,q,e,t,n]),Pe=(0,f.useCallback)(()=>{!A||!_||(b.current=A.currentSource,v({..._,source:A.currentSource,hash:A.currentHash}),i.current?.setValue(A.currentSource),S(!1),I(!1),q(),N(le(A.currentSource)),j(null))},[A,_,q]),Fe=(0,f.useCallback)(()=>{A&&Y({overrideHash:A.currentHash})},[A,Y]),Ie=(0,f.useCallback)(()=>{q(),i.current?.setValue(b.current),v(e=>e&&{...e,source:b.current}),S(!1),I(!1)},[q]);(0,f.useEffect)(()=>{let n=()=>{!_||C||A||o.getProjectScriptSource(e,t).then(e=>{e.hash!==_.hash&&(x?j({currentHash:e.hash,currentSource:e.source}):(b.current=e.source,v(e),i.current?.setValue(e.source),E(e.meta),O(!e.metaError),N(e.provenance??null)))}).catch(()=>{})};return window.addEventListener(`focus`,n),()=>window.removeEventListener(`focus`,n)},[_,x,C,A,e,t]);let X=M!==null&&!P||h,Le=(0,f.useCallback)(async()=>{let n=i.current?.getValue()??_?.source;if(!n)return;let r=ue(n);for(let n=0;n<5;n++){let i=n===0?`${t}-custom`:`${t}-custom-${n+1}`;try{await o.createProjectScript(e,{name:i,source:r}),q(),window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`script`,projectId:e,name:i,activate:!0}}));return}catch(e){if(e instanceof a&&e.status===409)continue;w(e.message);return}}w(`could not find a free name for the copy`)},[_,q,e,t]),Z=(0,f.useCallback)(async()=>{De(!0),U(null),ke(null),je(null);try{if(x||C){if(!await Y())return}else if(!D){U(`Fix the meta block before running.`);return}let r;try{r=await o.runProjectScript(e,{name:t,...n?{scope:n}:{},input:V})}catch(e){let t=e instanceof a?e.details:null;if(t&&typeof t==`object`&&`runId`in t)r=t;else throw e}ke(r),o.getProjectScriptRun(e,r.runId).then(je).catch(()=>{})}catch(e){U(e.message)}finally{De(!1)}},[x,D,e,V,Y,C,n,t]),Q=de(W?.error),Re=(0,f.useCallback)(async()=>{if(!Q)return;let e=i.current?.getValue();if(!e)return;let t=fe(e,Q);if(!t){let t=e.slice(0,e.indexOf(`meta`)).split(`
|
|
4
4
|
`).length;i.current?.revealLine(Math.max(1,t));return}Ne(!0);try{i.current?.setValue(t),J(t),await Z()}finally{Ne(!1)}},[J,Z,Q]),$=(0,f.useMemo)(()=>k.filter(e=>e.severity===`error`).length,[k]),ze=()=>window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`area`,area:`scripts`,activate:!0}})),Be=e=>window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`task`,ref:e.taskRef,activate:!0}}));return y?(0,p.jsx)(`div`,{className:`script-editor-view`,children:(0,p.jsx)(`p`,{className:`scripts-view__error`,children:y.includes(`404`)||y.includes(`not found`)?`Script "${t}" does not exist in this project.`:`Error: ${y}`})}):_?(0,p.jsxs)(`div`,{className:`script-editor-view`,children:[(0,p.jsxs)(`header`,{className:`script-editor-header`,children:[(0,p.jsx)(`button`,{type:`button`,className:`script-editor-back muted`,onClick:ze,title:`All scripts`,"aria-label":`Back to scripts`,children:`‹`}),(0,p.jsxs)(`div`,{className:`script-editor-title`,children:[(0,p.jsx)(`h1`,{children:t}),T?.description&&(0,p.jsx)(`p`,{className:`muted small`,children:T.description})]}),(0,p.jsx)(ae,{requires:T?.requires}),L.length>0&&(0,p.jsxs)(`button`,{type:`button`,className:`script-editor-usages muted small`,onClick:()=>Be(L[0]),title:L.map(e=>`${e.taskTitle} — ${e.stepName} (on ${e.moment})`).join(`
|
|
5
5
|
`),children:[`Runs on `,L.length,` task step`,L.length===1?``:`s`]}),(0,p.jsxs)(`div`,{className:`script-editor-actions`,children:[x&&(0,p.jsx)(`span`,{className:`script-editor-dirty small`,title:`Unsaved changes`,children:`● Unsaved`}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>void Y(),disabled:!x||C||X,children:C?`Saving…`:`Save`}),(0,p.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>{z(`run`)},children:`Test run`}),(0,p.jsx)(`button`,{type:`button`,className:`script-editor-rail-toggle muted`,onClick:()=>z(e=>e===null?`about`:null),title:R===null?`Show panel`:`Hide panel`,"aria-label":R===null?`Show panel`:`Hide panel`,children:R===null?`⟨`:`⟩`})]})]}),Te===`busy`&&(0,p.jsx)(`div`,{className:`script-editor-banner script-editor-banner--info`,children:(0,p.jsx)(`span`,{children:`Drafting with AI… you can start editing; the draft will replace the buffer.`})}),Te===`failed`&&(0,p.jsxs)(`div`,{className:`script-editor-banner script-editor-banner--warn`,children:[(0,p.jsx)(`span`,{children:`The AI draft didn't come through — starting from the blank skeleton instead.`}),(0,p.jsx)(`button`,{type:`button`,className:`muted small`,onClick:()=>B(null),children:`Dismiss`})]}),Ce&&(0,p.jsxs)(`div`,{className:`script-editor-banner script-editor-banner--info`,children:[(0,p.jsx)(`span`,{children:`Restored your unsaved changes from last time.`}),(0,p.jsx)(`button`,{type:`button`,className:`muted small`,onClick:Ie,children:`Discard them`})]}),A&&(0,p.jsxs)(`div`,{className:`script-editor-banner script-editor-banner--warn`,children:[(0,p.jsx)(`span`,{children:`This script changed on disk while you were editing.`}),(0,p.jsx)(`button`,{type:`button`,onClick:Pe,children:`Reload from disk`}),(0,p.jsx)(`button`,{type:`button`,onClick:Fe,children:`Overwrite with my version`})]}),M&&(0,p.jsxs)(`div`,{className:`script-editor-banner script-editor-banner--warn`,children:[(0,p.jsx)(`span`,{children:M.kind===`standard`?`Standard library — packed into the app and read-only. Duplicate it into this project to customize.`:M.kind===`user`?`From your machine-wide library (~/.gezel/scripts). Edits here apply everywhere it is referenced.`:M.kind===`craftbook`?`Part of the ${M.ref} craftbook — updates to the craftbook replace this file, so direct edits would be lost.`:`Generated from import ${M.ref} — re-syncing the import replaces this file.`}),M.kind!==`user`&&(0,p.jsx)(`button`,{type:`button`,onClick:()=>void Le(),children:M.kind===`standard`?`Duplicate into this project`:`Make my own copy`}),!P&&M.kind!==`standard`&&M.kind!==`user`&&(0,p.jsx)(`button`,{type:`button`,className:`muted`,onClick:()=>F(!0),children:`Edit anyway`})]}),!D&&(0,p.jsx)(`div`,{className:`script-editor-banner script-editor-banner--warn`,children:`Saved, but the meta block is invalid — this script is hidden from lists and can't run until it's fixed.`}),_e&&(0,p.jsxs)(`div`,{className:`script-editor-banner script-editor-banner--error`,children:[`Save failed: `,_e]}),(0,p.jsxs)(`div`,{className:`script-editor-body`,children:[(0,p.jsx)(ne,{ref:i,projectId:e,scriptName:t,initialSource:_.source,initialMeta:T,readOnly:X,onChangeContent:J,onSave:()=>void Y(),onProblems:be,onReady:()=>{ve.length>0&&i.current?.setServerDiagnostics(ve)}}),R!==null&&(0,p.jsx)(`aside`,{className:`script-editor-rail`,children:(0,p.jsxs)(ee,{value:R,onValueChange:e=>z(e),children:[(0,p.jsxs)(c,{"aria-label":`Script panel`,children:[(0,p.jsx)(s,{value:`about`,children:`About`}),(0,p.jsx)(s,{value:`run`,children:`Test run`})]}),(0,p.jsx)(l,{value:`about`,children:(0,p.jsx)(me,{meta:T,provenance:M,usages:L})}),(0,p.jsx)(l,{value:`run`,children:(0,p.jsxs)(`div`,{className:`script-editor-run`,children:[T?.inputs&&Object.keys(T.inputs).length>0&&(0,p.jsxs)(`fieldset`,{className:`script-detail__inputs`,children:[(0,p.jsx)(`legend`,{children:`Inputs`}),(0,p.jsx)(re,{inputs:T.inputs,values:V,onChange:H})]}),(0,p.jsx)(`div`,{className:`script-detail__actions`,children:(0,p.jsx)(`button`,{type:`button`,className:`primary`,disabled:Ee||C||X,onClick:()=>void Z(),children:Ee?`Running…`:x?`Save & run`:`Run`})}),Oe&&(0,p.jsx)(`p`,{className:`scripts-view__error`,children:Oe}),W&&Q&&(0,p.jsxs)(`div`,{className:`script-editor-capfix`,children:[(0,p.jsx)(`p`,{children:(0,p.jsxs)(`strong`,{children:[`This script tried to use “`,d(Q),`”, but it isn't allowed to yet.`]})}),(0,p.jsx)(`p`,{className:`muted small`,children:`Scripts can only use what they declare up front in their meta block.`}),(0,p.jsx)(`button`,{type:`button`,className:`primary`,disabled:Me,onClick:()=>void Re(),children:Me?`Updating…`:`Allow “${d(Q)}” and run again`})]}),W&&T&&(0,p.jsx)(oe,{result:W,meta:T}),Ae?.logs&&(0,p.jsxs)(`section`,{className:`script-editor-logs`,children:[(0,p.jsx)(`h4`,{children:`Log`}),(0,p.jsx)(`pre`,{children:Ae.logs})]})]})})]})})]}),k.length>0&&(0,p.jsxs)(`footer`,{className:`script-editor-problems`,children:[(0,p.jsxs)(`strong`,{className:`small`,children:[`Problems (`,$>0?`${$} error${$===1?``:`s`}`:k.length,`)`]}),(0,p.jsx)(`ul`,{children:k.slice(0,50).map((e,t)=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(`button`,{type:`button`,className:`script-editor-problem script-editor-problem--${e.severity}`,onClick:()=>i.current?.revealLine(e.line),children:[(0,p.jsx)(`span`,{className:`script-editor-problem-msg`,children:e.message}),(0,p.jsxs)(`span`,{className:`muted small`,children:[`line `,e.line]})]})},`${e.line}:${e.column}:${t}`))})]}),(0,p.jsx)(te,{open:Se,title:`Edit a managed script?`,message:`This file is replaced wholesale when its craftbook or import updates — your edits would be lost then. Making your own copy is the safe way to customize it.`,confirmLabel:`Edit anyway`,danger:!0,onConfirm:()=>{xe(!0),F(!1)},onCancel:()=>F(!1)})]}):(0,p.jsx)(`div`,{className:`script-editor-view`,children:(0,p.jsx)(`p`,{className:`muted small`,children:`Loading script…`})})}function me({meta:e,provenance:t,usages:n}){return e?(0,p.jsxs)(`div`,{className:`script-editor-about`,children:[(0,p.jsx)(`p`,{children:e.description}),e.inputs&&Object.keys(e.inputs).length>0&&(0,p.jsxs)(`section`,{children:[(0,p.jsx)(`h4`,{children:`Takes`}),(0,p.jsx)(`ul`,{children:Object.entries(e.inputs).map(([e,t])=>(0,p.jsxs)(`li`,{children:[(0,p.jsx)(`code`,{children:e}),` — `,t.description,t.required?` (required)`:``]},e))})]}),e.outputs&&Object.keys(e.outputs).length>0&&(0,p.jsxs)(`section`,{children:[(0,p.jsx)(`h4`,{children:`Produces`}),(0,p.jsx)(`ul`,{children:Object.entries(e.outputs).map(([e,t])=>(0,p.jsxs)(`li`,{children:[(0,p.jsx)(`code`,{children:e}),` — `,t.description]},e))})]}),e.requires&&e.requires.length>0&&(0,p.jsxs)(`section`,{children:[(0,p.jsx)(`h4`,{children:`Allowed to`}),(0,p.jsx)(`ul`,{children:e.requires.map(e=>(0,p.jsxs)(`li`,{children:[d(e),` `,(0,p.jsx)(`code`,{className:`muted small`,children:e})]},e))})]}),(0,p.jsxs)(`section`,{children:[(0,p.jsx)(`h4`,{children:`Origin`}),(0,p.jsx)(`p`,{className:`muted small`,children:t?t.kind===`standard`?`Standard library (${t.ref}) — ships with the app.`:t.kind===`user`?`Your machine-wide library (~/.gezel/scripts).`:t.kind===`craftbook`?`Installed by the ${t.ref} craftbook.`:`Generated from import ${t.ref}.`:`A script of this project.`})]}),n.length>0&&(0,p.jsxs)(`section`,{children:[(0,p.jsx)(`h4`,{children:`Used by`}),(0,p.jsx)(`ul`,{children:n.map(e=>(0,p.jsxs)(`li`,{children:[e.taskTitle,` — `,e.stepName,` (on `,e.moment,`)`]},`${e.taskRef}:${e.stepName}:${e.moment}`))})]})]}):(0,p.jsx)(`p`,{className:`muted small`,children:`This script's meta block doesn't parse yet, so there's nothing to summarize. Fix the problems listed below the editor.`})}export{y as ScriptEditorView,_ as __clearAllScriptDrafts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{t as r}from"./api-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{t as r}from"./api-CmrgM5Rf.js";import{a as i,i as a,o,r as s}from"./pending-drafts-BD227X9H.js";import{t as c}from"./NewScriptDialog-DuryIe50.js";var l=e(t(),1),u=n(),d=`shared-library`,f=`default`;function p({projectId:e}={}){let[t,n]=(0,l.useState)([]),[a,o]=(0,l.useState)(e??d),[s,p]=(0,l.useState)([]),[h,g]=(0,l.useState)(null),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)({}),[x,S]=(0,l.useState)(!1),[C,w]=(0,l.useState)(null),[T,E]=(0,l.useState)(!1),D=a===d,O=D?e??f:a;(0,l.useEffect)(()=>{if(e!==void 0){o(e);return}r.listProjects().then(e=>n(e.projects)).catch(e=>v(e.message))},[e]);let k=(0,l.useCallback)(async e=>{try{let t=e===d?await r.listUserScripts():e?await r.listProjectScripts(e):{scripts:[]};p(t.scripts)}catch(e){v(e.message)}},[]);(0,l.useEffect)(()=>{k(a)},[a,k]),(0,l.useEffect)(()=>{g(e=>e&&s.some(t=>t.name===e)?e:s[0]?.name??null)},[s]);let A=(0,l.useMemo)(()=>s.find(e=>e.name===h)??null,[s,h]);(0,l.useEffect)(()=>{if(!A){b({}),w(null);return}b(i(A.meta)),w(null)},[A]);let j=(0,l.useCallback)(async()=>{if(A){S(!0),v(null);try{let e=await r.runProjectScript(O,{name:A.name,...D?{scope:`user`}:{},input:y});w(e)}catch(e){v(e.message)}finally{S(!1)}}},[A,O,D,y]),M=(0,l.useCallback)(e=>{window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`script`,projectId:O,name:e,...D?{scope:`user`}:{},activate:!0}}))},[O,D]);return(0,u.jsxs)(`div`,{className:`scripts-view`,"data-testid":`scripts-view`,children:[(0,u.jsxs)(`header`,{className:`scripts-view__header`,children:[(0,u.jsx)(`h1`,{children:`Scripts`}),(0,u.jsxs)(`div`,{className:`scripts-view__toolbar`,children:[e===void 0&&(0,u.jsxs)(`label`,{className:`scripts-view__field`,children:[(0,u.jsx)(`span`,{children:`Scripts from`}),(0,u.jsxs)(`select`,{value:a,onChange:e=>{o(e.target.value),g(null)},children:[(0,u.jsx)(`option`,{value:d,children:`Shared library`}),t.map(e=>(0,u.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,u.jsxs)(`label`,{className:`scripts-view__field`,children:[(0,u.jsx)(`span`,{children:`Script`}),(0,u.jsx)(`select`,{value:h??``,disabled:s.length===0,onChange:e=>g(e.target.value||null),children:s.map(e=>(0,u.jsx)(`option`,{value:e.name,children:e.meta.name},e.name))})]}),(0,u.jsx)(`button`,{type:`button`,className:`primary scripts-view__new`,onClick:()=>E(!0),children:`New script`})]})]}),_&&(0,u.jsxs)(`p`,{className:`scripts-view__error`,children:[`Error: `,_]}),(0,u.jsx)(`div`,{className:`scripts-view__detail`,children:s.length===0?(0,u.jsx)(`p`,{className:`scripts-view__empty`,children:D?`No shared scripts yet. Scripts here belong to no single project — every project can run them — so this is the place for anything more than one job needs.`:`No scripts yet. Scripts are small automations that run when task phases start or finish — create one to get going.`}):A?(0,u.jsx)(m,{entry:A,shared:D,inputValues:y,onInputChange:b,running:x,onRun:j,onEdit:()=>M(A.name),lastRun:C}):null}),(0,u.jsx)(c,{open:T,projectId:O,...D?{scope:`user`}:{},onClose:()=>E(!1),onCreated:e=>{E(!1),k(a),g(e),M(e)}})]})}function m({entry:e,shared:t,inputValues:n,onInputChange:r,running:i,onRun:c,onEdit:l,lastRun:d}){let f=e.meta;return(0,u.jsxs)(`div`,{className:`script-detail`,children:[(0,u.jsxs)(`header`,{children:[(0,u.jsx)(`h2`,{children:f.name}),(0,u.jsx)(`p`,{children:f.description}),t&&(0,u.jsx)(`p`,{className:`muted small`,children:`In the shared library — every project can run it.`}),(0,u.jsx)(o,{requires:f.requires})]}),f.inputs&&Object.keys(f.inputs).length>0&&(0,u.jsxs)(`fieldset`,{className:`script-detail__inputs`,children:[(0,u.jsx)(`legend`,{children:`Inputs`}),(0,u.jsx)(a,{inputs:f.inputs,values:n,onChange:r})]}),f.outputs&&Object.keys(f.outputs).length>0&&(0,u.jsxs)(`section`,{className:`script-detail__outputs`,children:[(0,u.jsx)(`h3`,{children:`Declared outputs`}),(0,u.jsx)(`ul`,{children:Object.entries(f.outputs).map(([e,t])=>(0,u.jsxs)(`li`,{children:[(0,u.jsx)(`code`,{children:e}),`: `,(0,u.jsx)(`em`,{children:t.type}),` — `,t.description]},e))})]}),(0,u.jsxs)(`div`,{className:`script-detail__actions`,children:[(0,u.jsx)(`button`,{type:`button`,disabled:i,onClick:c,children:i?`Running…`:`Run`}),(0,u.jsx)(`button`,{type:`button`,onClick:l,children:`Edit code`})]}),d&&(0,u.jsx)(s,{result:d,meta:f})]})}export{p as ScriptsView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{P as r,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{P as r,dn as i,pn as a}from"./dist-CE5CbmDb.js";import{t as o}from"./api-CmrgM5Rf.js";import{t as s}from"./security-levels-QFeYFDP-.js";var c=e(t(),1),l=n(),u=[{key:`allowFileEdits`,label:`Edit files`,help:`Gate the file-adjacent model powers: git tools and shared-document writes from scripts. Gezel-managed workspace writes are decided per project — internal workspaces start writable, while folders you opened require explicit consent. Provider-native CLI access follows that provider's project posture.`},{key:`allowExternalChat`,label:`External chat providers`,help:`Expose cloud models (Claude, Copilot, ChatGPT). Off = local models only. You can still download new local models from Hugging Face.`},{key:`allowExternalServices`,label:`External services`,help:`Let gezellen reach the open web and let project previews load external resources. Off blocks those paths; cloud chat has its own switch, and manual GitHub pulls and model downloads are unaffected.`},{key:`allowScriptExecution`,label:`Execute scripts`,help:`Let gezellen run scripts they write and run craftbook script steps. Off still lets the app itself run npm / Node CLIs / MCP servers.`},{key:`allowAppNetwork`,label:`App network`,help:`Allow desktop-owned network traffic, including update checks and external resources in project previews. Off blocks background traffic and automatic renderer egress.`}];function d({config:e,onConfigChanged:t}){let[n,d]=(0,c.useState)(``),f=i({securityPolicy:e?.securityPolicy}).level,p=(0,c.useMemo)(()=>{let t=i({securityPolicy:e?.securityPolicy});return{allowFileEdits:t.allowFileEdits,allowExternalChat:t.allowExternalChat,allowExternalServices:t.allowExternalServices,allowScriptExecution:t.allowScriptExecution,allowAppNetwork:t.allowAppNetwork}},[e?.securityPolicy]),m=(0,c.useCallback)(async e=>{d(`saving…`);try{let n=await o.updateConfig({securityPolicy:e});t(n),window.dispatchEvent(new CustomEvent(`gezel:config-updated`,{detail:n})),d(`saved — open chats restart on their next message.`)}catch(e){d(`save failed: ${e.message}`)}},[t]),h=(0,c.useCallback)(e=>void m(a(e)),[m]),g=(0,c.useCallback)((e,t)=>{let n={...p,[e]:t};m({level:r(n),...n})},[p,m]);return(0,l.jsxs)(`section`,{className:`engagement-mode-panel engagement-mode-${f}`,children:[(0,l.jsx)(`h3`,{children:`Security & Compliance`}),(0,l.jsx)(`p`,{className:`muted`,style:{marginTop:0},children:`One control over what gezellen are allowed to do — edits, cloud providers, the open web, and script execution. Slide toward lockdown to make Gezel safe to try; loosen it as you build trust. Locked-down work still flows into the artifacts sandbox, so reviews, prototypes, and documents keep working.`}),(0,l.jsx)(`p`,{className:`muted small`,style:{marginTop:`-0.35rem`},children:`Changing the posture restarts open chat sessions so gezellen pick up the new rules on their next message. A gezel that is answering right now finishes that answer first.`}),(0,l.jsxs)(`div`,{className:`engagement-mode-switch gz-tray gz-tray--described`,role:`radiogroup`,"aria-label":`Security posture`,children:[s.map(e=>(0,l.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":f===e.id,className:`gz-key${f===e.id?` gz-key-active`:``}`,onClick:()=>h(e.id),children:e.label},e.id)),f===`custom`&&(0,l.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":!0,className:`gz-key gz-key-active gz-key-state`,disabled:!0,children:`Custom`})]}),(0,l.jsx)(`p`,{className:`engagement-mode-description gz-tray-description`,"aria-live":`polite`,children:f===`custom`?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:`Custom`}),` — individual capabilities below differ from the presets.`]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:s.find(e=>e.id===f)?.label}),` —`,` `,s.find(e=>e.id===f)?.description??``]})}),(0,l.jsxs)(`div`,{className:`workshop-tempo`,style:{marginTop:`1rem`},children:[(0,l.jsx)(`h4`,{className:`workshop-tempo-heading`,children:`Advanced — individual capabilities`}),(0,l.jsx)(`p`,{className:`muted small`,style:{margin:`0 0 0.5rem`},children:`Changing any switch off-preset sets the level to “Custom”.`}),u.map(e=>(0,l.jsxs)(`label`,{className:`debug-toggle`,style:{display:`flex`,alignItems:`flex-start`,gap:`0.5rem`,marginTop:`0.6rem`},children:[(0,l.jsx)(`input`,{type:`checkbox`,checked:p[e.key],onChange:t=>g(e.key,t.target.checked)}),(0,l.jsxs)(`span`,{children:[(0,l.jsx)(`strong`,{children:e.label}),(0,l.jsx)(`br`,{}),(0,l.jsx)(`span`,{className:`muted small`,children:e.help})]})]},e.key))]}),n&&(0,l.jsx)(`p`,{className:`muted`,style:{marginTop:`0.75rem`},children:n})]})}export{d as SecurityComplianceSettings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{H as r,W as i,zt as a}from"./dist-CE5CbmDb.js";import{t as o}from"./dist-BMZhqfv7.js";import{t as s}from"./api-CmrgM5Rf.js";import{_ as c,c as l,d as u,f as d,g as f,l as p,m,p as h,s as g,u as _,v}from"./primitives-CWrGZpPI.js";import{t as y}from"./model-context-DBqdK0PS.js";import{t as b}from"./poppetje-DvCJO36y.js";import{n as x,t as S}from"./relative-time-B2kBaekd.js";import{Bt as C,Gt as w,it as T,j as E,qt as D}from"./index-DivKnJyx.js";import{a as ee,o as te}from"./ChatTimelineView-Dn1TNyVn.js";var O=e(t(),1),k=n(),A=/@\[([^\]]+)\]\(gezel\\?:[^)\s]+\)/g;function j(e){return e.replace(A,(e,t)=>`@${t}`)}function M(e){return e===`New session`?`New thread`:e}function N(e){return!e||e===`New session`}function P(e,t,n){return e.completedAt?`done`:!n&&e.id===t?`active`:`pending`}var ne={done:`Signed off`,active:`Active`,pending:`Waiting its turn`};function F({steps:e,activeStepId:t,selectedStepId:n,onSelect:r,onAddStep:a,busy:o=!1,gezels:s=[],taskAssignee:c,taskStatus:l,onAssign:u}){let d=w(),f=E(),p=l===`complete`||l===`canceled`,m=e=>{let t=(e.suggestedGezelId?{kind:`gezel`,gezelId:e.suggestedGezelId}:null)??c??null;if(t?.kind===`user`)return`you`;if(t?.kind===`gezel`){let e=s.find(e=>e.id===t.gezelId);return e?i(e,f):void 0}};return(0,k.jsx)(T,{variant:`bench`,steps:e,selectedStepId:n,onSelect:r,statusOf:e=>P(e,t,p),stepOf:e=>{let n=P(e,t,p),r=e.assignee??(e.suggestedGezelId?{kind:`gezel`,gezelId:e.suggestedGezelId}:null)??c??null,a,l,h;r?.kind===`user`?a=`You`:r?.kind===`gezel`&&(h=s.find(e=>e.id===r.gezelId),a=h?i(h,f):void 0,l=f?void 0:h?.role);let g=n===`active`?l?`${l} · with the task`:`with the task`:l,_=n===`active`&&d&&h?.poppetje?(0,k.jsx)(b,{poppetje:h.poppetje,variant:`full`,size:26,svgId:`track-${e.id}`,...a?{title:a}:{}}):void 0,v=p&&n===`pending`?void 0:ne[n],y=e.assignee,x=y?.kind===`user`?`__user`:y?.kind===`gezel`?y.gezelId:`__inherit`,S=m(e),C=u?(0,k.jsxs)(`select`,{className:`bench-step-select`,value:x,disabled:o,"aria-label":`Assignee for ${e.name}`,title:`Assignee for ${e.name}`,onChange:t=>{let n=t.target.value;n===`__inherit`?u(e.id,null):n===`__user`?u(e.id,{kind:`user`}):u(e.id,{kind:`gezel`,gezelId:n})},children:[(0,k.jsx)(`option`,{value:`__inherit`,children:S?`inherit · ${S}`:`inherit from task`}),(0,k.jsx)(`option`,{value:`__user`,children:`you`}),s.map(e=>(0,k.jsx)(`option`,{value:e.id,children:!f&&e.role?`${e.name} · ${e.role}`:i(e,f)},e.id))]}):void 0;return{..._?{figure:_}:{},...C?{assigneeControl:C}:{},...a?{assigneeName:a}:{},...g?{assigneeRole:g}:{},...v?{statusWord:v}:{}}},onAddStep:a,busy:o,ariaLabel:`Task steps`,addLabel:`add a step`,...p?{terminal:{word:l===`complete`?`Complete`:`Canceled`,tone:l===`complete`?`complete`:`canceled`}}:{}})}var I=100;function L(e){if(e instanceof o&&e.details&&typeof e.details==`object`){let t=e.details.error;if(typeof t==`string`)return t}return e instanceof Error?e.message:String(e)}function re({status:e,sessionId:t}){let[n,r]=(0,O.useState)(!1),[i,a]=(0,O.useState)(!1),[o,l]=(0,O.useState)(null);if(!e||!(e.numCtx>0))return null;let{numCtx:u,estimatedTokens:d,transcriptTokens:p,autoCompactRatio:m,compactionCount:h,model:g}=e,_=d??p,b=d!==void 0,x=_===void 0?null:Math.round(100*_/u),S=x===null?0:Math.max(0,Math.min(100,x)),C=m===void 0?void 0:Math.round(m*100),w=e.compactionFailed?`critical`:x!==null&&x>=Math.min(C??80,80)?`warn`:``,T=`${y(u)}-token context`,E=x===null?y(u):`${S}%`,D=x===null?`${T} in this thread — nothing measured yet`:`This thread fills ${b?`about`:`at least`} ${S}% of its ${T}`,ee=async()=>{if(t){a(!0),l(null);try{await s.compactChatSession(t),r(!1)}catch(e){l(L(e))}finally{a(!1)}}};return(0,k.jsxs)(c,{open:n,onOpenChange:e=>{r(e),e||l(null)},children:[(0,k.jsx)(v,{asChild:!0,children:(0,k.jsxs)(`button`,{type:`button`,className:`context-meter${w?` context-meter-${w}`:``}`,"aria-label":`Thread context: ${D}`,title:D,children:[(0,k.jsx)(`span`,{className:`context-meter-ring-wrap`,children:(0,k.jsxs)(`svg`,{className:`context-meter-ring`,viewBox:`0 0 36 36`,"aria-hidden":`true`,children:[(0,k.jsx)(`circle`,{className:`context-meter-ring-bg`,cx:`18`,cy:`18`,r:`15.5`,fill:`none`,strokeWidth:`5`}),(0,k.jsx)(`circle`,{className:`context-meter-ring-fill`,cx:`18`,cy:`18`,r:`15.5`,fill:`none`,strokeWidth:`5`,pathLength:I,strokeDasharray:`${S} ${I-S}`,strokeDashoffset:`25`,strokeLinecap:`round`})]})}),(0,k.jsx)(`span`,{className:`context-meter-label`,children:E})]})}),(0,k.jsxs)(f,{className:`context-meter-popover`,side:`bottom`,align:`end`,children:[(0,k.jsx)(`div`,{className:`context-meter-popover-header`,children:`This thread’s context`}),(0,k.jsxs)(`dl`,{className:`context-meter-stats`,children:[g&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`dt`,{children:`Model`}),(0,k.jsx)(`dd`,{children:g})]}),(0,k.jsx)(`dt`,{children:`Window`}),(0,k.jsxs)(`dd`,{children:[y(u),` tokens`]}),(0,k.jsx)(`dt`,{children:`In use`}),(0,k.jsx)(`dd`,{children:_===void 0?`Not measured yet`:`${b?`~`:`at least `}${_.toLocaleString()} tokens (${S}%)`}),(0,k.jsx)(`dt`,{children:`Auto-compaction`}),(0,k.jsx)(`dd`,{children:C===void 0?`On`:`At ${C}% full`}),h!==void 0&&h>0&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`dt`,{children:`Compactions`}),(0,k.jsxs)(`dd`,{children:[h,` so far`]})]})]}),e.compactionFailed?(0,k.jsx)(`p`,{className:`context-meter-note context-meter-note-warn`,children:`Automatic compaction could not reduce this thread. The runtime will still apply its deterministic fit safeguards, but a fresh thread will think more clearly.`}):(0,k.jsxs)(`p`,{className:`context-meter-note`,children:[b?`Counts this thread only, measured before the last turn ran.`:`Counted from the messages on disk. The system prompt and tool list add a few thousand tokens on top; the exact figure lands after the next turn.`,` `,`Older messages are summarized automatically when the thread fills up.`]}),t&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`button`,{type:`button`,className:`context-meter-action`,onClick:()=>void ee(),disabled:i,children:i?`Compacting…`:`Compact now`}),o&&(0,k.jsx)(`p`,{className:`context-meter-note context-meter-note-warn`,children:o})]})]})]})}var ie=150,ae=1e3,R=`draft:`,oe=`__NEW__`,z=`New thread`,B=`Untitled draft`;function se(){return(0,k.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":`true`,focusable:`false`,children:[(0,k.jsx)(`circle`,{cx:`7`,cy:`7`,r:`5.9`,stroke:`currentColor`,strokeWidth:`1.2`}),(0,k.jsx)(`path`,{d:`M7 4.4v5.2M4.4 7h5.2`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinecap:`round`})]})}var ce=(0,k.jsxs)(`span`,{className:`session-row session-row-action`,children:[(0,k.jsx)(se,{}),(0,k.jsx)(`span`,{className:`session-row-title`,children:z})]}),le=5,ue=`sent:`;function V({gezelId:e,projectId:t,sessionId:n,onSessionIdChange:i,onActiveSessionChange:o,onFreshThread:c,refreshKey:f,taskRef:v,stepId:y,autoPickNewest:b=!0,engineLabel:S,activeDraftId:C,onDraftSelect:w,draftScope:T,craftbookRef:E}){let[A,j]=(0,O.useState)([]),[M,P]=(0,O.useState)([]),[ne,F]=(0,O.useState)(new Map),[I,L]=(0,O.useState)(!1),[se,V]=(0,O.useState)([]),[de,H]=(0,O.useState)(new Map),G=(0,O.useRef)(null),ge=(0,O.useRef)(C);ge.current=C;let _e=(0,O.useRef)(async()=>{}),ve=(0,O.useRef)(null),K=`${e}:${t}:${v??``}`,[q,ye]=(0,O.useState)(null),J=(0,O.useCallback)(async()=>{let n=`${e}:${t}:${v??``}`;try{let r;if(v){let t=a(v);if(!t)return[];r=(await s.listTaskSessions(t.projectId,t.num)).sessions.filter(t=>t.gezelId===e)}else r=(await s.listChatSessions({gezelId:e,projectId:t})).sessions.filter(e=>!e.taskRef);let i=r.filter(e=>!e.archived);return j(i),ye(n),i}catch(n){return console.error(`[SessionSwitcher] list sessions failed`,{gezelId:e,projectId:t,taskRef:v,err:n}),[]}},[e,t,v]);(0,O.useEffect)(()=>{G.current=null,j([]),ye(null),J()},[J,f]);let Y=(0,O.useCallback)(e=>(e.taskRef??void 0)===(v??void 0)&&(e.craftbookRef??void 0)===(E??void 0)&&(e.scope??void 0)===(T??void 0),[v,E,T]),X=(0,O.useCallback)(async()=>{try{let{drafts:n}=await s.listPromptDrafts(t,{gezelId:e,status:`draft`}),r=n.filter(Y);P(r.filter(e=>e.sessionId===null));let i=new Map;for(let e of r){if(!e.sessionId)continue;let t=i.get(e.sessionId);t?t.push(e):i.set(e.sessionId,[e])}F(i)}catch{}},[t,e,Y]);_e.current=X,(0,O.useEffect)(()=>{X()},[X]),(0,O.useEffect)(()=>{let e=K;if(q!==e)return;if(n&&A.some(e=>e.id===n)){G.current=e;return}if(G.current===e)return;if(C){G.current=e;return}let t=M[0];if(!(A.length===0&&!t)){if(G.current=e,b&&A.length>0){i(A[0].id);return}t&&(i(void 0),w?.(t.id))}},[A,q,n,K,b,i,C,M,w]),(0,O.useEffect)(()=>{if(q!==K)return;let e=A.find(e=>e.id===n);n&&!e||o?.(e??null)},[A,q,n,K,o]),(0,O.useEffect)(()=>{if(q!==K||!n||A.some(e=>e.id===n))return;let e=`${K}:${n}`;ve.current!==e&&(ve.current=e,J())},[A,q,n,K,J]),(0,O.useEffect)(()=>{let n=new AbortController,r=null,i=!1,a=null,o=()=>{r!==null&&window.clearTimeout(r),r=window.setTimeout(()=>{r=null,J()},ie)},c=()=>{a!==null&&window.clearTimeout(a),a=window.setTimeout(()=>{a=null,_e.current()},ae)};return(async()=>{let r=250;for(;!i;){try{for await(let a of D({url:s.projectEventsUrl(t),headers:s.authHeader(),signal:n.signal,fetch:s.getFetch()})){if(i)return;if(a.event.type===`prompt_draft_changed`){let n=a.event;n.projectId===t&&n.gezelId===e&&(n.draftId===ge.current&&!n.deleted&&n.status===`draft`||c());continue}if(a.projectId!==t||a.gezelId!==e)continue;let{event:n}=a;if((n.type===`user_message`||n.type===`done`||n.type===`context_compacted`)&&o(),a.sessionId&&(n.type===`context_window`||n.type===`context_warning`||n.type===`context_compacted`)){let e=a.sessionId;H(t=>{let r=new Map(t),i=r.get(e);if(n.type===`context_window`)r.set(e,{...i,numCtx:n.numCtx,model:n.model,autoCompactRatio:n.autoCompactRatio,...n.estimatedTokens===void 0?{}:{estimatedTokens:n.estimatedTokens}});else if(n.type===`context_warning`)r.set(e,{...i,numCtx:n.numCtx,model:n.model,estimatedTokens:n.estimatedTokens,compactionFailed:!0});else{let t=n.numCtx??i?.numCtx;if(t!==void 0){let{estimatedTokens:a,...o}=i??{};r.set(e,{...o,numCtx:t,model:n.model,...n.autoCompactRatio===void 0?{}:{autoCompactRatio:n.autoCompactRatio},...n.compactionCount===void 0?{}:{compactionCount:n.compactionCount},compactionFailed:!1})}}return r})}r=250}}catch(e){if(i||e.name===`AbortError`)return;console.warn(`[SessionSwitcher] chat event stream error (reconnecting in ${r}ms):`,e)}if(i)return;await new Promise(e=>window.setTimeout(e,r)),r=Math.min(r*2,5e3)}})(),()=>{i=!0,n.abort(),r!==null&&window.clearTimeout(r),a!==null&&window.clearTimeout(a)}},[e,t,J]);let be=(0,O.useCallback)(async()=>{L(!0);try{let r=await s.createPromptDraft(t,{gezelId:e,sessionId:n??null,...v?{taskRef:v}:{},...E?{craftbookRef:E}:{},...T?{scope:T}:{}});n?F(e=>{let t=new Map(e);return t.set(n,[r,...e.get(n)??[]]),t}):(P(e=>[r,...e.filter(e=>e.id!==r.id)]),i(void 0)),w?.(r.id)}finally{L(!1)}},[t,e,n,v,E,T,i,w]),xe=(0,O.useCallback)(()=>{w?.(void 0),i(void 0),c?.()},[w,i,c]),Se=(0,O.useCallback)(async(e,r)=>{L(!0);try{await s.deletePromptDraft(t,e),e===C&&w?.(void 0),r&&(await s.archiveChatSession(r),r===n&&i(void 0),await J()),await X()}finally{L(!1)}},[t,C,n,w,i,J,X]),Ce=(0,O.useCallback)(async()=>{if(!n){V([]);return}try{let{drafts:r}=await s.listPromptDrafts(t,{gezelId:e,sessionId:n,status:`sent`});V(r.filter(Y).slice(0,le))}catch{V([])}},[t,e,n,Y]),we=(0,O.useCallback)(async e=>{L(!0);try{let r=await s.duplicatePromptDraft(t,e,{sessionId:n??null});w?.(r.id),await X()}finally{L(!1)}},[t,n,w,X]),Te=(0,O.useCallback)(async e=>{L(!0);try{await s.archiveChatSession(e);let t=await J();e===n&&(w?.(void 0),i(t[0]?.id)),await X()}finally{L(!1)}},[n,J,X,i,w]),Ee=(0,O.useSyncExternalStore)(te,()=>C?ee(C):void 0),De=Ee===void 0?``:r(Ee),Oe=A.length>0,ke=M.length>0,Z=C&&!n&&!M.some(e=>e.id===C)?C:null,Ae=ke||Z!==null||A.some(e=>N(e.title)),je=A.some(e=>!N(e.title)),Me=e=>e.id===C&&De?{...e,title:De}:e,Ne=A.map(e=>{let t=(ne.get(e.id)??[]).map(Me),n=N(e.title),r=n?t[0]:void 0;return{s:e,drafts:t,namer:r,unsent:n,at:W(e,r)}}),Pe=(e,t)=>e.at<t.at?1:e.at>t.at?-1:0,Fe=[...M.map(e=>{let t=Me(e);return{kind:`draft`,draft:t,at:t.updatedAt}}),...Ne.filter(e=>e.unsent).map(e=>({kind:`thread`,...e}))].sort(Pe),Ie=Ne.filter(e=>!e.unsent).sort(Pe),Le=(e,t)=>(0,k.jsx)(`button`,{type:`button`,className:`session-row-archive`,"aria-label":`Archive thread ${U(e,t)}`,title:`Hide this thread from the list. It stays on disk.`,disabled:I,onPointerDown:e=>e.stopPropagation(),onPointerUp:e=>e.stopPropagation(),onClick:t=>{t.preventDefault(),t.stopPropagation(),Te(e.id)},children:`Archive`}),Re=(e,t,n)=>(0,k.jsx)(`button`,{type:`button`,className:`session-row-delete`,"aria-label":`Delete draft ${t}`,title:`Throw this message away`,disabled:I,onPointerDown:e=>e.stopPropagation(),onPointerUp:e=>e.stopPropagation(),onClick:t=>{t.preventDefault(),t.stopPropagation(),Se(e,n)},children:`×`}),ze=(e,t)=>(0,k.jsx)(p,{value:`${R}${e.id}`,textValue:he(e),trailing:Re(e.id,e.title||B),children:me(e,t)},e.id),Be=({s:e,drafts:t,namer:n,unsent:r})=>(0,k.jsxs)(O.Fragment,{children:[(0,k.jsx)(p,{value:e.id,textValue:pe(e,S,n,r),trailing:n?Re(n.id,n.title||B,t.length<=1?e.id:void 0):Le(e,n),children:fe(e,S,n,r)}),t.filter(e=>e.id!==n?.id).map(e=>ze(e,{child:!0,mark:!r}))]},e.id),Ve=De||(Ee===void 0?z:B),He=C&&!n?`${R}${C}`:n&&Oe?n:``,Q=He===``,Ue=Ae||je,$=n?A.find(e=>e.id===n):void 0,We=$?.contextWindow?{numCtx:$.contextWindow,model:$.model,...$.contextEstimatedTokens===void 0?{}:{estimatedTokens:$.contextEstimatedTokens},...$.contextAutoCompactRatio===void 0?{}:{autoCompactRatio:$.contextAutoCompactRatio},...$.compactionCount===void 0?{}:{compactionCount:$.compactionCount},...$.transcriptTokens===void 0?{}:{transcriptTokens:$.transcriptTokens}}:void 0,Ge=n?de.get(n):void 0,Ke=Ge?{...We,...Ge}:We;return(0,k.jsxs)(`div`,{className:`gezel-chat-session-header`,children:[(0,k.jsxs)(u,{value:He,onOpenChange:e=>{e&&Ce()},onValueChange:e=>{if(e){if(e.startsWith(ue)){we(e.slice(5));return}if(e===oe){xe();return}if(e.startsWith(R)){let t=e.slice(6),r=[...ne].find(([,e])=>e.some(e=>e.id===t))?.[0];r!==n&&i(r),w?.(t);return}w?.(void 0),i(e)}},disabled:I||Q&&!Ue,children:[(0,k.jsx)(h,{className:`gezel-chat-session-select`,children:(0,k.jsx)(m,{placeholder:z})}),(0,k.jsxs)(g,{className:`gezel-chat-session-menu`,children:[!Q&&(0,k.jsx)(p,{value:oe,textValue:z,children:ce}),!Q&&Ue&&(0,k.jsx)(d,{}),Ae&&(0,k.jsxs)(l,{children:[(0,k.jsx)(_,{children:`Not sent yet`}),Z&&(0,k.jsx)(p,{value:`${R}${Z}`,textValue:Ve,trailing:Re(Z,Ve),children:(0,k.jsx)(`span`,{className:`session-row`,children:(0,k.jsx)(`span`,{className:`session-row-title`,children:Ve})})}),Fe.map(e=>e.kind===`draft`?ze(e.draft,{mark:!1}):Be(e))]}),Ae&&je&&(0,k.jsx)(d,{}),je&&(0,k.jsxs)(l,{children:[(0,k.jsx)(_,{children:`Threads`}),Ie.map(Be)]}),se.length>0&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(d,{}),(0,k.jsxs)(l,{children:[(0,k.jsx)(_,{children:`Recently sent`}),se.map(e=>(0,k.jsx)(p,{value:`${ue}${e.id}`,textValue:`${e.title||B} · use again`,children:(0,k.jsxs)(`span`,{className:`session-row session-row-child`,children:[(0,k.jsx)(`span`,{className:`session-row-title`,children:e.title||B}),(0,k.jsx)(`span`,{className:`session-row-meta`,children:` · use again · sent ${x(e.sentAt??e.updatedAt)}`})]})},e.id))]})]})]})]}),(0,k.jsx)(`button`,{type:`button`,className:`gezel-chat-session-btn`,onClick:xe,disabled:I||Q,title:Q?`Already on a new thread`:`Start a new thread`,children:`+ New thread`}),(0,k.jsx)(re,{status:Ke,sessionId:n}),n&&(0,k.jsx)(`button`,{type:`button`,className:`gezel-chat-session-btn`,onClick:()=>void be(),disabled:I,title:`Start another message in this thread and keep the one you have`,children:`+ Draft`})]})}function de(e){let t=[],n=0,r=0;for(let i of e.matchAll(A)){let a=i.index??0;a>n&&t.push(e.slice(n,a)),t.push((0,k.jsxs)(`span`,{className:`session-mention`,children:[`@`,i[1]]},`m-${r}`)),n=a+i[0].length,r++}return t.length===0?e:(n<e.length&&t.push(e.slice(n)),t)}function H(e,t){return e.source?.kind===`external`?`From ${e.source.appName} · read-only`:t||`${C(e.providerName,window.__GEZEL__?.platform)}${e.model?` (${e.model})`:``}`}function U(e,t){return t?t.title||B:M(e.title)}function W(e,t){return t&&t.updatedAt>e.lastActivityAt?t.updatedAt:e.lastActivityAt}function fe(e,t,n,r){let i=W(e,n),a=r?` · ${x(i)}`:` · ${x(i)} · ${H(e,t)}`;return(0,k.jsxs)(`span`,{className:`session-row`,children:[(0,k.jsx)(`span`,{className:`session-row-title`,children:de(U(e,n))}),(0,k.jsx)(`span`,{className:`session-row-meta`,title:S(i),children:a})]})}function pe(e,t,n,r){let i=`${j(U(e,n))} · ${x(W(e,n))}`;return r?i:`${i} · ${H(e,t)}`}function me(e,t){return(0,k.jsxs)(`span`,{className:t?.child?`session-row session-row-child`:`session-row`,children:[(0,k.jsx)(`span`,{className:`session-row-title`,children:e.title||B}),t?.mark!==!1&&(0,k.jsx)(`span`,{className:`session-row-draft-mark`,children:`draft`}),(0,k.jsx)(`span`,{className:`session-row-meta`,title:S(e.updatedAt),children:` · ${x(e.updatedAt)}`})]})}function he(e){return`${e.title||B} · draft · ${x(e.updatedAt)}`}export{j as a,M as i,F as n,P as r,V as t};
|