@tea-agent/loop-agent 0.52.0-next.1 → 0.52.0-next.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/CHANGELOG.md +67 -21
- package/dist/build-stamp.json +3 -3
- package/dist/cli/command-definitions.js +1 -75
- package/dist/cli/help.js +1 -1
- package/dist/cli/program.js +1 -28
- package/dist/shared/operator/capabilities.js +0 -122
- package/dist/shared/update/npm-client.js +14 -3
- package/dist/task/config-types.js +5 -10
- package/dist/task/read-model.js +0 -4
- package/dist/task/runtime.js +0 -1
- package/dist/worker/console/chat/api-workbench-core.js +17 -6
- package/dist/worker/console/chat/api-workbench.js +2 -0
- package/dist/worker/console/chat/chat-event-projection.js +2 -0
- package/dist/worker/console/chat/chat-event-store.js +32 -2
- package/dist/worker/console/chat/chat-references.js +4 -0
- package/dist/worker/console/chat/pi-runtime/custom-tools/apiworkbench-tools.js +65 -3
- package/dist/worker/console/chat/pi-runtime/sdk-bindings.js +4 -0
- package/dist/worker/console/chat/pi-runtime.js +238 -89
- package/dist/worker/console/chat/repo-browser.js +5 -2
- package/dist/worker/console/chat/repo-preview-kind.js +16 -6
- package/dist/worker/console/chat/routes.js +295 -25
- package/dist/worker/console/chat/subagents/jobs.js +115 -4
- package/dist/worker/console/chat/terminal-sessions.js +27 -2
- package/dist/worker/console/chat/tool-exposure-catalog.js +1 -1
- package/dist/worker/console/chat/tool-preview.js +22 -0
- package/dist/worker/console/chat/turn-process.js +52 -0
- package/dist/worker/console/chat/vcp-prompt.js +14 -9
- package/dist/worker/console/chat/workspace-changes.js +137 -0
- package/dist/worker/console/console-update-runtime.js +5 -1
- package/dist/worker/console/operator-actions.js +7 -6
- package/dist/worker/console/operator-user-error.js +5 -1
- package/dist/worker/console/routes.js +1 -1
- package/dist/worker/console/server.js +89 -5
- package/dist/worker/console/static/assets/FilePreviewDocx-ybM3ZqSl.js +9 -0
- package/dist/worker/console/static/assets/abnfDiagram-N423BO3Z-BJkTFDSU.js +1 -0
- package/dist/worker/console/static/assets/{arc-Bkf_oc0_.js → arc-BJoqB-FK.js} +1 -1
- package/dist/worker/console/static/assets/architectureDiagram-T3A2C74G-Dnks_tKL.js +36 -0
- package/dist/worker/console/static/assets/{blockDiagram-VBNYF7ZC-D62uVvbI.js → blockDiagram-VBNYF7ZC-CYfXZ-MS.js} +1 -1
- package/dist/worker/console/static/assets/{c4Diagram-5PPSVZJV-Iq0Y8Afx.js → c4Diagram-5PPSVZJV-C8QUVTzH.js} +1 -1
- package/dist/worker/console/static/assets/channel-gvXtLBqv.js +1 -0
- package/dist/worker/console/static/assets/{chunk-2GRJ4B5K-D1TxRE3k.js → chunk-2GRJ4B5K-BeQTq_mP.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-2Q5K7J3B-BE-DHkAO.js → chunk-2Q5K7J3B-Cz8TULTz.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5RXB4S5H-t0iYO8Cc.js → chunk-5RXB4S5H-DTGsDFfs.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5VM5RSS4-Clo2nExi.js → chunk-5VM5RSS4-D3xtdDtx.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-6Q2QTUOP-C7bSpo-3.js → chunk-6Q2QTUOP-CFcH1dmG.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-GF5L2VYU-DorZaymh.js → chunk-GF5L2VYU-D1oWTPzh.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-JWPE2WC7-Ch_4HvyJ.js → chunk-JWPE2WC7-DQ1784gP.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-KBJHAD2P-yaSoFe-3.js → chunk-KBJHAD2P-BUa9gwx1.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-RYQCIY6F-QpjaXecS.js → chunk-RYQCIY6F-u-ANrNSL.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-XXDRQBXY-B3t6cycg.js → chunk-XXDRQBXY-Daj0bhib.js} +1 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-DQ5hdEfB.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-DQ5hdEfB.js +1 -0
- package/dist/worker/console/static/assets/cose-bilkent-JH36ORCC-Bk1oZEJ1.js +1 -0
- package/dist/worker/console/static/assets/{cynefin-VYW2F7L2-CP8LtrOl.js → cynefin-VYW2F7L2-BIFL8KrA.js} +1 -1
- package/dist/worker/console/static/assets/cynefinDiagram-MW4NZA55-C4Ev_fka.js +62 -0
- package/dist/worker/console/static/assets/{dagre-VZM6K2ZE-BK0ua9V8.js → dagre-VZM6K2ZE-D0n24UDZ.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-7IWD3JNH-t9-HP13j.js → diagram-7IWD3JNH-C1FlRrys.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-B4RE2ZJO-L5Sg9jMD.js → diagram-B4RE2ZJO-CWpeId5Y.js} +1 -1
- package/dist/worker/console/static/assets/diagram-LBJQPF4R-CeEU1CTn.js +24 -0
- package/dist/worker/console/static/assets/diagram-Q27KOJAE-DgpFxfNH.js +24 -0
- package/dist/worker/console/static/assets/diagram-UB23O5K3--9JrEf2p.js +41 -0
- package/dist/worker/console/static/assets/docx-preview-CAbT0VNs.js +23 -0
- package/dist/worker/console/static/assets/docxPreview-D_T4B7qe.js +1 -0
- package/dist/worker/console/static/assets/ebnfDiagram-BXEA7PRR-D7E9C_OC.js +1 -0
- package/dist/worker/console/static/assets/{erDiagram-JOGREHBK-CNOuj3BO.js → erDiagram-JOGREHBK-OYp4ZJQC.js} +1 -1
- package/dist/worker/console/static/assets/{flowDiagram-UKHOOZJN-h_Cyayai.js → flowDiagram-UKHOOZJN-Cyf8gGYJ.js} +1 -1
- package/dist/worker/console/static/assets/ganttDiagram-PKOTCBZU-B7gUfjoR.js +292 -0
- package/dist/worker/console/static/assets/gitGraphDiagram-DS77QQ5N-mirrpSLp.js +106 -0
- package/dist/worker/console/static/assets/infoDiagram-6WML65LV-gRb5KI0B.js +2 -0
- package/dist/worker/console/static/assets/{ishikawaDiagram-WSZJBQD7-DAdf5lHp.js → ishikawaDiagram-WSZJBQD7-v3JGPZ1t.js} +1 -1
- package/dist/worker/console/static/assets/{journeyDiagram-NVQOT4AX-BQbGtg66.js → journeyDiagram-NVQOT4AX-jJLc06Q0.js} +1 -1
- package/dist/worker/console/static/assets/{kanban-definition-27J2QSJJ-CetLubYc.js → kanban-definition-27J2QSJJ-BJ7qkdrx.js} +1 -1
- package/dist/worker/console/static/assets/{linear-DLZOjaVz.js → linear-B8iMATOq.js} +1 -1
- package/dist/worker/console/static/assets/main-BA6TGEgV.js +644 -0
- package/dist/worker/console/static/assets/main-BWBC5cML.css +1 -0
- package/dist/worker/console/static/assets/{mermaid.core-B_xZl_gM.js → mermaid.core-C-6iih3_.js} +5 -5
- package/dist/worker/console/static/assets/{mindmap-definition-FAOFIHXS-Dzo3dzp0.js → mindmap-definition-FAOFIHXS-kUxtuaLJ.js} +1 -1
- package/dist/worker/console/static/assets/pegDiagram-VL7TDLO6-CWscAnG2.js +1 -0
- package/dist/worker/console/static/assets/{pieDiagram-7S7Q4E2Y-Cp3YrVzQ.js → pieDiagram-7S7Q4E2Y-B4P97R-G.js} +1 -1
- package/dist/worker/console/static/assets/{quadrantDiagram-CIZ2JOQS-4tI5mUgW.js → quadrantDiagram-CIZ2JOQS-TK_kx3AZ.js} +1 -1
- package/dist/worker/console/static/assets/railroadDiagram-AXF67PYL-BvoUgYhv.js +1 -0
- package/dist/worker/console/static/assets/{requirementDiagram-LRYGKXZP-DY-0JqdT.js → requirementDiagram-LRYGKXZP-DD-OVcGf.js} +1 -1
- package/dist/worker/console/static/assets/{sankeyDiagram-W5VNT64P-DuJIzRKC.js → sankeyDiagram-W5VNT64P-C_d-co8f.js} +1 -1
- package/dist/worker/console/static/assets/{sequenceDiagram-SI44F4Z6-BTbVJ85l.js → sequenceDiagram-SI44F4Z6-DEDF0c92.js} +1 -1
- package/dist/worker/console/static/assets/{sheet-workbook-BPPh1uLw.js → sheet-workbook-BI2AD1uG.js} +2 -2
- package/dist/worker/console/static/assets/sizeCapture-X5ZJPWSS-C9N-yQxX.js +1 -0
- package/dist/worker/console/static/assets/stateDiagram-OKZ733FA-BXgVo9RE.js +1 -0
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-CPyYpg4o.js +1 -0
- package/dist/worker/console/static/assets/swimlanes-SLNWSIFB-DsJnGMMG.js +2 -0
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-BECT1jaq.js +8 -0
- package/dist/worker/console/static/assets/{timeline-definition-Z64GVDOM-GR6lxokn.js → timeline-definition-Z64GVDOM-BHQjX5sj.js} +1 -1
- package/dist/worker/console/static/assets/{vennDiagram-T6HMQDX7-DEkwyzsF.js → vennDiagram-T6HMQDX7-Cq_lSjge.js} +1 -1
- package/dist/worker/console/static/assets/{wardleyDiagram-T6FBY63Y-W5jnvEJ3.js → wardleyDiagram-T6FBY63Y-BEX8BDY-.js} +1 -1
- package/dist/worker/console/static/assets/{xychartDiagram-ELKLHX3M-cqsloioo.js → xychartDiagram-ELKLHX3M-BTyfZdAf.js} +1 -1
- package/dist/worker/console/static/docx-preview.html +25 -0
- package/dist/worker/console/static/index.html +3 -2
- package/dist/worker/console/static/vcp/fonts/README.md +28 -0
- package/dist/worker/console/static/vcp/vendor/vcp-engine-v1.js +4 -4
- package/dist/worker/console/static-src/operator-chat/StateDot.js +17 -0
- package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +8 -1
- package/dist/worker/console/static-src/operator-chat/details-rail-surfaces.js +2 -0
- package/dist/worker/console/static-src/operator-chat/file-touch.js +107 -0
- package/dist/worker/console/static-src/operator-chat/open-preview-in-browser.js +44 -0
- package/dist/worker/console/static-src/operator-chat/reference-display.js +7 -1
- package/dist/worker/console/static-src/operator-chat/tasks-auto-open.js +100 -0
- package/dist/worker/console/static-src/operator-chat/tasks-layout-tween.js +103 -0
- package/dist/worker/console/static-src/operator-chat/tasks-model.js +657 -0
- package/dist/worker/console/static-src/operator-chat/tasks-view-glide.js +96 -0
- package/dist/worker/console/static-src/operator-chat/turn-group-equality.js +1 -0
- package/dist/worker/console/static-src/operator-chat/use-auto-animate.js +61 -0
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +194 -47
- package/dist/worker/console/static-src/operator-chat/useChatStream.js +4 -0
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +18 -0
- package/dist/worker/console/static-src/operator-chat/useRepoBrowser.js +111 -21
- package/dist/worker/console/static-src/operator-chat/useRuntimeControls.js +91 -47
- package/dist/worker/console/static-src/operator-chat/useVcpPreferences.js +1 -1
- package/dist/worker/console/static-src/operator-chat/vcp-fonts.js +180 -22
- package/dist/worker/console/static-src/operator-chat/vcp-frame.js +3 -3
- package/dist/worker/console/static-src/shell/console-update-progress.js +16 -0
- package/dist/worker/console/static-src/shell/console-update-reload.js +4 -1
- package/dist/worker/console/static-src/shell/workspace-route.js +0 -2
- package/dist/worker/console/vite.config.js +5 -1
- package/dist/worker/console/workspace-registry.js +62 -19
- package/dist/worker/observe/static/operator-chrome.js +0 -1
- package/dist/workflows/dag/backend-test-scenario-param.js +60 -4
- package/dist/workflows/dag/dynamic-runtime/reduction.js +7 -2
- package/dist/workflows/dag/frontend-test-framework-adapters.js +11 -2
- package/dist/workflows/script/windows/guest.js +13 -2
- package/dist/workflows/script/windows/native.js +21 -3
- package/docs/architecture/dag-execution.md +2 -13
- package/docs/architecture/facts-and-state.md +2 -3
- package/docs/architecture/runtime-boundaries.md +2 -2
- package/package.json +5 -3
- package/resource-catalog.v1.json +6 -6
- package/skills/loop-agent/references/command-reference.md +2 -41
- package/skills/loop-agent/references/harness-policy.md +3 -30
- package/skills/loop-agent/references/long-running-loop.md +6 -54
- package/dist/application/loop/run-action.js +0 -19
- package/dist/commands/dag-workflow-compile.js +0 -93
- package/dist/commands/dag-workflow-plan.js +0 -132
- package/dist/commands/dag-workflow-validate.js +0 -68
- package/dist/commands/loop-benchmark.js +0 -74
- package/dist/commands/loop.js +0 -251
- package/dist/commands/workflow.js +0 -259
- package/dist/infrastructure/harness/loop-store.js +0 -41
- package/dist/worker/console/static/assets/abnfDiagram-N423BO3Z-FQePHM07.js +0 -1
- package/dist/worker/console/static/assets/architectureDiagram-T3A2C74G-p_mwm8cd.js +0 -36
- package/dist/worker/console/static/assets/channel-CIBAg8WF.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-B4xQrSmv.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-B4xQrSmv.js +0 -1
- package/dist/worker/console/static/assets/cose-bilkent-JH36ORCC-BPXf8ZYr.js +0 -1
- package/dist/worker/console/static/assets/cynefinDiagram-MW4NZA55-CNsL9N2-.js +0 -62
- package/dist/worker/console/static/assets/diagram-LBJQPF4R-BipWFRgs.js +0 -24
- package/dist/worker/console/static/assets/diagram-Q27KOJAE-T2p4xa38.js +0 -24
- package/dist/worker/console/static/assets/diagram-UB23O5K3-CVwz6LVu.js +0 -41
- package/dist/worker/console/static/assets/ebnfDiagram-BXEA7PRR-CybQrGSA.js +0 -1
- package/dist/worker/console/static/assets/ganttDiagram-PKOTCBZU-D411_55h.js +0 -292
- package/dist/worker/console/static/assets/gitGraphDiagram-DS77QQ5N-DpVtzs9z.js +0 -106
- package/dist/worker/console/static/assets/index-B7cwOTL9.js +0 -649
- package/dist/worker/console/static/assets/index-CATbSkPc.css +0 -1
- package/dist/worker/console/static/assets/infoDiagram-6WML65LV-D74Uvx6K.js +0 -2
- package/dist/worker/console/static/assets/pegDiagram-VL7TDLO6-CSwoBOpM.js +0 -1
- package/dist/worker/console/static/assets/railroadDiagram-AXF67PYL-n0Mt3Yia.js +0 -1
- package/dist/worker/console/static/assets/sizeCapture-X5ZJPWSS-Dmf1pC7B.js +0 -1
- package/dist/worker/console/static/assets/stateDiagram-OKZ733FA-4-jdPUHD.js +0 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-DojWfYnC.js +0 -1
- package/dist/worker/console/static/assets/swimlanes-SLNWSIFB-DNhjjaAU.js +0 -2
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-CJo4AKWH.js +0 -8
- package/dist/worker/console/static/vcp/fonts/Lanxi-/345/217/257/345/256/213.woff2 +0 -0
- package/dist/worker/console/static/vcp/fonts/Lanxi-/346/234/227/345/256/213.woff2 +0 -0
- package/dist/worker/console/static/vcp/fonts/Lanxi-/350/266/205/347/262/227/351/273/221.woff2 +0 -0
- package/dist/workflows/dynamic/compile.js +0 -371
- package/dist/workflows/dynamic/compileTypes.js +0 -1
- package/dist/workflows/dynamic/errors.js +0 -5
- package/dist/workflows/dynamic/profiles.js +0 -156
- package/dist/workflows/dynamic/spec.js +0 -115
- package/dist/workflows/dynamic/validate.js +0 -275
- package/dist/workflows/loop/actions/dag-action.js +0 -129
- package/dist/workflows/loop/actions/pi-review.js +0 -267
- package/dist/workflows/loop/actions/shared.js +0 -157
- package/dist/workflows/loop/actions/shell-verify.js +0 -82
- package/dist/workflows/loop/actions/types.js +0 -1
- package/dist/workflows/loop/actions/workflow-action.js +0 -255
- package/dist/workflows/loop/actions.js +0 -160
- package/dist/workflows/loop/benchmark.js +0 -513
- package/dist/workflows/loop/closeout.js +0 -135
- package/dist/workflows/loop/context.js +0 -47
- package/dist/workflows/loop/events.js +0 -26
- package/dist/workflows/loop/hash.js +0 -32
- package/dist/workflows/loop/index.js +0 -8
- package/dist/workflows/loop/paths.js +0 -17
- package/dist/workflows/loop/policy/auto-policy.js +0 -112
- package/dist/workflows/loop/policy/path-patterns.js +0 -13
- package/dist/workflows/loop/rounds.js +0 -81
- package/dist/workflows/loop/signals.js +0 -52
- package/dist/workflows/loop/state.js +0 -116
- package/dist/workflows/loop/templates.js +0 -54
- package/dist/workflows/loop/types.js +0 -28
- /package/dist/workflows/{dynamic/artifacts.js → dag/dynamic-runtime/reduction-artifacts.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as xi,g as di,o as Yt,n as fi,a as pi,b as mi,_ as n,l as Nt,D as yi,e as bi,p as Ai,y as kt,i as wi,A as Ht,B as Ci,E as Si,az as Ri,P as Ot}from"./mermaid.core-
|
|
1
|
+
import{s as xi,g as di,o as Yt,n as fi,a as pi,b as mi,_ as n,l as Nt,D as yi,e as bi,p as Ai,y as kt,i as wi,A as Ht,B as Ci,E as Si,az as Ri,P as Ot}from"./mermaid.core-C-6iih3_.js";import{i as _i}from"./init-Gi6I4Gst.js";import{o as ki}from"./ordinal-Cboi1Yqb.js";import{l as Wt}from"./linear-B8iMATOq.js";import"./FilePreviewDocx-ybM3ZqSl.js";import"./defaultLocale-DX6XiGOO.js";function Ti(e,t,i){e=+e,t=+t,i=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+i;for(var s=-1,a=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(a);++s<a;)o[s]=e+s*i;return o}function wt(){var e=ki().unknown(void 0),t=e.domain,i=e.range,s=0,a=1,o,l,p=!1,d=0,k=0,T=.5;delete e.unknown;function _(){var b=t().length,E=a<s,L=E?a:s,P=E?s:a;o=(P-L)/Math.max(1,b-d+k*2),p&&(o=Math.floor(o)),L+=(P-L-o*(b-d))*T,l=o*(1-d),p&&(L=Math.round(L),l=Math.round(l));var I=Ti(b).map(function(m){return L+o*m});return i(E?I.reverse():I)}return e.domain=function(b){return arguments.length?(t(b),_()):t()},e.range=function(b){return arguments.length?([s,a]=b,s=+s,a=+a,_()):[s,a]},e.rangeRound=function(b){return[s,a]=b,s=+s,a=+a,p=!0,_()},e.bandwidth=function(){return l},e.step=function(){return o},e.round=function(b){return arguments.length?(p=!!b,_()):p},e.padding=function(b){return arguments.length?(d=Math.min(1,k=+b),_()):d},e.paddingInner=function(b){return arguments.length?(d=Math.min(1,b),_()):d},e.paddingOuter=function(b){return arguments.length?(k=+b,_()):k},e.align=function(b){return arguments.length?(T=Math.max(0,Math.min(1,b)),_()):T},e.copy=function(){return wt(t(),[s,a]).round(p).paddingInner(d).paddingOuter(k).align(T)},_i.apply(_(),arguments)}var Ct=(function(){var e=n(function(F,h,u,g){for(u=u||{},g=F.length;g--;u[F[g]]=h);return u},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],a=[1,5],o=[1,6],l=[1,7],p=[1,5,10,12,14,16,18,19,21,23,36,37,38],d=[1,25],k=[1,26],T=[1,28],_=[1,29],b=[1,30],E=[1,31],L=[1,32],P=[1,33],I=[1,34],m=[1,35],D=[1,36],c=[1,37],B=[1,43],W=[1,42],X=[1,47],Y=[1,50],S=[1,10,12,14,16,18,19,21,23,36,37,38],H=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],A=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],w=[1,65],V=[26,28],R={trace:n(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:n(function(h,u,g,x,C,r,rt){var f=r.length-1;switch(C){case 5:x.setOrientation(r[f]);break;case 9:x.setDiagramTitle(r[f].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[f]);break;case 13:x.setLineData(r[f-1],r[f]);break;case 14:x.setBarData({text:"",type:"text"},r[f]);break;case 15:x.setBarData(r[f-1],r[f]);break;case 16:this.$=r[f].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[f].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[f-1];break;case 20:case 30:this.$=[r[f-2],...r[f]];break;case 21:case 31:this.$=[r[f]];break;case 22:this.$={value:Number(r[f-1]),label:r[f]};break;case 23:this.$={value:Number(r[f]),label:""};break;case 24:x.setXAxisTitle(r[f]);break;case 25:x.setXAxisTitle(r[f-1]);break;case 26:x.setXAxisTitle({type:"text",text:""});break;case 27:x.setXAxisBand(r[f]);break;case 28:x.setXAxisRangeData(Number(r[f-2]),Number(r[f]));break;case 29:this.$=r[f-1];break;case 32:x.setYAxisTitle(r[f]);break;case 33:x.setYAxisTitle(r[f-1]);break;case 34:x.setYAxisTitle({type:"text",text:""});break;case 35:x.setYAxisRangeData(Number(r[f-2]),Number(r[f]));break;case 39:this.$={text:r[f],type:"text"};break;case 40:this.$={text:r[f],type:"text"};break;case 41:this.$={text:r[f],type:"markdown"};break;case 42:this.$=r[f];break;case 43:this.$=r[f-1]+""+r[f];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,36:a,37:o,38:l}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,36:a,37:o,38:l}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],36:a,37:o,38:l}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(p,[2,36]),e(p,[2,37]),e(p,[2,38]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,36:a,37:o,38:l}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,36:a,37:o,38:l}),{11:23,30:d,39:24,40:k,41:27,42:T,43:_,44:b,45:E,46:L,47:P,48:I,49:m,50:D,51:c},{11:39,13:38,24:B,29:W,30:d,31:40,32:41,39:24,40:k,41:27,42:T,43:_,44:b,45:E,46:L,47:P,48:I,49:m,50:D,51:c},{11:45,15:44,29:X,30:d,35:46,39:24,40:k,41:27,42:T,43:_,44:b,45:E,46:L,47:P,48:I,49:m,50:D,51:c},{11:49,17:48,24:Y,30:d,39:24,40:k,41:27,42:T,43:_,44:b,45:E,46:L,47:P,48:I,49:m,50:D,51:c},{11:52,17:51,24:Y,30:d,39:24,40:k,41:27,42:T,43:_,44:b,45:E,46:L,47:P,48:I,49:m,50:D,51:c},{20:[1,53]},{22:[1,54]},e(S,[2,18]),{1:[2,2]},e(S,[2,8]),e(S,[2,9]),e(H,[2,39],{41:55,42:T,43:_,44:b,45:E,46:L,47:P,48:I,49:m,50:D,51:c}),e(H,[2,40]),e(H,[2,41]),e(A,[2,42]),e(A,[2,44]),e(A,[2,45]),e(A,[2,46]),e(A,[2,47]),e(A,[2,48]),e(A,[2,49]),e(A,[2,50]),e(A,[2,51]),e(A,[2,52]),e(A,[2,53]),e(S,[2,10]),e(S,[2,24],{32:41,31:56,24:B,29:W}),e(S,[2,26]),e(S,[2,27]),{33:[1,57]},{11:59,30:d,34:58,39:24,40:k,41:27,42:T,43:_,44:b,45:E,46:L,47:P,48:I,49:m,50:D,51:c},e(S,[2,11]),e(S,[2,32],{35:60,29:X}),e(S,[2,34]),{33:[1,61]},e(S,[2,12]),{17:62,24:Y},{25:63,27:64,29:w},e(S,[2,14]),{17:66,24:Y},e(S,[2,16]),e(S,[2,17]),e(A,[2,43]),e(S,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(S,[2,33]),{29:[1,70]},e(S,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(V,[2,23],{30:[1,73]}),e(S,[2,15]),e(S,[2,28]),e(S,[2,29]),{11:59,30:d,34:74,39:24,40:k,41:27,42:T,43:_,44:b,45:E,46:L,47:P,48:I,49:m,50:D,51:c},e(S,[2,35]),e(S,[2,19]),{25:75,27:64,29:w},e(V,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:n(function(h,u){if(u.recoverable)this.trace(h);else{var g=new Error(h);throw g.hash=u,g}},"parseError"),parse:n(function(h){var u=this,g=[0],x=[],C=[null],r=[],rt=this.table,f="",gt=0,Mt=0,li=2,zt=1,ci=r.slice.call(arguments,1),v=Object.create(this.lexer),$={yy:{}};for(var mt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,mt)&&($.yy[mt]=this.yy[mt]);v.setInput(h,$.yy),$.yy.lexer=v,$.yy.parser=this,typeof v.yylloc>"u"&&(v.yylloc={});var yt=v.yylloc;r.push(yt);var ui=v.options&&v.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function gi(z){g.length=g.length-2*z,C.length=C.length-z,r.length=r.length-z}n(gi,"popStack");function Bt(){var z;return z=x.pop()||v.lex()||zt,typeof z!="number"&&(z instanceof Array&&(x=z,z=x.pop()),z=u.symbols_[z]||z),z}n(Bt,"lex");for(var M,U,O,bt,G={},xt,N,Vt,dt;;){if(U=g[g.length-1],this.defaultActions[U]?O=this.defaultActions[U]:((M===null||typeof M>"u")&&(M=Bt()),O=rt[U]&&rt[U][M]),typeof O>"u"||!O.length||!O[0]){var At="";dt=[];for(xt in rt[U])this.terminals_[xt]&&xt>li&&dt.push("'"+this.terminals_[xt]+"'");v.showPosition?At="Parse error on line "+(gt+1)+`:
|
|
2
2
|
`+v.showPosition()+`
|
|
3
3
|
Expecting `+dt.join(", ")+", got '"+(this.terminals_[M]||M)+"'":At="Parse error on line "+(gt+1)+": Unexpected "+(M==zt?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(At,{text:v.match,token:this.terminals_[M]||M,line:v.yylineno,loc:yt,expected:dt})}if(O[0]instanceof Array&&O.length>1)throw new Error("Parse Error: multiple actions possible at state: "+U+", token: "+M);switch(O[0]){case 1:g.push(M),C.push(v.yytext),r.push(v.yylloc),g.push(O[1]),M=null,Mt=v.yyleng,f=v.yytext,gt=v.yylineno,yt=v.yylloc;break;case 2:if(N=this.productions_[O[1]][1],G.$=C[C.length-N],G._$={first_line:r[r.length-(N||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(N||1)].first_column,last_column:r[r.length-1].last_column},ui&&(G._$.range=[r[r.length-(N||1)].range[0],r[r.length-1].range[1]]),bt=this.performAction.apply(G,[f,Mt,gt,$.yy,O[1],C,r].concat(ci)),typeof bt<"u")return bt;N&&(g=g.slice(0,-1*N*2),C=C.slice(0,-1*N),r=r.slice(0,-1*N)),g.push(this.productions_[O[1]][0]),C.push(G.$),r.push(G._$),Vt=rt[g[g.length-2]][g[g.length-1]],g.push(Vt);break;case 3:return!0}}return!0},"parse")},ot=(function(){var F={EOF:1,parseError:n(function(u,g){if(this.yy.parser)this.yy.parser.parseError(u,g);else throw new Error(u)},"parseError"),setInput:n(function(h,u){return this.yy=u||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:n(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var u=h.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:n(function(h){var u=h.length,g=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===x.length?this.yylloc.first_column:0)+x[x.length-g.length].length-g[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n(function(h){this.unput(this.match.slice(h))},"less"),pastInput:n(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:n(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n(function(){var h=this.pastInput(),u=new Array(h.length+1).join("-");return h+this.upcomingInput()+`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
|
6
|
+
<title>Word 文档预览 · Loop 操作台</title>
|
|
7
|
+
<style>
|
|
8
|
+
html, body { margin: 0; height: 100%; background: #eef1f5; }
|
|
9
|
+
#root { height: 100%; }
|
|
10
|
+
#root[role="alert"] {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
padding: 24px;
|
|
15
|
+
color: #b91c1c;
|
|
16
|
+
font: 14px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
<script type="module" crossorigin src="/assets/docxPreview-D_T4B7qe.js"></script>
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/FilePreviewDocx-ybM3ZqSl.js">
|
|
21
|
+
</head>
|
|
22
|
+
<body>
|
|
23
|
+
<div id="root"></div>
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
<link rel="stylesheet" href="/inspect/vendor/remixicon/remixicon.css" />
|
|
11
11
|
<link rel="stylesheet" href="/inspect/operator-chrome.css" />
|
|
12
12
|
<title>Loop 操作台 · Operator Console</title>
|
|
13
|
-
<script type="module" crossorigin src="/assets/
|
|
14
|
-
<link rel="
|
|
13
|
+
<script type="module" crossorigin src="/assets/main-BA6TGEgV.js"></script>
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/FilePreviewDocx-ybM3ZqSl.js">
|
|
15
|
+
<link rel="stylesheet" crossorigin href="/assets/main-BWBC5cML.css">
|
|
15
16
|
</head>
|
|
16
17
|
<body>
|
|
17
18
|
<div id="root"></div>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# VCP 内置字体
|
|
2
|
+
|
|
3
|
+
卡片默认使用系统字体别名(`Vcp-Sans` / `Vcp-Serif` / `Vcp-Kai` / `Vcp-Mono`,见
|
|
4
|
+
`src/worker/console/static-src/operator-chat/vcp-fonts.ts`)。这里的 woff2 只作为
|
|
5
|
+
离线兜底与单文件导出的一致性保证。
|
|
6
|
+
|
|
7
|
+
只允许放 **SIL OFL 1.1** 字族——本目录会随 npm 包分发,非商业授权字体不得入库。
|
|
8
|
+
|
|
9
|
+
| 文件 | 上游字族 | 字重 | 授权 |
|
|
10
|
+
| --- | --- | --- | --- |
|
|
11
|
+
| `Lanxi-HeiTi.woff2` | [Noto Sans CJK SC](https://github.com/notofonts/noto-cjk) | 400 | SIL OFL 1.1 |
|
|
12
|
+
| `Lanxi-HeiTiBold.woff2` | Noto Sans CJK SC Bold | 700 | SIL OFL 1.1 |
|
|
13
|
+
| `Lanxi-WenKai.woff2` | [LXGW WenKai GB Lite](https://github.com/lxgw/LxgwWenKaiGB-Lite) | 400 | SIL OFL 1.1 |
|
|
14
|
+
|
|
15
|
+
文件名保留 `Lanxi-*` 前缀是兼容既有卡片与测试的稳定标识,不代表另有来源。
|
|
16
|
+
|
|
17
|
+
## 已移除
|
|
18
|
+
|
|
19
|
+
| 文件 | 移除原因 |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `Lanxi-超粗黑.woff2` | 笔画在标题字号下糊成一坨,不可读 |
|
|
22
|
+
| `Lanxi-可宋.woff2` | *Noncommercial* 授权,不能随包分发;已被 `Vcp-Serif` 系统衬线链覆盖 |
|
|
23
|
+
| `Lanxi-朗宋.woff2` | 同上 |
|
|
24
|
+
|
|
25
|
+
## 授权全文
|
|
26
|
+
|
|
27
|
+
OFL 1.1 全文见 <https://openfontlicense.org>。分发这些 woff2 时不得单独售卖字体,
|
|
28
|
+
修改后的衍生字体必须沿用 OFL。
|
|
@@ -305,7 +305,7 @@
|
|
|
305
305
|
// 仅对「有 <style> 的卡」注入:注入在第一个 <style> 标签开头作为底护兜底,
|
|
306
306
|
// 保持卡片自身声明的字体规则在后、优先级更高,同时排除 pre/code 免伤等宽代码。
|
|
307
307
|
var FONT_INHERIT_TAGS = 'div,p,span,h1,h2,h3,h4,h5,h6,li,td,th,a,strong,b,em,i,blockquote,small,label,figcaption,summary,button'
|
|
308
|
-
var FONT_SYSTEM_CHAIN = "
|
|
308
|
+
var FONT_SYSTEM_CHAIN = "var(--vcp-font-sans,-apple-system,BlinkMacSystemFont,'PingFang SC','Hiragino Sans GB','Microsoft YaHei UI','Microsoft YaHei','Segoe UI',system-ui,sans-serif)"
|
|
309
309
|
var FONT_INHERIT_RULE = function (uid) {
|
|
310
310
|
var out = '\n /* v6.33 渲染器注入:字体链兜底(根容器锁定 + 未声明字体元素继承)*/\n #' + uid + '{font-family:' + FONT_SYSTEM_CHAIN + ' !important}\n '
|
|
311
311
|
var tags = FONT_INHERIT_TAGS.split(',')
|
|
@@ -980,7 +980,7 @@
|
|
|
980
980
|
}
|
|
981
981
|
// ① 根容器:font-family 兜底链或无字体 → 锁定系统链(AI 显式内联/选择器尊重)
|
|
982
982
|
var rootFont = el.style.fontFamily
|
|
983
|
-
if (!(rootFont && rootFont.indexOf('
|
|
983
|
+
if (!(rootFont && rootFont.indexOf('var(--vcp-font-sans') !== 0 && !matched(el, 'font-family'))) {
|
|
984
984
|
if (!matched(el, 'font-family')) {
|
|
985
985
|
el.style.setProperty('font-family', FONT_SYSTEM_CHAIN, 'important')
|
|
986
986
|
}
|
|
@@ -1718,7 +1718,7 @@
|
|
|
1718
1718
|
if (!has('borderRadius')) base.borderRadius = '16px'
|
|
1719
1719
|
if (!has('border') && !has('borderColor')) base.border = '1px solid var(--vcp-border)'
|
|
1720
1720
|
if (!has('boxSizing')) base.boxSizing = 'border-box'
|
|
1721
|
-
if (!has('fontFamily')) base.fontFamily = "
|
|
1721
|
+
if (!has('fontFamily')) base.fontFamily = "var(--vcp-font-sans,-apple-system,'PingFang SC','Microsoft YaHei',system-ui,sans-serif)"
|
|
1722
1722
|
if (!has('lineHeight')) base.lineHeight = '1.6'
|
|
1723
1723
|
if (!has('display')) base.display = 'block'
|
|
1724
1724
|
if (!has('width')) base.width = '100%'
|
|
@@ -1772,7 +1772,7 @@
|
|
|
1772
1772
|
if (!has2('border-radius')) bs.setProperty('border-radius', '16px')
|
|
1773
1773
|
if (!has2('border') && !has2('border-color')) bs.setProperty('border', '1px solid var(--vcp-border)')
|
|
1774
1774
|
if (!has2('box-sizing')) bs.setProperty('box-sizing', 'border-box')
|
|
1775
|
-
if (!has2('font-family')) bs.setProperty('font-family', "
|
|
1775
|
+
if (!has2('font-family')) bs.setProperty('font-family', "var(--vcp-font-sans,-apple-system,'PingFang SC','Microsoft YaHei',system-ui,sans-serif)")
|
|
1776
1776
|
if (!has2('line-height')) bs.setProperty('line-height', '1.6')
|
|
1777
1777
|
if (!has2('display')) bs.setProperty('display', 'block')
|
|
1778
1778
|
if (!has2('width')) bs.setProperty('width', '100%')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
function syncSpinner(element) {
|
|
3
|
+
if (!element)
|
|
4
|
+
return;
|
|
5
|
+
const svg = element;
|
|
6
|
+
for (const animation of svg.getAnimations?.({ subtree: true }) ?? []) {
|
|
7
|
+
animation.startTime = 0;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** Small shared status marker; ongoing is the only animated state. */
|
|
11
|
+
export function StateDot(props) {
|
|
12
|
+
const edge = props.size ?? (props.state === "ongoing" ? 14 : 10);
|
|
13
|
+
if (props.state === "ongoing") {
|
|
14
|
+
return (_jsx("svg", { ref: syncSpinner, className: `oc-state-dot${props.className ? ` ${props.className}` : ""}`, "data-state": "ongoing", width: edge, height: edge, viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsxs("g", { className: "oc-state-dot-motion", children: [_jsx("circle", { className: "oc-state-dot-track", cx: "12", cy: "12", r: "9.5" }), _jsx("circle", { className: "oc-state-dot-arc", cx: "12", cy: "12", r: "9.5" })] }) }));
|
|
15
|
+
}
|
|
16
|
+
return _jsx("span", { className: `oc-state-dot${props.className ? ` ${props.className}` : ""}`, "data-state": props.state, style: { width: edge, height: edge }, "aria-hidden": "true" });
|
|
17
|
+
}
|
|
@@ -17,7 +17,7 @@ import { createAnimationFrameBatcher } from "./animation-frame-batcher.js";
|
|
|
17
17
|
* original request would have. `assistantId` is the in-flight assistant
|
|
18
18
|
* message id to patch for streaming text; reconnect creates one if none. */
|
|
19
19
|
export function createChatSseEventApplier(deps) {
|
|
20
|
-
const { refs, onReconcile, setError, setInterview, setHumanGateCards, setArtifactCards, setStreaming, setTurnPhase = () => undefined, setDeferredTurn = () => undefined, setDeferredTurns = () => undefined, setStreamingAssistantId, setUnread, setOperationCards, setUsage, onTelemetryRefresh, setMessages, setToolCalls, setPendingQuestion = () => undefined, setTodos = () => undefined, setWorkflowRuns = () => undefined, setGoal = () => undefined, setGoalStatus = () => undefined, setOperatorActions = () => undefined, setSddSessionIdentity = () => undefined, setConversationNodes = () => undefined, setTurnState = () => undefined, getMessages, } = deps;
|
|
20
|
+
const { refs, onReconcile, setError, setInterview, setHumanGateCards, setArtifactCards, setStreaming, setTurnPhase = () => undefined, setDeferredTurn = () => undefined, setDeferredTurns = () => undefined, setStreamingAssistantId, setUnread, setOperationCards, setUsage, onTelemetryRefresh, setMessages, setToolCalls, setPendingQuestion = () => undefined, setTodos = () => undefined, setWorkspaceChanges = () => undefined, setWorkflowRuns = () => undefined, setGoal = () => undefined, setGoalStatus = () => undefined, setOperatorActions = () => undefined, setSddSessionIdentity = () => undefined, setConversationNodes = () => undefined, setTurnState = () => undefined, getMessages, } = deps;
|
|
21
21
|
let queueOwner;
|
|
22
22
|
let queueRevision = -1;
|
|
23
23
|
// Keep the fence after terminal evidence clears the ownership refs. Session
|
|
@@ -209,6 +209,13 @@ export function createChatSseEventApplier(deps) {
|
|
|
209
209
|
}
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
|
+
if (eventName === "workspace_changes") {
|
|
213
|
+
const summary = payload;
|
|
214
|
+
if (typeof summary.turnId === "string" && Array.isArray(summary.files)) {
|
|
215
|
+
setWorkspaceChanges(current => [...current.filter(item => item.turnId !== summary.turnId), summary].sort((a, b) => (a.turnNumber ?? 0) - (b.turnNumber ?? 0)));
|
|
216
|
+
}
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
212
219
|
if (eventName === "todo_updated" || eventName === "todo_cleared") {
|
|
213
220
|
const todos = Array.isArray(payload.todos) ? payload.todos : [];
|
|
214
221
|
setTodos(todos.filter((item) => Boolean(item) && typeof item === "object" && typeof item.content === "string" && (item.status === "pending" || item.status === "in_progress" || item.status === "completed")));
|
|
@@ -21,6 +21,7 @@ export const DETAILS_SURFACES = {
|
|
|
21
21
|
"activity",
|
|
22
22
|
"trajectory",
|
|
23
23
|
"goal",
|
|
24
|
+
"tasks",
|
|
24
25
|
"subagents",
|
|
25
26
|
"workflows",
|
|
26
27
|
"dag",
|
|
@@ -42,6 +43,7 @@ const TAB_TO_SURFACE = {
|
|
|
42
43
|
activity: "session",
|
|
43
44
|
trajectory: "session",
|
|
44
45
|
goal: "session",
|
|
46
|
+
tasks: "session",
|
|
45
47
|
subagents: "session",
|
|
46
48
|
workflows: "session",
|
|
47
49
|
dag: "session",
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which files did the model just write or edit?
|
|
3
|
+
*
|
|
4
|
+
* The repo browser's file preview is a SNAPSHOT: once open, its content never
|
|
5
|
+
* changed, so a reply that edited that very file left the reader looking at the
|
|
6
|
+
* old bytes with no way to refresh short of closing and reopening the tab.
|
|
7
|
+
*
|
|
8
|
+
* DSH answers the same question and its reasoning is worth copying exactly
|
|
9
|
+
* (`src/client/ops-stream.ts`, `src/client/changes/ops.ts`): it does NOT watch
|
|
10
|
+
* the filesystem. `fs.watch` reports a DIRECTORY's entry list changing, so it
|
|
11
|
+
* can see a file appear or vanish but never a file's CONTENTS changing — the
|
|
12
|
+
* one thing an open preview has to notice. DSH instead folds the session's own
|
|
13
|
+
* tool-call log into "which file was just touched", which also means the
|
|
14
|
+
* plugin's own saves cannot re-trigger a reload, and a write that failed never
|
|
15
|
+
* fires.
|
|
16
|
+
*
|
|
17
|
+
* This module is the same fold over Loop's `ToolCallEntry[]`, with DSH's three
|
|
18
|
+
* rules:
|
|
19
|
+
*
|
|
20
|
+
* 1. **Settled successes only.** A `write` fires once its result landed without
|
|
21
|
+
* an error, so a half-written file never reaches the preview.
|
|
22
|
+
* 2. **Nothing historical fires.** The first read of a session is the baseline:
|
|
23
|
+
* every op it already contains is recorded as seen and refreshes nothing.
|
|
24
|
+
* 3. **Session-scoped.** A touch found in one session is invisible to another.
|
|
25
|
+
*/
|
|
26
|
+
/** A tool whose SUCCESSFUL result changed a file's content. */
|
|
27
|
+
const WRITE_TOOL_NAMES = new Set([
|
|
28
|
+
"write",
|
|
29
|
+
"edit",
|
|
30
|
+
"multi-edit",
|
|
31
|
+
"multi_edit",
|
|
32
|
+
"create",
|
|
33
|
+
"str_replace",
|
|
34
|
+
"str-replace-editor",
|
|
35
|
+
]);
|
|
36
|
+
/**
|
|
37
|
+
* Classify one tool name. Unknown names are ignored rather than guessed at: a
|
|
38
|
+
* false positive would reload an unrelated preview, while a miss only costs the
|
|
39
|
+
* reader one manual reopen.
|
|
40
|
+
*/
|
|
41
|
+
export function isFileWriteTool(toolName) {
|
|
42
|
+
const name = toolName.trim();
|
|
43
|
+
if (WRITE_TOOL_NAMES.has(name))
|
|
44
|
+
return true;
|
|
45
|
+
// Namespaced forms (`fs.write`, `filesystem__edit`, `mcp__x__write_file`).
|
|
46
|
+
const tail = name.includes("__") ? name.slice(name.lastIndexOf("__") + 2) : name.slice(name.lastIndexOf(".") + 1);
|
|
47
|
+
if (WRITE_TOOL_NAMES.has(tail))
|
|
48
|
+
return true;
|
|
49
|
+
// `apply_patch` edits many files with no single path; it is deliberately NOT
|
|
50
|
+
// in the set above, and is handled by the caller as "reload everything open".
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Fold a session's tool calls into the file touches that happened AFTER
|
|
55
|
+
* `sinceSeq`.
|
|
56
|
+
*
|
|
57
|
+
* `sinceSeq` starts at `null` for a session's first read — that call returns no
|
|
58
|
+
* touches at all and only establishes the baseline, which is what keeps opening
|
|
59
|
+
* an old conversation from reloading everything.
|
|
60
|
+
*/
|
|
61
|
+
export function collectFileTouches(calls, sinceSeq) {
|
|
62
|
+
let high = sinceSeq ?? 0;
|
|
63
|
+
// Baseline read: record how far the log goes, refresh nothing.
|
|
64
|
+
if (sinceSeq === null) {
|
|
65
|
+
for (const call of calls) {
|
|
66
|
+
high = Math.max(high, call.finishedSeq ?? call.eventSeq ?? 0);
|
|
67
|
+
}
|
|
68
|
+
return { paths: [], reloadAll: false, cursor: high };
|
|
69
|
+
}
|
|
70
|
+
const seen = new Set();
|
|
71
|
+
const paths = [];
|
|
72
|
+
let reloadAll = false;
|
|
73
|
+
for (const call of calls) {
|
|
74
|
+
const seq = call.finishedSeq ?? call.eventSeq ?? 0;
|
|
75
|
+
if (seq <= high)
|
|
76
|
+
continue;
|
|
77
|
+
high = Math.max(high, seq);
|
|
78
|
+
// Rule 1: only a call that settled successfully changed a file.
|
|
79
|
+
if (call.status !== "ok")
|
|
80
|
+
continue;
|
|
81
|
+
const name = call.toolName.trim();
|
|
82
|
+
if (name === "apply_patch" || name.endsWith("__apply_patch")) {
|
|
83
|
+
reloadAll = true;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (!isFileWriteTool(name))
|
|
87
|
+
continue;
|
|
88
|
+
const path = pathOf(call.args);
|
|
89
|
+
if (!path || seen.has(path))
|
|
90
|
+
continue;
|
|
91
|
+
seen.add(path);
|
|
92
|
+
paths.push(path);
|
|
93
|
+
}
|
|
94
|
+
return { paths, reloadAll, cursor: high };
|
|
95
|
+
}
|
|
96
|
+
/** Every path-shaped key the file tools use, checked before use. */
|
|
97
|
+
function pathOf(args) {
|
|
98
|
+
if (args === null || typeof args !== "object" || Array.isArray(args))
|
|
99
|
+
return undefined;
|
|
100
|
+
const record = args;
|
|
101
|
+
for (const key of ["file_path", "path", "filePath", "filename", "file"]) {
|
|
102
|
+
const value = record[key];
|
|
103
|
+
if (typeof value === "string" && value.trim().length > 0)
|
|
104
|
+
return value;
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
@@ -51,6 +51,11 @@ export function isPdfPreviewLanguage(language) {
|
|
|
51
51
|
export function isSheetPreviewLanguage(language) {
|
|
52
52
|
return ["xlsx", "xls", "csv", "tsv"].includes(normalizedLanguage(language));
|
|
53
53
|
}
|
|
54
|
+
/** Word documents rendered by the in-browser docx renderer. `.doc` is the
|
|
55
|
+
* legacy binary format and has no renderer. */
|
|
56
|
+
export function isDocxPreviewLanguage(language) {
|
|
57
|
+
return normalizedLanguage(language) === "docx";
|
|
58
|
+
}
|
|
54
59
|
export function isBinarySheetLanguage(language) {
|
|
55
60
|
return ["xlsx", "xls"].includes(normalizedLanguage(language));
|
|
56
61
|
}
|
|
@@ -72,6 +77,7 @@ export function isKindBinaryPreview(preview) {
|
|
|
72
77
|
return (preview.kind === "image" ||
|
|
73
78
|
preview.kind === "unsupported" ||
|
|
74
79
|
preview.kind === "pdf" ||
|
|
80
|
+
preview.kind === "docx" ||
|
|
75
81
|
(preview.kind === "sheet" && isBinarySheetLanguage(preview.language)));
|
|
76
82
|
}
|
|
77
83
|
function isSvgLanguage(language) {
|
|
@@ -330,6 +336,11 @@ function previewPane(preview, sheets) {
|
|
|
330
336
|
if (preview.kind === "pdf" && preview.previewUrl) {
|
|
331
337
|
return `<div class="frame"><iframe class="page" title="${escapeHtml(preview.path)}" src="${escapeHtml(preview.previewUrl)}"></iframe></div>`;
|
|
332
338
|
}
|
|
339
|
+
if (preview.kind === "docx") {
|
|
340
|
+
// The detached reader page renders the pages itself; a raw ``.docx`` byte
|
|
341
|
+
// response in an iframe would just download.
|
|
342
|
+
return `<article class="doc"><p class="unsupported">此文件已在独立窗口中打开。</p></article>`;
|
|
343
|
+
}
|
|
333
344
|
if (preview.kind === "sheet")
|
|
334
345
|
return sheetPreviewPane(preview, sheets);
|
|
335
346
|
if (preview.kind === "image" && preview.previewUrl) {
|
|
@@ -434,6 +445,36 @@ ${readingPageScript()}
|
|
|
434
445
|
</body>
|
|
435
446
|
</html>`;
|
|
436
447
|
}
|
|
448
|
+
/** Origin of the running Console. `ChatWorkspace` passes `origin: ""`, so a
|
|
449
|
+
* preview URL can be a bare path; resolving it against a hardcoded host would
|
|
450
|
+
* drop the real port. */
|
|
451
|
+
function consoleOrigin() {
|
|
452
|
+
const location = globalThis.location;
|
|
453
|
+
if (location?.origin && location.origin !== "null")
|
|
454
|
+
return location.origin;
|
|
455
|
+
if (location?.href) {
|
|
456
|
+
try {
|
|
457
|
+
return new URL(location.href).origin;
|
|
458
|
+
}
|
|
459
|
+
catch {
|
|
460
|
+
/* fall through to the test fallback */
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return "http://localhost";
|
|
464
|
+
}
|
|
465
|
+
/** Detached Word reader page: it fetches the workspace byte route named by
|
|
466
|
+
* `url` and renders the pages in its own document, so the detached window
|
|
467
|
+
* keeps selectable text instead of a raw `.docx` download. */
|
|
468
|
+
export function docxReaderUrl(previewUrl, path) {
|
|
469
|
+
// An absolute preview URL already carries the right host; a bare path is
|
|
470
|
+
// resolved against the live Console origin so the reader page and the byte
|
|
471
|
+
// route stay on the same port.
|
|
472
|
+
const absolute = /^[a-z][a-z0-9+.-]*:\/\//i.test(previewUrl)
|
|
473
|
+
? previewUrl
|
|
474
|
+
: new URL(previewUrl, consoleOrigin()).toString();
|
|
475
|
+
const reader = new URL("/docx-preview.html", absolute).toString();
|
|
476
|
+
return `${reader}?url=${encodeURIComponent(absolute)}&path=${encodeURIComponent(path)}`;
|
|
477
|
+
}
|
|
437
478
|
function screenAvail() {
|
|
438
479
|
const screen = globalThis.screen;
|
|
439
480
|
return {
|
|
@@ -474,6 +515,9 @@ export function openPreviewInBrowser(preview, host = defaultHost(), features = p
|
|
|
474
515
|
preview.previewUrl) {
|
|
475
516
|
targetUrl = preview.previewUrl;
|
|
476
517
|
}
|
|
518
|
+
else if (preview.kind === "docx" && preview.previewUrl) {
|
|
519
|
+
targetUrl = docxReaderUrl(preview.previewUrl, preview.path);
|
|
520
|
+
}
|
|
477
521
|
if (!targetUrl) {
|
|
478
522
|
const documentHtml = buildPreviewBrowserDocument(preview, sheets);
|
|
479
523
|
const blob = new Blob([documentHtml], { type: "text/html;charset=utf-8" });
|
|
@@ -12,6 +12,7 @@ export function referenceTag(source) {
|
|
|
12
12
|
case "file": return source.view === "sheet" ? "表格" : source.view === "html" ? "HTML" : "文件";
|
|
13
13
|
case "diff": return "差异";
|
|
14
14
|
case "message": return "消息";
|
|
15
|
+
case "api": return "API";
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
export function referenceMeta(source) {
|
|
@@ -31,8 +32,13 @@ export function referenceMeta(source) {
|
|
|
31
32
|
return "对话中的一段文字";
|
|
32
33
|
case "terminal":
|
|
33
34
|
return "终端选文";
|
|
35
|
+
case "api":
|
|
36
|
+
return `${source.method} ${truncateUrlForMeta(source.url)}`;
|
|
34
37
|
}
|
|
35
38
|
}
|
|
39
|
+
function truncateUrlForMeta(url) {
|
|
40
|
+
return url.length > 64 ? `${url.slice(0, 61)}…` : url;
|
|
41
|
+
}
|
|
36
42
|
export function referenceMetaTitle(source) {
|
|
37
|
-
return source.kind === "browser" ? source.url : referenceMeta(source);
|
|
43
|
+
return source.kind === "browser" || source.kind === "api" ? source.url : referenceMeta(source);
|
|
38
44
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-open triggers for the Tasks surface — the Loop twin of DSH's
|
|
3
|
+
* "auto-open on subagent / background job" behaviour.
|
|
4
|
+
*
|
|
5
|
+
* DSH turns this on by default (`autoOpenSubagent`, `autoOpenJobs` in
|
|
6
|
+
* `prefs-shared.ts`), decides it from a session-list snapshot, and parks the
|
|
7
|
+
* column instead of taking the viewport over on a narrow screen
|
|
8
|
+
* (`use-host-feeds.ts`). The decisions themselves are pure, so they live here
|
|
9
|
+
* and the component only wires them to state.
|
|
10
|
+
*
|
|
11
|
+
* Two rules are copied verbatim because they are what make the feature
|
|
12
|
+
* bearable rather than nagging:
|
|
13
|
+
*
|
|
14
|
+
* 1. **0 → N only.** A session that ALREADY has subagents, opened for the
|
|
15
|
+
* first time, must not pop the rail — the reader came to read the chat, and
|
|
16
|
+
* the baseline starts at the current count. Same for jobs: the first
|
|
17
|
+
* observation only arms the baseline.
|
|
18
|
+
* 2. **An open rail is never redirected.** If the reader is already looking at
|
|
19
|
+
* some tab, background work must not steal it. Only a rail that was CLOSED
|
|
20
|
+
* gets opened.
|
|
21
|
+
*/
|
|
22
|
+
const PREF_KEY = "loop-console.tasks-auto-open.v1";
|
|
23
|
+
export const DEFAULT_TASKS_AUTO_OPEN_PREFS = {
|
|
24
|
+
// DSH ships both triggers ON.
|
|
25
|
+
subagent: true,
|
|
26
|
+
jobs: true,
|
|
27
|
+
mobileOff: true,
|
|
28
|
+
};
|
|
29
|
+
/** Read the stored prefs, falling back to the DSH defaults. */
|
|
30
|
+
export function readTasksAutoOpenPrefs() {
|
|
31
|
+
if (typeof window === "undefined")
|
|
32
|
+
return DEFAULT_TASKS_AUTO_OPEN_PREFS;
|
|
33
|
+
try {
|
|
34
|
+
const raw = window.localStorage.getItem(PREF_KEY);
|
|
35
|
+
if (!raw)
|
|
36
|
+
return DEFAULT_TASKS_AUTO_OPEN_PREFS;
|
|
37
|
+
const parsed = JSON.parse(raw);
|
|
38
|
+
return {
|
|
39
|
+
subagent: typeof parsed.subagent === "boolean" ? parsed.subagent : DEFAULT_TASKS_AUTO_OPEN_PREFS.subagent,
|
|
40
|
+
jobs: typeof parsed.jobs === "boolean" ? parsed.jobs : DEFAULT_TASKS_AUTO_OPEN_PREFS.jobs,
|
|
41
|
+
mobileOff: typeof parsed.mobileOff === "boolean" ? parsed.mobileOff : DEFAULT_TASKS_AUTO_OPEN_PREFS.mobileOff,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return DEFAULT_TASKS_AUTO_OPEN_PREFS;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function writeTasksAutoOpenPrefs(prefs) {
|
|
49
|
+
if (typeof window === "undefined")
|
|
50
|
+
return;
|
|
51
|
+
try {
|
|
52
|
+
window.localStorage.setItem(PREF_KEY, JSON.stringify(prefs));
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
/* A blocked storage must not break the chat. */
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** DSH's narrow breakpoint: below this the right column covers the chat. */
|
|
59
|
+
export const TASKS_AUTO_OPEN_NARROW_WIDTH = 768;
|
|
60
|
+
export function isNarrowViewport(width) {
|
|
61
|
+
return width < TASKS_AUTO_OPEN_NARROW_WIDTH;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Did a NEW subagent appear in this session between two counts?
|
|
65
|
+
*
|
|
66
|
+
* `null` means "no baseline yet" (the first observation of a session), which
|
|
67
|
+
* arms the baseline without opening anything.
|
|
68
|
+
*/
|
|
69
|
+
export function detectNewSubagent(previousCount, nextCount) {
|
|
70
|
+
if (previousCount === null)
|
|
71
|
+
return false;
|
|
72
|
+
return previousCount === 0 && nextCount > 0;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Did a NEW background job appear?
|
|
76
|
+
*
|
|
77
|
+
* Unlike the subagent rule this fires on ANY increase, because an agent may
|
|
78
|
+
* start several jobs in one conversation and each deserves to surface (DSH's
|
|
79
|
+
* `detectNewJob` makes the same distinction). A decrease never fires.
|
|
80
|
+
*/
|
|
81
|
+
export function detectNewJob(previousCount, nextCount) {
|
|
82
|
+
if (previousCount === null)
|
|
83
|
+
return false;
|
|
84
|
+
return nextCount > previousCount;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Whether a background trigger should actually open the rail.
|
|
88
|
+
*
|
|
89
|
+
* Kept separate from the detection helpers so the "never steal an open rail"
|
|
90
|
+
* rule lives in ONE place: a trigger decides WHETHER work appeared, this decides
|
|
91
|
+
* whether acting on it is polite.
|
|
92
|
+
*/
|
|
93
|
+
export function shouldAutoOpen(input) {
|
|
94
|
+
if (!input.prefs[input.kind])
|
|
95
|
+
return false;
|
|
96
|
+
if (input.prefs.mobileOff && isNarrowViewport(input.viewportWidth))
|
|
97
|
+
return false;
|
|
98
|
+
// An open rail belongs to the reader: never redirect it.
|
|
99
|
+
return !input.detailsOpen;
|
|
100
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { taskEdgePath } from "./tasks-model.js";
|
|
3
|
+
export const TASKS_LAYOUT_TWEEN_MS = 220;
|
|
4
|
+
function easeOut(progress) {
|
|
5
|
+
const t = Math.min(1, Math.max(0, progress));
|
|
6
|
+
return 1 - (1 - t) ** 3;
|
|
7
|
+
}
|
|
8
|
+
function prefersReducedMotion() {
|
|
9
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
10
|
+
}
|
|
11
|
+
function mix(a, b, progress) {
|
|
12
|
+
return a + (b - a) * progress;
|
|
13
|
+
}
|
|
14
|
+
function tweenNode(from, to, progress) {
|
|
15
|
+
if (!from)
|
|
16
|
+
return to;
|
|
17
|
+
return {
|
|
18
|
+
...to,
|
|
19
|
+
x: mix(from.x, to.x, progress),
|
|
20
|
+
y: mix(from.y, to.y, progress),
|
|
21
|
+
width: mix(from.width, to.width, progress),
|
|
22
|
+
height: mix(from.height, to.height, progress),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function tweenEdge(from, to, progress, fromNodes, toNodes) {
|
|
26
|
+
const fromStart = fromNodes.get(to.from) ?? toNodes.get(to.from);
|
|
27
|
+
const fromEnd = fromNodes.get(to.to) ?? toNodes.get(to.to);
|
|
28
|
+
const toStart = toNodes.get(to.from);
|
|
29
|
+
const toEnd = toNodes.get(to.to);
|
|
30
|
+
if (!from || !fromStart || !fromEnd || !toStart || !toEnd)
|
|
31
|
+
return to;
|
|
32
|
+
/*
|
|
33
|
+
* Rebuild the path through the SHARED constructor, not a local formula.
|
|
34
|
+
*
|
|
35
|
+
* This function used to interpolate its own single cubic, which silently
|
|
36
|
+
* replaced whatever `taskEdgePath` produced on every animation frame: the
|
|
37
|
+
* model's routing (the stubs, and the gutter detour for a deep child) never
|
|
38
|
+
* reached the screen, so a fix in the model looked like a no-op in the
|
|
39
|
+
* browser even though its unit test passed.
|
|
40
|
+
*
|
|
41
|
+
* The two endpoints are interpolated and the path is rebuilt from those
|
|
42
|
+
* drawn boxes, so the connector stays glued to the cards while they move.
|
|
43
|
+
*/
|
|
44
|
+
const drawnFrom = {
|
|
45
|
+
...toStart,
|
|
46
|
+
x: mix(fromStart.x, toStart.x, progress),
|
|
47
|
+
y: mix(fromStart.y, toStart.y, progress),
|
|
48
|
+
width: mix(fromStart.width, toStart.width, progress),
|
|
49
|
+
height: mix(fromStart.height, toStart.height, progress),
|
|
50
|
+
};
|
|
51
|
+
const drawnTo = {
|
|
52
|
+
...toEnd,
|
|
53
|
+
x: mix(fromEnd.x, toEnd.x, progress),
|
|
54
|
+
y: mix(fromEnd.y, toEnd.y, progress),
|
|
55
|
+
width: mix(fromEnd.width, toEnd.width, progress),
|
|
56
|
+
height: mix(fromEnd.height, toEnd.height, progress),
|
|
57
|
+
};
|
|
58
|
+
const boxes = [...toNodes.values()].map((node) => node.id === toStart.id ? drawnFrom : node.id === toEnd.id ? drawnTo : node);
|
|
59
|
+
return { ...to, path: taskEdgePath(drawnFrom, drawnTo, boxes) };
|
|
60
|
+
}
|
|
61
|
+
function tweenFrame(from, to, progress) {
|
|
62
|
+
if (!from)
|
|
63
|
+
return to;
|
|
64
|
+
return {
|
|
65
|
+
...to,
|
|
66
|
+
x: mix(from.x, to.x, progress),
|
|
67
|
+
y: mix(from.y, to.y, progress),
|
|
68
|
+
width: mix(from.width, to.width, progress),
|
|
69
|
+
height: mix(from.height, to.height, progress),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export function useTweenedTasksLayout(layout) {
|
|
73
|
+
const drawnRef = useRef(undefined);
|
|
74
|
+
const [drawn, setDrawn] = useState(layout);
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
const previous = drawnRef.current;
|
|
77
|
+
if (!previous || prefersReducedMotion()) {
|
|
78
|
+
drawnRef.current = layout;
|
|
79
|
+
setDrawn(layout);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const previousNodes = new Map(previous.nodes.map((node) => [node.id, node]));
|
|
83
|
+
const currentNodes = new Map(layout.nodes.map((node) => [node.id, node]));
|
|
84
|
+
const previousFrames = new Map(previous.phaseFrames.map((frame) => [frame.id, frame]));
|
|
85
|
+
const previousEdges = new Map(previous.edges.map((edge) => [edge.id, edge]));
|
|
86
|
+
const started = performance.now();
|
|
87
|
+
let raf = 0;
|
|
88
|
+
const frame = () => {
|
|
89
|
+
const progress = easeOut((performance.now() - started) / TASKS_LAYOUT_TWEEN_MS);
|
|
90
|
+
const nodes = layout.nodes.map((node) => tweenNode(previousNodes.get(node.id), node, progress));
|
|
91
|
+
const phaseFrames = layout.phaseFrames.map((item) => tweenFrame(previousFrames.get(item.id), item, progress));
|
|
92
|
+
const edges = layout.edges.map((edge) => tweenEdge(previousEdges.get(edge.id), edge, progress, previousNodes, currentNodes));
|
|
93
|
+
const next = { ...layout, nodes, phaseFrames, edges };
|
|
94
|
+
drawnRef.current = next;
|
|
95
|
+
setDrawn(next);
|
|
96
|
+
if (progress < 1)
|
|
97
|
+
raf = requestAnimationFrame(frame);
|
|
98
|
+
};
|
|
99
|
+
raf = requestAnimationFrame(frame);
|
|
100
|
+
return () => cancelAnimationFrame(raf);
|
|
101
|
+
}, [layout]);
|
|
102
|
+
return drawn;
|
|
103
|
+
}
|