@cc-monitoring/proxy-core 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/404.html +1 -1
- package/dist/docs/assets/{app.6_CicOIJ.js → app.Dc46Hlqp.js} +1 -1
- package/dist/docs/assets/chunks/{@localSearchIndexroot.CHyuB7c8.js → @localSearchIndexroot.BN6hB8Jr.js} +1 -1
- package/dist/docs/assets/chunks/{VPLocalSearchBox.ZMWZsg8z.js → VPLocalSearchBox.Snq5jR6J.js} +1 -1
- package/dist/docs/assets/chunks/{theme.BkvhsjzH.js → theme.XLtxGM-l.js} +2 -2
- package/dist/docs/index.html +2 -2
- package/dist/docs/overview.html +2 -2
- package/dist/docs/packages-utils.html +2 -2
- package/dist/docs/proxy-admin/env-and-build.html +2 -2
- package/dist/docs/proxy-admin/index.html +2 -2
- package/dist/docs/proxy-admin/layout-and-menu.html +2 -2
- package/dist/docs/proxy-admin/pages.html +2 -2
- package/dist/docs/proxy-admin/routing-and-auth.html +2 -2
- package/dist/docs/proxy-admin/services-and-mock.html +2 -2
- package/dist/docs/proxy-cli/api-layer.html +2 -2
- package/dist/docs/proxy-cli/app-shell.html +2 -2
- package/dist/docs/proxy-cli/components-common.html +2 -2
- package/dist/docs/proxy-cli/components-config.html +2 -2
- package/dist/docs/proxy-cli/components-requests.html +2 -2
- package/dist/docs/proxy-cli/components-stats.html +2 -2
- package/dist/docs/proxy-cli/components-status.html +2 -2
- package/dist/docs/proxy-cli/data-hooks.html +2 -2
- package/dist/docs/proxy-cli/index.html +2 -2
- package/dist/docs/proxy-cli/utils-and-i18n.html +2 -2
- package/dist/docs/proxy-core/chat-api.html +2 -2
- package/dist/docs/proxy-core/cli.html +2 -2
- package/dist/docs/proxy-core/config.html +2 -2
- package/dist/docs/proxy-core/data-layer.html +2 -2
- package/dist/docs/proxy-core/entry.html +2 -2
- package/dist/docs/proxy-core/index.html +2 -2
- package/dist/docs/proxy-core/pm2.html +2 -2
- package/dist/docs/proxy-core/providers.html +2 -2
- package/dist/docs/proxy-core/proxy.html +2 -2
- package/dist/docs/proxy-core/stats.html +2 -2
- package/dist/docs/proxy-core/tool.html +2 -2
- package/dist/docs/proxy-core/ui-routes.html +2 -2
- package/dist/docs/proxy-core/utilities.html +2 -2
- package/dist/docs/quickstart.html +2 -2
- package/dist/docs/request-flow.html +2 -2
- package/dist/server/__tests__/server.test.js +9 -1
- package/dist/server/__tests__/ui-route.test.js +8 -0
- package/dist/server/ui-route.js +113 -7
- package/dist/ui/assets/{1c-HTPXddJd.js → 1c-Bx3CHH-I.js} +1 -1
- package/dist/ui/assets/{abnf-bINSkl_m.js → abnf-NN4-iXDM.js} +1 -1
- package/dist/ui/assets/{abnfDiagram-VRR7QNED-ClDzCbvw.js → abnfDiagram-VRR7QNED-CXFZgDk7.js} +1 -1
- package/dist/ui/assets/{accesslog-BAnIWzpe.js → accesslog-Bq9x4vSZ.js} +1 -1
- package/dist/ui/assets/{actionscript-DVcm6F_C.js → actionscript-CeaB6gjT.js} +1 -1
- package/dist/ui/assets/{ada-Cxn-QX4j.js → ada-DObFDSC6.js} +1 -1
- package/dist/ui/assets/{angelscript-BAwAPvBQ.js → angelscript-4pIbuWPH.js} +1 -1
- package/dist/ui/assets/{apache-CjjovgUx.js → apache-w0LzP4me.js} +1 -1
- package/dist/ui/assets/{applescript-VUcyXoVh.js → applescript-DXpD6Cc9.js} +1 -1
- package/dist/ui/assets/{arc-3Nou_aku.js → arc-Dtt1H4m8.js} +1 -1
- package/dist/ui/assets/{arcade-Dz2VAk7O.js → arcade-D_zU9Djr.js} +1 -1
- package/dist/ui/assets/{architectureDiagram-ZJ3FMSHR-DhwSsCdN.js → architectureDiagram-ZJ3FMSHR-C0E_eQDM.js} +1 -1
- package/dist/ui/assets/{arduino-B-Ptb1K1.js → arduino-BnmN_xp_.js} +1 -1
- package/dist/ui/assets/{armasm-DU_6qZlW.js → armasm-CH_xJaHf.js} +1 -1
- package/dist/ui/assets/{asciidoc-DYbYiWKT.js → asciidoc-BlvZZ-hO.js} +1 -1
- package/dist/ui/assets/{aspectj-CmdNkqAs.js → aspectj-DP5DdFKQ.js} +1 -1
- package/dist/ui/assets/{autohotkey-if9QUvYo.js → autohotkey-Cy7dy_B1.js} +1 -1
- package/dist/ui/assets/{autoit-DGU3G1s6.js → autoit-BmQwjQdM.js} +1 -1
- package/dist/ui/assets/{avrasm-1zsEtPJ6.js → avrasm-fcPy4w1X.js} +1 -1
- package/dist/ui/assets/{awk-CvmeshSq.js → awk-AlcwGSdk.js} +1 -1
- package/dist/ui/assets/{axapta-CbJGb5cN.js → axapta-NyMN6Mvz.js} +1 -1
- package/dist/ui/assets/{bash-CFXg_i2e.js → bash-Bn3yyTUs.js} +1 -1
- package/dist/ui/assets/{basic-6atic5cT.js → basic-gp9eOjjv.js} +1 -1
- package/dist/ui/assets/{blockDiagram-677ZJIJ3-BKXinDkB.js → blockDiagram-677ZJIJ3-BHAadGGo.js} +1 -1
- package/dist/ui/assets/{bnf-DydAtPHV.js → bnf-DRAiK-_J.js} +1 -1
- package/dist/ui/assets/{brainfuck-CnHx1vO0.js → brainfuck-IYgPavhh.js} +1 -1
- package/dist/ui/assets/{coq-BShzwzh7.js → c-Dht0EgwX.js} +1 -1
- package/dist/ui/assets/{c-like-XpQV9S6j.js → c-like-B7T39dtK.js} +1 -1
- package/dist/ui/assets/{c4Diagram-LMCZKHZV-D5EmWl5d.js → c4Diagram-LMCZKHZV-4cXT8R9f.js} +1 -1
- package/dist/ui/assets/{cal-D-orUuBW.js → cal-DmXm_WLX.js} +1 -1
- package/dist/ui/assets/{capnproto-TdI6NT8O.js → capnproto-Cb-rKd-Z.js} +1 -1
- package/dist/ui/assets/{ceylon-Dji8eqtG.js → ceylon-Bn2aNwEq.js} +1 -1
- package/dist/ui/assets/channel-BgAIihW-.js +1 -0
- package/dist/ui/assets/{chunk-2Q5K7J3B-CaIvwVWl.js → chunk-2Q5K7J3B-B3N_AddF.js} +1 -1
- package/dist/ui/assets/{chunk-32BRIVSS-C7oMpoeu.js → chunk-32BRIVSS-CW7iU3gE.js} +1 -1
- package/dist/ui/assets/{chunk-5VM5RSS4-BQ0aVGl-.js → chunk-5VM5RSS4-M8Ep3dJD.js} +1 -1
- package/dist/ui/assets/{chunk-EX3LRPZG-D-_EqojZ.js → chunk-EX3LRPZG-t2hCXH-v.js} +1 -1
- package/dist/ui/assets/{chunk-JWPE2WC7-B0OLx2rk.js → chunk-JWPE2WC7-rQK8maXo.js} +1 -1
- package/dist/ui/assets/{chunk-MOJQB5TN-Be8IXTUE.js → chunk-MOJQB5TN-BpU7vp3L.js} +1 -1
- package/dist/ui/assets/{chunk-RYQCIY6F-DceCW2mS.js → chunk-RYQCIY6F-CJVNOulR.js} +1 -1
- package/dist/ui/assets/{chunk-V7JOEXUC-Cbhq5qgO.js → chunk-V7JOEXUC-B--maww3.js} +1 -1
- package/dist/ui/assets/{chunk-VR4S4FIN-D6WJuaS1.js → chunk-VR4S4FIN-QJ5u9nSh.js} +1 -1
- package/dist/ui/assets/{chunk-XXDRQBXY-CKrih4pC.js → chunk-XXDRQBXY-BcM9JOXa.js} +1 -1
- package/dist/ui/assets/classDiagram-OUVF2IWQ-0fsnUoNI.js +1 -0
- package/dist/ui/assets/classDiagram-v2-EOCWNBFH-0fsnUoNI.js +1 -0
- package/dist/ui/assets/{clean-0frlVN_A.js → clean-BCfhFoON.js} +1 -1
- package/dist/ui/assets/{clojure-D0q_yQDf.js → clojure-DtnBj8eB.js} +1 -1
- package/dist/ui/assets/{clojure-repl-DgYhEzOe.js → clojure-repl-D8X-urCW.js} +1 -1
- package/dist/ui/assets/{cmake-WF5tF5xU.js → cmake-BH2RXBgt.js} +1 -1
- package/dist/ui/assets/{coffeescript-CyWYgeyv.js → coffeescript-CuoLiQ_d.js} +1 -1
- package/dist/ui/assets/{c-DarYnPBd.js → coq-BYVsAo31.js} +1 -1
- package/dist/ui/assets/{cos-C5i3_TIB.js → cos-t-cDfrf6.js} +1 -1
- package/dist/ui/assets/{cose-bilkent-JH36ORCC-BCwilS6I.js → cose-bilkent-JH36ORCC-CYip_9u7.js} +1 -1
- package/dist/ui/assets/{cpp-F1mRQFyw.js → cpp-Cgv0dQ7g.js} +1 -1
- package/dist/ui/assets/{crmsh-BAkHUu-B.js → crmsh-7pr1Pq_e.js} +1 -1
- package/dist/ui/assets/{crystal-CwUaomfj.js → crystal-BHZFifeV.js} +1 -1
- package/dist/ui/assets/{csharp-B1gHIdjK.js → csharp-CVMfBRGF.js} +1 -1
- package/dist/ui/assets/{csp-CblCTMvV.js → csp-NEBRDuZY.js} +1 -1
- package/dist/ui/assets/{css-CXg7kJV3.js → css-B0fbMkoQ.js} +1 -1
- package/dist/ui/assets/{cynefin-VYW2F7L2-BdgMlR5e.js → cynefin-VYW2F7L2-CycR2u2l.js} +1 -1
- package/dist/ui/assets/{cynefinDiagram-TSTJHNR4-Bozdux8p.js → cynefinDiagram-TSTJHNR4-CvXYb5em.js} +1 -1
- package/dist/ui/assets/{d-Cs5yNCaM.js → d-AzA6F7Ab.js} +1 -1
- package/dist/ui/assets/{dagre-VKFMJZFB-tI_mjNMn.js → dagre-VKFMJZFB-6NuSYMRG.js} +1 -1
- package/dist/ui/assets/{dart-BqgylVkh.js → dart-D0VXSwKi.js} +1 -1
- package/dist/ui/assets/{delphi-CbnfHpIi.js → delphi-B-bkLmCx.js} +1 -1
- package/dist/ui/assets/{diagram-FQU43EPY-DmyL3OJT.js → diagram-FQU43EPY-CNNW_5O7.js} +1 -1
- package/dist/ui/assets/{diagram-G47NLZAW-BEi9GZlZ.js → diagram-G47NLZAW-C60bRph-.js} +1 -1
- package/dist/ui/assets/{diagram-NH7WQ7WH-Bct44Oh1.js → diagram-NH7WQ7WH-CwERNWac.js} +1 -1
- package/dist/ui/assets/{diagram-OA4YK3LP-VWAgZxPK.js → diagram-OA4YK3LP-9XSTmf1Z.js} +1 -1
- package/dist/ui/assets/{diagram-WEI45ONY-CxcHsE6q.js → diagram-WEI45ONY-h8K41_YA.js} +1 -1
- package/dist/ui/assets/{diff-CMJ2hGQW.js → diff-Ch9RlEn8.js} +1 -1
- package/dist/ui/assets/{django-Cq_XIhVZ.js → django-C00rhzcB.js} +1 -1
- package/dist/ui/assets/{dns-CJs3z6-E.js → dns-C5MKVde0.js} +1 -1
- package/dist/ui/assets/{dockerfile-ehs0ogry.js → dockerfile-BpRaVDMB.js} +1 -1
- package/dist/ui/assets/{dos-DXOYESf1.js → dos-CjQOJ_vn.js} +1 -1
- package/dist/ui/assets/{dsconfig-Cs2hs3Bl.js → dsconfig-3zd3UkyN.js} +1 -1
- package/dist/ui/assets/{dts-Dk8yoweb.js → dts-Bb6PtK5T.js} +1 -1
- package/dist/ui/assets/{dust-BMK9e-Ss.js → dust-BEJKezIa.js} +1 -1
- package/dist/ui/assets/{ebnf-DlyBI5m6.js → ebnf-5-TvfsoC.js} +1 -1
- package/dist/ui/assets/{ebnfDiagram-CCIWWBDH-DBp9JHEq.js → ebnfDiagram-CCIWWBDH-CRmIjeas.js} +1 -1
- package/dist/ui/assets/{elixir-BThlsblT.js → elixir-B6gSEyen.js} +1 -1
- package/dist/ui/assets/{elm-DrmZwmcc.js → elm-rR0aqyyf.js} +1 -1
- package/dist/ui/assets/{erDiagram-Q63AITRT-BhK4NKvx.js → erDiagram-Q63AITRT-DS3jYOq8.js} +1 -1
- package/dist/ui/assets/{erb-BQM7j3K9.js → erb-DUu22Jxg.js} +1 -1
- package/dist/ui/assets/{erlang-CuUaWEXv.js → erlang-C0m-R-6W.js} +1 -1
- package/dist/ui/assets/{erlang-repl-DB0uphao.js → erlang-repl-B7O2MhlI.js} +1 -1
- package/dist/ui/assets/{excel-DmsuWUss.js → excel-CIqnqFs1.js} +1 -1
- package/dist/ui/assets/{fix-D-Uzxpz_.js → fix-Ds9tcTzQ.js} +1 -1
- package/dist/ui/assets/{flix-B_7EHWiA.js → flix-ByzuevTB.js} +1 -1
- package/dist/ui/assets/{flowDiagram-23GEKE2U-DtMG1G-h.js → flowDiagram-23GEKE2U-B9F3S_Hl.js} +1 -1
- package/dist/ui/assets/{fortran-Djp5tH9W.js → fortran-DieSVGx5.js} +1 -1
- package/dist/ui/assets/{fsharp-Pj_2ZEa4.js → fsharp-DGP8m6H3.js} +1 -1
- package/dist/ui/assets/{gams-B2i3v2ec.js → gams-BiLGBohb.js} +1 -1
- package/dist/ui/assets/{ganttDiagram-NO4QXBWP-C7M-JA0W.js → ganttDiagram-NO4QXBWP-CHiCWnJt.js} +1 -1
- package/dist/ui/assets/{gauss-DaV8sHLU.js → gauss-Btl1fjJ0.js} +1 -1
- package/dist/ui/assets/{gcode-0Jvrh6HY.js → gcode-DWl2YoL_.js} +1 -1
- package/dist/ui/assets/{gherkin-DoOl28D6.js → gherkin-D42ESIJ2.js} +1 -1
- package/dist/ui/assets/{gitGraphDiagram-IHSO6WYX-D3HB5mow.js → gitGraphDiagram-IHSO6WYX-0pEKZnJg.js} +1 -1
- package/dist/ui/assets/{glsl-DEbk7rH5.js → glsl-Dx1QhGIM.js} +1 -1
- package/dist/ui/assets/{gml-CBcqXBNV.js → gml-f0noEVTB.js} +1 -1
- package/dist/ui/assets/{go-DqesmqF8.js → go-DXT6c-0g.js} +1 -1
- package/dist/ui/assets/{golo-9U1oO0b5.js → golo-D3NuJxTg.js} +1 -1
- package/dist/ui/assets/{gradle-DZliBXTY.js → gradle-CUsTLc_e.js} +1 -1
- package/dist/ui/assets/{groovy-Dys3GQwv.js → groovy-BIkOcIpQ.js} +1 -1
- package/dist/ui/assets/{haml-CrtAODl1.js → haml-C5jI7YVN.js} +1 -1
- package/dist/ui/assets/{handlebars-CueXuqSj.js → handlebars-UOvbWwDx.js} +1 -1
- package/dist/ui/assets/{haskell-CRungOQt.js → haskell-DuO_Av2n.js} +1 -1
- package/dist/ui/assets/{haxe-aMz7L4gD.js → haxe-C0Cg5Hjh.js} +1 -1
- package/dist/ui/assets/{hsp-Cw75yqGb.js → hsp-CTDajZig.js} +1 -1
- package/dist/ui/assets/{htmlbars-e_mpUZNH.js → htmlbars-_ITuCkOs.js} +1 -1
- package/dist/ui/assets/{http-Di7E_m1o.js → http-Dr26PHfb.js} +1 -1
- package/dist/ui/assets/{hy-CwlvsNj6.js → hy-B-ThgV4T.js} +1 -1
- package/dist/ui/assets/index-C0fxlU9d.css +10 -0
- package/dist/ui/assets/{index-BdSumlU0.js → index-CpQr158p.js} +3 -3
- package/dist/ui/assets/{index-BVM6YOjH.js → index-CwcnuNUs.js} +256 -256
- package/dist/ui/assets/{infoDiagram-FWYZ7A6U-_r-6eAzx.js → infoDiagram-FWYZ7A6U-ClKPOdlx.js} +1 -1
- package/dist/ui/assets/{inform7-dwg1imm1.js → inform7-D7JYYkX9.js} +1 -1
- package/dist/ui/assets/{ini-DEXL1rCA.js → ini-BZwCkFAf.js} +1 -1
- package/dist/ui/assets/{irpf90-Ccs_8Sp-.js → irpf90-omMve0rd.js} +1 -1
- package/dist/ui/assets/{isbl-B9d1nYmL.js → isbl-C4xosfum.js} +1 -1
- package/dist/ui/assets/{ishikawaDiagram-FXEZZL3T-lNCezpU4.js → ishikawaDiagram-FXEZZL3T-PtbNBMgh.js} +1 -1
- package/dist/ui/assets/{java-5fv2smM6.js → java-CWjWDe7Q.js} +1 -1
- package/dist/ui/assets/{javascript-TAWm0NK8.js → javascript-C3dxrGuA.js} +1 -1
- package/dist/ui/assets/{jboss-cli-dM1kcsbR.js → jboss-cli-CJE7m0Y-.js} +1 -1
- package/dist/ui/assets/{journeyDiagram-5HDEW3XC-CBYHux8i.js → journeyDiagram-5HDEW3XC-DgK9V4yg.js} +1 -1
- package/dist/ui/assets/{json-CtCzm6jF.js → json-DFUiNV7v.js} +1 -1
- package/dist/ui/assets/{julia-Co7H3kzk.js → julia-CUTHpx8X.js} +1 -1
- package/dist/ui/assets/{julia-repl-BT1ar5VS.js → julia-repl-_ZaQqdrz.js} +1 -1
- package/dist/ui/assets/{kanban-definition-HUTT4EX6-B8x8eQyo.js → kanban-definition-HUTT4EX6-BFrDfKdv.js} +1 -1
- package/dist/ui/assets/{kotlin-W6mVKIj9.js → kotlin-CrYjQYp8.js} +1 -1
- package/dist/ui/assets/{lasso-DJG4luGz.js → lasso-CAiVg9m2.js} +1 -1
- package/dist/ui/assets/{latex-DbBOxO7u.js → latex-BkxnXIrT.js} +1 -1
- package/dist/ui/assets/{ldif-CVS189JA.js → ldif-CBOqxiN7.js} +1 -1
- package/dist/ui/assets/{leaf-eYNiXTKP.js → leaf-CbBZyOGH.js} +1 -1
- package/dist/ui/assets/{less-DxhvWM95.js → less-Ca6uLPP0.js} +1 -1
- package/dist/ui/assets/{lisp-SC7AwnXC.js → lisp-0Cm7_Bzv.js} +1 -1
- package/dist/ui/assets/{livecodeserver-CR2eHihF.js → livecodeserver-B7ka0vFT.js} +1 -1
- package/dist/ui/assets/{livescript-DBZ-GaVK.js → livescript-CGmWmcLd.js} +1 -1
- package/dist/ui/assets/{llvm-BzURO4tt.js → llvm-DCVMvkrH.js} +1 -1
- package/dist/ui/assets/{lsl-DGoJxEUu.js → lsl-PVrTScpn.js} +1 -1
- package/dist/ui/assets/{lua-qgG9gdiw.js → lua-BTo3z2Ux.js} +1 -1
- package/dist/ui/assets/{makefile-D0kZ6SOe.js → makefile-DJGh9r9C.js} +1 -1
- package/dist/ui/assets/{markdown-DRQWgMxk.js → markdown-BOloL-q7.js} +1 -1
- package/dist/ui/assets/{mathematica-DIBvZyEZ.js → mathematica-CtMMQM2V.js} +1 -1
- package/dist/ui/assets/{matlab-BNg0BR0b.js → matlab-Bfg_AWdR.js} +1 -1
- package/dist/ui/assets/{maxima-Bpga3G1G.js → maxima-B2cdS7BY.js} +1 -1
- package/dist/ui/assets/{mel-CMOJa9Mg.js → mel-BvfPvpYI.js} +1 -1
- package/dist/ui/assets/{mercury-uvrRzupw.js → mercury-B6KgNIai.js} +1 -1
- package/dist/ui/assets/{mindmap-definition-LN4V7U3C-DK8j_8Ap.js → mindmap-definition-LN4V7U3C-BkeXo5If.js} +1 -1
- package/dist/ui/assets/{mipsasm-p1gWpDuw.js → mipsasm-Csras-cD.js} +1 -1
- package/dist/ui/assets/{mizar-DV1ENOOU.js → mizar-C3WDI1-X.js} +1 -1
- package/dist/ui/assets/{mojolicious-tg5XQSro.js → mojolicious-MnD2Whic.js} +1 -1
- package/dist/ui/assets/{monkey-D8mYa31Q.js → monkey-DLvUPYTI.js} +1 -1
- package/dist/ui/assets/{moonscript-1d_rtlyv.js → moonscript-B0XEb3R3.js} +1 -1
- package/dist/ui/assets/{n1ql-C5srRxme.js → n1ql-BMRF54sY.js} +1 -1
- package/dist/ui/assets/{nginx-xS1muaWm.js → nginx-DqUyeHb8.js} +1 -1
- package/dist/ui/assets/{nim-CGGiMQfp.js → nim-3xwg8mOL.js} +1 -1
- package/dist/ui/assets/{nix-C77HsR7m.js → nix-ByTkLdcH.js} +1 -1
- package/dist/ui/assets/{node-repl-CSeYusSM.js → node-repl-sGSuIUFG.js} +1 -1
- package/dist/ui/assets/{nsis-BffC7mSW.js → nsis-Dng5mFSM.js} +1 -1
- package/dist/ui/assets/{objectivec-WpjnmlJB.js → objectivec-DSQ8vb7n.js} +1 -1
- package/dist/ui/assets/{ocaml-CHUkJkjB.js → ocaml-BHOhEgRu.js} +1 -1
- package/dist/ui/assets/{openscad-BvImqFT0.js → openscad-DcUxQ-FQ.js} +1 -1
- package/dist/ui/assets/{oxygene-BMBykbf5.js → oxygene-DNlmqhsR.js} +1 -1
- package/dist/ui/assets/{parser3-lRbuZW0M.js → parser3-DIR98Q6n.js} +1 -1
- package/dist/ui/assets/{pegDiagram-2B236MQR-C4DWmrja.js → pegDiagram-2B236MQR-BrXp_1_9.js} +1 -1
- package/dist/ui/assets/{perl-B0DjfKoO.js → perl-16cY7fyu.js} +1 -1
- package/dist/ui/assets/{pf-Aor6NyYJ.js → pf-KrAq2BW7.js} +1 -1
- package/dist/ui/assets/{pgsql-CVKcjjNR.js → pgsql-BV1Z2bjp.js} +1 -1
- package/dist/ui/assets/{php-CZ7geHZt.js → php-FGjYSZqs.js} +1 -1
- package/dist/ui/assets/{php-template-DiFuW2dF.js → php-template-B1OW86WT.js} +1 -1
- package/dist/ui/assets/{pieDiagram-ENE6RG2P-BO7AmF5j.js → pieDiagram-ENE6RG2P-Bh0bhWSa.js} +1 -1
- package/dist/ui/assets/{plaintext-DcvmOuNc.js → plaintext-Cvn_UgSv.js} +1 -1
- package/dist/ui/assets/{pony-DGPeAcOc.js → pony-CRWnA3MR.js} +1 -1
- package/dist/ui/assets/{powershell-DsrPyJdK.js → powershell-Cwn155MZ.js} +1 -1
- package/dist/ui/assets/{processing-Co2VRXN1.js → processing-BS6-1lrQ.js} +1 -1
- package/dist/ui/assets/{profile-D4PjpLUf.js → profile-C45OLQrv.js} +1 -1
- package/dist/ui/assets/{prolog-DEbkeg9r.js → prolog-C5YafSzY.js} +1 -1
- package/dist/ui/assets/{properties-Cxqcuj1s.js → properties-BULd-Zhg.js} +1 -1
- package/dist/ui/assets/{protobuf-C-zdlrww.js → protobuf-Qf1IuG5l.js} +1 -1
- package/dist/ui/assets/{puppet-BPX3SrOx.js → puppet-93XdQvnn.js} +1 -1
- package/dist/ui/assets/{purebasic-BdQnNJS3.js → purebasic-DlYNScQP.js} +1 -1
- package/dist/ui/assets/{python-D067_Gj8.js → python-D-Do6-F0.js} +1 -1
- package/dist/ui/assets/{python-repl-DCqNVlc0.js → python-repl-DGutP04w.js} +1 -1
- package/dist/ui/assets/{q-kABXYW-8.js → q-lmgfrySy.js} +1 -1
- package/dist/ui/assets/{qml-Iao-Whg7.js → qml-BbjX_mSU.js} +1 -1
- package/dist/ui/assets/{quadrantDiagram-ABIIQ3AL-DetQn-0l.js → quadrantDiagram-ABIIQ3AL-B891FOO8.js} +1 -1
- package/dist/ui/assets/{r-BnwpapnO.js → r--x8NzO9N.js} +1 -1
- package/dist/ui/assets/{railroadDiagram-RFXS5EU6-DFaFKHAH.js → railroadDiagram-RFXS5EU6-R3O-GKNe.js} +1 -1
- package/dist/ui/assets/{reasonml-Cn_Y03uT.js → reasonml-DwHsAflh.js} +1 -1
- package/dist/ui/assets/{requirementDiagram-TGXJPOKE-Dg1LrT-T.js → requirementDiagram-TGXJPOKE-D4l_xEXt.js} +1 -1
- package/dist/ui/assets/{rib-ByAqQn0v.js → rib-DMJNtDwV.js} +1 -1
- package/dist/ui/assets/{roboconf-BJPu6NC5.js → roboconf-BNNGTvHr.js} +1 -1
- package/dist/ui/assets/{routeros-CL3Jm0Zq.js → routeros-BF7SVruD.js} +1 -1
- package/dist/ui/assets/{rsl-DaXy7KaD.js → rsl-1EHeIZqp.js} +1 -1
- package/dist/ui/assets/{ruby-DI6awte_.js → ruby-B-v_BYYp.js} +1 -1
- package/dist/ui/assets/{ruleslanguage-DoTVEZE9.js → ruleslanguage-GFeEMSdK.js} +1 -1
- package/dist/ui/assets/{rust-ULEd75wO.js → rust-ApqGtMhh.js} +1 -1
- package/dist/ui/assets/{sankeyDiagram-HTMAVEWB-DQtFl110.js → sankeyDiagram-HTMAVEWB-Dc-2lhBq.js} +1 -1
- package/dist/ui/assets/{sas-f7ATFuJk.js → sas-YkxX6N9_.js} +1 -1
- package/dist/ui/assets/{scala-Dha1zro2.js → scala-BpHi86GZ.js} +1 -1
- package/dist/ui/assets/{scheme-BcaFHKeF.js → scheme-D889qY8Y.js} +1 -1
- package/dist/ui/assets/{scilab-CIiiyD4z.js → scilab-C3l-bcRx.js} +1 -1
- package/dist/ui/assets/{scss-CkBomL0n.js → scss-D0iGASxm.js} +1 -1
- package/dist/ui/assets/{sequenceDiagram-DBY2YBRQ-DIbNQtCn.js → sequenceDiagram-DBY2YBRQ-DvppgciC.js} +1 -1
- package/dist/ui/assets/{shell-Cxu8Py1z.js → shell-PUnaEPCO.js} +1 -1
- package/dist/ui/assets/{sizeCapture-X5ZJPWSS-Cj7PglQv.js → sizeCapture-X5ZJPWSS-DhvIbxXs.js} +1 -1
- package/dist/ui/assets/{smali-C4EYyWYz.js → smali-Du_dF9hl.js} +1 -1
- package/dist/ui/assets/{smalltalk-BlPTprP4.js → smalltalk-CSr2Gc1v.js} +1 -1
- package/dist/ui/assets/{sml-DEPzhlr4.js → sml-D3zkvzP2.js} +1 -1
- package/dist/ui/assets/{sqf-CRu3asu9.js → sqf-BZQ34qEZ.js} +1 -1
- package/dist/ui/assets/{sql-DK-YfQqg.js → sql-BFKScMsf.js} +1 -1
- package/dist/ui/assets/{sql_more-BuMEOcjj.js → sql_more-C2Lc_Qqq.js} +1 -1
- package/dist/ui/assets/{stan-DMr13kyD.js → stan-CzY8VdxU.js} +1 -1
- package/dist/ui/assets/{stata-Bt6E2zQi.js → stata-9GxyhPpV.js} +1 -1
- package/dist/ui/assets/{stateDiagram-2N3HPSRC-Bk-gF72D.js → stateDiagram-2N3HPSRC-CM63y6f0.js} +1 -1
- package/dist/ui/assets/stateDiagram-v2-6OUMAXLB-OA9dcuA9.js +1 -0
- package/dist/ui/assets/{step21-Bi954ur4.js → step21-BpK_Zw3v.js} +1 -1
- package/dist/ui/assets/{stylus-CQwwMaLm.js → stylus-DQ4k28M4.js} +1 -1
- package/dist/ui/assets/{subunit-BkixDEMH.js → subunit-C6ciOPNF.js} +1 -1
- package/dist/ui/assets/{swift-DS1DWNAE.js → swift-CJfqqSbT.js} +1 -1
- package/dist/ui/assets/{swimlanes-5IMT3BWC-C-AZKO5z.js → swimlanes-5IMT3BWC-DS6_HNF7.js} +2 -2
- package/dist/ui/assets/swimlanesDiagram-G3AALYLV-BLEnJU_R.js +8 -0
- package/dist/ui/assets/{taggerscript-DZHi1hoc.js → taggerscript-VouMmJ_v.js} +1 -1
- package/dist/ui/assets/{tap-CXxSD8bM.js → tap-wXCy18ot.js} +1 -1
- package/dist/ui/assets/{tcl-CdoAAMbn.js → tcl-ewDOmCFX.js} +1 -1
- package/dist/ui/assets/{thrift-DM086HVt.js → thrift-BfFA03rE.js} +1 -1
- package/dist/ui/assets/{timeline-definition-FHXFAJF6-DcrcjFwq.js → timeline-definition-FHXFAJF6-Dz2m6S6x.js} +1 -1
- package/dist/ui/assets/{tp-Y-w3S3ES.js → tp-HGBcpNf9.js} +1 -1
- package/dist/ui/assets/{twig-C5c_nAus.js → twig-nrQZ0pw8.js} +1 -1
- package/dist/ui/assets/{typescript-fc7SMhJu.js → typescript-B7tNYFEQ.js} +1 -1
- package/dist/ui/assets/{vala-BV-GlwLI.js → vala-BIjQtoo6.js} +1 -1
- package/dist/ui/assets/{vbnet-BIqQmnKr.js → vbnet-Bbspccm6.js} +1 -1
- package/dist/ui/assets/{vbscript-h186Lnrz.js → vbscript-C45_QgOy.js} +1 -1
- package/dist/ui/assets/{vbscript-html-DcuP7lTb.js → vbscript-html-DlF2QBc7.js} +1 -1
- package/dist/ui/assets/{vennDiagram-L72KCM5P-Dnh11y2e.js → vennDiagram-L72KCM5P-BPEphYtX.js} +1 -1
- package/dist/ui/assets/{verilog-Cbgb_XnR.js → verilog-BSitd8W0.js} +1 -1
- package/dist/ui/assets/{vhdl-COP7w5IC.js → vhdl-C1bbeiC4.js} +1 -1
- package/dist/ui/assets/{vim-COGwKzgS.js → vim-DchwbT8X.js} +1 -1
- package/dist/ui/assets/{wardleyDiagram-EHGQE667-BeiD8fPz.js → wardleyDiagram-EHGQE667-BttTCoBT.js} +1 -1
- package/dist/ui/assets/{x86asm-BdBqPPf4.js → x86asm-vARxMUvn.js} +1 -1
- package/dist/ui/assets/{xl-BmCQT7Vj.js → xl-dx63vvXo.js} +1 -1
- package/dist/ui/assets/{xml-DM0NxGiJ.js → xml-BUnj27wL.js} +1 -1
- package/dist/ui/assets/{xquery-BUaYHDJM.js → xquery-T7gpnf0e.js} +1 -1
- package/dist/ui/assets/{xychartDiagram-FW5EYKEG-CnwvTrkm.js → xychartDiagram-FW5EYKEG-BfrNhdrG.js} +1 -1
- package/dist/ui/assets/{yaml-DMs8lGDt.js → yaml-xRgQKzeL.js} +1 -1
- package/dist/ui/assets/{zephir-BvjoPdmg.js → zephir-Yu6l5qJj.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/dist/utils/__tests__/knowledge-store.test.js +86 -5
- package/dist/utils/__tests__/pi-browser-tools.test.d.ts +1 -0
- package/dist/utils/__tests__/pi-browser-tools.test.js +30 -0
- package/dist/utils/__tests__/pi-crawl-tools.test.d.ts +1 -0
- package/dist/utils/__tests__/pi-crawl-tools.test.js +315 -0
- package/dist/utils/__tests__/pi-dedup-reconcile.test.d.ts +1 -0
- package/dist/utils/__tests__/pi-dedup-reconcile.test.js +89 -0
- package/dist/utils/__tests__/pi-dedup.test.d.ts +1 -0
- package/dist/utils/__tests__/pi-dedup.test.js +106 -0
- package/dist/utils/__tests__/pi-learn-orchestrator.test.d.ts +1 -0
- package/dist/utils/__tests__/pi-learn-orchestrator.test.js +885 -0
- package/dist/utils/__tests__/pi-runtime-json.test.d.ts +1 -0
- package/dist/utils/__tests__/pi-runtime-json.test.js +11 -0
- package/dist/utils/__tests__/web-crawler.test.d.ts +1 -0
- package/dist/utils/__tests__/web-crawler.test.js +69 -0
- package/dist/utils/knowledge-store.d.ts +2 -0
- package/dist/utils/knowledge-store.js +32 -6
- package/dist/utils/pi-browser-tools.d.ts +2 -0
- package/dist/utils/pi-browser-tools.js +9 -2
- package/dist/utils/pi-crawl-tools.d.ts +62 -0
- package/dist/utils/pi-crawl-tools.js +298 -0
- package/dist/utils/pi-dedup.d.ts +62 -0
- package/dist/utils/pi-dedup.js +218 -0
- package/dist/utils/pi-learn-orchestrator.d.ts +44 -0
- package/dist/utils/pi-learn-orchestrator.js +431 -0
- package/dist/utils/pi-runtime.d.ts +23 -1
- package/dist/utils/pi-runtime.js +255 -68
- package/dist/utils/web-crawler.d.ts +13 -0
- package/dist/utils/web-crawler.js +64 -0
- package/package.json +1 -1
- package/dist/ui/assets/channel-BdcV3Ykv.js +0 -1
- package/dist/ui/assets/classDiagram-OUVF2IWQ-CAZR5rAv.js +0 -1
- package/dist/ui/assets/classDiagram-v2-EOCWNBFH-CAZR5rAv.js +0 -1
- package/dist/ui/assets/index-WPLwx8h5.css +0 -10
- package/dist/ui/assets/stateDiagram-v2-6OUMAXLB-BFJCYsLY.js +0 -1
- package/dist/ui/assets/swimlanesDiagram-G3AALYLV-BZd1Gt4_.js +0 -8
package/dist/utils/pi-runtime.js
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// - ModelRuntime 懒加载,全局单例
|
|
3
3
|
// - registerProvider 注册一个 "ccm" provider,走 anthropic-messages 协议到本地 proxy
|
|
4
4
|
// - createPiSession() 返回一个新 AgentSession,cwd 钉死在 docsDir
|
|
5
|
-
// - 按 chat /
|
|
5
|
+
// - 按 chat / outline / refine / tag 四种模式挂载不同工具集 + system prompt
|
|
6
6
|
import fs from 'node:fs';
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
import os from 'node:os';
|
|
9
9
|
import { Type } from 'typebox';
|
|
10
|
-
import { createAgentSession, DefaultResourceLoader, ModelRuntime, createWriteToolDefinition,
|
|
10
|
+
import { createAgentSession, DefaultResourceLoader, ModelRuntime, createWriteToolDefinition, } from '@earendil-works/pi-coding-agent';
|
|
11
11
|
import { dataDir } from './paths.js';
|
|
12
|
-
import { sandboxWriteOps
|
|
13
|
-
import { browserTools } from './pi-browser-tools.js';
|
|
12
|
+
import { sandboxWriteOps } from './pi-sandbox-ops.js';
|
|
14
13
|
import { knowledgeStore } from './knowledge-store.js';
|
|
14
|
+
import { createCrawlTools } from './pi-crawl-tools.js';
|
|
15
15
|
// 知识文档目录:所有文件工具的 cwd 和沙箱白名单根
|
|
16
16
|
const docsDir = path.join(dataDir, 'docs');
|
|
17
17
|
// pi agent 目录(auth / models / system.md)
|
|
@@ -59,70 +59,196 @@ async function getRuntime(port) {
|
|
|
59
59
|
}
|
|
60
60
|
return runtimePromise;
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
const DEFAULT_SYSTEM_PROMPT = `You are a knowledge management AI operating inside a sandbox.
|
|
64
|
-
Your knowledge directory (~/.cc-monitoring/docs) stores a **dictionary**: concise, distilled entries a future reader can look up. You do NOT copy source text — you digest it.
|
|
62
|
+
const KB_STRUCTURE = `Your knowledge directory (~/.cc-monitoring/docs) stores a **dictionary**: concise, distilled entries a future reader can look up. You do NOT copy source text — you digest it.
|
|
65
63
|
|
|
66
|
-
STRUCTURE:
|
|
67
|
-
- Each topic is a subfolder:
|
|
68
|
-
- Each topic has
|
|
69
|
-
- Bodies live in
|
|
70
|
-
- Root
|
|
64
|
+
STRUCTURE (all paths below are RELATIVE TO the knowledge root ~/.cc-monitoring/docs — the write tool's working directory IS this root, so NEVER prefix a path with "docs/"):
|
|
65
|
+
- Each topic is a subfolder: <topic-slug>/
|
|
66
|
+
- Each topic has <slug>/index.json (metadata + chunk list, NO body)
|
|
67
|
+
- Bodies live in <topic-slug>/chunks/chunk-NNN.md
|
|
68
|
+
- Root index.json lists all topics as JSON
|
|
69
|
+
- Fetched source pages for a topic are already prepared in <slug>/sources/ — you only READ them, never write or modify them`;
|
|
70
|
+
export const CHAT_SYSTEM_PROMPT = `You are a knowledge management AI operating inside a sandbox.
|
|
71
|
+
${KB_STRUCTURE}
|
|
71
72
|
|
|
72
|
-
|
|
73
|
+
ANSWERING QUESTIONS:
|
|
73
74
|
1. Call list_topics to see available topics
|
|
74
75
|
2. If topic is unclear, call search_chunks(query) to find relevant chunks across topics
|
|
75
76
|
3. Call get_topic(topic) to see that topic's chunk list
|
|
76
77
|
4. Call read_chunk(topic, chunk_id) for relevant chunks — only read chunks you need
|
|
77
78
|
5. Prefer answering from knowledge base chunks when relevant content exists; cite which chunks you used
|
|
78
|
-
6. If no relevant chunk exists, answer from your general knowledge; if you truly don't know, say so
|
|
79
|
+
6. If no relevant chunk exists, answer from your general knowledge; if you truly don't know, say so`;
|
|
80
|
+
export const OUTLINE_SYSTEM_PROMPT = `You are an outline-phase worker. The relevant web pages have ALREADY been fetched and saved to sources/ for your assigned topic. Your job: read them and propose an outline of dictionary entries. Do NOT write chunks.
|
|
79
81
|
|
|
80
|
-
|
|
81
|
-
0. First READ all input material end-to-end. Do NOT start writing chunk-by-chunk as you read. Before writing, internally outline the distinct concepts you extracted. Only then begin.
|
|
82
|
-
1. Call list_topics first to check for existing similar topics — reuse, don't duplicate
|
|
83
|
-
2. Use browser tools to read web pages if the input is a URL
|
|
84
|
-
3. For each concept, produce a dictionary entry. An entry is a STAND-ALONE, retrievable note — the future reader has NO access to the source document. It must make sense alone.
|
|
85
|
-
4. Write each chunk as markdown with this structure (write in the source document's language):
|
|
82
|
+
${KB_STRUCTURE}
|
|
86
83
|
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
WORKFLOW:
|
|
85
|
+
1. Call read_source(topic) to load ALL fetched source pages (multiple pages are separated by ---).
|
|
86
|
+
2. Outline the DISTINCT concepts actually present across these pages. One concept = one future chunk. Do not bundle unrelated ideas.
|
|
87
|
+
3. Call add_outline(slug, title, items) ONCE at the end:
|
|
88
|
+
- slug: the EXACT slug given in your task
|
|
89
|
+
- title: human-readable topic title
|
|
90
|
+
- items: array of { id, title, oneLine } — id is a short stable slug per item (e.g. "use-state"), oneLine is a single-sentence definition
|
|
89
91
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
\`\`\`
|
|
92
|
+
HARD RULES:
|
|
93
|
+
- Use ONLY content present in the fetched sources. Do NOT add concepts from training-data memory. If the sources are thin, outline only what is there.
|
|
94
|
+
- read_source MUST be your first call. If it returns an error, STOP and report it immediately.
|
|
95
|
+
- Do NOT write chunk files, source files, or index.json.
|
|
96
|
+
- Do NOT summarize prematurely — outline only; distillation happens later.
|
|
97
|
+
- After add_outline succeeds, print the returned slug and item count. Stop.`;
|
|
98
|
+
export const CRAWL_SYSTEM_PROMPT = `You are a crawl-phase worker. You drive the browser YOURSELF to incrementally fetch web pages for your assigned topic and save every useful page into sources/. Do NOT outline or write chunks.
|
|
98
99
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
6. Write chunks to docs/<topic-slug>/chunks/chunk-NNN.md (number sequentially from 001)
|
|
105
|
-
7. Call add_topic(slug, title, summary, tags) to register/update the topic in the index
|
|
106
|
-
8. Call add_chunk(topic, chunk_id, title, summary) for each chunk you wrote
|
|
107
|
-
9. Do NOT write or edit index.json files directly — use add_topic/add_chunk tools
|
|
100
|
+
WORKFLOW:
|
|
101
|
+
1. Call crawl_open to open the entry URL given in your task.
|
|
102
|
+
2. Call save_source(url) to save the CURRENT page.
|
|
103
|
+
3. From the page's links, pick same-site, valuable CONTENT pages — skip login/signup, navigation chrome, language switchers, pagination, and pure anchors. Call crawl_visit(url), then save_source(url) for each page.
|
|
104
|
+
4. When there are no more useful links, or the page/depth limit is reached, call crawl_finish, print the returned stats, and stop.
|
|
108
105
|
|
|
109
|
-
|
|
110
|
-
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
106
|
+
HARD RULES:
|
|
107
|
+
- Write ONLY into sources/ via save_source. Never write other files.
|
|
108
|
+
- Never visit cross-site URLs.
|
|
109
|
+
- If a tool returns an error, do NOT retry the same URL; pick another link or finish.
|
|
110
|
+
- At most ~20 pages. Prefer a few dense pages over many thin ones.
|
|
111
|
+
- After crawl_finish succeeds, stop.`;
|
|
112
|
+
export const REFINE_SYSTEM_PROMPT = `You are a refine-phase worker. For ONE item from the topic's outline, produce a single dictionary chunk.
|
|
113
|
+
|
|
114
|
+
${KB_STRUCTURE}
|
|
115
|
+
|
|
116
|
+
WORKFLOW:
|
|
117
|
+
1. Call read_source(topic) to load ALL fetched source pages (multiple pages separated by ---).
|
|
118
|
+
2. Focus on your assigned item. Do NOT distill other items.
|
|
119
|
+
3. Write ONE chunk file <topic>/chunks/chunk-NNN.md (number sequentially from 001; path RELATIVE TO the knowledge root, no "docs/" prefix) using the write tool, in the source document's language, with this structure:
|
|
120
|
+
|
|
121
|
+
\`\`\`
|
|
122
|
+
# <term or concept name>
|
|
123
|
+
|
|
124
|
+
- 定义 / Definition: <one sentence, in your own words>
|
|
125
|
+
- 是什么 / What it is: <2-4 bullets, the core idea>
|
|
126
|
+
- 不是什么 / What it is NOT: <common confusions, if any>
|
|
127
|
+
- 关键点 / Key points: <3-6 bullets, the load-bearing facts>
|
|
128
|
+
- 适用场景 / When to use: <where this applies>
|
|
129
|
+
- 误区 / Pitfalls: <common mistakes, edge cases>
|
|
130
|
+
- 来源 / Source: <url(s) of the page(s) you actually used — copy them from the "Source:" headers at the top of each fetched page; list several URLs if the chunk draws on several pages>
|
|
131
|
+
\`\`\`
|
|
132
|
+
|
|
133
|
+
4. Call add_chunk(topic, chunk_id, title, summary, tags) to register it.
|
|
134
|
+
- tags: 3-6 lowercase hyphenated tags describing the concept (synonyms, key terms).
|
|
135
|
+
|
|
136
|
+
HARD RULES:
|
|
137
|
+
- read_source MUST be your first call. If it returns an error, STOP and report it immediately. Do NOT write a placeholder source.md yourself, and do NOT write the chunk from memory.
|
|
138
|
+
- Every fact must come from the fetched sources. If a claim is not supported by them, omit it. Never fill gaps from memory.
|
|
139
|
+
- NO large quotes. A short quote (≤2 sentences) is allowed ONLY as evidence under a bullet you already wrote in your own words.
|
|
140
|
+
- Every bullet must be YOU re-expressing the idea. If you find yourself copying sentences, stop and rephrase.
|
|
141
|
+
- One concept per chunk.
|
|
142
|
+
- If the material is thin on a concept, write what exists; do NOT invent content. Omit empty sections.
|
|
143
|
+
- Do NOT call add_topic. Do NOT write index.json.`;
|
|
144
|
+
export const TAG_SYSTEM_PROMPT = `You are a tag-phase worker. Enrich an existing topic with rich, retrieval-friendly tags.
|
|
145
|
+
|
|
146
|
+
${KB_STRUCTURE}
|
|
147
|
+
|
|
148
|
+
WORKFLOW:
|
|
149
|
+
1. Call get_topic(slug) to list this topic's chunks.
|
|
150
|
+
2. Call read_chunk for the chunks to understand the actual content.
|
|
151
|
+
3. Generate 5 categories of tags (10-20 total), all lowercase hyphenated:
|
|
152
|
+
- synonyms: alternate names / aliases
|
|
153
|
+
- hypernym: broader parent concept (e.g. "state-management" for redux)
|
|
154
|
+
- trigger-scenarios: situations where a reader would reach for this (e.g. "form-validation")
|
|
155
|
+
- confusable: things this is often mixed up with
|
|
156
|
+
- typical-questions: questions a reader might search (e.g. "how-does-usestate-work")
|
|
157
|
+
4. Call add_topic(slug, title, summary, tags) to OVERWRITE the topic's tags + metadata. Reuse the existing title and summary from get_topic; do not change them.
|
|
158
|
+
|
|
159
|
+
HARD RULES:
|
|
160
|
+
- Do NOT write chunk files. Do NOT call add_chunk.
|
|
161
|
+
- Do NOT invent tags the content does not support.`;
|
|
162
|
+
/** 从 ~/.cc-monitoring/pi/system.md 读取自定义 system prompt(仅 chat 模式覆盖) */
|
|
163
|
+
function loadChatSystemPrompt() {
|
|
114
164
|
const mdPath = path.join(agentDir, 'system.md');
|
|
115
165
|
try {
|
|
116
166
|
return fs.readFileSync(mdPath, 'utf8');
|
|
117
167
|
}
|
|
118
168
|
catch {
|
|
119
|
-
return
|
|
169
|
+
return CHAT_SYSTEM_PROMPT;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function systemPromptForMode(mode) {
|
|
173
|
+
switch (mode) {
|
|
174
|
+
case 'chat':
|
|
175
|
+
return loadChatSystemPrompt();
|
|
176
|
+
case 'outline':
|
|
177
|
+
return OUTLINE_SYSTEM_PROMPT;
|
|
178
|
+
case 'crawl':
|
|
179
|
+
return CRAWL_SYSTEM_PROMPT;
|
|
180
|
+
case 'refine':
|
|
181
|
+
return REFINE_SYSTEM_PROMPT;
|
|
182
|
+
case 'tag':
|
|
183
|
+
return TAG_SYSTEM_PROMPT;
|
|
184
|
+
case 'reconcile':
|
|
185
|
+
return 'Return ONLY a single minified JSON object, no prose, no code fence.';
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// ============================================================
|
|
189
|
+
// 工具构造
|
|
190
|
+
const ok = (text) => ({ content: [{ type: 'text', text }], details: undefined });
|
|
191
|
+
const err = (e) => ({ content: [{ type: 'text', text: `error: ${e instanceof Error ? e.message : String(e)}` }], details: undefined });
|
|
192
|
+
// 与 knowledge-store TOPIC_RE 保持一致:防路径穿越(../、绝对路径、反斜杠等)
|
|
193
|
+
const SLUG_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
194
|
+
function assertSlug(slug, field) {
|
|
195
|
+
if (!SLUG_RE.test(slug)) {
|
|
196
|
+
throw new Error(`invalid ${field}: ${slug}`);
|
|
120
197
|
}
|
|
121
198
|
}
|
|
122
|
-
/**
|
|
199
|
+
/** add_outline:对已存在的 slug 目录登记大纲(写 outline.json + seed topic) */
|
|
200
|
+
function buildAddOutlineTool() {
|
|
201
|
+
return {
|
|
202
|
+
name: 'add_outline',
|
|
203
|
+
label: 'add_outline',
|
|
204
|
+
description: '在已由抓取阶段准备好的 <slug> 目录登记大纲(写 outline.json + seed topic),只调用一次。',
|
|
205
|
+
parameters: Type.Object({
|
|
206
|
+
slug: Type.String({ description: '任务指定的小写连字符 slug,如 react-hooks' }),
|
|
207
|
+
title: Type.String(),
|
|
208
|
+
items: Type.Array(Type.Object({
|
|
209
|
+
id: Type.String({ description: '条目稳定 id,如 use-state' }),
|
|
210
|
+
title: Type.String(),
|
|
211
|
+
oneLine: Type.String({ description: '一句话定义' }),
|
|
212
|
+
})),
|
|
213
|
+
}),
|
|
214
|
+
async execute(_id, params) {
|
|
215
|
+
assertSlug(params.slug, 'slug');
|
|
216
|
+
const topicDir = path.join(docsDir, params.slug);
|
|
217
|
+
if (!fs.existsSync(topicDir))
|
|
218
|
+
throw new Error(`topic dir not prepared: ${params.slug}`);
|
|
219
|
+
if (!fs.existsSync(path.join(topicDir, 'sources')))
|
|
220
|
+
throw new Error(`sources missing for topic: ${params.slug}`);
|
|
221
|
+
fs.writeFileSync(path.join(topicDir, 'outline.json'), JSON.stringify({ slug: params.slug, source: 'sources/', items: params.items }, null, 2));
|
|
222
|
+
await knowledgeStore.upsertTopic({
|
|
223
|
+
slug: params.slug,
|
|
224
|
+
title: params.title,
|
|
225
|
+
summary: '(refining)',
|
|
226
|
+
tags: [],
|
|
227
|
+
});
|
|
228
|
+
return ok(JSON.stringify({ slug: params.slug, itemCount: params.items.length }));
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/** read_source:读取该主题 sources/ 目录下全部已抓取网页 */
|
|
233
|
+
function buildReadSourceTool() {
|
|
234
|
+
return {
|
|
235
|
+
name: 'read_source',
|
|
236
|
+
label: 'read_source',
|
|
237
|
+
description: '读取该主题 sources/ 目录下全部已抓取网页(按文件名排序、--- 分隔)。',
|
|
238
|
+
parameters: Type.Object({ topic: Type.String({ description: '主题 slug' }) }),
|
|
239
|
+
async execute(_id, params) {
|
|
240
|
+
assertSlug(params.topic, 'topic');
|
|
241
|
+
const dir = path.join(docsDir, params.topic, 'sources');
|
|
242
|
+
const files = fs.readdirSync(dir).filter((f) => f.endsWith('.md')).sort();
|
|
243
|
+
if (files.length === 0)
|
|
244
|
+
throw new Error(`no sources for topic: ${params.topic}`);
|
|
245
|
+
const merged = files.map((f) => fs.readFileSync(path.join(dir, f), 'utf8')).join('\n\n---\n\n');
|
|
246
|
+
return ok(merged);
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
/** 知识检索领域工具 */
|
|
123
251
|
function buildKnowledgeTools() {
|
|
124
|
-
const ok = (text) => ({ content: [{ type: 'text', text }], details: undefined });
|
|
125
|
-
const err = (e) => ({ content: [{ type: 'text', text: `error: ${e instanceof Error ? e.message : String(e)}` }], details: undefined });
|
|
126
252
|
return [
|
|
127
253
|
{
|
|
128
254
|
name: 'list_topics',
|
|
@@ -212,6 +338,7 @@ function buildKnowledgeTools() {
|
|
|
212
338
|
chunk_id: Type.String({ description: '如 chunk-001' }),
|
|
213
339
|
title: Type.String(),
|
|
214
340
|
summary: Type.String(),
|
|
341
|
+
tags: Type.Array(Type.String({ description: '小写连字符标签,3-6 个' })),
|
|
215
342
|
}),
|
|
216
343
|
async execute(_id, params) {
|
|
217
344
|
try {
|
|
@@ -220,6 +347,7 @@ function buildKnowledgeTools() {
|
|
|
220
347
|
chunkId: params.chunk_id,
|
|
221
348
|
title: params.title,
|
|
222
349
|
summary: params.summary,
|
|
350
|
+
tags: params.tags,
|
|
223
351
|
});
|
|
224
352
|
return ok('chunk ref added');
|
|
225
353
|
}
|
|
@@ -230,30 +358,45 @@ function buildKnowledgeTools() {
|
|
|
230
358
|
},
|
|
231
359
|
];
|
|
232
360
|
}
|
|
361
|
+
const KNOWLEDGE_TOOLS = buildKnowledgeTools();
|
|
362
|
+
const KT = (name) => KNOWLEDGE_TOOLS.find((t) => t.name === name);
|
|
363
|
+
const WRITE_TOOL = createWriteToolDefinition(docsDir, { operations: sandboxWriteOps });
|
|
233
364
|
/** 按模式构建工具集(ToolDefinition 数组,用于 customTools) */
|
|
234
|
-
function buildModeTools(mode) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
365
|
+
function buildModeTools(mode, crawlGuard) {
|
|
366
|
+
switch (mode) {
|
|
367
|
+
case 'chat':
|
|
368
|
+
return [KT('list_topics'), KT('get_topic'), KT('search_chunks'), KT('read_chunk')];
|
|
369
|
+
case 'outline':
|
|
370
|
+
return [buildReadSourceTool(), buildAddOutlineTool()];
|
|
371
|
+
case 'crawl':
|
|
372
|
+
if (!crawlGuard)
|
|
373
|
+
throw new Error('crawl 模式必须传入 crawlGuard');
|
|
374
|
+
return createCrawlTools(crawlGuard);
|
|
375
|
+
case 'refine':
|
|
376
|
+
return [buildReadSourceTool(), WRITE_TOOL, KT('add_chunk')];
|
|
377
|
+
case 'tag':
|
|
378
|
+
return [KT('list_topics'), KT('get_topic'), KT('read_chunk'), KT('add_topic')];
|
|
379
|
+
// reconcile:无工具纯 JSON 调用
|
|
380
|
+
case 'reconcile':
|
|
381
|
+
return [];
|
|
239
382
|
}
|
|
240
|
-
// learn:领域工具(查重/读现有)+ write/edit + browser
|
|
241
|
-
// 注意:createXxxToolDefinition 返回带具体 schema 的 ToolDefinition<TParams, ...>,
|
|
242
|
-
// 与无泛型的 ToolDefinition 在 renderCall 上不协变,需要 as ToolDefinition 抹平。
|
|
243
|
-
return [
|
|
244
|
-
...knowledgeTools,
|
|
245
|
-
createWriteToolDefinition(docsDir, { operations: sandboxWriteOps }),
|
|
246
|
-
createEditToolDefinition(docsDir, { operations: sandboxEditOps }),
|
|
247
|
-
...browserTools,
|
|
248
|
-
];
|
|
249
383
|
}
|
|
250
384
|
/** 按模式构建工具白名单(tools 字段,全小写) */
|
|
251
385
|
function buildToolAllowlist(mode) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
386
|
+
switch (mode) {
|
|
387
|
+
case 'chat':
|
|
388
|
+
return ['list_topics', 'get_topic', 'search_chunks', 'read_chunk'];
|
|
389
|
+
case 'outline':
|
|
390
|
+
return ['read_source', 'add_outline'];
|
|
391
|
+
case 'crawl':
|
|
392
|
+
return ['crawl_open', 'save_source', 'crawl_visit', 'crawl_finish'];
|
|
393
|
+
case 'refine':
|
|
394
|
+
return ['read_source', 'write', 'add_chunk'];
|
|
395
|
+
case 'tag':
|
|
396
|
+
return ['list_topics', 'get_topic', 'read_chunk', 'add_topic'];
|
|
397
|
+
case 'reconcile':
|
|
398
|
+
return [];
|
|
255
399
|
}
|
|
256
|
-
return [...base, 'add_topic', 'add_chunk', 'write', 'edit', ...browserTools.map((t) => t.name)];
|
|
257
400
|
}
|
|
258
401
|
export async function createPiSession(options) {
|
|
259
402
|
const runtime = await getRuntime(options.port);
|
|
@@ -267,8 +410,8 @@ export async function createPiSession(options) {
|
|
|
267
410
|
// 但 before_provider_headers handler 是每次上游请求时才触发,
|
|
268
411
|
// 所以先放一个可变变量,返回 session 后再填值。
|
|
269
412
|
let currentSessionId = '';
|
|
270
|
-
const systemPrompt =
|
|
271
|
-
const modeTools = buildModeTools(options.mode);
|
|
413
|
+
const systemPrompt = systemPromptForMode(options.mode);
|
|
414
|
+
const modeTools = buildModeTools(options.mode, options.crawlGuard);
|
|
272
415
|
const toolAllowlist = buildToolAllowlist(options.mode);
|
|
273
416
|
const resourceLoader = new DefaultResourceLoader({
|
|
274
417
|
cwd,
|
|
@@ -303,3 +446,47 @@ export async function createPiSession(options) {
|
|
|
303
446
|
currentSessionId = session.sessionId;
|
|
304
447
|
return session;
|
|
305
448
|
}
|
|
449
|
+
// ============================================================
|
|
450
|
+
// 无工具 JSON 调用(reconcile 模式)
|
|
451
|
+
/**
|
|
452
|
+
* 从任意文本截取第一个 `{` 到最后一个 `}` 之间的子串并解析为 JSON 对象。
|
|
453
|
+
* 容忍 prose / 代码围栏包裹。无 `{` 或解析失败时抛错。
|
|
454
|
+
*/
|
|
455
|
+
export function extractJsonObject(raw) {
|
|
456
|
+
const start = raw.indexOf('{');
|
|
457
|
+
const end = raw.lastIndexOf('}');
|
|
458
|
+
if (start === -1 || end === -1 || end < start) {
|
|
459
|
+
throw new Error('no json object in response');
|
|
460
|
+
}
|
|
461
|
+
try {
|
|
462
|
+
return JSON.parse(raw.slice(start, end + 1));
|
|
463
|
+
}
|
|
464
|
+
catch {
|
|
465
|
+
throw new Error('no json object in response');
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* 建 reconcile(无工具)session,跑一次纯 JSON 调用并返回解析结果。
|
|
470
|
+
* instructions 与 prompt 合并为单条用户消息:规则在前,JSON 数据在后。
|
|
471
|
+
*/
|
|
472
|
+
export async function runJsonPrompt(opts) {
|
|
473
|
+
const session = await createPiSession({ port: opts.port, mode: 'reconcile' });
|
|
474
|
+
// 订阅累积 assistant 文本 chunk
|
|
475
|
+
let accumulated = '';
|
|
476
|
+
const unsub = session.subscribe((ev) => {
|
|
477
|
+
if (ev.type === 'message_update') {
|
|
478
|
+
const ae = ev.assistantMessageEvent;
|
|
479
|
+
if (ae?.type === 'text_delta' && typeof ae.delta === 'string') {
|
|
480
|
+
accumulated += ae.delta;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
try {
|
|
485
|
+
await session.prompt(`${opts.instructions}\n\n${opts.prompt}`);
|
|
486
|
+
await session.waitForIdle();
|
|
487
|
+
}
|
|
488
|
+
finally {
|
|
489
|
+
unsub();
|
|
490
|
+
}
|
|
491
|
+
return extractJsonObject(accumulated);
|
|
492
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const CRAWL_MAX_PAGES = 20;
|
|
2
|
+
export declare const CRAWL_MAX_DEPTH = 1;
|
|
3
|
+
/**
|
|
4
|
+
* 从 URL 生成 slug。
|
|
5
|
+
* host 取去 www. 后的首个 DNS label(pi.dev → pi),pathname 最多取 3 个非泛段。
|
|
6
|
+
*/
|
|
7
|
+
export declare function slugFromUrl(raw: string): string;
|
|
8
|
+
/** 从文件名/标签生成 slug:取 basename、去扩展名后清洗,空则 'topic' */
|
|
9
|
+
export declare function slugFromLabel(label: string): string;
|
|
10
|
+
/** 同站判定:去 www.、小写后相等,或 h 是 base 的子域 */
|
|
11
|
+
export declare function isSameSite(hostname: string, baseHostname: string): boolean;
|
|
12
|
+
/** 解析候选链接:仅 http(s)、清 hash、排除二进制/文档资源;无法解析返回 null */
|
|
13
|
+
export declare function normalizeCandidate(href: string, entry: URL): URL | null;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// web-crawler:抓取相关纯函数(slug 生成 / 同站判定 / 候选链接归一)与抓取上限常量。
|
|
2
|
+
// 渐进抓取的有状态逻辑见 pi-crawl-tools.ts(CrawlGuard)。
|
|
3
|
+
export const CRAWL_MAX_PAGES = 20;
|
|
4
|
+
export const CRAWL_MAX_DEPTH = 1;
|
|
5
|
+
// ---------- 纯函数辅助 ----------
|
|
6
|
+
const GENERIC_SEGMENTS = new Set(['docs', 'doc']);
|
|
7
|
+
/** 单段清洗:小写 + 非 a-z0-9 字符折叠成 -(不做首尾裁剪,留给上层统一处理) */
|
|
8
|
+
function cleanSegment(seg) {
|
|
9
|
+
return seg.toLowerCase().replace(/[^a-z0-9]+/g, '-');
|
|
10
|
+
}
|
|
11
|
+
/** 校验 slug 合法性,非法兜底 'topic' */
|
|
12
|
+
function finalizeSlug(slug) {
|
|
13
|
+
const s = slug
|
|
14
|
+
.replace(/-+/g, '-')
|
|
15
|
+
.replace(/^-+|-+$/g, '')
|
|
16
|
+
.slice(0, 60)
|
|
17
|
+
.replace(/-+$/, '');
|
|
18
|
+
return /^[a-z0-9][a-z0-9-]*$/.test(s) ? s : 'topic';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 从 URL 生成 slug。
|
|
22
|
+
* host 取去 www. 后的首个 DNS label(pi.dev → pi),pathname 最多取 3 个非泛段。
|
|
23
|
+
*/
|
|
24
|
+
export function slugFromUrl(raw) {
|
|
25
|
+
const u = new URL(raw);
|
|
26
|
+
const hostLabel = u.hostname.replace(/^www\./, '').split('.')[0];
|
|
27
|
+
const segments = [cleanSegment(hostLabel)];
|
|
28
|
+
for (const part of u.pathname.split('/')) {
|
|
29
|
+
const seg = cleanSegment(part);
|
|
30
|
+
if (seg && !GENERIC_SEGMENTS.has(seg))
|
|
31
|
+
segments.push(seg);
|
|
32
|
+
}
|
|
33
|
+
return finalizeSlug(segments.slice(0, 4).join('-'));
|
|
34
|
+
}
|
|
35
|
+
/** 从文件名/标签生成 slug:取 basename、去扩展名后清洗,空则 'topic' */
|
|
36
|
+
export function slugFromLabel(label) {
|
|
37
|
+
const base = label.split(/[\\/]/).pop() ?? label;
|
|
38
|
+
const stem = base.replace(/\.[^.]+$/, '');
|
|
39
|
+
return finalizeSlug(cleanSegment(stem));
|
|
40
|
+
}
|
|
41
|
+
/** 同站判定:去 www.、小写后相等,或 h 是 base 的子域 */
|
|
42
|
+
export function isSameSite(hostname, baseHostname) {
|
|
43
|
+
const norm = (h) => h.toLowerCase().replace(/^www\./, '');
|
|
44
|
+
const h = norm(hostname);
|
|
45
|
+
const base = norm(baseHostname);
|
|
46
|
+
return h === base || h.endsWith(`.${base}`);
|
|
47
|
+
}
|
|
48
|
+
const BINARY_EXTENSIONS = /\.(pdf|zip|rar|7z|exe|dmg|pkg|png|jpg|jpeg|gif|svg|webp|mp3|mp4|mov|avi|doc|docx|xls|xlsx|ppt|pptx)$/i;
|
|
49
|
+
/** 解析候选链接:仅 http(s)、清 hash、排除二进制/文档资源;无法解析返回 null */
|
|
50
|
+
export function normalizeCandidate(href, entry) {
|
|
51
|
+
let u;
|
|
52
|
+
try {
|
|
53
|
+
u = new URL(href, entry);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
if (u.protocol !== 'http:' && u.protocol !== 'https:')
|
|
59
|
+
return null;
|
|
60
|
+
u.hash = '';
|
|
61
|
+
if (BINARY_EXTENSIONS.test(u.pathname))
|
|
62
|
+
return null;
|
|
63
|
+
return u;
|
|
64
|
+
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aj as o,ak as n}from"./index-BVM6YOjH.js";const t=(a,r)=>o.lang.round(n.parse(a)[r]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-Cbhq5qgO.js";import{_ as i}from"./index-BVM6YOjH.js";import"./chunk-5VM5RSS4-BQ0aVGl-.js";import"./chunk-XXDRQBXY-CKrih4pC.js";import"./chunk-VR4S4FIN-D6WJuaS1.js";import"./chunk-32BRIVSS-C7oMpoeu.js";var u={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{u as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-Cbhq5qgO.js";import{_ as i}from"./index-BVM6YOjH.js";import"./chunk-5VM5RSS4-BQ0aVGl-.js";import"./chunk-XXDRQBXY-CKrih4pC.js";import"./chunk-VR4S4FIN-D6WJuaS1.js";import"./chunk-32BRIVSS-C7oMpoeu.js";var u={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{u as diagram};
|