@cc-monitoring/proxy-core 0.3.1 → 0.4.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/cli/__tests__/commands.test.js +1 -1
- package/dist/cli/commands/exec.js +31 -42
- package/dist/docs/404.html +2 -2
- package/dist/docs/assets/{app.B9A39uFv.js → app.DtYNT5zS.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.C4sjikMO.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.DdhC696L.js → VPLocalSearchBox.DpXF9ZAI.js} +1 -1
- package/dist/docs/assets/chunks/{theme.CfB2tOFi.js → theme.TS_gUyc7.js} +2 -2
- package/dist/docs/assets/{proxy-cli_data-hooks.md.w9Oe1OD3.js → proxy-cli_data-hooks.md.Bz8CVbxO.js} +1 -1
- package/dist/docs/assets/{proxy-core_ui-routes.md.Dyqkeoiv.js → proxy-core_ui-routes.md.B21t1p7R.js} +1 -1
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/index.html +3 -3
- package/dist/docs/overview.html +3 -3
- package/dist/docs/packages-utils.html +3 -3
- package/dist/docs/proxy-admin/env-and-build.html +3 -3
- package/dist/docs/proxy-admin/index.html +3 -3
- package/dist/docs/proxy-admin/layout-and-menu.html +3 -3
- package/dist/docs/proxy-admin/pages.html +3 -3
- package/dist/docs/proxy-admin/routing-and-auth.html +3 -3
- package/dist/docs/proxy-admin/services-and-mock.html +3 -3
- package/dist/docs/proxy-cli/api-layer.html +3 -3
- package/dist/docs/proxy-cli/app-shell.html +3 -3
- package/dist/docs/proxy-cli/components-common.html +3 -3
- package/dist/docs/proxy-cli/components-config.html +3 -3
- package/dist/docs/proxy-cli/components-requests.html +3 -3
- package/dist/docs/proxy-cli/components-stats.html +3 -3
- package/dist/docs/proxy-cli/components-status.html +3 -3
- package/dist/docs/proxy-cli/data-hooks.html +5 -5
- package/dist/docs/proxy-cli/index.html +3 -3
- package/dist/docs/proxy-cli/utils-and-i18n.html +3 -3
- package/dist/docs/proxy-core/chat-api.html +3 -3
- package/dist/docs/proxy-core/cli.html +3 -3
- package/dist/docs/proxy-core/config.html +3 -3
- package/dist/docs/proxy-core/data-layer.html +3 -3
- package/dist/docs/proxy-core/entry.html +3 -3
- package/dist/docs/proxy-core/index.html +3 -3
- package/dist/docs/proxy-core/pm2.html +3 -3
- package/dist/docs/proxy-core/providers.html +3 -3
- package/dist/docs/proxy-core/proxy.html +3 -3
- package/dist/docs/proxy-core/stats.html +3 -3
- package/dist/docs/proxy-core/tool.html +3 -3
- package/dist/docs/proxy-core/ui-routes.html +5 -5
- package/dist/docs/proxy-core/utilities.html +3 -3
- package/dist/docs/quickstart.html +3 -3
- package/dist/docs/request-flow.html +3 -3
- package/dist/logger/index.d.ts +0 -3
- package/dist/logger/index.js +0 -1
- package/dist/mcp-server/tools.js +8 -9
- package/dist/server/__tests__/providers-route.test.js +1 -0
- package/dist/server/auth.d.ts +0 -1
- package/dist/server/auth.js +1 -1
- package/dist/server/chat-route.js +48 -162
- package/dist/server/data-push.d.ts +0 -1
- package/dist/server/data-push.js +0 -7
- package/dist/server/proxy.js +128 -224
- package/dist/server/ui-route.js +76 -59
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry.d.ts +0 -4
- package/dist/tools/registry.js +0 -8
- package/dist/types/config.d.ts +0 -13
- package/dist/types/pm2.d.ts +1 -2
- package/dist/ui/assets/{1c-DAu68mP4.js → 1c-CCx-FOtz.js} +1 -1
- package/dist/ui/assets/{abnf-Cu8RHCHK.js → abnf-Bwbi42Z8.js} +1 -1
- package/dist/ui/assets/{abnfDiagram-VRR7QNED-BUBToPXF.js → abnfDiagram-VRR7QNED-Dm1-8q0E.js} +1 -1
- package/dist/ui/assets/{accesslog-BG-34XOy.js → accesslog-DCytz_-m.js} +1 -1
- package/dist/ui/assets/{actionscript-iw0HHMGM.js → actionscript-3udf15oh.js} +1 -1
- package/dist/ui/assets/{ada-qRqj6VGQ.js → ada-M5Xa74xG.js} +1 -1
- package/dist/ui/assets/{angelscript-BeaXyx_P.js → angelscript-qlrFxfW-.js} +1 -1
- package/dist/ui/assets/{apache-CU8d-z9X.js → apache-B-sF-DQH.js} +1 -1
- package/dist/ui/assets/{applescript-d1Wxkqz1.js → applescript-4FdcBnbI.js} +1 -1
- package/dist/ui/assets/{arc-BMsPIm3j.js → arc-BB3K1enp.js} +1 -1
- package/dist/ui/assets/{arcade-CtbgrWTM.js → arcade-B_yqWaaG.js} +1 -1
- package/dist/ui/assets/{architectureDiagram-ZJ3FMSHR-CVjC5TrS.js → architectureDiagram-ZJ3FMSHR-B39vkY8V.js} +1 -1
- package/dist/ui/assets/{arduino-Bc9L39Hr.js → arduino-yAcBoTWU.js} +1 -1
- package/dist/ui/assets/{armasm-DuWmpjWR.js → armasm-wIcY84bI.js} +1 -1
- package/dist/ui/assets/{asciidoc-CDIhFTnx.js → asciidoc-Bxnu28-Z.js} +1 -1
- package/dist/ui/assets/{aspectj-SYj-57Es.js → aspectj-B2cKJA_O.js} +1 -1
- package/dist/ui/assets/{autohotkey-hBi5dq37.js → autohotkey-B_rMWTtE.js} +1 -1
- package/dist/ui/assets/{autoit-BSawXzhg.js → autoit-DwcuvMwv.js} +1 -1
- package/dist/ui/assets/{avrasm-CwYom8Np.js → avrasm-heGX1PXK.js} +1 -1
- package/dist/ui/assets/{awk-BvBRfGo2.js → awk-BiqCQAEf.js} +1 -1
- package/dist/ui/assets/{axapta-CqUavA8k.js → axapta-Cv8M-Ih6.js} +1 -1
- package/dist/ui/assets/{bash-BS_ZnmEu.js → bash-Divgn3JV.js} +1 -1
- package/dist/ui/assets/{basic-xbP4IXrN.js → basic-B9dnAP55.js} +1 -1
- package/dist/ui/assets/{blockDiagram-677ZJIJ3-CmpI3f5p.js → blockDiagram-677ZJIJ3-DQ1mf7A_.js} +1 -1
- package/dist/ui/assets/{bnf-BECwu6uW.js → bnf-kIL5mSsP.js} +1 -1
- package/dist/ui/assets/{brainfuck-QQgu4j4N.js → brainfuck-DqB7xDjH.js} +1 -1
- package/dist/ui/assets/{coq-IDMIFfem.js → c-HmsCM6sx.js} +1 -1
- package/dist/ui/assets/{c-like-DYrFOtXy.js → c-like-De5MhE7G.js} +1 -1
- package/dist/ui/assets/{c4Diagram-LMCZKHZV-B6Hgngz9.js → c4Diagram-LMCZKHZV-DQxtYsAx.js} +1 -1
- package/dist/ui/assets/{cal-CNMrJ6v5.js → cal-mYdfz9en.js} +1 -1
- package/dist/ui/assets/{capnproto-DYCKl6oY.js → capnproto-D04CRlOt.js} +1 -1
- package/dist/ui/assets/{ceylon-mb8tRPl0.js → ceylon-pi9lFCja.js} +1 -1
- package/dist/ui/assets/channel-ChTtxQDg.js +1 -0
- package/dist/ui/assets/{chunk-2Q5K7J3B-LxvQ-G67.js → chunk-2Q5K7J3B-BDD1nPt8.js} +1 -1
- package/dist/ui/assets/{chunk-32BRIVSS-DxzKK6Aw.js → chunk-32BRIVSS-DgeQFBb5.js} +1 -1
- package/dist/ui/assets/{chunk-5VM5RSS4-CZEoYJ2W.js → chunk-5VM5RSS4-C7Xf2SnI.js} +1 -1
- package/dist/ui/assets/{chunk-EX3LRPZG-DS2PytrN.js → chunk-EX3LRPZG-B_3p1HEv.js} +1 -1
- package/dist/ui/assets/{chunk-JWPE2WC7-UX0Sr1Ie.js → chunk-JWPE2WC7-Dvs7u8eY.js} +1 -1
- package/dist/ui/assets/{chunk-MOJQB5TN-YbJgT9t4.js → chunk-MOJQB5TN-By21wDCN.js} +1 -1
- package/dist/ui/assets/{chunk-RYQCIY6F-DS2VH_U9.js → chunk-RYQCIY6F-6NC700r1.js} +1 -1
- package/dist/ui/assets/{chunk-V7JOEXUC-CZr0pkI1.js → chunk-V7JOEXUC-vEUqZ3rh.js} +1 -1
- package/dist/ui/assets/{chunk-VR4S4FIN-50opPAD3.js → chunk-VR4S4FIN-6tX2dNN9.js} +1 -1
- package/dist/ui/assets/{chunk-XXDRQBXY-DAAX9l7U.js → chunk-XXDRQBXY-qDb2jxAR.js} +1 -1
- package/dist/ui/assets/classDiagram-OUVF2IWQ-Ccbvamlu.js +1 -0
- package/dist/ui/assets/classDiagram-v2-EOCWNBFH-Ccbvamlu.js +1 -0
- package/dist/ui/assets/{clean-C4X7dSkh.js → clean-CLCsDUl1.js} +1 -1
- package/dist/ui/assets/{clojure-DSg9gUa7.js → clojure-dVi5Xifj.js} +1 -1
- package/dist/ui/assets/{clojure-repl-CagRYx7h.js → clojure-repl-BO_FpFmF.js} +1 -1
- package/dist/ui/assets/{cmake-CFdBn53c.js → cmake-CP5aJbyK.js} +1 -1
- package/dist/ui/assets/{coffeescript-CJZtMOPx.js → coffeescript-ZEfu_9pF.js} +1 -1
- package/dist/ui/assets/{c-BRJEPYra.js → coq-6aKUn3zn.js} +1 -1
- package/dist/ui/assets/{cos-Bx2VJuzG.js → cos-BohCnRN2.js} +1 -1
- package/dist/ui/assets/{cose-bilkent-JH36ORCC-zWRLsZpZ.js → cose-bilkent-JH36ORCC-DyXCbbro.js} +1 -1
- package/dist/ui/assets/{cpp-CsG6DlC4.js → cpp-FOgPWPEt.js} +1 -1
- package/dist/ui/assets/{crmsh-DTy9MnmJ.js → crmsh-B0OYb-Oe.js} +1 -1
- package/dist/ui/assets/{crystal-BwgrLrZ1.js → crystal-CuWb_dXm.js} +1 -1
- package/dist/ui/assets/{csharp-B2VeTPAF.js → csharp-BbcqM09j.js} +1 -1
- package/dist/ui/assets/{csp-CTpydNhH.js → csp-rgHnTaDq.js} +1 -1
- package/dist/ui/assets/{css-B0mMUbpY.js → css-C-ibh7ZG.js} +1 -1
- package/dist/ui/assets/{cynefin-VYW2F7L2-BmjQEj6q.js → cynefin-VYW2F7L2-CkuBhgC4.js} +1 -1
- package/dist/ui/assets/{cynefinDiagram-TSTJHNR4-Dr0Zrke0.js → cynefinDiagram-TSTJHNR4-eycFyDao.js} +1 -1
- package/dist/ui/assets/{d-DjuDZnbI.js → d-C0gXxJ0O.js} +1 -1
- package/dist/ui/assets/{dagre-VKFMJZFB-xoTPT2Uu.js → dagre-VKFMJZFB-DzqX9e49.js} +1 -1
- package/dist/ui/assets/{dart-xR3GU9TJ.js → dart-C-fTpuUV.js} +1 -1
- package/dist/ui/assets/{delphi-bJas5QnG.js → delphi-Chm0B9xv.js} +1 -1
- package/dist/ui/assets/{diagram-FQU43EPY-rL_IU7gU.js → diagram-FQU43EPY-BEgCqfg1.js} +1 -1
- package/dist/ui/assets/{diagram-G47NLZAW-EcDiCVGj.js → diagram-G47NLZAW-Cw11Vs2v.js} +1 -1
- package/dist/ui/assets/{diagram-NH7WQ7WH-CGGXOjev.js → diagram-NH7WQ7WH-DSG_UWpP.js} +1 -1
- package/dist/ui/assets/{diagram-OA4YK3LP-DnE7hDjD.js → diagram-OA4YK3LP-CJz-WOaJ.js} +1 -1
- package/dist/ui/assets/{diagram-WEI45ONY-CTJH5eD8.js → diagram-WEI45ONY-CBXjBCvc.js} +1 -1
- package/dist/ui/assets/{diff-doJFF3fv.js → diff-C-vyuMSL.js} +1 -1
- package/dist/ui/assets/{django-D3b-owa_.js → django-CJK7lReT.js} +1 -1
- package/dist/ui/assets/{dns-C42KYV-Z.js → dns-D02SHjSy.js} +1 -1
- package/dist/ui/assets/{dockerfile-9KUINc2j.js → dockerfile-trKL1Bqu.js} +1 -1
- package/dist/ui/assets/{dos-CxnlJ6qp.js → dos-C52dy-sK.js} +1 -1
- package/dist/ui/assets/{dsconfig-6CMMCwmY.js → dsconfig-MzHgzVrt.js} +1 -1
- package/dist/ui/assets/{dts-D78rdUIB.js → dts-B137dHyX.js} +1 -1
- package/dist/ui/assets/{dust-Dv1uTfJU.js → dust-BcbM0r5C.js} +1 -1
- package/dist/ui/assets/{ebnf-BGbG1cFK.js → ebnf-DkbpI7bK.js} +1 -1
- package/dist/ui/assets/{ebnfDiagram-CCIWWBDH-z2VgRSUV.js → ebnfDiagram-CCIWWBDH-aI5uQ7w1.js} +1 -1
- package/dist/ui/assets/{elixir-ZgAQVY1J.js → elixir-BOtDuqQy.js} +1 -1
- package/dist/ui/assets/{elm-CudiFuNu.js → elm-DS8Tyyu-.js} +1 -1
- package/dist/ui/assets/{erDiagram-Q63AITRT-X1TODuRv.js → erDiagram-Q63AITRT-2vCbd4Mm.js} +1 -1
- package/dist/ui/assets/{erb-Bz_NZh6W.js → erb-CSXECRbn.js} +1 -1
- package/dist/ui/assets/{erlang-DNuj1nb2.js → erlang-BMxlgKPJ.js} +1 -1
- package/dist/ui/assets/{erlang-repl-SP1Gan9W.js → erlang-repl-DPzlolPg.js} +1 -1
- package/dist/ui/assets/{excel-0K77uECF.js → excel-CW2Uxed3.js} +1 -1
- package/dist/ui/assets/{fix-CalJq7JD.js → fix-UW84SlCs.js} +1 -1
- package/dist/ui/assets/{flix-BlIs11_w.js → flix-4UGiPULd.js} +1 -1
- package/dist/ui/assets/{flowDiagram-23GEKE2U-DA2dnmc0.js → flowDiagram-23GEKE2U-R5PbCbZI.js} +1 -1
- package/dist/ui/assets/{fortran-ZCobXY2R.js → fortran-nhHsngdu.js} +1 -1
- package/dist/ui/assets/{fsharp-Be8rwUtc.js → fsharp-CDyZ1ST5.js} +1 -1
- package/dist/ui/assets/{gams-DUat8frQ.js → gams-DHzkkUie.js} +1 -1
- package/dist/ui/assets/{ganttDiagram-NO4QXBWP-DdFwaIGZ.js → ganttDiagram-NO4QXBWP-CGcq4Ie_.js} +1 -1
- package/dist/ui/assets/{gauss-BB4U88dy.js → gauss-DdhFGyBv.js} +1 -1
- package/dist/ui/assets/{gcode-DzeUZuZg.js → gcode-ImHh8OLA.js} +1 -1
- package/dist/ui/assets/{gherkin-B_8vW_BO.js → gherkin-CTWAW-XR.js} +1 -1
- package/dist/ui/assets/{gitGraphDiagram-IHSO6WYX-B-Dn8x6I.js → gitGraphDiagram-IHSO6WYX-8nM2Z9lD.js} +1 -1
- package/dist/ui/assets/{glsl-DGHGjPC1.js → glsl-0_W_27G2.js} +1 -1
- package/dist/ui/assets/{gml-BYEku8Yh.js → gml-BoDggu2z.js} +1 -1
- package/dist/ui/assets/{go-D8aSgQMc.js → go-DYfFygwl.js} +1 -1
- package/dist/ui/assets/{golo-CDjCU_jh.js → golo-Mlq-TCg9.js} +1 -1
- package/dist/ui/assets/{gradle-BeUw7tl_.js → gradle-BALAinEB.js} +1 -1
- package/dist/ui/assets/{groovy-5iCQOtR3.js → groovy-Dht--dWU.js} +1 -1
- package/dist/ui/assets/{haml-BEdL8FJi.js → haml-DpMrxg0d.js} +1 -1
- package/dist/ui/assets/{handlebars-BuYQNzoK.js → handlebars-DqHzujNj.js} +1 -1
- package/dist/ui/assets/{haskell-I4FCBcW0.js → haskell-DZSchhkY.js} +1 -1
- package/dist/ui/assets/{haxe-yigyKfFr.js → haxe-C0zBRjdy.js} +1 -1
- package/dist/ui/assets/{hsp-ZUk4j7d1.js → hsp-D_PwbSv2.js} +1 -1
- package/dist/ui/assets/{htmlbars-QYP3lT3u.js → htmlbars-DxAFMG8u.js} +1 -1
- package/dist/ui/assets/{http-BJpD1O71.js → http-DvTRF0Do.js} +1 -1
- package/dist/ui/assets/{hy-CIJ1bP6S.js → hy-lVO-kNyp.js} +1 -1
- package/dist/ui/assets/{index-BDXWttnT.js → index-BbMRVVGt.js} +3 -3
- package/dist/ui/assets/{index-COAgrx1J.js → index-Ci23SMK2.js} +242 -242
- package/dist/ui/assets/index-DlsVXaHT.css +10 -0
- package/dist/ui/assets/{infoDiagram-FWYZ7A6U-fTg9eLNt.js → infoDiagram-FWYZ7A6U-C7WYDlvc.js} +1 -1
- package/dist/ui/assets/{inform7-DAsu-lC2.js → inform7-B8Tf2n8v.js} +1 -1
- package/dist/ui/assets/{ini-Bhz-zHCg.js → ini-DSoYMaLF.js} +1 -1
- package/dist/ui/assets/{irpf90-BunhbwBl.js → irpf90-RCPdkB14.js} +1 -1
- package/dist/ui/assets/{isbl-q9L6hOhP.js → isbl-C2p75PPj.js} +1 -1
- package/dist/ui/assets/{ishikawaDiagram-FXEZZL3T-B8G0sdgd.js → ishikawaDiagram-FXEZZL3T-Cm6jsPlc.js} +1 -1
- package/dist/ui/assets/{java-Iks5Pkau.js → java-DeY4Yuia.js} +1 -1
- package/dist/ui/assets/{javascript-C4vltXPw.js → javascript-3uX1CO-H.js} +1 -1
- package/dist/ui/assets/{jboss-cli-BQBvd2X2.js → jboss-cli-DgnD8mEc.js} +1 -1
- package/dist/ui/assets/{journeyDiagram-5HDEW3XC-Crbzgrum.js → journeyDiagram-5HDEW3XC-DEGV1uA5.js} +1 -1
- package/dist/ui/assets/{json-DXK0_jUK.js → json-BV2PmJJp.js} +1 -1
- package/dist/ui/assets/{julia-CCYoBiYK.js → julia-B-m8kQm7.js} +1 -1
- package/dist/ui/assets/{julia-repl-y8v2Oorl.js → julia-repl-C51atU2X.js} +1 -1
- package/dist/ui/assets/{kanban-definition-HUTT4EX6-C8sCOsBX.js → kanban-definition-HUTT4EX6-BJ4k5iTX.js} +1 -1
- package/dist/ui/assets/{kotlin-Bnjk7_fw.js → kotlin-CYBziIgl.js} +1 -1
- package/dist/ui/assets/{lasso-B-al6x63.js → lasso-Dw2SBMDW.js} +1 -1
- package/dist/ui/assets/{latex-BUmqlb9r.js → latex-Dpd35yke.js} +1 -1
- package/dist/ui/assets/{ldif-D42RWj6Q.js → ldif-Ce9EZU__.js} +1 -1
- package/dist/ui/assets/{leaf-CrH4BZ0m.js → leaf-CpkZzQtC.js} +1 -1
- package/dist/ui/assets/{less-upmRlQQW.js → less-Uzo7M0FD.js} +1 -1
- package/dist/ui/assets/{lisp-DHYS22SA.js → lisp-DWXDlJYm.js} +1 -1
- package/dist/ui/assets/{livecodeserver-CeQNmFP3.js → livecodeserver-uEyPEgVJ.js} +1 -1
- package/dist/ui/assets/{livescript-PJWpY1JI.js → livescript-BQ5f07oK.js} +1 -1
- package/dist/ui/assets/{llvm-BKtKWwCt.js → llvm-BAvP-skE.js} +1 -1
- package/dist/ui/assets/{lsl-RWRLRjk7.js → lsl-DhbiIKu6.js} +1 -1
- package/dist/ui/assets/{lua-BFUDiPGm.js → lua-COxeUeLx.js} +1 -1
- package/dist/ui/assets/{makefile-CUDyOz5D.js → makefile-DhDx-IgL.js} +1 -1
- package/dist/ui/assets/{markdown-zZCLypc6.js → markdown-DX5_kSxq.js} +1 -1
- package/dist/ui/assets/{mathematica-BHbxKxnq.js → mathematica-D351ZddB.js} +1 -1
- package/dist/ui/assets/{matlab-DlGtg--p.js → matlab-CELqIiwF.js} +1 -1
- package/dist/ui/assets/{maxima-BBBeS3Ra.js → maxima-B_YljrMm.js} +1 -1
- package/dist/ui/assets/{mel-nh8j7W_6.js → mel-DltsbNS8.js} +1 -1
- package/dist/ui/assets/{mercury-DyyD-pqr.js → mercury-axX-5Vjj.js} +1 -1
- package/dist/ui/assets/{mindmap-definition-LN4V7U3C-CJlhDHqM.js → mindmap-definition-LN4V7U3C-Bl1EJo6p.js} +1 -1
- package/dist/ui/assets/{mipsasm-hiEhRRiq.js → mipsasm-BxmerVwX.js} +1 -1
- package/dist/ui/assets/{mizar-BZa3iAAL.js → mizar-XNHfbpL2.js} +1 -1
- package/dist/ui/assets/{mojolicious-BCIm2V_y.js → mojolicious-BR0U_7zk.js} +1 -1
- package/dist/ui/assets/{monkey-zmK-7N8b.js → monkey-lLuu9_f-.js} +1 -1
- package/dist/ui/assets/{moonscript-BsS_Mn3D.js → moonscript-DoaZ3DRQ.js} +1 -1
- package/dist/ui/assets/{n1ql-D7xVgDP0.js → n1ql-C6TId6Iu.js} +1 -1
- package/dist/ui/assets/{nginx-ct2q4dtd.js → nginx-BezSG-JT.js} +1 -1
- package/dist/ui/assets/{nim-RO0UOmW3.js → nim-Bb0rfXie.js} +1 -1
- package/dist/ui/assets/{nix-BcRJxPKH.js → nix-o3sJ5-54.js} +1 -1
- package/dist/ui/assets/{node-repl-DgIefwxW.js → node-repl-Sv5hhcTf.js} +1 -1
- package/dist/ui/assets/{nsis-DqHs9QhB.js → nsis-B45BJFhF.js} +1 -1
- package/dist/ui/assets/{objectivec-BBcWqc7Y.js → objectivec-CzS6zVgh.js} +1 -1
- package/dist/ui/assets/{ocaml-BExfw7D6.js → ocaml-Bqux7PyP.js} +1 -1
- package/dist/ui/assets/{openscad-CHPRELQb.js → openscad-4Wf6mF84.js} +1 -1
- package/dist/ui/assets/{oxygene-DpS9uMJW.js → oxygene-Fvwqgkkt.js} +1 -1
- package/dist/ui/assets/{parser3-CjJ_QdBp.js → parser3-zEfzT5wv.js} +1 -1
- package/dist/ui/assets/{pegDiagram-2B236MQR-GM70woGy.js → pegDiagram-2B236MQR-Dd4rIztM.js} +1 -1
- package/dist/ui/assets/{perl-BSNM2Kt8.js → perl-CsS1Gs6o.js} +1 -1
- package/dist/ui/assets/{pf-Z-hKf_88.js → pf-BNH1jO0R.js} +1 -1
- package/dist/ui/assets/{pgsql-DDgznxBg.js → pgsql-DqPigHrq.js} +1 -1
- package/dist/ui/assets/{php-BzAhxF-l.js → php-CdOl9bRs.js} +1 -1
- package/dist/ui/assets/{php-template-DkgcKHRc.js → php-template-DPfirJg2.js} +1 -1
- package/dist/ui/assets/{pieDiagram-ENE6RG2P-Bst7mPyz.js → pieDiagram-ENE6RG2P-DGaJNf4S.js} +1 -1
- package/dist/ui/assets/{plaintext-BYEppD0R.js → plaintext-EHbgBKzw.js} +1 -1
- package/dist/ui/assets/{pony-BT_kQd1K.js → pony-DmJajtp2.js} +1 -1
- package/dist/ui/assets/{powershell-BfRsuSsf.js → powershell-DfGzdWR6.js} +1 -1
- package/dist/ui/assets/{processing-DpzWe5Iu.js → processing-BT0ETgPG.js} +1 -1
- package/dist/ui/assets/{profile-BCOhS5cM.js → profile-B3I-x5Lt.js} +1 -1
- package/dist/ui/assets/{prolog-OxaCCaW8.js → prolog-B_4QJIvI.js} +1 -1
- package/dist/ui/assets/{properties-DMFlA2Ca.js → properties-BFVI8weS.js} +1 -1
- package/dist/ui/assets/{protobuf-CRDFkXvZ.js → protobuf-PaF39oZZ.js} +1 -1
- package/dist/ui/assets/{puppet-DnrVyLzx.js → puppet-BDC6Q8VF.js} +1 -1
- package/dist/ui/assets/{purebasic-Dht4Hniv.js → purebasic-B2ejrOZK.js} +1 -1
- package/dist/ui/assets/{python-B0aMirWu.js → python-BOxtIk9H.js} +1 -1
- package/dist/ui/assets/{python-repl-BlYDBGa7.js → python-repl-BslBh_Mx.js} +1 -1
- package/dist/ui/assets/{q-DzrtW9kT.js → q-BPe8WLGW.js} +1 -1
- package/dist/ui/assets/{qml-DnfQsR3i.js → qml-BazRR6fz.js} +1 -1
- package/dist/ui/assets/{quadrantDiagram-ABIIQ3AL-DNRYurBT.js → quadrantDiagram-ABIIQ3AL-BQ7aPkHk.js} +1 -1
- package/dist/ui/assets/{r-DGI_ZuTD.js → r-C09pGNJC.js} +1 -1
- package/dist/ui/assets/{railroadDiagram-RFXS5EU6-CmbC3Vz4.js → railroadDiagram-RFXS5EU6-sCO9VGvE.js} +1 -1
- package/dist/ui/assets/{reasonml-3SohMgh2.js → reasonml-S7dzwVL9.js} +1 -1
- package/dist/ui/assets/{requirementDiagram-TGXJPOKE-8CxrXHco.js → requirementDiagram-TGXJPOKE-CfT5aVZg.js} +1 -1
- package/dist/ui/assets/{rib-DfRSd4Qa.js → rib-fM2EwQd4.js} +1 -1
- package/dist/ui/assets/{roboconf-CQczGdGW.js → roboconf-D7AaeyrW.js} +1 -1
- package/dist/ui/assets/{routeros-DCka-T2i.js → routeros-c6Q7mKuq.js} +1 -1
- package/dist/ui/assets/{rsl-Dr8MOwMo.js → rsl-sCpEQBxh.js} +1 -1
- package/dist/ui/assets/{ruby-C2zFSkh_.js → ruby-lcKhz2w9.js} +1 -1
- package/dist/ui/assets/{ruleslanguage-C97YsgQq.js → ruleslanguage-BW4ATOuX.js} +1 -1
- package/dist/ui/assets/{rust-H3h8kd9A.js → rust-BbpU-0VY.js} +1 -1
- package/dist/ui/assets/{sankeyDiagram-HTMAVEWB-DBXLWjEq.js → sankeyDiagram-HTMAVEWB-CaweCpvN.js} +1 -1
- package/dist/ui/assets/{sas-04z0Xu8P.js → sas-BPt5R0dx.js} +1 -1
- package/dist/ui/assets/{scala-DyB9Aoiv.js → scala-DxW_vqXs.js} +1 -1
- package/dist/ui/assets/{scheme-DBj6nxUi.js → scheme-T2Q_jWzT.js} +1 -1
- package/dist/ui/assets/{scilab-Btj7AD9s.js → scilab-DMORg9lV.js} +1 -1
- package/dist/ui/assets/{scss-BXZJyXt7.js → scss-t0VsosqT.js} +1 -1
- package/dist/ui/assets/{sequenceDiagram-DBY2YBRQ-DXIkBFKC.js → sequenceDiagram-DBY2YBRQ-o-H_R4zb.js} +1 -1
- package/dist/ui/assets/{shell-BsreQR1Z.js → shell-CnCDa1s9.js} +1 -1
- package/dist/ui/assets/{sizeCapture-X5ZJPWSS-ocS9jxAQ.js → sizeCapture-X5ZJPWSS-BNLkHGDS.js} +1 -1
- package/dist/ui/assets/{smali-D9wQw9zm.js → smali-_n-BxJyG.js} +1 -1
- package/dist/ui/assets/{smalltalk-Dku6G_H3.js → smalltalk-B90PXJwK.js} +1 -1
- package/dist/ui/assets/{sml-BknyU6ya.js → sml-fuY7bj-n.js} +1 -1
- package/dist/ui/assets/{sqf-DRYMaOg8.js → sqf-COpwkyuo.js} +1 -1
- package/dist/ui/assets/{sql-Cw3Ax4KA.js → sql-CXIT0j-x.js} +1 -1
- package/dist/ui/assets/{sql_more-vWdslLE0.js → sql_more-C1Oxq4rx.js} +1 -1
- package/dist/ui/assets/{stan-8XH5bDS6.js → stan-BZEpaHeC.js} +1 -1
- package/dist/ui/assets/{stata-4e77wgfe.js → stata-CkBwaiZM.js} +1 -1
- package/dist/ui/assets/{stateDiagram-2N3HPSRC-RMmL9jMG.js → stateDiagram-2N3HPSRC-BkdnNF7I.js} +1 -1
- package/dist/ui/assets/stateDiagram-v2-6OUMAXLB-0JnZ1VSQ.js +1 -0
- package/dist/ui/assets/{step21-ByIeDMY3.js → step21-fs9N_U3O.js} +1 -1
- package/dist/ui/assets/{stylus-ZAhJyWsw.js → stylus-Bs_9cvKZ.js} +1 -1
- package/dist/ui/assets/{subunit-pPW2UGkj.js → subunit-DvgcOCqJ.js} +1 -1
- package/dist/ui/assets/{swift-CX3BB5az.js → swift-BE4ONsur.js} +1 -1
- package/dist/ui/assets/{swimlanes-5IMT3BWC-C2zAuJ56.js → swimlanes-5IMT3BWC-uqTAc7o7.js} +2 -2
- package/dist/ui/assets/swimlanesDiagram-G3AALYLV-DQRIIEmi.js +8 -0
- package/dist/ui/assets/{taggerscript-BHcjbWIC.js → taggerscript-BhmPJ64C.js} +1 -1
- package/dist/ui/assets/{tap-BOl1lBlS.js → tap-DkueIVKV.js} +1 -1
- package/dist/ui/assets/{tcl-DZjeOBDh.js → tcl-DyXOOkFi.js} +1 -1
- package/dist/ui/assets/{thrift-BxboWg4x.js → thrift-Dhgbk56T.js} +1 -1
- package/dist/ui/assets/{timeline-definition-FHXFAJF6-BOxsxyq_.js → timeline-definition-FHXFAJF6-DBAk9Ouc.js} +1 -1
- package/dist/ui/assets/{tp-BNM6ql3J.js → tp-BsXyrRGH.js} +1 -1
- package/dist/ui/assets/{twig-Dj9ZiXD4.js → twig-J0HqIuHw.js} +1 -1
- package/dist/ui/assets/{typescript-7MEJlu_6.js → typescript-Dkwvul39.js} +1 -1
- package/dist/ui/assets/{vala-DNqOAgHJ.js → vala-CRGnf8aY.js} +1 -1
- package/dist/ui/assets/{vbnet-T0mNKVc_.js → vbnet-BtJAUe3z.js} +1 -1
- package/dist/ui/assets/{vbscript-CeuwVMAI.js → vbscript-RgFFNuM3.js} +1 -1
- package/dist/ui/assets/{vbscript-html-BbJSt2w6.js → vbscript-html-DO32Io9Y.js} +1 -1
- package/dist/ui/assets/{vennDiagram-L72KCM5P-BX9mWeiT.js → vennDiagram-L72KCM5P-BJi6y0hh.js} +1 -1
- package/dist/ui/assets/{verilog-DYuhYfkX.js → verilog-C4h6MLcI.js} +1 -1
- package/dist/ui/assets/{vhdl-Cf9aT-t7.js → vhdl-DOafePyU.js} +1 -1
- package/dist/ui/assets/{vim-DciP44K1.js → vim-BAdTA9TY.js} +1 -1
- package/dist/ui/assets/{wardleyDiagram-EHGQE667-CDj2rOzu.js → wardleyDiagram-EHGQE667-C7c_4IJ6.js} +1 -1
- package/dist/ui/assets/{x86asm-E-AN_LXO.js → x86asm-BCL6__QH.js} +1 -1
- package/dist/ui/assets/{xl-CxYLJelN.js → xl-qIzE4HOe.js} +1 -1
- package/dist/ui/assets/{xml-yz1SRLuU.js → xml-DE2sJXYU.js} +1 -1
- package/dist/ui/assets/{xquery-BLzBF3tV.js → xquery-CQ35t92y.js} +1 -1
- package/dist/ui/assets/{xychartDiagram-FW5EYKEG-Czapk9-Z.js → xychartDiagram-FW5EYKEG-D2ILn0jL.js} +1 -1
- package/dist/ui/assets/{yaml-Cv4Y7iN_.js → yaml-5KaAvG5C.js} +1 -1
- package/dist/ui/assets/{zephir-KRcdQfEX.js → zephir-CbR3Ryfq.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/dist/utils/__tests__/abort-signals.test.js +67 -0
- package/dist/utils/__tests__/inject-loop.test.js +1 -53
- package/dist/utils/__tests__/learn-tasks-db.test.js +82 -0
- package/dist/utils/__tests__/openai-converter.test.js +25 -0
- package/dist/utils/__tests__/pi-crawl-tools.test.js +15 -4
- package/dist/utils/__tests__/pi-dedup-reconcile.test.js +11 -9
- package/dist/utils/__tests__/pi-events.test.js +172 -0
- package/dist/utils/__tests__/pi-learn-orchestrator.test.js +216 -6
- package/dist/utils/__tests__/pi-runtime-json.test.js +38 -3
- package/dist/utils/__tests__/providers-db.test.js +40 -2
- package/dist/utils/__tests__/request-writer.test.js +271 -39
- package/dist/utils/__tests__/sse-protocol.test.d.ts +1 -0
- package/dist/utils/__tests__/sse-protocol.test.js +115 -0
- package/dist/utils/__tests__/vault.test.d.ts +1 -0
- package/dist/utils/__tests__/{knowledge-store.test.js → vault.test.js} +16 -16
- package/dist/utils/abort-signals.d.ts +13 -0
- package/dist/utils/abort-signals.js +33 -0
- package/dist/utils/db.d.ts +1 -0
- package/dist/utils/db.js +24 -0
- package/dist/utils/esm-dirname.d.ts +0 -15
- package/dist/utils/esm-dirname.js +0 -4
- package/dist/utils/inject-loop.d.ts +0 -27
- package/dist/utils/inject-loop.js +2 -56
- package/dist/utils/learn-tasks-db.d.ts +15 -0
- package/dist/utils/learn-tasks-db.js +35 -0
- package/dist/utils/openai-converter.js +88 -78
- package/dist/utils/pi-browser-tools.d.ts +0 -2
- package/dist/utils/pi-browser-tools.js +0 -174
- package/dist/utils/pi-crawl-tools.d.ts +2 -1
- package/dist/utils/pi-crawl-tools.js +16 -11
- package/dist/utils/pi-dedup.d.ts +8 -30
- package/dist/utils/pi-dedup.js +32 -67
- package/dist/utils/pi-events.d.ts +65 -0
- package/dist/utils/pi-events.js +98 -0
- package/dist/utils/pi-learn-orchestrator.d.ts +6 -5
- package/dist/utils/pi-learn-orchestrator.js +71 -106
- package/dist/utils/pi-runtime.d.ts +5 -6
- package/dist/utils/pi-runtime.js +38 -42
- package/dist/utils/pi-sandbox-ops.d.ts +0 -36
- package/dist/utils/pi-sandbox-ops.js +5 -190
- package/dist/utils/providers-db.d.ts +3 -0
- package/dist/utils/providers-db.js +21 -7
- package/dist/utils/request-writer.d.ts +59 -30
- package/dist/utils/request-writer.js +178 -58
- package/dist/utils/sse-protocol.d.ts +34 -0
- package/dist/utils/sse-protocol.js +121 -0
- package/dist/utils/sse-stream-processor.d.ts +4 -9
- package/dist/utils/sse-stream-processor.js +13 -104
- package/dist/utils/sse-writer.d.ts +1 -1
- package/dist/utils/sse-writer.js +3 -2
- package/dist/utils/stats-aggregator.js +3 -0
- package/dist/utils/tool-injector.js +7 -0
- package/dist/utils/vault.d.ts +111 -0
- package/dist/utils/vault.js +434 -0
- package/package.json +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.B6Qfxe6W.js +0 -1
- package/dist/types/api.d.ts +0 -20
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.js +0 -4
- package/dist/types/log.d.ts +0 -13
- package/dist/ui/assets/channel-Bc4Td8eZ.js +0 -1
- package/dist/ui/assets/classDiagram-OUVF2IWQ-BicxhZFq.js +0 -1
- package/dist/ui/assets/classDiagram-v2-EOCWNBFH-BicxhZFq.js +0 -1
- package/dist/ui/assets/index-C0fxlU9d.css +0 -10
- package/dist/ui/assets/stateDiagram-v2-6OUMAXLB-QvaEO5U6.js +0 -1
- package/dist/ui/assets/swimlanesDiagram-G3AALYLV-DPgCOY0D.js +0 -8
- package/dist/utils/__tests__/sse-accumulator.test.js +0 -83
- package/dist/utils/knowledge-store.d.ts +0 -51
- package/dist/utils/knowledge-store.js +0 -241
- package/dist/utils/migrate-files-to-db.d.ts +0 -1
- package/dist/utils/migrate-files-to-db.js +0 -138
- package/dist/utils/sse-accumulator.d.ts +0 -9
- package/dist/utils/sse-accumulator.js +0 -59
- /package/dist/docs/assets/{proxy-cli_data-hooks.md.w9Oe1OD3.lean.js → proxy-cli_data-hooks.md.Bz8CVbxO.lean.js} +0 -0
- /package/dist/docs/assets/{proxy-core_ui-routes.md.Dyqkeoiv.lean.js → proxy-core_ui-routes.md.B21t1p7R.lean.js} +0 -0
- /package/dist/{types/api.js → utils/__tests__/abort-signals.test.d.ts} +0 -0
- /package/dist/{types/log.js → utils/__tests__/learn-tasks-db.test.d.ts} +0 -0
- /package/dist/utils/__tests__/{knowledge-store.test.d.ts → openai-converter.test.d.ts} +0 -0
- /package/dist/utils/__tests__/{sse-accumulator.test.d.ts → pi-events.test.d.ts} +0 -0
|
@@ -7,42 +7,23 @@
|
|
|
7
7
|
//
|
|
8
8
|
// "轮次" = 一次 assistant 交互(assistant message_start → message_end);
|
|
9
9
|
// slug 由入口 URL / 文件名确定性生成。
|
|
10
|
-
import fs from 'node:fs';
|
|
11
10
|
import path from 'node:path';
|
|
12
11
|
import { dataDir } from './paths.js';
|
|
13
12
|
import { createPiSession } from './pi-runtime.js';
|
|
14
13
|
import { CrawlGuard } from './pi-crawl-tools.js';
|
|
14
|
+
import { createTimeoutSignal, bindAbort } from './abort-signals.js';
|
|
15
15
|
import { slugFromUrl, slugFromLabel } from './web-crawler.js';
|
|
16
16
|
import { assertNoOldDirs, readAllTopics, readSidecarDetail, readTopicDetail, reconcileTopics, mergeTopics, mintSlug } from './pi-dedup.js';
|
|
17
|
+
import { isAssistantMessage, extractAssistantDelta, extractToolResultText } from './pi-events.js';
|
|
18
|
+
import { createVault } from './vault.js';
|
|
17
19
|
// 每阶段(含 S2 每个 item prompt)独立超时:5 分钟。
|
|
18
20
|
// 防止 pi session 在 stuck LLM 响应上无限挂起,导致 SSE 通道常开、前端永久转圈。
|
|
19
21
|
const STAGE_TIMEOUT_MS = 5 * 60 * 1000;
|
|
20
|
-
/**
|
|
21
|
-
* Promise.race 包一层超时。超时触发时调用 abortFn(session.abort()),
|
|
22
|
-
* 然后 reject;正常 settle 时清掉 timer,避免泄漏。
|
|
23
|
-
*/
|
|
24
|
-
function withTimeout(p, ms, abortFn) {
|
|
25
|
-
let timer;
|
|
26
|
-
const timeoutP = new Promise((_, reject) => {
|
|
27
|
-
timer = setTimeout(() => {
|
|
28
|
-
// 触发 abort,尽量让底层 fetch/pi session 提前收尾;reject 用明确错误
|
|
29
|
-
abortFn().catch(() => { });
|
|
30
|
-
reject(new Error(`stage 超时 ${ms}ms`));
|
|
31
|
-
}, ms);
|
|
32
|
-
});
|
|
33
|
-
return Promise.race([
|
|
34
|
-
p.finally(() => {
|
|
35
|
-
if (timer)
|
|
36
|
-
clearTimeout(timer);
|
|
37
|
-
}),
|
|
38
|
-
timeoutP,
|
|
39
|
-
]);
|
|
40
|
-
}
|
|
41
22
|
/**
|
|
42
23
|
* 跑一次 prompt,透传 text/tool 事件到 events;resolve 当 prompt 自然结束。
|
|
43
24
|
* 同时返回本 session 内关键工具调用的标志位(用于 S3 成功判定)。
|
|
44
25
|
*/
|
|
45
|
-
async function runPrompt(session, promptText, events, roundCounter) {
|
|
26
|
+
async function runPrompt(session, promptText, events, roundCounter, signal) {
|
|
46
27
|
const result = { addTopicCalled: false, readSourceOk: false };
|
|
47
28
|
// Finding 1:tool_execution_start 时只记录「即将调 add_topic 且 tags 非空」,
|
|
48
29
|
// 真正置位必须等 tool_execution_end 且 isError=false。否则工具执行失败(upsert
|
|
@@ -55,23 +36,24 @@ async function runPrompt(session, promptText, events, roundCounter) {
|
|
|
55
36
|
let roundOpen = false;
|
|
56
37
|
const unsub = session.subscribe((ev) => {
|
|
57
38
|
try {
|
|
58
|
-
if (ev.type === 'message_start' && ev
|
|
59
|
-
|
|
39
|
+
if (ev.type === 'message_start' && isAssistantMessage(ev)) {
|
|
40
|
+
// 轮次 1-based:先自增后用;roundCounter 跨 session 全局单调
|
|
60
41
|
roundCounter.index += 1;
|
|
42
|
+
currentRound = roundCounter.index;
|
|
61
43
|
roundOpen = true;
|
|
62
44
|
events.roundStart(currentRound);
|
|
63
45
|
}
|
|
64
|
-
else if (ev.type === 'message_end' && ev
|
|
46
|
+
else if (ev.type === 'message_end' && isAssistantMessage(ev)) {
|
|
65
47
|
roundOpen = false;
|
|
66
48
|
events.roundEnd(currentRound);
|
|
67
49
|
}
|
|
68
50
|
else if (ev.type === 'message_update') {
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
-
events.textDelta(
|
|
51
|
+
const d = extractAssistantDelta(ev);
|
|
52
|
+
if (d?.kind === 'text') {
|
|
53
|
+
events.textDelta(d.delta);
|
|
72
54
|
}
|
|
73
|
-
else if (
|
|
74
|
-
events.thinkingDelta(
|
|
55
|
+
else if (d?.kind === 'thinking') {
|
|
56
|
+
events.thinkingDelta(d.delta);
|
|
75
57
|
}
|
|
76
58
|
}
|
|
77
59
|
else if (ev.type === 'tool_execution_start') {
|
|
@@ -86,9 +68,6 @@ async function runPrompt(session, promptText, events, roundCounter) {
|
|
|
86
68
|
}
|
|
87
69
|
}
|
|
88
70
|
else if (ev.type === 'tool_execution_end') {
|
|
89
|
-
const resultText = Array.isArray(ev.result?.content)
|
|
90
|
-
? ev.result.content.map((c) => (c?.type === 'text' ? c.text : '')).join('\n')
|
|
91
|
-
: '';
|
|
92
71
|
if (ev.toolName === 'add_topic' && pendingAddTopicWithTags && !ev.isError) {
|
|
93
72
|
result.addTopicCalled = true;
|
|
94
73
|
}
|
|
@@ -100,7 +79,7 @@ async function runPrompt(session, promptText, events, roundCounter) {
|
|
|
100
79
|
toolName: ev.toolName,
|
|
101
80
|
isError: !!ev.isError,
|
|
102
81
|
durationMs: ev.durationMs ?? 0,
|
|
103
|
-
result:
|
|
82
|
+
result: extractToolResultText(ev.result),
|
|
104
83
|
});
|
|
105
84
|
}
|
|
106
85
|
}
|
|
@@ -108,12 +87,16 @@ async function runPrompt(session, promptText, events, roundCounter) {
|
|
|
108
87
|
// 事件转发失败不中断流水线
|
|
109
88
|
}
|
|
110
89
|
});
|
|
90
|
+
// 5 分钟超时 + 外部取消:任一触发都调 session.abort();SDK abort 后 prompt/waitForIdle
|
|
91
|
+
// 会正常 resolve(不 reject),故 await 后需检查 combined.aborted 主动抛错中止
|
|
92
|
+
const combined = createTimeoutSignal(STAGE_TIMEOUT_MS, signal);
|
|
93
|
+
bindAbort(combined, () => session.abort());
|
|
111
94
|
try {
|
|
112
|
-
|
|
113
|
-
await
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
95
|
+
await session.prompt(promptText);
|
|
96
|
+
await session.waitForIdle();
|
|
97
|
+
if (combined.aborted) {
|
|
98
|
+
throw new Error('learn 运行已中止');
|
|
99
|
+
}
|
|
117
100
|
}
|
|
118
101
|
finally {
|
|
119
102
|
unsub();
|
|
@@ -130,75 +113,54 @@ async function runPrompt(session, promptText, events, roundCounter) {
|
|
|
130
113
|
// ============================================================
|
|
131
114
|
// 原料准备 + outline 阶段
|
|
132
115
|
// ============================================================
|
|
133
|
-
/** 重建 topic 目录:sources/(抓取/上传原料)+ chunks/(后续产物) */
|
|
134
|
-
function prepareTopicDir(docsDir, slug) {
|
|
135
|
-
const dir = path.join(docsDir, slug);
|
|
136
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
137
|
-
fs.mkdirSync(path.join(dir, 'sources'), { recursive: true });
|
|
138
|
-
fs.mkdirSync(path.join(dir, 'chunks'), { recursive: true });
|
|
139
|
-
}
|
|
140
|
-
/** 写一份原料到 <slug>/sources/source-NNN.md */
|
|
141
|
-
function writeSourceFile(docsDir, slug, index, url, text) {
|
|
142
|
-
const name = `source-${String(index + 1).padStart(3, '0')}.md`;
|
|
143
|
-
fs.writeFileSync(path.join(docsDir, slug, 'sources', name), `Source: ${url}\n\n${text}`, 'utf8');
|
|
144
|
-
}
|
|
145
|
-
/** 数 <slug>/sources 下 .md 文件数量;目录不存在按 0 */
|
|
146
|
-
function countSourceFiles(docsDir, slug) {
|
|
147
|
-
try {
|
|
148
|
-
return fs.readdirSync(path.join(docsDir, slug, 'sources')).filter((f) => f.endsWith('.md')).length;
|
|
149
|
-
}
|
|
150
|
-
catch {
|
|
151
|
-
return 0;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
116
|
async function runOutlineStage(opts, events, roundCounter) {
|
|
117
|
+
const { vault } = opts;
|
|
155
118
|
// 抓取必须在 stageStart 之后:crawl 的 round/tool 事件才能落进前端已建好的 outline 阶段
|
|
156
119
|
events.stageStart('outline');
|
|
157
120
|
let guard = null;
|
|
158
121
|
try {
|
|
159
122
|
if (opts.sourceType === 'url') {
|
|
160
123
|
// crawl agent 在阶段内自己驱动渐进抓取;0 页则全新 guard+session 重试 1 次
|
|
161
|
-
guard = new CrawlGuard({ entryUrl: opts.input, docsDir:
|
|
124
|
+
guard = new CrawlGuard({ entryUrl: opts.input, docsDir: vault.root, slug: opts.slug });
|
|
162
125
|
let crawlSession = (await createPiSession({
|
|
163
126
|
port: opts.port,
|
|
164
127
|
mode: 'crawl',
|
|
165
128
|
crawlGuard: guard,
|
|
129
|
+
signal: opts.signal,
|
|
166
130
|
}));
|
|
167
131
|
const crawlPrompt = `Entry URL: ${opts.input}\n` +
|
|
168
132
|
`Topic slug: ${opts.slug}\n` +
|
|
169
133
|
`Call crawl_open to start, save every useful page with save_source, then call crawl_finish.`;
|
|
170
|
-
await runPrompt(crawlSession, crawlPrompt, events, roundCounter);
|
|
171
|
-
if (countSourceFiles(opts.
|
|
134
|
+
await runPrompt(crawlSession, crawlPrompt, events, roundCounter, opts.signal);
|
|
135
|
+
if (vault.countSourceFiles(opts.slug) === 0) {
|
|
172
136
|
// 替换前关闭旧 guard(close 容错),再全新 guard + session 重试一次
|
|
173
137
|
await guard.close();
|
|
174
|
-
guard = new CrawlGuard({ entryUrl: opts.input, docsDir:
|
|
138
|
+
guard = new CrawlGuard({ entryUrl: opts.input, docsDir: vault.root, slug: opts.slug });
|
|
175
139
|
crawlSession = (await createPiSession({
|
|
176
140
|
port: opts.port,
|
|
177
141
|
mode: 'crawl',
|
|
178
142
|
crawlGuard: guard,
|
|
143
|
+
signal: opts.signal,
|
|
179
144
|
}));
|
|
180
|
-
await runPrompt(crawlSession, crawlPrompt, events, roundCounter);
|
|
181
|
-
if (countSourceFiles(opts.
|
|
145
|
+
await runPrompt(crawlSession, crawlPrompt, events, roundCounter, opts.signal);
|
|
146
|
+
if (vault.countSourceFiles(opts.slug) === 0) {
|
|
182
147
|
throw new Error('crawl 未收集到页面');
|
|
183
148
|
}
|
|
184
149
|
}
|
|
185
150
|
}
|
|
186
151
|
else {
|
|
187
|
-
writeSourceFile(opts.
|
|
152
|
+
vault.writeSourceFile(opts.slug, 0, opts.label ?? 'uploaded-file', opts.input);
|
|
188
153
|
}
|
|
189
154
|
// crawl 完成后的 outline session(流程不变)
|
|
190
155
|
const session = (await createPiSession({ port: opts.port, mode: 'outline' }));
|
|
191
156
|
const prompt = `Topic slug: ${opts.slug}\n` +
|
|
192
157
|
`Call read_source(${JSON.stringify(opts.slug)}) to read the prepared sources, then call add_outline with this EXACT slug (${JSON.stringify(opts.slug)}). ` +
|
|
193
158
|
`Provide an appropriate title and the outline items.`;
|
|
194
|
-
await runPrompt(session, prompt, events, roundCounter);
|
|
195
|
-
const
|
|
196
|
-
if (!fs.existsSync(outlinePath))
|
|
197
|
-
throw new Error('outline 未生成');
|
|
198
|
-
const outline = JSON.parse(fs.readFileSync(outlinePath, 'utf8'));
|
|
159
|
+
await runPrompt(session, prompt, events, roundCounter, opts.signal);
|
|
160
|
+
const items = vault.readOutlineItems(opts.slug);
|
|
199
161
|
// title 取 S1 seed 的 index.json(查重门需要候选标题)
|
|
200
|
-
const
|
|
201
|
-
return { slug: opts.slug, items
|
|
162
|
+
const title = vault.readEntryIndexSync(opts.slug).title;
|
|
163
|
+
return { slug: opts.slug, items, title };
|
|
202
164
|
}
|
|
203
165
|
finally {
|
|
204
166
|
// 兜底关闭当前 guard(crawl_finish 已关时 close 也安全)
|
|
@@ -212,6 +174,7 @@ async function runOutlineStage(opts, events, roundCounter) {
|
|
|
212
174
|
async function runRefineStage(opts, slug, items, events, roundCounter,
|
|
213
175
|
/** chunk id 起始偏移:合并进已有主题时从目标现有 chunk 数后续号 */
|
|
214
176
|
startOffset = 0) {
|
|
177
|
+
const { vault } = opts;
|
|
215
178
|
events.stageStart('refine', items.length);
|
|
216
179
|
let chunksWritten = 0;
|
|
217
180
|
let itemsFailed = 0;
|
|
@@ -229,15 +192,14 @@ startOffset = 0) {
|
|
|
229
192
|
let failReason = 'chunk 文件未生成';
|
|
230
193
|
for (let attempt = 0; attempt < 2 && !ok; attempt++) {
|
|
231
194
|
const session = (await createPiSession({ port: opts.port, mode: 'refine' }));
|
|
232
|
-
const res = await runPrompt(session, prompt, events, roundCounter);
|
|
195
|
+
const res = await runPrompt(session, prompt, events, roundCounter, opts.signal);
|
|
233
196
|
if (!res.readSourceOk) {
|
|
234
197
|
failReason = 'read_source 未成功读取';
|
|
235
198
|
continue;
|
|
236
199
|
}
|
|
237
|
-
const chunkPath = path.join(opts.docsDir, slug, 'chunks', `${chunkId}.md`);
|
|
238
200
|
try {
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
201
|
+
const body = vault.readEntryFile(slug, 'chunks', `${chunkId}.md`);
|
|
202
|
+
if (body.length > 0)
|
|
241
203
|
ok = true;
|
|
242
204
|
}
|
|
243
205
|
catch {
|
|
@@ -249,9 +211,7 @@ startOffset = 0) {
|
|
|
249
211
|
if (ok) {
|
|
250
212
|
let chunkRegistered = false;
|
|
251
213
|
try {
|
|
252
|
-
|
|
253
|
-
const idx = JSON.parse(fs.readFileSync(idxPath, 'utf8'));
|
|
254
|
-
chunkRegistered = (idx.chunks ?? []).some((c) => c.id === chunkId);
|
|
214
|
+
chunkRegistered = vault.readEntryIndexSync(slug).chunks.some((c) => c.id === chunkId);
|
|
255
215
|
}
|
|
256
216
|
catch {
|
|
257
217
|
// index.json 读失败/JSON 坏 → 当作未注册
|
|
@@ -289,10 +249,10 @@ startOffset = 0) {
|
|
|
289
249
|
async function runTagStage(opts, slug, events, roundCounter,
|
|
290
250
|
/** 合并场景:查重门裁定的合并后 title/summary,要求 add_topic 设置为该精确值 */
|
|
291
251
|
override) {
|
|
252
|
+
const { vault } = opts;
|
|
292
253
|
events.stageStart('tag');
|
|
293
254
|
try {
|
|
294
|
-
const
|
|
295
|
-
const topicIdx = JSON.parse(fs.readFileSync(topicIdxPath, 'utf8'));
|
|
255
|
+
const topicIdx = vault.readEntryIndexSync(slug);
|
|
296
256
|
// 合并后重跑 tag:title/summary 取 override 精确值;否则沿用现有值
|
|
297
257
|
const title = override?.title ?? topicIdx.title;
|
|
298
258
|
const summary = override?.summary ?? topicIdx.summary;
|
|
@@ -310,7 +270,7 @@ override) {
|
|
|
310
270
|
let tagged = false;
|
|
311
271
|
for (let attempt = 0; attempt < 2 && !tagged; attempt++) {
|
|
312
272
|
const session = (await createPiSession({ port: opts.port, mode: 'tag' }));
|
|
313
|
-
const res = await runPrompt(session, prompt, events, roundCounter);
|
|
273
|
+
const res = await runPrompt(session, prompt, events, roundCounter, opts.signal);
|
|
314
274
|
if (res.addTopicCalled) {
|
|
315
275
|
tagged = true;
|
|
316
276
|
break;
|
|
@@ -329,7 +289,10 @@ override) {
|
|
|
329
289
|
// ============================================================
|
|
330
290
|
export async function runLearnPipeline(opts) {
|
|
331
291
|
const docsDir = opts.docsDir ?? path.join(dataDir, 'docs');
|
|
292
|
+
const vault = createVault(docsDir);
|
|
332
293
|
const slug = opts.sourceType === 'url' ? slugFromUrl(opts.input) : slugFromLabel(opts.label ?? 'topic');
|
|
294
|
+
// 状态机落库钩子:任何文件/目录改动之前调用,抛错直接传播(此时无任何改动)
|
|
295
|
+
opts.onStart?.(slug);
|
|
333
296
|
// 阻断:存在未清理的 .old 旁挂目录时直接拒绝,必须在一切写入之前
|
|
334
297
|
assertNoOldDirs(docsDir);
|
|
335
298
|
// 全局轮次计数器:所有 session 共享,轮次索引全流水线单调递增
|
|
@@ -340,9 +303,9 @@ export async function runLearnPipeline(opts) {
|
|
|
340
303
|
// 门0:slug 精确命中——已有同 slug 主题时先旁挂旧 topic(含点号不被识别为 topic),再全新建并跑 S1
|
|
341
304
|
const collision = (await readAllTopics(docsDir)).some((t) => t.slug === slug);
|
|
342
305
|
if (collision) {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
outline = await runOutlineStage({
|
|
306
|
+
vault.parkTopic(slug);
|
|
307
|
+
vault.prepareTopic(slug);
|
|
308
|
+
outline = await runOutlineStage({ sourceType: opts.sourceType, input: opts.input, label: opts.label, port: opts.port, vault, slug, signal: opts.signal }, opts.events, roundCounter);
|
|
346
309
|
const sidecar = await readSidecarDetail(docsDir, slug);
|
|
347
310
|
const r0 = await reconcileTopics({
|
|
348
311
|
port: opts.port,
|
|
@@ -350,12 +313,13 @@ export async function runLearnPipeline(opts) {
|
|
|
350
313
|
candidate: { slug, title: outline.title, tags: [], items: outline.items },
|
|
351
314
|
targets: sidecar ? [sidecar] : [],
|
|
352
315
|
wantItems: true,
|
|
316
|
+
signal: opts.signal,
|
|
353
317
|
});
|
|
354
318
|
if (r0.match) {
|
|
355
319
|
// dst=canonical:旧 chunks 续号并入,再补新增条目,最后带 merged 打 tag
|
|
356
320
|
const off = mergeTopics(docsDir, `${slug}.old`, slug);
|
|
357
|
-
const refine = await runRefineStage({ port: opts.port,
|
|
358
|
-
await runTagStage({ port: opts.port,
|
|
321
|
+
const refine = await runRefineStage({ port: opts.port, vault, signal: opts.signal }, slug, r0.itemsToAdd, opts.events, roundCounter, off);
|
|
322
|
+
await runTagStage({ port: opts.port, vault, signal: opts.signal }, slug, opts.events, roundCounter, { title: r0.mergedTitle, summary: r0.mergedSummary });
|
|
359
323
|
return { slug, chunksWritten: refine.chunksWritten, itemsFailed: refine.itemsFailed };
|
|
360
324
|
}
|
|
361
325
|
// slug 真碰撞:新内容另铸 ns,旧 topic 还原
|
|
@@ -363,22 +327,21 @@ export async function runLearnPipeline(opts) {
|
|
|
363
327
|
port: opts.port,
|
|
364
328
|
title: outline.title,
|
|
365
329
|
existing: (await readAllTopics(docsDir)).map((t) => t.slug),
|
|
330
|
+
signal: opts.signal,
|
|
366
331
|
});
|
|
367
332
|
// 新 canonical → ns,更正其 index.slug
|
|
368
|
-
|
|
369
|
-
const
|
|
370
|
-
const nsIdx = JSON.parse(fs.readFileSync(nsIdxPath, 'utf8'));
|
|
333
|
+
vault.renameTopic(slug, ns);
|
|
334
|
+
const nsIdx = vault.readEntryIndexSync(ns);
|
|
371
335
|
nsIdx.slug = ns;
|
|
372
|
-
|
|
336
|
+
vault.writeEntryIndexSync(ns, nsIdx);
|
|
373
337
|
// 根 index:把 S1 为新内容登记的 slug 条目改挂 ns
|
|
374
|
-
const
|
|
375
|
-
const rootIdx = JSON.parse(fs.readFileSync(rootPath, 'utf8'));
|
|
338
|
+
const rootIdx = vault.readRootIndexSync();
|
|
376
339
|
const newEntry = rootIdx.topics.find((t) => t.slug === slug);
|
|
377
340
|
if (newEntry)
|
|
378
341
|
newEntry.slug = ns;
|
|
379
342
|
// 旧 topic 还原:.old → slug
|
|
380
|
-
|
|
381
|
-
const oldIdx =
|
|
343
|
+
vault.restoreTopic(slug);
|
|
344
|
+
const oldIdx = vault.readEntryIndexSync(slug);
|
|
382
345
|
const oldRoot = rootIdx.topics.find((t) => t.slug === slug);
|
|
383
346
|
if (oldRoot) {
|
|
384
347
|
oldRoot.title = oldIdx.title;
|
|
@@ -388,12 +351,12 @@ export async function runLearnPipeline(opts) {
|
|
|
388
351
|
else {
|
|
389
352
|
rootIdx.topics.push({ slug, title: oldIdx.title, summary: oldIdx.summary, tags: oldIdx.tags });
|
|
390
353
|
}
|
|
391
|
-
|
|
354
|
+
vault.writeRootIndexSync(rootIdx);
|
|
392
355
|
activeSlug = ns;
|
|
393
356
|
}
|
|
394
357
|
else {
|
|
395
|
-
|
|
396
|
-
outline = await runOutlineStage({
|
|
358
|
+
vault.prepareTopic(slug);
|
|
359
|
+
outline = await runOutlineStage({ sourceType: opts.sourceType, input: opts.input, label: opts.label, port: opts.port, vault, slug, signal: opts.signal }, opts.events, roundCounter);
|
|
397
360
|
}
|
|
398
361
|
// 门1:outline 后、refine 前,基于大纲条目查重(命中则只要需新增的条目)
|
|
399
362
|
const r1 = await reconcileTopics({
|
|
@@ -401,18 +364,19 @@ export async function runLearnPipeline(opts) {
|
|
|
401
364
|
docsDir,
|
|
402
365
|
candidate: { slug: activeSlug, title: outline.title, tags: [], items: outline.items },
|
|
403
366
|
wantItems: true,
|
|
367
|
+
signal: opts.signal,
|
|
404
368
|
});
|
|
405
369
|
if (r1.match) {
|
|
406
370
|
const targetSlug = r1.targetSlug;
|
|
407
371
|
// 先物理并入(返回目标现有 chunk 总数作为续号偏移),再只写新增条目,最后带 override 打 tag
|
|
408
372
|
const off = mergeTopics(docsDir, activeSlug, targetSlug);
|
|
409
|
-
const refine = await runRefineStage({ port: opts.port,
|
|
410
|
-
await runTagStage({ port: opts.port,
|
|
373
|
+
const refine = await runRefineStage({ port: opts.port, vault, signal: opts.signal }, targetSlug, r1.itemsToAdd, opts.events, roundCounter, off);
|
|
374
|
+
await runTagStage({ port: opts.port, vault, signal: opts.signal }, targetSlug, opts.events, roundCounter, { title: r1.mergedTitle, summary: r1.mergedSummary });
|
|
411
375
|
return { slug: targetSlug, chunksWritten: refine.chunksWritten, itemsFailed: refine.itemsFailed };
|
|
412
376
|
}
|
|
413
377
|
// 门1 未命中:常规 refine(从头编号)+ 常规 tag
|
|
414
|
-
const refine = await runRefineStage({ port: opts.port,
|
|
415
|
-
await runTagStage({ port: opts.port,
|
|
378
|
+
const refine = await runRefineStage({ port: opts.port, vault, signal: opts.signal }, activeSlug, outline.items, opts.events, roundCounter, 0);
|
|
379
|
+
await runTagStage({ port: opts.port, vault, signal: opts.signal }, activeSlug, opts.events, roundCounter);
|
|
416
380
|
// 门2:tag 后基于富 tags 再查一次(不需要新增条目)
|
|
417
381
|
const detail = await readTopicDetail(docsDir, activeSlug);
|
|
418
382
|
const r2 = await reconcileTopics({
|
|
@@ -420,11 +384,12 @@ export async function runLearnPipeline(opts) {
|
|
|
420
384
|
docsDir,
|
|
421
385
|
candidate: { slug: activeSlug, title: outline.title, tags: detail?.tags ?? [], items: undefined },
|
|
422
386
|
wantItems: false,
|
|
387
|
+
signal: opts.signal,
|
|
423
388
|
});
|
|
424
389
|
if (r2.match) {
|
|
425
390
|
const targetSlug = r2.targetSlug;
|
|
426
391
|
mergeTopics(docsDir, activeSlug, targetSlug);
|
|
427
|
-
await runTagStage({ port: opts.port,
|
|
392
|
+
await runTagStage({ port: opts.port, vault, signal: opts.signal }, targetSlug, opts.events, roundCounter, { title: r2.mergedTitle, summary: r2.mergedSummary });
|
|
428
393
|
return { slug: targetSlug, chunksWritten: refine.chunksWritten, itemsFailed: refine.itemsFailed };
|
|
429
394
|
}
|
|
430
395
|
return { slug: activeSlug, chunksWritten: refine.chunksWritten, itemsFailed: refine.itemsFailed };
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { type AgentSession } from '@earendil-works/pi-coding-agent';
|
|
2
2
|
import { type CrawlGuard } from './pi-crawl-tools.js';
|
|
3
3
|
export type PiSessionMode = 'chat' | 'outline' | 'refine' | 'tag' | 'crawl' | 'reconcile';
|
|
4
|
-
|
|
4
|
+
interface CreatePiSessionOptions {
|
|
5
5
|
cwd?: string;
|
|
6
6
|
port: number;
|
|
7
7
|
mode: PiSessionMode;
|
|
8
8
|
/** mode='crawl' 时必填:渐进抓取状态守卫 */
|
|
9
9
|
crawlGuard?: CrawlGuard;
|
|
10
|
+
/** 外部取消信号(mode='crawl' 时接到抓取工具上) */
|
|
11
|
+
signal?: AbortSignal;
|
|
10
12
|
}
|
|
11
|
-
export declare const CHAT_SYSTEM_PROMPT = "You are a knowledge management AI operating inside a sandbox.\nYour knowledge directory (~/.cc-monitoring/docs) stores a **dictionary**: concise, distilled entries a future reader can look up. You do NOT copy source text \u2014 you digest it.\n\nSTRUCTURE (all paths below are RELATIVE TO the knowledge root ~/.cc-monitoring/docs \u2014 the write tool's working directory IS this root, so NEVER prefix a path with \"docs/\"):\n- Each topic is a subfolder: <topic-slug>/\n- Each topic has <slug>/index.json (metadata + chunk list, NO body)\n- Bodies live in <topic-slug>/chunks/chunk-NNN.md\n- Root index.json lists all topics as JSON\n- Fetched source pages for a topic are already prepared in <slug>/sources/ \u2014 you only READ them, never write or modify them\n\nANSWERING QUESTIONS:\n1. Call list_topics to see available topics\n2. If topic is unclear, call search_chunks(query) to find relevant chunks across topics\n3. Call get_topic(topic) to see that topic's chunk list\n4. Call read_chunk(topic, chunk_id) for relevant chunks \u2014 only read chunks you need\n5. Prefer answering from knowledge base chunks when relevant content exists; cite which chunks you used\n6. If no relevant chunk exists, answer from your general knowledge; if you truly don't know, say so";
|
|
12
|
-
export declare 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.\n\nYour knowledge directory (~/.cc-monitoring/docs) stores a **dictionary**: concise, distilled entries a future reader can look up. You do NOT copy source text \u2014 you digest it.\n\nSTRUCTURE (all paths below are RELATIVE TO the knowledge root ~/.cc-monitoring/docs \u2014 the write tool's working directory IS this root, so NEVER prefix a path with \"docs/\"):\n- Each topic is a subfolder: <topic-slug>/\n- Each topic has <slug>/index.json (metadata + chunk list, NO body)\n- Bodies live in <topic-slug>/chunks/chunk-NNN.md\n- Root index.json lists all topics as JSON\n- Fetched source pages for a topic are already prepared in <slug>/sources/ \u2014 you only READ them, never write or modify them\n\nWORKFLOW:\n1. Call read_source(topic) to load ALL fetched source pages (multiple pages are separated by ---).\n2. Outline the DISTINCT concepts actually present across these pages. One concept = one future chunk. Do not bundle unrelated ideas.\n3. Call add_outline(slug, title, items) ONCE at the end:\n - slug: the EXACT slug given in your task\n - title: human-readable topic title\n - items: array of { id, title, oneLine } \u2014 id is a short stable slug per item (e.g. \"use-state\"), oneLine is a single-sentence definition\n\nHARD RULES:\n- 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.\n- read_source MUST be your first call. If it returns an error, STOP and report it immediately.\n- Do NOT write chunk files, source files, or index.json.\n- Do NOT summarize prematurely \u2014 outline only; distillation happens later.\n- After add_outline succeeds, print the returned slug and item count. Stop.";
|
|
13
|
-
export declare 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.\n\nWORKFLOW:\n1. Call crawl_open to open the entry URL given in your task.\n2. Call save_source(url) to save the CURRENT page.\n3. From the page's links, pick same-site, valuable CONTENT pages \u2014 skip login/signup, navigation chrome, language switchers, pagination, and pure anchors. Call crawl_visit(url), then save_source(url) for each page.\n4. When there are no more useful links, or the page/depth limit is reached, call crawl_finish, print the returned stats, and stop.\n\nHARD RULES:\n- Write ONLY into sources/ via save_source. Never write other files.\n- Never visit cross-site URLs.\n- If a tool returns an error, do NOT retry the same URL; pick another link or finish.\n- At most ~20 pages. Prefer a few dense pages over many thin ones.\n- After crawl_finish succeeds, stop.";
|
|
14
|
-
export declare const REFINE_SYSTEM_PROMPT = "You are a refine-phase worker. For ONE item from the topic's outline, produce a single dictionary chunk.\n\nYour knowledge directory (~/.cc-monitoring/docs) stores a **dictionary**: concise, distilled entries a future reader can look up. You do NOT copy source text \u2014 you digest it.\n\nSTRUCTURE (all paths below are RELATIVE TO the knowledge root ~/.cc-monitoring/docs \u2014 the write tool's working directory IS this root, so NEVER prefix a path with \"docs/\"):\n- Each topic is a subfolder: <topic-slug>/\n- Each topic has <slug>/index.json (metadata + chunk list, NO body)\n- Bodies live in <topic-slug>/chunks/chunk-NNN.md\n- Root index.json lists all topics as JSON\n- Fetched source pages for a topic are already prepared in <slug>/sources/ \u2014 you only READ them, never write or modify them\n\nWORKFLOW:\n1. Call read_source(topic) to load ALL fetched source pages (multiple pages separated by ---).\n2. Focus on your assigned item. Do NOT distill other items.\n3. 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:\n\n```\n# <term or concept name>\n\n- \u5B9A\u4E49 / Definition: <one sentence, in your own words>\n- \u662F\u4EC0\u4E48 / What it is: <2-4 bullets, the core idea>\n- \u4E0D\u662F\u4EC0\u4E48 / What it is NOT: <common confusions, if any>\n- \u5173\u952E\u70B9 / Key points: <3-6 bullets, the load-bearing facts>\n- \u9002\u7528\u573A\u666F / When to use: <where this applies>\n- \u8BEF\u533A / Pitfalls: <common mistakes, edge cases>\n- \u6765\u6E90 / Source: <url(s) of the page(s) you actually used \u2014 copy them from the \"Source:\" headers at the top of each fetched page; list several URLs if the chunk draws on several pages>\n```\n\n4. Call add_chunk(topic, chunk_id, title, summary, tags) to register it.\n - tags: 3-6 lowercase hyphenated tags describing the concept (synonyms, key terms).\n\nHARD RULES:\n- 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.\n- Every fact must come from the fetched sources. If a claim is not supported by them, omit it. Never fill gaps from memory.\n- NO large quotes. A short quote (\u22642 sentences) is allowed ONLY as evidence under a bullet you already wrote in your own words.\n- Every bullet must be YOU re-expressing the idea. If you find yourself copying sentences, stop and rephrase.\n- One concept per chunk.\n- If the material is thin on a concept, write what exists; do NOT invent content. Omit empty sections.\n- Do NOT call add_topic. Do NOT write index.json.";
|
|
15
|
-
export declare const TAG_SYSTEM_PROMPT = "You are a tag-phase worker. Enrich an existing topic with rich, retrieval-friendly tags.\n\nYour knowledge directory (~/.cc-monitoring/docs) stores a **dictionary**: concise, distilled entries a future reader can look up. You do NOT copy source text \u2014 you digest it.\n\nSTRUCTURE (all paths below are RELATIVE TO the knowledge root ~/.cc-monitoring/docs \u2014 the write tool's working directory IS this root, so NEVER prefix a path with \"docs/\"):\n- Each topic is a subfolder: <topic-slug>/\n- Each topic has <slug>/index.json (metadata + chunk list, NO body)\n- Bodies live in <topic-slug>/chunks/chunk-NNN.md\n- Root index.json lists all topics as JSON\n- Fetched source pages for a topic are already prepared in <slug>/sources/ \u2014 you only READ them, never write or modify them\n\nWORKFLOW:\n1. Call get_topic(slug) to list this topic's chunks.\n2. Call read_chunk for the chunks to understand the actual content.\n3. Generate 5 categories of tags (10-20 total), all lowercase hyphenated:\n - synonyms: alternate names / aliases\n - hypernym: broader parent concept (e.g. \"state-management\" for redux)\n - trigger-scenarios: situations where a reader would reach for this (e.g. \"form-validation\")\n - confusable: things this is often mixed up with\n - typical-questions: questions a reader might search (e.g. \"how-does-usestate-work\")\n4. 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.\n\nHARD RULES:\n- Do NOT write chunk files. Do NOT call add_chunk.\n- Do NOT invent tags the content does not support.";
|
|
16
13
|
export declare function createPiSession(options: CreatePiSessionOptions): Promise<AgentSession>;
|
|
17
14
|
/**
|
|
18
15
|
* 从任意文本截取第一个 `{` 到最后一个 `}` 之间的子串并解析为 JSON 对象。
|
|
@@ -27,4 +24,6 @@ export declare function runJsonPrompt(opts: {
|
|
|
27
24
|
port: number;
|
|
28
25
|
instructions: string;
|
|
29
26
|
prompt: string;
|
|
27
|
+
signal?: AbortSignal;
|
|
30
28
|
}): Promise<unknown>;
|
|
29
|
+
export {};
|