@teammy/server 0.1.4 → 0.1.6
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/main.js +11646 -7952
- package/dist/native-pi-entry.js +14 -1
- package/dist/project-pi-entry.js +46 -8
- package/dist/runtime/workflows/task-bootstrap/prompt.md +2 -0
- package/dist/web/assets/{Assistant-B3h2yQF3.css → Assistant-4yZWjYm-.css} +1 -1
- package/dist/web/assets/Assistant-BNVXOHQZ.js +1 -0
- package/dist/web/assets/Dashboard-zKTK6EZD.js +1 -0
- package/dist/web/assets/Files-DI98WkdW.js +1 -0
- package/dist/web/assets/{Markdown-Bq8P_NBV.js → Markdown-D3cU0ani.js} +4 -4
- package/dist/web/assets/Materials-CK-mbNmo.css +1 -0
- package/dist/web/assets/Materials-CWptgAHz.js +6 -0
- package/dist/web/assets/Sessions-DiDwqXLI.js +1 -0
- package/dist/web/assets/WorkspaceTree-DeAA1QtV.js +1 -0
- package/dist/web/assets/{file-links-CFCIacLV.js → file-links-GfCXWkEh.js} +1 -1
- package/dist/web/assets/index-BwEl1PIa.js +66 -0
- package/dist/web/assets/{index-B-MqU_88.css → index-CTIAGUGG.css} +1 -1
- package/dist/web/downloads/teammy-skill.zip +0 -0
- package/dist/web/index.html +2 -2
- package/node_modules/@isaacs/nonrecursive-glob-match/LICENSE.md +55 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/README.md +333 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.d.ts +114 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js +762 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.min.js +3 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/package.json +3 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.d.ts +4 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.d.ts.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js +142 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.d.ts +114 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.js +758 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.js.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.min.js +3 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.min.js.map +7 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/package.json +3 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.d.ts +4 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.d.ts.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.js +138 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.js.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/package.json +56 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/src/index.ts +900 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/src/parse-class.ts +158 -0
- package/node_modules/@wecom/aibot-node-sdk/README.md +786 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/api.d.ts +17 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/client.d.ts +217 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/crypto.d.ts +12 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/index.cjs.js +1563 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/index.cjs.js.map +1 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/index.d.ts +1324 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/index.esm.js +1544 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/index.esm.js.map +1 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/logger.d.ts +14 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/message-handler.d.ts +29 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/types/api.d.ts +466 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/types/common.d.ts +30 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/types/config.d.ts +34 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/types/event.d.ts +109 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/types/index.d.ts +10 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/types/message.d.ts +158 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/utils.d.ts +19 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/wecom-crypto/index.d.ts +46 -0
- package/node_modules/@wecom/aibot-node-sdk/dist/ws.d.ts +161 -0
- package/node_modules/@wecom/aibot-node-sdk/package.json +43 -0
- package/node_modules/asynckit/LICENSE +21 -0
- package/node_modules/asynckit/README.md +233 -0
- package/node_modules/asynckit/bench.js +76 -0
- package/node_modules/asynckit/index.js +6 -0
- package/node_modules/asynckit/lib/abort.js +29 -0
- package/node_modules/asynckit/lib/async.js +34 -0
- package/node_modules/asynckit/lib/defer.js +26 -0
- package/node_modules/asynckit/lib/iterate.js +75 -0
- package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/node_modules/asynckit/lib/state.js +37 -0
- package/node_modules/asynckit/lib/streamify.js +141 -0
- package/node_modules/asynckit/lib/terminator.js +29 -0
- package/node_modules/asynckit/package.json +63 -0
- package/node_modules/asynckit/parallel.js +43 -0
- package/node_modules/asynckit/serial.js +17 -0
- package/node_modules/asynckit/serialOrdered.js +75 -0
- package/node_modules/asynckit/stream.js +21 -0
- package/node_modules/axios/CHANGELOG.md +1934 -0
- package/node_modules/axios/LICENSE +7 -0
- package/node_modules/axios/MIGRATION_GUIDE.md +877 -0
- package/node_modules/axios/README.md +2786 -0
- package/node_modules/axios/dist/axios.js +6460 -0
- package/node_modules/axios/dist/axios.min.js +5 -0
- package/node_modules/axios/dist/axios.min.js.map +1 -0
- package/node_modules/axios/dist/browser/axios.cjs +6509 -0
- package/node_modules/axios/dist/esm/axios.js +6530 -0
- package/node_modules/axios/dist/esm/axios.min.js +3 -0
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -0
- package/node_modules/axios/dist/node/axios.cjs +7491 -0
- package/node_modules/axios/index.d.cts +785 -0
- package/node_modules/axios/index.d.ts +804 -0
- package/node_modules/axios/index.js +45 -0
- package/node_modules/axios/lib/adapters/README.md +36 -0
- package/node_modules/axios/lib/adapters/adapters.js +132 -0
- package/node_modules/axios/lib/adapters/fetch.js +749 -0
- package/node_modules/axios/lib/adapters/http.js +1609 -0
- package/node_modules/axios/lib/adapters/xhr.js +384 -0
- package/node_modules/axios/lib/axios.js +89 -0
- package/node_modules/axios/lib/cancel/CancelToken.js +135 -0
- package/node_modules/axios/lib/cancel/CanceledError.js +22 -0
- package/node_modules/axios/lib/cancel/isCancel.js +5 -0
- package/node_modules/axios/lib/core/Axios.js +361 -0
- package/node_modules/axios/lib/core/AxiosError.js +278 -0
- package/node_modules/axios/lib/core/AxiosHeaders.js +487 -0
- package/node_modules/axios/lib/core/InterceptorManager.js +182 -0
- package/node_modules/axios/lib/core/README.md +8 -0
- package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
- package/node_modules/axios/lib/core/buildFullPath.js +76 -0
- package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +115 -0
- package/node_modules/axios/lib/core/mergeConfig.js +237 -0
- package/node_modules/axios/lib/core/methodList.js +17 -0
- package/node_modules/axios/lib/core/setFormDataHeaders.js +27 -0
- package/node_modules/axios/lib/core/settle.js +27 -0
- package/node_modules/axios/lib/core/transformData.js +28 -0
- package/node_modules/axios/lib/defaults/index.js +178 -0
- package/node_modules/axios/lib/defaults/transitional.js +11 -0
- package/node_modules/axios/lib/env/README.md +3 -0
- package/node_modules/axios/lib/env/classes/FormData.js +2 -0
- package/node_modules/axios/lib/env/data.js +1 -0
- package/node_modules/axios/lib/helpers/AxiosTransformStream.js +165 -0
- package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +59 -0
- package/node_modules/axios/lib/helpers/Http2Sessions.js +122 -0
- package/node_modules/axios/lib/helpers/HttpStatusCode.js +88 -0
- package/node_modules/axios/lib/helpers/README.md +7 -0
- package/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +29 -0
- package/node_modules/axios/lib/helpers/bind.js +14 -0
- package/node_modules/axios/lib/helpers/buildURL.js +69 -0
- package/node_modules/axios/lib/helpers/callbackify.js +18 -0
- package/node_modules/axios/lib/helpers/combineURLs.js +23 -0
- package/node_modules/axios/lib/helpers/composeSignals.js +71 -0
- package/node_modules/axios/lib/helpers/cookies.js +88 -0
- package/node_modules/axios/lib/helpers/deprecatedMethod.js +31 -0
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +193 -0
- package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
- package/node_modules/axios/lib/helpers/formDataToJSON.js +149 -0
- package/node_modules/axios/lib/helpers/formDataToStream.js +119 -0
- package/node_modules/axios/lib/helpers/fromDataURI.js +75 -0
- package/node_modules/axios/lib/helpers/isAbsoluteURL.js +19 -0
- package/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +11 -0
- package/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
- package/node_modules/axios/lib/helpers/null.js +2 -0
- package/node_modules/axios/lib/helpers/parseHeaders.js +72 -0
- package/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
- package/node_modules/axios/lib/helpers/progressEventReducer.js +54 -0
- package/node_modules/axios/lib/helpers/readBlob.js +15 -0
- package/node_modules/axios/lib/helpers/resolveConfig.js +120 -0
- package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +520 -0
- package/node_modules/axios/lib/helpers/speedometer.js +55 -0
- package/node_modules/axios/lib/helpers/spread.js +28 -0
- package/node_modules/axios/lib/helpers/throttle.js +45 -0
- package/node_modules/axios/lib/helpers/toFormData.js +279 -0
- package/node_modules/axios/lib/helpers/toURLEncodedForm.js +19 -0
- package/node_modules/axios/lib/helpers/trackStream.js +89 -0
- package/node_modules/axios/lib/helpers/validator.js +112 -0
- package/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
- package/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
- package/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
- package/node_modules/axios/lib/platform/browser/index.js +13 -0
- package/node_modules/axios/lib/platform/common/utils.js +52 -0
- package/node_modules/axios/lib/platform/index.js +7 -0
- package/node_modules/axios/lib/platform/node/classes/Buffer.js +11 -0
- package/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
- package/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
- package/node_modules/axios/lib/platform/node/index.js +37 -0
- package/node_modules/axios/lib/utils.js +1201 -0
- package/node_modules/axios/node_modules/agent-base/README.md +145 -0
- package/node_modules/axios/node_modules/agent-base/dist/src/index.d.ts +78 -0
- package/node_modules/axios/node_modules/agent-base/dist/src/index.js +203 -0
- package/node_modules/axios/node_modules/agent-base/dist/src/index.js.map +1 -0
- package/node_modules/axios/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
- package/node_modules/axios/node_modules/agent-base/dist/src/promisify.js +18 -0
- package/node_modules/axios/node_modules/agent-base/dist/src/promisify.js.map +1 -0
- package/node_modules/axios/node_modules/agent-base/package.json +64 -0
- package/node_modules/axios/node_modules/agent-base/src/index.ts +345 -0
- package/node_modules/axios/node_modules/agent-base/src/promisify.ts +33 -0
- package/node_modules/axios/node_modules/https-proxy-agent/README.md +137 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.js +177 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/index.js +14 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
- package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- package/node_modules/axios/node_modules/https-proxy-agent/package.json +56 -0
- package/node_modules/axios/package.json +202 -0
- package/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
- package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
- package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
- package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
- package/node_modules/call-bind-apply-helpers/LICENSE +21 -0
- package/node_modules/call-bind-apply-helpers/README.md +62 -0
- package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
- package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
- package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
- package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
- package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
- package/node_modules/call-bind-apply-helpers/index.js +15 -0
- package/node_modules/call-bind-apply-helpers/package.json +85 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
- package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
- package/node_modules/combined-stream/License +19 -0
- package/node_modules/combined-stream/Readme.md +138 -0
- package/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/node_modules/combined-stream/package.json +25 -0
- package/node_modules/delayed-stream/.npmignore +1 -0
- package/node_modules/delayed-stream/License +19 -0
- package/node_modules/delayed-stream/Makefile +7 -0
- package/node_modules/delayed-stream/Readme.md +141 -0
- package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/node_modules/delayed-stream/package.json +27 -0
- package/node_modules/dunder-proto/.eslintrc +5 -0
- package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
- package/node_modules/dunder-proto/.nycrc +13 -0
- package/node_modules/dunder-proto/CHANGELOG.md +24 -0
- package/node_modules/dunder-proto/LICENSE +21 -0
- package/node_modules/dunder-proto/README.md +54 -0
- package/node_modules/dunder-proto/get.d.ts +5 -0
- package/node_modules/dunder-proto/get.js +30 -0
- package/node_modules/dunder-proto/package.json +76 -0
- package/node_modules/dunder-proto/set.d.ts +5 -0
- package/node_modules/dunder-proto/set.js +35 -0
- package/node_modules/dunder-proto/test/get.js +34 -0
- package/node_modules/dunder-proto/test/index.js +4 -0
- package/node_modules/dunder-proto/test/set.js +50 -0
- package/node_modules/dunder-proto/tsconfig.json +9 -0
- package/node_modules/es-define-property/.eslintrc +13 -0
- package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
- package/node_modules/es-define-property/.nycrc +9 -0
- package/node_modules/es-define-property/CHANGELOG.md +29 -0
- package/node_modules/es-define-property/LICENSE +21 -0
- package/node_modules/es-define-property/README.md +49 -0
- package/node_modules/es-define-property/index.d.ts +3 -0
- package/node_modules/es-define-property/index.js +14 -0
- package/node_modules/es-define-property/package.json +81 -0
- package/node_modules/es-define-property/test/index.js +56 -0
- package/node_modules/es-define-property/tsconfig.json +10 -0
- package/node_modules/es-errors/.eslintrc +5 -0
- package/node_modules/es-errors/.github/FUNDING.yml +12 -0
- package/node_modules/es-errors/CHANGELOG.md +40 -0
- package/node_modules/es-errors/LICENSE +21 -0
- package/node_modules/es-errors/README.md +55 -0
- package/node_modules/es-errors/eval.d.ts +3 -0
- package/node_modules/es-errors/eval.js +4 -0
- package/node_modules/es-errors/index.d.ts +3 -0
- package/node_modules/es-errors/index.js +4 -0
- package/node_modules/es-errors/package.json +80 -0
- package/node_modules/es-errors/range.d.ts +3 -0
- package/node_modules/es-errors/range.js +4 -0
- package/node_modules/es-errors/ref.d.ts +3 -0
- package/node_modules/es-errors/ref.js +4 -0
- package/node_modules/es-errors/syntax.d.ts +3 -0
- package/node_modules/es-errors/syntax.js +4 -0
- package/node_modules/es-errors/test/index.js +19 -0
- package/node_modules/es-errors/tsconfig.json +49 -0
- package/node_modules/es-errors/type.d.ts +3 -0
- package/node_modules/es-errors/type.js +4 -0
- package/node_modules/es-errors/uri.d.ts +3 -0
- package/node_modules/es-errors/uri.js +4 -0
- package/node_modules/es-object-atoms/.eslintrc +16 -0
- package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
- package/node_modules/es-object-atoms/CHANGELOG.md +44 -0
- package/node_modules/es-object-atoms/LICENSE +21 -0
- package/node_modules/es-object-atoms/README.md +63 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
- package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
- package/node_modules/es-object-atoms/ToObject.js +10 -0
- package/node_modules/es-object-atoms/index.d.ts +3 -0
- package/node_modules/es-object-atoms/index.js +4 -0
- package/node_modules/es-object-atoms/isObject.d.ts +3 -0
- package/node_modules/es-object-atoms/isObject.js +6 -0
- package/node_modules/es-object-atoms/package.json +79 -0
- package/node_modules/es-object-atoms/test/index.js +38 -0
- package/node_modules/es-object-atoms/tsconfig.json +7 -0
- package/node_modules/es-set-tostringtag/.eslintrc +13 -0
- package/node_modules/es-set-tostringtag/.nycrc +9 -0
- package/node_modules/es-set-tostringtag/CHANGELOG.md +67 -0
- package/node_modules/es-set-tostringtag/LICENSE +21 -0
- package/node_modules/es-set-tostringtag/README.md +53 -0
- package/node_modules/es-set-tostringtag/index.d.ts +10 -0
- package/node_modules/es-set-tostringtag/index.js +35 -0
- package/node_modules/es-set-tostringtag/package.json +78 -0
- package/node_modules/es-set-tostringtag/test/index.js +85 -0
- package/node_modules/es-set-tostringtag/tsconfig.json +9 -0
- package/node_modules/eventemitter3/LICENSE +21 -0
- package/node_modules/eventemitter3/README.md +85 -0
- package/node_modules/eventemitter3/dist/eventemitter3.esm.js +355 -0
- package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js +1 -0
- package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js.map +1 -0
- package/node_modules/eventemitter3/dist/eventemitter3.umd.js +363 -0
- package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js +1 -0
- package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js.map +1 -0
- package/node_modules/eventemitter3/index.d.ts +135 -0
- package/node_modules/eventemitter3/index.js +336 -0
- package/node_modules/eventemitter3/index.mjs +4 -0
- package/node_modules/eventemitter3/package.json +62 -0
- package/node_modules/follow-redirects/LICENSE +18 -0
- package/node_modules/follow-redirects/README.md +183 -0
- package/node_modules/follow-redirects/debug.js +15 -0
- package/node_modules/follow-redirects/http.js +1 -0
- package/node_modules/follow-redirects/https.js +1 -0
- package/node_modules/follow-redirects/index.js +714 -0
- package/node_modules/follow-redirects/package.json +58 -0
- package/node_modules/form-data/CHANGELOG.md +686 -0
- package/node_modules/form-data/License +19 -0
- package/node_modules/form-data/README.md +355 -0
- package/node_modules/form-data/index.d.ts +62 -0
- package/node_modules/form-data/lib/browser.js +4 -0
- package/node_modules/form-data/lib/form_data.js +506 -0
- package/node_modules/form-data/lib/populate.js +10 -0
- package/node_modules/form-data/package.json +82 -0
- package/node_modules/function-bind/.eslintrc +21 -0
- package/node_modules/function-bind/.github/FUNDING.yml +12 -0
- package/node_modules/function-bind/.github/SECURITY.md +3 -0
- package/node_modules/function-bind/.nycrc +13 -0
- package/node_modules/function-bind/CHANGELOG.md +136 -0
- package/node_modules/function-bind/LICENSE +20 -0
- package/node_modules/function-bind/README.md +46 -0
- package/node_modules/function-bind/implementation.js +84 -0
- package/node_modules/function-bind/index.js +5 -0
- package/node_modules/function-bind/package.json +87 -0
- package/node_modules/function-bind/test/.eslintrc +9 -0
- package/node_modules/function-bind/test/index.js +252 -0
- package/node_modules/get-intrinsic/.eslintrc +42 -0
- package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
- package/node_modules/get-intrinsic/.nycrc +9 -0
- package/node_modules/get-intrinsic/CHANGELOG.md +186 -0
- package/node_modules/get-intrinsic/LICENSE +21 -0
- package/node_modules/get-intrinsic/README.md +71 -0
- package/node_modules/get-intrinsic/index.js +378 -0
- package/node_modules/get-intrinsic/package.json +97 -0
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
- package/node_modules/get-proto/.eslintrc +10 -0
- package/node_modules/get-proto/.github/FUNDING.yml +12 -0
- package/node_modules/get-proto/.nycrc +9 -0
- package/node_modules/get-proto/CHANGELOG.md +21 -0
- package/node_modules/get-proto/LICENSE +21 -0
- package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
- package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
- package/node_modules/get-proto/README.md +50 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
- package/node_modules/get-proto/index.d.ts +5 -0
- package/node_modules/get-proto/index.js +27 -0
- package/node_modules/get-proto/package.json +81 -0
- package/node_modules/get-proto/test/index.js +68 -0
- package/node_modules/get-proto/tsconfig.json +9 -0
- package/node_modules/glob/README.md +388 -214
- package/node_modules/glob/dist/commonjs/glob.d.ts +20 -11
- package/node_modules/glob/dist/commonjs/glob.d.ts.map +1 -1
- package/node_modules/glob/dist/commonjs/glob.js +22 -29
- package/node_modules/glob/dist/commonjs/glob.js.map +1 -1
- package/node_modules/glob/dist/commonjs/has-magic.d.ts +1 -1
- package/node_modules/glob/dist/commonjs/has-magic.d.ts.map +1 -1
- package/node_modules/glob/dist/commonjs/has-magic.js +1 -4
- package/node_modules/glob/dist/commonjs/has-magic.js.map +1 -1
- package/node_modules/glob/dist/commonjs/ignore.d.ts +16 -4
- package/node_modules/glob/dist/commonjs/ignore.d.ts.map +1 -1
- package/node_modules/glob/dist/commonjs/ignore.js +24 -4
- package/node_modules/glob/dist/commonjs/ignore.js.map +1 -1
- package/node_modules/glob/dist/commonjs/index.d.ts +3 -2
- package/node_modules/glob/dist/commonjs/index.d.ts.map +1 -1
- package/node_modules/glob/dist/commonjs/index.js.map +1 -1
- package/node_modules/glob/dist/commonjs/index.min.js +2 -3
- package/node_modules/glob/dist/commonjs/index.min.js.map +4 -4
- package/node_modules/glob/dist/commonjs/pattern.d.ts +10 -3
- package/node_modules/glob/dist/commonjs/pattern.d.ts.map +1 -1
- package/node_modules/glob/dist/commonjs/pattern.js +27 -15
- package/node_modules/glob/dist/commonjs/pattern.js.map +1 -1
- package/node_modules/glob/dist/commonjs/processor.d.ts +23 -10
- package/node_modules/glob/dist/commonjs/processor.d.ts.map +1 -1
- package/node_modules/glob/dist/commonjs/processor.js +36 -23
- package/node_modules/glob/dist/commonjs/processor.js.map +1 -1
- package/node_modules/glob/dist/commonjs/walker.d.ts +19 -17
- package/node_modules/glob/dist/commonjs/walker.d.ts.map +1 -1
- package/node_modules/glob/dist/commonjs/walker.js +50 -35
- package/node_modules/glob/dist/commonjs/walker.js.map +1 -1
- package/node_modules/glob/dist/esm/glob.d.ts +20 -11
- package/node_modules/glob/dist/esm/glob.d.ts.map +1 -1
- package/node_modules/glob/dist/esm/glob.js +22 -29
- package/node_modules/glob/dist/esm/glob.js.map +1 -1
- package/node_modules/glob/dist/esm/has-magic.d.ts +1 -1
- package/node_modules/glob/dist/esm/has-magic.d.ts.map +1 -1
- package/node_modules/glob/dist/esm/has-magic.js +1 -4
- package/node_modules/glob/dist/esm/has-magic.js.map +1 -1
- package/node_modules/glob/dist/esm/ignore.d.ts +16 -4
- package/node_modules/glob/dist/esm/ignore.d.ts.map +1 -1
- package/node_modules/glob/dist/esm/ignore.js +25 -5
- package/node_modules/glob/dist/esm/ignore.js.map +1 -1
- package/node_modules/glob/dist/esm/index.d.ts +3 -2
- package/node_modules/glob/dist/esm/index.d.ts.map +1 -1
- package/node_modules/glob/dist/esm/index.js.map +1 -1
- package/node_modules/glob/dist/esm/index.min.js +2 -3
- package/node_modules/glob/dist/esm/index.min.js.map +4 -4
- package/node_modules/glob/dist/esm/pattern.d.ts +10 -3
- package/node_modules/glob/dist/esm/pattern.d.ts.map +1 -1
- package/node_modules/glob/dist/esm/pattern.js +27 -15
- package/node_modules/glob/dist/esm/pattern.js.map +1 -1
- package/node_modules/glob/dist/esm/processor.d.ts +23 -10
- package/node_modules/glob/dist/esm/processor.d.ts.map +1 -1
- package/node_modules/glob/dist/esm/processor.js +36 -23
- package/node_modules/glob/dist/esm/processor.js.map +1 -1
- package/node_modules/glob/dist/esm/walker.d.ts +19 -17
- package/node_modules/glob/dist/esm/walker.d.ts.map +1 -1
- package/node_modules/glob/dist/esm/walker.js +51 -36
- package/node_modules/glob/dist/esm/walker.js.map +1 -1
- package/node_modules/glob/package.json +28 -12
- package/node_modules/glob/src/glob.ts +655 -0
- package/node_modules/glob/src/has-magic.ts +23 -0
- package/node_modules/glob/src/ignore.ts +162 -0
- package/node_modules/glob/src/index.ts +225 -0
- package/node_modules/glob/src/pattern.ts +286 -0
- package/node_modules/glob/src/processor.ts +333 -0
- package/node_modules/glob/src/walker.ts +523 -0
- package/node_modules/gopd/.eslintrc +16 -0
- package/node_modules/gopd/.github/FUNDING.yml +12 -0
- package/node_modules/gopd/CHANGELOG.md +45 -0
- package/node_modules/gopd/LICENSE +21 -0
- package/node_modules/gopd/README.md +40 -0
- package/node_modules/gopd/gOPD.d.ts +1 -0
- package/node_modules/gopd/gOPD.js +4 -0
- package/node_modules/gopd/index.d.ts +5 -0
- package/node_modules/gopd/index.js +15 -0
- package/node_modules/gopd/package.json +77 -0
- package/node_modules/gopd/test/index.js +36 -0
- package/node_modules/gopd/tsconfig.json +9 -0
- package/node_modules/has-symbols/.eslintrc +11 -0
- package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
- package/node_modules/has-symbols/.nycrc +9 -0
- package/node_modules/has-symbols/CHANGELOG.md +91 -0
- package/node_modules/has-symbols/LICENSE +21 -0
- package/node_modules/has-symbols/README.md +46 -0
- package/node_modules/has-symbols/index.d.ts +3 -0
- package/node_modules/has-symbols/index.js +14 -0
- package/node_modules/has-symbols/package.json +111 -0
- package/node_modules/has-symbols/shams.d.ts +3 -0
- package/node_modules/has-symbols/shams.js +45 -0
- package/node_modules/has-symbols/test/index.js +22 -0
- package/node_modules/has-symbols/test/shams/core-js.js +29 -0
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
- package/node_modules/has-symbols/test/tests.js +58 -0
- package/node_modules/has-symbols/tsconfig.json +10 -0
- package/node_modules/has-tostringtag/.eslintrc +5 -0
- package/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
- package/node_modules/has-tostringtag/.nycrc +13 -0
- package/node_modules/has-tostringtag/CHANGELOG.md +42 -0
- package/node_modules/has-tostringtag/LICENSE +21 -0
- package/node_modules/has-tostringtag/README.md +46 -0
- package/node_modules/has-tostringtag/index.d.ts +3 -0
- package/node_modules/has-tostringtag/index.js +8 -0
- package/node_modules/has-tostringtag/package.json +108 -0
- package/node_modules/has-tostringtag/shams.d.ts +3 -0
- package/node_modules/has-tostringtag/shams.js +8 -0
- package/node_modules/has-tostringtag/test/index.js +21 -0
- package/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
- package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
- package/node_modules/has-tostringtag/test/tests.js +15 -0
- package/node_modules/has-tostringtag/tsconfig.json +49 -0
- package/node_modules/hasown/.github/FUNDING.yml +12 -0
- package/node_modules/hasown/.nycrc +13 -0
- package/node_modules/hasown/CHANGELOG.md +58 -0
- package/node_modules/hasown/LICENSE +21 -0
- package/node_modules/hasown/README.md +40 -0
- package/node_modules/hasown/eslint.config.mjs +6 -0
- package/node_modules/hasown/index.d.ts +3 -0
- package/node_modules/hasown/index.js +8 -0
- package/node_modules/hasown/package.json +91 -0
- package/node_modules/hasown/tsconfig.json +6 -0
- package/node_modules/math-intrinsics/.eslintrc +16 -0
- package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
- package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
- package/node_modules/math-intrinsics/LICENSE +21 -0
- package/node_modules/math-intrinsics/README.md +50 -0
- package/node_modules/math-intrinsics/abs.d.ts +1 -0
- package/node_modules/math-intrinsics/abs.js +4 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
- package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
- package/node_modules/math-intrinsics/floor.d.ts +1 -0
- package/node_modules/math-intrinsics/floor.js +4 -0
- package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
- package/node_modules/math-intrinsics/isFinite.js +12 -0
- package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/isInteger.js +16 -0
- package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
- package/node_modules/math-intrinsics/isNaN.js +6 -0
- package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
- package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
- package/node_modules/math-intrinsics/max.d.ts +1 -0
- package/node_modules/math-intrinsics/max.js +4 -0
- package/node_modules/math-intrinsics/min.d.ts +1 -0
- package/node_modules/math-intrinsics/min.js +4 -0
- package/node_modules/math-intrinsics/mod.d.ts +3 -0
- package/node_modules/math-intrinsics/mod.js +9 -0
- package/node_modules/math-intrinsics/package.json +86 -0
- package/node_modules/math-intrinsics/pow.d.ts +1 -0
- package/node_modules/math-intrinsics/pow.js +4 -0
- package/node_modules/math-intrinsics/round.d.ts +1 -0
- package/node_modules/math-intrinsics/round.js +4 -0
- package/node_modules/math-intrinsics/sign.d.ts +3 -0
- package/node_modules/math-intrinsics/sign.js +11 -0
- package/node_modules/math-intrinsics/test/index.js +192 -0
- package/node_modules/math-intrinsics/tsconfig.json +3 -0
- package/node_modules/mime-db/HISTORY.md +507 -0
- package/node_modules/mime-db/LICENSE +23 -0
- package/node_modules/mime-db/README.md +100 -0
- package/node_modules/mime-db/db.json +8519 -0
- package/node_modules/mime-db/index.js +12 -0
- package/node_modules/mime-db/package.json +60 -0
- package/node_modules/mime-types/HISTORY.md +397 -0
- package/node_modules/mime-types/LICENSE +23 -0
- package/node_modules/mime-types/README.md +113 -0
- package/node_modules/mime-types/index.js +188 -0
- package/node_modules/mime-types/package.json +44 -0
- package/node_modules/minimatch/README.md +125 -107
- package/node_modules/minimatch/dist/commonjs/index.d.ts +49 -38
- package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -1
- package/node_modules/minimatch/dist/commonjs/index.js +782 -359
- package/node_modules/minimatch/dist/commonjs/index.js.map +1 -1
- package/node_modules/minimatch/dist/esm/index.d.ts +49 -38
- package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -1
- package/node_modules/minimatch/dist/esm/index.js +781 -356
- package/node_modules/minimatch/dist/esm/index.js.map +1 -1
- package/node_modules/minimatch/package.json +5 -4
- package/node_modules/path-scurry/README.md +0 -1
- package/node_modules/path-scurry/dist/commonjs/index.d.ts +7 -0
- package/node_modules/path-scurry/dist/commonjs/index.d.ts.map +1 -1
- package/node_modules/path-scurry/dist/commonjs/index.js +59 -21
- package/node_modules/path-scurry/dist/commonjs/index.js.map +1 -1
- package/node_modules/path-scurry/dist/esm/index.d.ts +7 -0
- package/node_modules/path-scurry/dist/esm/index.d.ts.map +1 -1
- package/node_modules/path-scurry/dist/esm/index.js +42 -14
- package/node_modules/path-scurry/dist/esm/index.js.map +1 -1
- package/node_modules/path-scurry/package.json +4 -4
- package/node_modules/proxy-from-env/LICENSE +20 -0
- package/node_modules/proxy-from-env/README.md +163 -0
- package/node_modules/proxy-from-env/index.cjs +105 -0
- package/node_modules/proxy-from-env/index.js +103 -0
- package/node_modules/proxy-from-env/package.json +43 -0
- package/package.json +3 -1
- package/dist/web/assets/Assistant-DSQAdSiW.js +0 -1
- package/dist/web/assets/Dashboard-dCu2Cdxd.js +0 -1
- package/dist/web/assets/Files-cRhoWviM.js +0 -1
- package/dist/web/assets/Sessions-BxHsX1C5.js +0 -1
- package/dist/web/assets/WorkspaceTree-CD94JsaJ.js +0 -1
- package/dist/web/assets/index-BXpTaAUz.js +0 -66
- package/node_modules/minimatch/dist/commonjs/ast.d.ts +0 -22
- package/node_modules/minimatch/dist/commonjs/ast.d.ts.map +0 -1
- package/node_modules/minimatch/dist/commonjs/ast.js +0 -845
- package/node_modules/minimatch/dist/commonjs/ast.js.map +0 -1
- package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +0 -8
- package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +0 -1
- package/node_modules/minimatch/dist/commonjs/brace-expressions.js +0 -150
- package/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +0 -1
- package/node_modules/minimatch/dist/esm/ast.d.ts +0 -22
- package/node_modules/minimatch/dist/esm/ast.d.ts.map +0 -1
- package/node_modules/minimatch/dist/esm/ast.js +0 -841
- package/node_modules/minimatch/dist/esm/ast.js.map +0 -1
- package/node_modules/minimatch/dist/esm/brace-expressions.d.ts +0 -8
- package/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +0 -1
- package/node_modules/minimatch/dist/esm/brace-expressions.js +0 -146
- package/node_modules/minimatch/dist/esm/brace-expressions.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "path-scurry",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "walk paths fast and efficiently",
|
|
5
5
|
"author": "Isaac Z. Schlueter <i@izs.me> (https://blog.izs.me)",
|
|
6
6
|
"main": "./dist/commonjs/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"presnap": "npm run prepare",
|
|
32
32
|
"test": "tap",
|
|
33
33
|
"snap": "tap",
|
|
34
|
-
"format": "prettier --write .
|
|
34
|
+
"format": "prettier --write .",
|
|
35
35
|
"typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts",
|
|
36
36
|
"bench": "bash ./scripts/bench.sh"
|
|
37
37
|
},
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"mkdirp": "^3.0.0",
|
|
42
42
|
"prettier": "^3.3.2",
|
|
43
43
|
"rimraf": "^6.1.3",
|
|
44
|
-
"tap": "^21.
|
|
44
|
+
"tap": "^21.8.0",
|
|
45
45
|
"ts-node": "^10.9.2",
|
|
46
|
-
"tshy": "^
|
|
46
|
+
"tshy": "^4.1.3",
|
|
47
47
|
"typedoc": "^0.28.17"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2016-2018 Rob Wu <rob@robwu.nl>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
10
|
+
so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# proxy-from-env
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
[](https://coveralls.io/github/Rob--W/proxy-from-env?branch=master)
|
|
5
|
+
|
|
6
|
+
`proxy-from-env` is a Node.js package that exports a function (`getProxyForUrl`)
|
|
7
|
+
that takes an input URL (a string, an instance of
|
|
8
|
+
[`URL`](https://nodejs.org/docs/latest/api/url.html#the-whatwg-url-api),
|
|
9
|
+
or [`url.parse`](https://nodejs.org/docs/latest/api/url.html#url_url_parsing)'s
|
|
10
|
+
return value) and returns the desired proxy URL (also a string) based on
|
|
11
|
+
standard proxy environment variables. If no proxy is set, an empty string is
|
|
12
|
+
returned.
|
|
13
|
+
|
|
14
|
+
If your application makes important (security) decisions based on the URL, be
|
|
15
|
+
consistent in the mechanism to parse and validate URLs, as differences in URL
|
|
16
|
+
parsing behavior can affect the outcome of proxy resolution.
|
|
17
|
+
Strings are parsed with the standard `URL` API, as of `proxy-from-env@2.0.0`.
|
|
18
|
+
Older versions relied on the (now deprecated) `url.parse` method instead.
|
|
19
|
+
|
|
20
|
+
Invalid values in environment variables are not handled by the library
|
|
21
|
+
([#41](https://github.com/Rob--W/proxy-from-env/issues/41)).
|
|
22
|
+
|
|
23
|
+
It is your responsibility to actually proxy the request using the given URL.
|
|
24
|
+
|
|
25
|
+
Installation:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm install proxy-from-env
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Example
|
|
32
|
+
This example shows how the data for a URL can be fetched via the
|
|
33
|
+
[`http` module](https://nodejs.org/api/http.html), in a proxy-aware way.
|
|
34
|
+
|
|
35
|
+
warning: this simple example works for http requests only. To support https,
|
|
36
|
+
you must establish a proxy tunnel via the
|
|
37
|
+
[http `connect` method](https://developer.mozilla.org/en-us/docs/web/http/reference/methods/connect).
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
import http from 'node:test';
|
|
41
|
+
import { getProxyForUrl } from 'proxy-from-env';
|
|
42
|
+
// ^ or: var getProxyForUrl = require('proxy-from-env').getProxyForUrl;
|
|
43
|
+
|
|
44
|
+
var some_url = 'http://example.com/something';
|
|
45
|
+
|
|
46
|
+
// // Example, if there is a proxy server at 10.0.0.1:1234, then setting the
|
|
47
|
+
// // http_proxy environment variable causes the request to go through a proxy.
|
|
48
|
+
// process.env.http_proxy = 'http://10.0.0.1:1234';
|
|
49
|
+
//
|
|
50
|
+
// // But if the host to be proxied is listed in NO_PROXY, then the request is
|
|
51
|
+
// // not proxied (but a direct request is made).
|
|
52
|
+
// process.env.no_proxy = 'example.com';
|
|
53
|
+
|
|
54
|
+
var proxy_url = getProxyForUrl(some_url); // <-- Our magic.
|
|
55
|
+
if (proxy_url) {
|
|
56
|
+
// Should be proxied through proxy_url.
|
|
57
|
+
var parsed_some_url = new URL(some_url);
|
|
58
|
+
var parsed_proxy_url = new URL(proxy_url);
|
|
59
|
+
// A HTTP proxy is quite simple. It is similar to a normal request, except the
|
|
60
|
+
// path is an absolute URL, and the proxied URL's host is put in the header
|
|
61
|
+
// instead of the server's actual host.
|
|
62
|
+
httpOptions = {
|
|
63
|
+
protocol: parsed_proxy_url.protocol,
|
|
64
|
+
hostname: parsed_proxy_url.hostname,
|
|
65
|
+
port: parsed_proxy_url.port,
|
|
66
|
+
path: parsed_some_url.href,
|
|
67
|
+
headers: {
|
|
68
|
+
Host: parsed_some_url.host, // = host name + optional port.
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
} else {
|
|
72
|
+
// Direct request.
|
|
73
|
+
httpOptions = some_url;
|
|
74
|
+
}
|
|
75
|
+
http.get(httpOptions, function(res) {
|
|
76
|
+
var responses = [];
|
|
77
|
+
res.on('data', function(chunk) { responses.push(chunk); });
|
|
78
|
+
res.on('end', function() { console.log(responses.join('')); });
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Full proxy support
|
|
83
|
+
The simple example above works for http requests only. To support https, you
|
|
84
|
+
must establish a proxy tunnel via the
|
|
85
|
+
[http `connect` method](https://developer.mozilla.org/en-us/docs/web/http/reference/methods/connect).
|
|
86
|
+
|
|
87
|
+
An example of that is shown in the
|
|
88
|
+
[`https-proxy-agent` npm package](https://www.npmjs.com/package/https-proxy-agent).
|
|
89
|
+
The [`proxy-agent` npm package](https://www.npmjs.com/package/proxy-agent)
|
|
90
|
+
combines `https-proxy-agent` and `proxy-from-env` to offer a `http.Agent` that
|
|
91
|
+
supports proxies from environment variables.
|
|
92
|
+
|
|
93
|
+
### Built-in proxy support
|
|
94
|
+
Node.js is working on built-in support for proxy environment variables,
|
|
95
|
+
currently behind `NODE_USE_ENV_PROXY=1` or `--use-env-proxy`. For details, see:
|
|
96
|
+
|
|
97
|
+
- https://github.com/nodejs/node/issues/57872
|
|
98
|
+
- https://nodejs.org/api/http.html#built-in-proxy-support
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
## Environment variables
|
|
102
|
+
The environment variables can be specified in all lowercase or all uppercase,
|
|
103
|
+
with lowercase taking precedence over the uppercase variant. A variable that is
|
|
104
|
+
not set has the same meaning as a variable that is set but has no value.
|
|
105
|
+
|
|
106
|
+
### NO\_PROXY
|
|
107
|
+
|
|
108
|
+
`NO_PROXY` is a list of host names (optionally with a port). If the input URL
|
|
109
|
+
matches any of the entries in `NO_PROXY`, then the input URL should be fetched
|
|
110
|
+
by a direct request (i.e. without a proxy).
|
|
111
|
+
|
|
112
|
+
Matching follows the following rules:
|
|
113
|
+
|
|
114
|
+
- `NO_PROXY=*` disables all proxies.
|
|
115
|
+
- Space and commas may be used to separate the entries in the `NO_PROXY` list.
|
|
116
|
+
- If `NO_PROXY` does not contain any entries, then proxies are never disabled.
|
|
117
|
+
- If a port is added after the host name, then the ports must match. If the URL
|
|
118
|
+
does not have an explicit port name, the protocol's default port is used.
|
|
119
|
+
- Generally, the proxy is only disabled if the host name is an exact match for
|
|
120
|
+
an entry in the `NO_PROXY` list. The only exceptions are entries that start
|
|
121
|
+
with a dot or with a wildcard; then the proxy is disabled if the host name
|
|
122
|
+
ends with the entry.
|
|
123
|
+
|
|
124
|
+
See `test.js` for examples of what should match and what does not.
|
|
125
|
+
|
|
126
|
+
### \*\_PROXY
|
|
127
|
+
|
|
128
|
+
The environment variable used for the proxy depends on the protocol of the URL.
|
|
129
|
+
For example, `https://example.com` uses the "https" protocol, and therefore the
|
|
130
|
+
proxy to be used is `HTTPS_PROXY` (_NOT_ `HTTP_PROXY`, which is _only_ used for
|
|
131
|
+
http:-URLs).
|
|
132
|
+
|
|
133
|
+
The library is not limited to http(s), other schemes such as
|
|
134
|
+
`FTP_PROXY` (ftp:),
|
|
135
|
+
`WSS_PROXY` (wss:),
|
|
136
|
+
`WS_PROXY` (ws:)
|
|
137
|
+
are also supported.
|
|
138
|
+
|
|
139
|
+
If present, `ALL_PROXY` is used as fallback if there is no other match.
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## External resources
|
|
143
|
+
The exact way of parsing the environment variables is not codified in any
|
|
144
|
+
standard. This library is designed to be compatible with formats as expected by
|
|
145
|
+
existing software.
|
|
146
|
+
The following resources were used to determine the desired behavior:
|
|
147
|
+
|
|
148
|
+
- cURL:
|
|
149
|
+
https://curl.haxx.se/docs/manpage.html#ENVIRONMENT
|
|
150
|
+
https://github.com/curl/curl/blob/4af40b3646d3b09f68e419f7ca866ff395d1f897/lib/url.c#L4446-L4514
|
|
151
|
+
https://github.com/curl/curl/blob/4af40b3646d3b09f68e419f7ca866ff395d1f897/lib/url.c#L4608-L4638
|
|
152
|
+
|
|
153
|
+
- wget:
|
|
154
|
+
https://www.gnu.org/software/wget/manual/wget.html#Proxies
|
|
155
|
+
http://git.savannah.gnu.org/cgit/wget.git/tree/src/init.c?id=636a5f9a1c508aa39e35a3a8e9e54520a284d93d#n383
|
|
156
|
+
http://git.savannah.gnu.org/cgit/wget.git/tree/src/retr.c?id=93c1517c4071c4288ba5a4b038e7634e4c6b5482#n1278
|
|
157
|
+
|
|
158
|
+
- W3:
|
|
159
|
+
https://www.w3.org/Daemon/User/Proxies/ProxyClients.html
|
|
160
|
+
|
|
161
|
+
- Python's urllib:
|
|
162
|
+
https://github.com/python/cpython/blob/936135bb97fe04223aa30ca6e98eac8f3ed6b349/Lib/urllib/request.py#L755-L782
|
|
163
|
+
https://github.com/python/cpython/blob/936135bb97fe04223aa30ca6e98eac8f3ed6b349/Lib/urllib/request.py#L2444-L2479
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var DEFAULT_PORTS = {
|
|
4
|
+
ftp: 21,
|
|
5
|
+
gopher: 70,
|
|
6
|
+
http: 80,
|
|
7
|
+
https: 443,
|
|
8
|
+
ws: 80,
|
|
9
|
+
wss: 443,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function parseUrl(urlString) {
|
|
13
|
+
try {
|
|
14
|
+
return new URL(urlString);
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {string|object|URL} url - The URL as a string or URL instance, or a
|
|
22
|
+
* compatible object (such as the result from legacy url.parse).
|
|
23
|
+
* @return {string} The URL of the proxy that should handle the request to the
|
|
24
|
+
* given URL. If no proxy is set, this will be an empty string.
|
|
25
|
+
*/
|
|
26
|
+
function getProxyForUrl(url) {
|
|
27
|
+
var parsedUrl = (typeof url === 'string' ? parseUrl(url) : url) || {};
|
|
28
|
+
var proto = parsedUrl.protocol;
|
|
29
|
+
var hostname = parsedUrl.host;
|
|
30
|
+
var port = parsedUrl.port;
|
|
31
|
+
if (typeof hostname !== 'string' || !hostname || typeof proto !== 'string') {
|
|
32
|
+
return ''; // Don't proxy URLs without a valid scheme or host.
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
proto = proto.split(':', 1)[0];
|
|
36
|
+
// Stripping ports in this way instead of using parsedUrl.hostname to make
|
|
37
|
+
// sure that the brackets around IPv6 addresses are kept.
|
|
38
|
+
hostname = hostname.replace(/:\d*$/, '');
|
|
39
|
+
port = parseInt(port) || DEFAULT_PORTS[proto] || 0;
|
|
40
|
+
if (!shouldProxy(hostname, port)) {
|
|
41
|
+
return ''; // Don't proxy URLs that match NO_PROXY.
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var proxy = getEnv(proto + '_proxy') || getEnv('all_proxy');
|
|
45
|
+
if (proxy && proxy.indexOf('://') === -1) {
|
|
46
|
+
// Missing scheme in proxy, default to the requested URL's scheme.
|
|
47
|
+
proxy = proto + '://' + proxy;
|
|
48
|
+
}
|
|
49
|
+
return proxy;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Determines whether a given URL should be proxied.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} hostname - The host name of the URL.
|
|
56
|
+
* @param {number} port - The effective port of the URL.
|
|
57
|
+
* @returns {boolean} Whether the given URL should be proxied.
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
function shouldProxy(hostname, port) {
|
|
61
|
+
var NO_PROXY = getEnv('no_proxy').toLowerCase();
|
|
62
|
+
if (!NO_PROXY) {
|
|
63
|
+
return true; // Always proxy if NO_PROXY is not set.
|
|
64
|
+
}
|
|
65
|
+
if (NO_PROXY === '*') {
|
|
66
|
+
return false; // Never proxy if wildcard is set.
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return NO_PROXY.split(/[,\s]/).every(function(proxy) {
|
|
70
|
+
if (!proxy) {
|
|
71
|
+
return true; // Skip zero-length hosts.
|
|
72
|
+
}
|
|
73
|
+
var parsedProxy = proxy.match(/^(.+):(\d+)$/);
|
|
74
|
+
var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy;
|
|
75
|
+
var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0;
|
|
76
|
+
if (parsedProxyPort && parsedProxyPort !== port) {
|
|
77
|
+
return true; // Skip if ports don't match.
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!/^[.*]/.test(parsedProxyHostname)) {
|
|
81
|
+
// No wildcards, so stop proxying if there is an exact match.
|
|
82
|
+
return hostname !== parsedProxyHostname;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (parsedProxyHostname.charAt(0) === '*') {
|
|
86
|
+
// Remove leading wildcard.
|
|
87
|
+
parsedProxyHostname = parsedProxyHostname.slice(1);
|
|
88
|
+
}
|
|
89
|
+
// Stop proxying if the hostname ends with the no_proxy host.
|
|
90
|
+
return !hostname.endsWith(parsedProxyHostname);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Get the value for an environment variable.
|
|
96
|
+
*
|
|
97
|
+
* @param {string} key - The name of the environment variable.
|
|
98
|
+
* @return {string} The value of the environment variable.
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
101
|
+
function getEnv(key) {
|
|
102
|
+
return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || '';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
exports.getProxyForUrl = getProxyForUrl;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var DEFAULT_PORTS = {
|
|
4
|
+
ftp: 21,
|
|
5
|
+
gopher: 70,
|
|
6
|
+
http: 80,
|
|
7
|
+
https: 443,
|
|
8
|
+
ws: 80,
|
|
9
|
+
wss: 443,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function parseUrl(urlString) {
|
|
13
|
+
try {
|
|
14
|
+
return new URL(urlString);
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {string|object|URL} url - The URL as a string or URL instance, or a
|
|
22
|
+
* compatible object (such as the result from legacy url.parse).
|
|
23
|
+
* @return {string} The URL of the proxy that should handle the request to the
|
|
24
|
+
* given URL. If no proxy is set, this will be an empty string.
|
|
25
|
+
*/
|
|
26
|
+
export function getProxyForUrl(url) {
|
|
27
|
+
var parsedUrl = (typeof url === 'string' ? parseUrl(url) : url) || {};
|
|
28
|
+
var proto = parsedUrl.protocol;
|
|
29
|
+
var hostname = parsedUrl.host;
|
|
30
|
+
var port = parsedUrl.port;
|
|
31
|
+
if (typeof hostname !== 'string' || !hostname || typeof proto !== 'string') {
|
|
32
|
+
return ''; // Don't proxy URLs without a valid scheme or host.
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
proto = proto.split(':', 1)[0];
|
|
36
|
+
// Stripping ports in this way instead of using parsedUrl.hostname to make
|
|
37
|
+
// sure that the brackets around IPv6 addresses are kept.
|
|
38
|
+
hostname = hostname.replace(/:\d*$/, '');
|
|
39
|
+
port = parseInt(port) || DEFAULT_PORTS[proto] || 0;
|
|
40
|
+
if (!shouldProxy(hostname, port)) {
|
|
41
|
+
return ''; // Don't proxy URLs that match NO_PROXY.
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var proxy = getEnv(proto + '_proxy') || getEnv('all_proxy');
|
|
45
|
+
if (proxy && proxy.indexOf('://') === -1) {
|
|
46
|
+
// Missing scheme in proxy, default to the requested URL's scheme.
|
|
47
|
+
proxy = proto + '://' + proxy;
|
|
48
|
+
}
|
|
49
|
+
return proxy;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Determines whether a given URL should be proxied.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} hostname - The host name of the URL.
|
|
56
|
+
* @param {number} port - The effective port of the URL.
|
|
57
|
+
* @returns {boolean} Whether the given URL should be proxied.
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
function shouldProxy(hostname, port) {
|
|
61
|
+
var NO_PROXY = getEnv('no_proxy').toLowerCase();
|
|
62
|
+
if (!NO_PROXY) {
|
|
63
|
+
return true; // Always proxy if NO_PROXY is not set.
|
|
64
|
+
}
|
|
65
|
+
if (NO_PROXY === '*') {
|
|
66
|
+
return false; // Never proxy if wildcard is set.
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return NO_PROXY.split(/[,\s]/).every(function(proxy) {
|
|
70
|
+
if (!proxy) {
|
|
71
|
+
return true; // Skip zero-length hosts.
|
|
72
|
+
}
|
|
73
|
+
var parsedProxy = proxy.match(/^(.+):(\d+)$/);
|
|
74
|
+
var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy;
|
|
75
|
+
var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0;
|
|
76
|
+
if (parsedProxyPort && parsedProxyPort !== port) {
|
|
77
|
+
return true; // Skip if ports don't match.
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!/^[.*]/.test(parsedProxyHostname)) {
|
|
81
|
+
// No wildcards, so stop proxying if there is an exact match.
|
|
82
|
+
return hostname !== parsedProxyHostname;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (parsedProxyHostname.charAt(0) === '*') {
|
|
86
|
+
// Remove leading wildcard.
|
|
87
|
+
parsedProxyHostname = parsedProxyHostname.slice(1);
|
|
88
|
+
}
|
|
89
|
+
// Stop proxying if the hostname ends with the no_proxy host.
|
|
90
|
+
return !hostname.endsWith(parsedProxyHostname);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Get the value for an environment variable.
|
|
96
|
+
*
|
|
97
|
+
* @param {string} key - The name of the environment variable.
|
|
98
|
+
* @return {string} The value of the environment variable.
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
101
|
+
function getEnv(key) {
|
|
102
|
+
return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || '';
|
|
103
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "proxy-from-env",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Offers getProxyForUrl to get the proxy URL for a URL, respecting the *_PROXY (e.g. HTTP_PROXY) and NO_PROXY environment variables.",
|
|
5
|
+
"main": "index.cjs",
|
|
6
|
+
"exports": {
|
|
7
|
+
"import": "./index.js",
|
|
8
|
+
"require": "./index.cjs"
|
|
9
|
+
},
|
|
10
|
+
"files": ["index.js", "index.cjs"],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"lint": "eslint *.js *.mjs *.cjs",
|
|
13
|
+
"test": "node --test ./test.js",
|
|
14
|
+
"test-require": "node ./test-require.cjs",
|
|
15
|
+
"test-coverage": "node --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=lcov.info ./test.js",
|
|
16
|
+
"test-coverage-as-html": "npm run test-coverage && genhtml lcov.info -o coverage/"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/Rob--W/proxy-from-env.git"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"proxy",
|
|
24
|
+
"http_proxy",
|
|
25
|
+
"https_proxy",
|
|
26
|
+
"no_proxy",
|
|
27
|
+
"environment"
|
|
28
|
+
],
|
|
29
|
+
"author": "Rob Wu <rob@robwu.nl> (https://robwu.nl/)",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/Rob--W/proxy-from-env/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/Rob--W/proxy-from-env#readme",
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"eslint": "^9.39.2"
|
|
37
|
+
},
|
|
38
|
+
"type": "module",
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=10"
|
|
41
|
+
},
|
|
42
|
+
"sideEffects": false
|
|
43
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teammy/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "The centralized Teammy collaboration hub server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,9 +27,11 @@
|
|
|
27
27
|
"@earendil-works/pi-ai": "1.4.0",
|
|
28
28
|
"@earendil-works/pi-coding-agent": "1.4.0",
|
|
29
29
|
"@fastify/static": "^10.1.7",
|
|
30
|
+
"@wecom/aibot-node-sdk": "1.0.7",
|
|
30
31
|
"diff": "8.0.4",
|
|
31
32
|
"fastify": "5.12.7",
|
|
32
33
|
"ignore": "^7.0.8",
|
|
34
|
+
"ws": "8.22.0",
|
|
33
35
|
"zod": "4.6.7"
|
|
34
36
|
}
|
|
35
37
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e,E as t,J as n,O as r,U as ee,W as te,Y as ne,_ as i,a,d as o,i as re,j as s,k as c,l as ie,n as l,r as u,t as ae,v as oe,x as d,y as f}from"./index-BXpTaAUz.js";import{t as p}from"./Markdown-Bq8P_NBV.js";var m=n(),h=c(),g=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),_=e=>e.replace(/[#*_`>]/g,``).replace(/\s+/g,` `).trim();function v({mine:e=!1,author:t,time:n,children:r}){return(0,h.jsx)(`div`,{className:`assistant-bubble-row ${e?`mine`:``}`,children:(0,h.jsxs)(`div`,{className:`assistant-bubble`,children:[(0,h.jsxs)(`div`,{className:`assistant-bubble-meta`,children:[(0,h.jsx)(`span`,{children:t}),(0,h.jsx)(`time`,{dateTime:n,children:g(n)})]}),r]})})}function y({me:n}){let{projectId:c,request:y}=ie(),x=r(),S=e(c,n,`assistant-selection`),C=e(c,n,`assistant-drafts`),se=(0,m.useCallback)(e=>y(`agents/outbox`,re,{signal:e}),[y]),w=t(se,3e3,e(c,n,`outbox`)),ce=(0,m.useCallback)(e=>y(`agents/chats`,ae,{signal:e}),[y]),T=t(ce,3e3,e(c,n,`chats`)),[E,le]=(0,m.useState)(()=>{let e=new URLSearchParams(location.search).get(`chat`);return e?`chat:${e}`:x?.get(S)??``}),D=E.startsWith(`chat:`)?E.slice(5):``,O=!E||!!D,[k,A]=(0,m.useState)(()=>x?.get(e(c,n,`chat`,D))),j=k?.id===D?k:x?.get(e(c,n,`chat`,D)),ue=T.data?.chats.find(e=>e.id===D),[de,M]=(0,m.useState)(),[N,fe]=(0,m.useState)(()=>x?.get(C)??{}),P=N[E]??``,F=e=>fe(t=>({...t,[E]:e})),[I,L]=(0,m.useState)(!1),[R,z]=(0,m.useState)(!1),[pe,B]=(0,m.useState)(``),[V,H]=(0,m.useState)(``),U=(0,m.useRef)(null),W=(0,m.useRef)(!0),G=(0,m.useRef)(E);G.current=E,(0,m.useEffect)(()=>{k&&x?.set(e(c,n,`chat`,k.id),k)},[x,c,n,k]),(0,m.useEffect)(()=>{x?.set(C,N)},[x,C,N]);function K(e){G.current=e,le(e),x?.set(S,e);let t=new URL(location.href);e.startsWith(`chat:`)?t.searchParams.set(`chat`,e.slice(5)):t.searchParams.delete(`chat`),history.replaceState(history.state,``,t)}(0,m.useEffect)(()=>{!E&&T.data?.chats.length&&K(`chat:${T.data.chats[0].id}`)},[E,T.data]);let q=(w.data?.messages??[]).filter(e=>e.box===`debug`).reverse(),J=w.data?.messages.find(e=>e.id===(E===`debug`?de:E)),Y=q.filter(e=>!e.readAt).map(e=>e.id).join(`,`);(0,m.useEffect)(()=>{E===`debug`&&Y&&Promise.all(Y.split(`,`).map(e=>y(`agents/outbox/${e}/read`,a,{method:`POST`}))).then(()=>{window.dispatchEvent(new Event(`teammy:outbox`)),w.reload()}).catch(e=>B(s(e)))},[E,Y,y,w.reload]),(0,m.useEffect)(()=>{if(H(``),!D)return;let e=!0,t=new EventSource(ne(`/api/v1/projects/${encodeURIComponent(c)}/agents/chats/${encodeURIComponent(D)}/events`));t.addEventListener(`snapshot`,t=>{if(e)try{A(l.parse(JSON.parse(t.data))),H(``)}catch(e){H(s(e))}}),t.onerror=()=>{e&&H(`对话连接中断,正在重新连接…`)},t.addEventListener(`run`,t=>{if(!e)return;let n=u.parse(JSON.parse(t.data));A(e=>e&&{...e,runs:e.runs.some(e=>e.id===n.id)?e.runs:[...e.runs,n]})});for(let n of[`delta`,`reset`,`state`])t.addEventListener(n,t=>{if(!e)return;let r=JSON.parse(t.data);A(e=>e&&{...e,runs:e.runs.map(e=>e.id===r.id?{...e,answer:n===`delta`?e.answer+(r.text??``):n===`reset`?``:r.answer??e.answer,state:r.state??e.state,error:r.error===void 0?e.error:r.error}:e)})});return()=>{e=!1,t.close()}},[c,D]),(0,m.useEffect)(()=>{W.current&&U.current?.scrollIntoView({block:`end`})},[E,k?.runs,J?.recipients,q.length]);function X(){window.dispatchEvent(new Event(`teammy:outbox`)),w.reload()}async function Z(e){if(W.current=!0,K(e),B(``),M(void 0),!(e.startsWith(`chat:`)||e===`debug`))try{await y(`agents/outbox/${e}/read`,a,{method:`POST`}),X()}catch(e){B(s(e))}}async function me(){if(!R){z(!0),B(``);try{let e=await y(`agents/chats`,l,{method:`POST`});A(e),await Z(`chat:${e.id}`),T.reload()}catch(e){B(s(e))}finally{z(!1)}}}async function he(e){e.preventDefault();let t=P.trim();if(t&&!I){L(!0),B(``);try{if(O){let e=D;if(!e){let t=await y(`agents/chats`,l,{method:`POST`});e=t.id,G.current===E&&(A(t),K(`chat:${e}`))}let n=await y(`agents/chats/${e}`,u,{method:`POST`,body:{text:t}});A(t=>t?.id===e?{...t,runs:t.runs.some(e=>e.id===n.id)?t.runs:[...t.runs,n]}:t),T.reload()}else await y(`agents/outbox/${J.id}/reply`,te({taskId:ee()}),{method:`POST`,body:{body:t}}),X(),M(void 0);F(``)}catch(e){B(s(e))}finally{L(!1)}}}let Q=O||!!J&&!J.archivedAt&&!J.recipients.find(e=>e.userId===n)?.reply,$=O&&!j&&(!!D||!T.data);return(0,h.jsxs)(`div`,{className:`split-layout assistant-layout`,"data-testid":`assistant-page`,children:[(0,h.jsxs)(`aside`,{className:`assistant-list`,"aria-label":`消息列表`,children:[(0,h.jsxs)(`header`,{className:`assistant-list-heading`,children:[(0,h.jsx)(`h1`,{children:`消息`}),(0,h.jsx)(oe,{className:`assistant-new-chat`,icon:`plus`,label:`新建对话`,disabled:R,onClick:()=>void me(),"data-testid":`assistant-launcher`})]}),(0,h.jsxs)(`div`,{className:`assistant-message-scroll`,children:[T.loading&&!T.data&&(0,h.jsx)(`p`,{className:`assistant-list-status`,role:`status`,children:`加载中…`}),T.data?.chats.map(e=>(0,h.jsxs)(`button`,{type:`button`,"data-testid":`assistant-chat-${e.id}`,className:`assistant-message-item assistant-chat-item ${D===e.id?`selected`:``}`,"aria-pressed":D===e.id,onClick:()=>void Z(`chat:${e.id}`),children:[(0,h.jsx)(`span`,{className:`assistant-message-dot ${e.state===`running`||e.state===`queued`?`unread`:``}`}),(0,h.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,h.jsx)(o,{selected:D===e.id,children:(0,h.jsx)(`strong`,{children:e.title})}),(0,h.jsxs)(`time`,{dateTime:e.updatedAt,children:[new Date(e.updatedAt).toLocaleDateString([],{month:`numeric`,day:`numeric`}),` `,g(e.updatedAt)]})]})]},e.id)),!!q.length&&(0,h.jsxs)(`button`,{type:`button`,"data-testid":`debug-outbox`,className:`assistant-message-item ${E===`debug`?`selected`:``}`,onClick:()=>void Z(`debug`),children:[(0,h.jsx)(`span`,{className:`assistant-message-dot ${Y?`unread`:``}`}),(0,h.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,h.jsx)(o,{selected:E===`debug`,children:(0,h.jsx)(`strong`,{children:`运行提醒`})}),(0,h.jsx)(`span`,{children:_(q.at(-1).body)})]})]}),w.data?.messages.filter(e=>e.box!==`debug`).sort((e,t)=>Number(!!e.archivedAt)-Number(!!t.archivedAt)).map(e=>(0,h.jsxs)(`button`,{type:`button`,"data-testid":`outbox-${e.id}`,className:`assistant-message-item ${e.archivedAt?`archived`:``} ${E===e.id?`selected`:``}`,onClick:()=>void Z(e.id),children:[(0,h.jsx)(`span`,{className:`assistant-message-dot ${e.readAt?``:`unread`}`}),(0,h.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,h.jsx)(o,{selected:E===e.id,children:(0,h.jsx)(`strong`,{children:_(e.body)})}),(0,h.jsxs)(`time`,{dateTime:e.createdAt,children:[new Date(e.createdAt).toLocaleDateString([],{month:`numeric`,day:`numeric`}),` `,g(e.createdAt)]})]})]},e.id))]}),(0,h.jsx)(d,{error:!0,children:w.error||T.error})]}),(0,h.jsxs)(`section`,{className:`assistant-thread`,"aria-label":O?`提百事对话`:`消息内容`,children:[(0,h.jsx)(`header`,{className:`assistant-thread-heading`,children:(0,h.jsx)(`h2`,{children:O?ue?.title??(D?`无标题`:`提百事`):E===`debug`?`运行提醒`:`项目消息`})}),(0,h.jsxs)(`div`,{className:`assistant-transcript`,role:`log`,"aria-live":`polite`,"data-testid":`assistant-transcript`,onScroll:e=>{let t=e.currentTarget;W.current=t.scrollHeight-t.scrollTop-t.clientHeight<100},children:[O?$?(0,h.jsxs)(`div`,{className:`assistant-empty`,"data-testid":`assistant-loading`,children:[(0,h.jsx)(f,{}),(0,h.jsx)(`p`,{role:`status`,children:V||T.error?`暂时无法加载对话`:`加载中…`})]}):j?.runs.length?j.runs.map(e=>(0,h.jsxs)(`div`,{className:`assistant-turn`,children:[(0,h.jsx)(v,{mine:!0,author:n,time:e.createdAt,children:(0,h.jsx)(`div`,{className:`markdown`,children:(0,h.jsx)(p,{children:e.text})})}),(0,h.jsxs)(v,{author:`提百事`,time:e.createdAt,children:[e.answer&&(0,h.jsx)(`div`,{className:`markdown`,children:(0,h.jsx)(p,{children:e.answer})}),[`queued`,`running`].includes(e.state)&&(0,h.jsxs)(`span`,{className:`assistant-typing`,"aria-label":`正在回答`,children:[(0,h.jsx)(`i`,{}),(0,h.jsx)(`i`,{}),(0,h.jsx)(`i`,{})]}),e.state===`failed`&&(0,h.jsx)(d,{error:!0,children:e.error||`本次回答未完成。`})]})]},e.id)):(0,h.jsxs)(`div`,{className:`assistant-empty`,children:[(0,h.jsx)(f,{}),(0,h.jsx)(`p`,{children:`有什么项目问题想聊聊?`})]}):!w.data&&w.loading?(0,h.jsx)(`div`,{className:`assistant-empty`,children:(0,h.jsx)(`p`,{role:`status`,children:`加载中…`})}):E===`debug`?q.map(e=>(0,h.jsx)(b,{item:e,me:n,onReply:!e.archivedAt&&!e.recipients.find(e=>e.userId===n)?.reply?()=>{M(e.id),F(``),B(``)}:void 0},e.id)):J&&(0,h.jsx)(b,{item:J,me:n}),(0,h.jsx)(`div`,{ref:U})]}),(0,h.jsx)(d,{error:!0,children:pe||(O?V:``)}),Q&&!O&&(0,h.jsx)(`p`,{className:`assistant-reply-hint`,id:`assistant-reply-hint`,children:E===`debug`?`回复运行提醒:${_(J.body).split(`诊断码`)[0]}。发送后将作为新的后台输入。`:`回应「提百事」的问题。注意:只能发送一条消息,「提百事」收到后会继续工作。如果有新的问题,「提百事」会继续发消息来问你。`}),Q?(0,h.jsxs)(`form`,{className:`assistant-composer`,onSubmit:e=>void he(e),children:[(0,h.jsx)(`textarea`,{value:P,onChange:e=>F(e.target.value),"aria-label":O?`向提百事提问`:`回复消息`,"aria-describedby":O?void 0:`assistant-reply-hint`,placeholder:O?`问问提百事…`:`回复…`,rows:2,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,h.jsx)(`button`,{className:`primary assistant-send`,type:`submit`,disabled:I||$||!P.trim(),"aria-label":`发送`,children:(0,h.jsx)(i,{name:`send`})})]}):E!==`debug`&&J&&(0,h.jsxs)(`div`,{className:`assistant-archived`,children:[(0,h.jsx)(i,{name:`archive`}),`已归档`]})]})]})}function b({item:e,me:t,onReply:n}){return(0,h.jsxs)(`div`,{"data-testid":`outbox-thread-${e.id}`,children:[(0,h.jsxs)(v,{author:e.box===`debug`?`运行提醒`:`提百事`,time:e.createdAt,children:[(0,h.jsx)(`div`,{className:`markdown`,children:(0,h.jsx)(p,{children:e.body})}),n&&(0,h.jsx)(`button`,{type:`button`,className:`assistant-debug-reply`,onClick:n,children:`回复`})]}),[...e.recipients].filter(e=>e.reply).sort((e,t)=>e.reply.createdAt.localeCompare(t.reply.createdAt)).map(e=>(0,h.jsx)(v,{mine:e.userId===t,author:e.userId,time:e.reply.createdAt,children:(0,h.jsx)(`div`,{className:`markdown`,children:(0,h.jsx)(p,{children:e.reply.body})})},e.userId))]})}export{y as Assistant};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e,E as t,J as n,S as r,T as i,Y as a,_ as o,b as s,f as c,g as l,j as u,k as d,l as f,m as p,p as m,v as h,w as g,x as _}from"./index-BXpTaAUz.js";import{t as v}from"./project-links-XbF78Bal.js";import"./file-links-CFCIacLV.js";var y=n(),b=d(),x=[{status:`planned`,label:`计划`},{status:`in_progress`,label:`进行中`},{status:`in_review`,label:`待验收`},{status:`completed`,label:`已完成`},{status:null,label:`未明确`}];function S({members:n,project:i}){let{request:a,projectId:o}=f(),s=(0,y.useCallback)(e=>a(`tasks`,c,{signal:e}),[a]),l=t(s,3e3,e(o,`tasks`)),[u,d]=(0,y.useState)(),m=l.data,h=new Map(n.map(e=>[e.id,e.displayName||e.id]));return(0,b.jsxs)(`div`,{className:`task-board`,children:[(0,b.jsx)(r,{title:i?.projectName.trim()?`${i.projectName.trim()}|工作看板`:`工作看板`,description:i?.description.trim()||``}),(0,b.jsx)(_,{error:!0,children:l.error}),(0,b.jsx)(`section`,{className:`task-board-lanes`,"aria-label":`任务进度`,"data-testid":`progress-board`,children:x.filter(e=>e.status!==null||m?.tasks.some(e=>e.status===null)).map(e=>{let t=m?.tasks.filter(t=>t.status===e.status)??[];return(0,b.jsxs)(`section`,{className:`task-lane`,"aria-label":e.label,"data-stage":e.status??`unknown`,children:[(0,b.jsxs)(`h2`,{children:[(0,b.jsx)(`span`,{className:`lane-dot`}),e.label,(0,b.jsx)(p,{children:m?t.length:`—`})]}),(0,b.jsx)(`div`,{className:`task-lane-content`,children:t.length?t.map(e=>(0,b.jsx)(C,{task:e,names:h,onEdit:()=>d(e),onSaved:()=>void l.reload()},e.id)):(0,b.jsx)(`p`,{className:`task-lane-empty`,children:l.error&&!m?`读取失败`:m?`暂无任务`:`读取中…`})})]},e.label)})}),u&&(0,b.jsx)(T,{task:u,onClose:()=>d(void 0),onSaved:()=>{d(void 0),l.reload()}},u.id)]})}function C({task:e,names:t,onEdit:n,onSaved:r}){let{projectId:s,request:c}=f(),l=i(),[d,p]=(0,y.useState)(!1),[x,S]=(0,y.useState)(``);async function C(){if(!d){p(!0),S(``);try{await c(`tasks/${e.id}/correction`,m,{method:`PATCH`,signal:l,body:{needsConfirmation:!1}}),l.aborted||r()}catch(e){l.aborted||S(u(e))}finally{p(!1)}}}return(0,b.jsxs)(`details`,{className:`task-card`,"data-testid":`task-card`,"data-task-id":e.id,"data-owner":e.owner,"data-status":e.status??`unknown`,children:[(0,b.jsxs)(`summary`,{className:`task-card-heading`,"data-testid":`task-toggle`,children:[(0,b.jsx)(`h3`,{children:e.title}),(0,b.jsxs)(`span`,{className:`task-card-meta`,children:[(0,b.jsx)(`small`,{children:t.get(e.owner)??e.owner}),e.needsConfirmation&&(0,b.jsxs)(`span`,{className:`task-confirmation`,"data-testid":`task-confirmation`,children:[(0,b.jsx)(o,{name:`attention`,size:`small`}),`需要确认`]})]})]}),(0,b.jsx)(h,{icon:`edit`,className:`task-card-edit`,label:`纠正任务:${e.title}`,"data-testid":`task-correct`,disabled:d,onClick:n}),(0,b.jsxs)(`div`,{className:`task-card-details`,children:[e.corrected&&!e.needsConfirmation&&(0,b.jsx)(`small`,{children:`已确认`}),e.needsReview&&(0,b.jsx)(`p`,{children:`本次整理未能明确对应,请核对来源。`}),(0,b.jsx)(`h4`,{children:`目标`}),(0,b.jsx)(`p`,{children:e.goal?(0,b.jsx)(w,{value:e.goal,names:t}):`目标未明确`}),(0,b.jsx)(`h4`,{children:`当前进展`}),(0,b.jsx)(`p`,{className:`task-progress`,children:(0,b.jsx)(w,{value:e.progress,names:t})}),(0,b.jsx)(`div`,{className:`task-card-sources`,children:e.sources.map(t=>(0,b.jsxs)(`a`,{"data-testid":`task-source`,href:a(v(s,e.owner,t.path)),children:[(0,b.jsx)(o,{name:`file`,size:`small`}),(0,b.jsx)(`span`,{children:t.path})]},t.path))}),e.syncedAt&&(0,b.jsxs)(`small`,{children:[`资料同步于 `,(0,b.jsx)(g,{value:e.syncedAt})]}),e.needsConfirmation&&(0,b.jsxs)(`div`,{className:`task-card-confirm`,children:[(0,b.jsx)(_,{error:!0,children:x}),(0,b.jsx)(`button`,{className:`primary`,"data-testid":`task-confirm-save`,disabled:d,onClick:()=>void C(),children:d?`正在保存…`:`保存`})]})]})]})}function w({value:e,names:t}){return e.split(/(@[a-z][a-z0-9_-]*)/gi).map((e,n)=>e.startsWith(`@`)&&t.has(e.slice(1))?(0,b.jsx)(`mark`,{className:`task-mention`,children:e},n):e)}function T({task:e,onClose:t,onSaved:n}){let{request:r}=f(),a=i(),[o,c]=(0,y.useState)(e.title),[d,p]=(0,y.useState)(e.status??``),[h,g]=(0,y.useState)(e.goal??``),[v,S]=(0,y.useState)(e.progress),[C,w]=(0,y.useState)(!1),[T,E]=(0,y.useState)(``),D={...o===e.title?{}:{title:o},...d===(e.status??``)?{}:{status:d||null},...h===(e.goal??``)?{}:{goal:h||null},...v===e.progress?{}:{progress:v},...e.needsConfirmation?{needsConfirmation:!1}:{}};async function O(t=!1){if(!(C||!t&&!Object.keys(D).length)){w(!0),E(``);try{await r(`tasks/${e.id}/correction`,m,{method:t?`DELETE`:`PATCH`,signal:a,...t?{}:{body:D}}),a.aborted||n()}catch(e){a.aborted||E(u(e))}finally{w(!1)}}}return(0,b.jsx)(s,{id:`task-correction`,title:`纠正任务`,onClose:t,children:(0,b.jsxs)(`form`,{className:`stack`,"aria-busy":C,onSubmit:e=>{e.preventDefault(),O()},children:[(0,b.jsx)(l,{id:`task-title`,label:`标题`,children:(0,b.jsx)(`input`,{value:o,required:!0,onChange:e=>c(e.target.value)})}),(0,b.jsxs)(`fieldset`,{className:`task-status-field`,disabled:C,children:[(0,b.jsx)(`legend`,{children:`状态`}),(0,b.jsx)(`div`,{className:`task-status-options`,"data-testid":`task-status`,children:x.filter(e=>e.status!==null).map(e=>(0,b.jsxs)(`label`,{className:`task-status-choice`,children:[(0,b.jsx)(`input`,{type:`radio`,name:`task-status`,value:e.status,checked:d===e.status,onChange:()=>p(e.status)}),(0,b.jsx)(`span`,{children:e.label})]},e.status))})]}),(0,b.jsx)(l,{id:`task-goal`,label:`目标`,children:(0,b.jsx)(`textarea`,{value:h,onChange:e=>g(e.target.value)})}),(0,b.jsx)(l,{id:`task-progress`,label:`当前进展`,children:(0,b.jsx)(`textarea`,{value:v,onChange:e=>S(e.target.value)})}),(0,b.jsx)(_,{error:!0,children:T}),(0,b.jsxs)(`div`,{className:`row wrap`,children:[(0,b.jsx)(`button`,{type:`submit`,className:`primary`,disabled:C||!Object.keys(D).length,"data-testid":`task-correction-save`,children:`保存`}),e.corrected&&(0,b.jsx)(`button`,{type:`button`,disabled:C,"data-testid":`task-correction-reset`,onClick:()=>void O(!0),children:`恢复自动结果`})]})]})})}function E({members:e,config:t}){return(0,b.jsx)(S,{members:e,project:t})}export{E as Dashboard};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,C as t,D as n,E as r,F as i,J as a,N as o,Y as s,_ as c,c as l,h as u,k as d,l as f,o as p,s as m,v as h,x as g}from"./index-BXpTaAUz.js";import{t as _}from"./Markdown-Bq8P_NBV.js";import{t as v}from"./project-links-XbF78Bal.js";import{t as y}from"./file-links-CFCIacLV.js";import{n as b,t as x}from"./WorkspaceTree-CD94JsaJ.js";var S=a(),C=d();function w(e,t){let n=t.split(`/`).slice(0,-1);return n.map((t,r)=>b(e,n.slice(0,r+1).join(`/`))).concat(b(e,``))}function T({members:t,me:n,onRefresh:a}){let{api:c,projectId:d}=f(),[_,T]=(0,S.useState)(()=>{let e=new URLSearchParams(location.search),n=e.get(`owner`),r=i.safeParse(e.get(`path`));return n&&(n===`_project`||t.some(e=>e.id===n))&&r.success&&!m(r.data)?{owner:n,path:r.data}:void 0}),[D,O]=(0,S.useState)(()=>new Set(_?w(_.owner,_.path):[b(n,``)])),[k,A]=(0,S.useState)(()=>_?{..._,kind:`file`}:void 0),[j,M]=(0,S.useState)(0),[N,P]=(0,S.useState)(()=>{let e=new URLSearchParams(location.search);return!_&&(e.has(`owner`)||e.has(`path`))?`文件链接不完整或目标已不可用。`:``}),F=(0,S.useCallback)(async t=>{if(_)try{return{owner:_.owner,...await c.file(_.owner,_.path,void 0,t)}}catch(t){throw t instanceof e&&t.code===`FILE_NOT_FOUND`?Error(`找不到这个文件,可能已被删除或移动。`):t}},[_?.owner,_?.path,j]),I=r(F),L=I.data?.owner===_?.owner&&I.data?.file.path===_?.path?I.data:void 0;function R(e,t){let n=t.split(`/`).filter(Boolean);O(t=>{let r=new Set(t);for(let t=0;t<=n.length;t++)r.add(b(e,n.slice(0,t).join(`/`)));return r})}function z(e,t){P(``),R(e,t.split(`/`).slice(0,-1).join(`/`)),T({owner:e,path:t}),A({owner:e,path:t,kind:`file`}),history.replaceState(null,``,s(v(d,e,t)))}function B(e){if(!_)return!1;let n=y(_.owner===`_project`?_.path:`${_.owner}/${_.path}`,e);if(!n)return!/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(`//`)&&(P(`该链接超出工作区,请在原仓库查看。`),!0);if(m(n.path))return P(`配置文件不在文件浏览中显示。`),!0;let[r,...i]=n.path.split(`/`),a=t.some(e=>e.id===r),o=a?r:p,s=a?i.join(`/`):n.path;return P(``),n.directory?(R(o,s),A({owner:o,path:s,kind:`directory`})):o===_.owner&&s===_.path?n.anchor&&[...document.querySelectorAll(`.markdown h1,.markdown h2,.markdown h3,.markdown h4`)].find(e=>e.textContent?.trim().toLowerCase().replace(/\s+/g,`-`)===n.anchor.toLowerCase())?.scrollIntoView({block:`center`}):z(o,s),!0}return(0,C.jsxs)(`div`,{className:`split-layout file-explorer`,"data-testid":`file-browser`,children:[(0,C.jsxs)(`aside`,{className:`file-tree-pane`,"aria-label":`文件资源管理器`,children:[(0,C.jsx)(l,{title:`文件`,icon:`files`,children:(0,C.jsx)(h,{icon:`refresh`,label:`刷新文件`,"data-testid":`files-refresh`,onClick:()=>{P(``),M(e=>e+1),a()}})}),(0,C.jsx)(x,{members:t,expanded:D,selected:k,revealed:!I.loading&&!I.error&&L?{owner:L.owner,path:L.file.path,file:L.file}:void 0,onSelect:z,onToggle:(e,t)=>{A({owner:e,path:t,kind:`directory`}),O(n=>{let r=new Set(n),i=b(e,t);return r.has(i)?r.delete(i):r.add(i),r})}},j)]}),(0,C.jsx)(`section`,{className:`file-detail`,"data-testid":`file-preview`,"data-owner-id":_?.owner,"data-file-path":_?.path,"aria-label":o.filePreview,children:_?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(g,{error:!0,children:N||!I.loading&&I.error}),I.error&&(0,C.jsx)(`button`,{className:`file-entry-retry`,"data-testid":`files-retry`,onClick:()=>void I.reload(),children:o.retry}),I.loading?(0,C.jsx)(`p`,{className:`preview-body`,role:`status`,children:o.loading}):!I.error&&L&&(0,C.jsx)(E,{owner:L.owner,file:L.file,onLink:B},`${L.owner}:${L.file.path}:${L.file.sha256}`)]}):N?(0,C.jsx)(g,{error:!0,children:N}):(0,C.jsx)(u,{mascot:!0,title:`从一份资料开始`,description:o.pickFile})})]})}function E({owner:e,file:i,onLink:a}){let{readTextBlob:s,blobUrl:l,projectId:u}=f(),[d,p]=(0,S.useState)(!1),m=i.size>524288,v=/\.(md|markdown)$/i.test(i.path),y=(0,S.useCallback)(e=>m?Promise.resolve(void 0):s(i,e),[i.sha256,i.size,m]),b=r(y,!1,n(u,`file-body`,i.sha256));return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`header`,{className:`file-detail-header`,children:[(0,C.jsxs)(`span`,{className:`file-detail-path`,title:`${e===`_project`?`workspaces`:e}/${i.path}`,children:[(0,C.jsxs)(`span`,{children:[e===`_project`?`workspaces`:e,` / `]}),i.path]}),(0,C.jsxs)(t,{label:`文件操作`,children:[v&&(0,C.jsx)(h,{icon:d?`preview`:`code`,label:d?`切换为预览`:`切换为原文`,"data-testid":`file-toggle-raw`,"aria-pressed":d,onClick:()=>p(!d)}),(0,C.jsx)(`a`,{className:`icon-button`,"data-testid":`file-download`,"aria-label":o.download,title:o.download,href:l(i.sha256),download:i.path.split(`/`).at(-1),children:(0,C.jsx)(c,{name:`download`})})]})]}),m?(0,C.jsx)(`div`,{className:`empty`,children:(0,C.jsx)(`p`,{children:o.previewLarge})}):b.error?(0,C.jsxs)(`div`,{className:`preview-body`,children:[(0,C.jsx)(g,{error:!0,children:b.error}),(0,C.jsx)(`button`,{"data-testid":`file-preview-retry`,onClick:()=>void b.reload(),children:o.retry})]}):b.loading?(0,C.jsx)(`p`,{className:`preview-body`,role:`status`,children:o.loading}):(0,C.jsx)(`div`,{className:`preview-body`,children:v&&!d?(0,C.jsx)(`article`,{className:`markdown`,"data-testid":`file-content`,"data-format":`markdown`,children:(0,C.jsx)(_,{onLink:a,children:b.data??``})}):(0,C.jsx)(`pre`,{className:`raw`,"data-testid":`file-content`,"data-format":`text`,children:b.data})})]})}export{T as Files};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,B as t,D as n,E as r,G as i,H as a,I as o,J as s,K as c,L as l,M as u,N as d,P as f,R as p,T as m,U as h,V as g,W as _,Y as v,_ as y,c as b,h as x,j as S,k as C,l as w,q as T,u as E,v as D,w as O,x as k,z as A}from"./index-BXpTaAUz.js";import{n as j,r as M,t as N}from"./Markdown-Bq8P_NBV.js";import{n as P}from"./project-links-XbF78Bal.js";import{i as F,r as I}from"./WorkspaceTree-CD94JsaJ.js";var L=s(),R=A([`overview`,`handoff`]),z=_({title:i().trim().min(1),summary:i().trim().min(1)}).strict(),B=_({markdown:i().trim().min(1)}).strict(),V=z.extend({sourceRevision:l,sourceHash:o,generatedAt:i(),stale:g()}),H=_({kind:R,status:A([`absent`,`queued`,`running`,`succeeded`,`failed`]),available:g(),currentRevision:l,sourceRevision:l.nullable(),stale:g(),result:c([z,B]).nullable(),generatedAt:i().nullable(),error:i().nullable()}),U=A([`claude-code`,`codex`,`cursor`,`pi`,`dsh`]),W=_({formatVersion:a(1),adapterVersion:a(1),agent:U,nativeId:i().min(1).max(512),cwd:i().min(1).max(4096),messages:t(_({id:i().min(1).max(1024),role:A([`user`,`assistant`]),text:i().min(1),source:i().min(1).max(1024)}).strict())}).strict().refine(e=>new Set(e.messages.map(e=>e.id)).size===e.messages.length,`Duplicate message IDs.`);_({operationId:T(),sessionKey:o,parentRevision:l,blob:f}).strict();var G=_({owner:p,sessionKey:o,agent:U,nativeId:i(),cwd:i(),title:i(),revision:l,updatedAt:i(),messageCount:h().int().nonnegative(),blob:f,overview:V.optional()}),K=_({sessions:t(G),nextCursor:l.nullable()}),q=_({totalSessions:h().int().nonnegative(),totalMessages:h().int().nonnegative(),memberCount:h().int().nonnegative(),updatedAt:i().nullable()});_({owner:p.optional(),sessionKey:o.optional()}).strict().refine(e=>!e.sessionKey||!!e.owner,`A session scope requires an owner.`);var J=_({matches:t(_({owner:p,sessionKey:o,revision:l,messageId:i(),role:A([`user`,`assistant`]),snippet:i(),title:i()})),nextCursor:l.nullable()}),Y=_({owner:p,key:o,revision:l.refine(e=>e>0).optional(),messageId:i().min(1).optional()});function X(e){let t=new URLSearchParams(e);if(![`owner`,`sessionKey`,`revision`,`messageId`].some(e=>t.has(e)))return{};let n=Y.safeParse({owner:t.get(`owner`),key:t.get(`sessionKey`),...t.has(`revision`)?{revision:Number(t.get(`revision`))}:{},...t.has(`messageId`)?{messageId:t.get(`messageId`)}:{}});return n.success?{target:n.data}:{error:`对话链接不完整或已损坏。`}}var Z=C();function Q({members:e,refresh:t,selected:n,onOwner:r,onSession:i}){let[a,o]=(0,L.useState)(()=>new Set(n?.key?[n.owner]:[])),[s,c]=(0,L.useState)(e[0]?.id??``);return(0,Z.jsx)(`div`,{role:`tree`,"aria-label":`成员对话`,"data-testid":`session-tree`,onKeyDown:I,children:[...e].sort((e,t)=>F(e.displayName,t.displayName)||F(e.id,t.id)).map(e=>(0,Z.jsxs)(`div`,{role:`none`,children:[(0,Z.jsxs)(E,{type:`button`,role:`treeitem`,"aria-level":1,"aria-expanded":a.has(e.id),"aria-selected":n?.owner===e.id&&!n.key,className:`tree-item tree-folder`,style:{"--tree-level":1},tabIndex:s===e.id?0:-1,"data-testid":`session-owner`,"data-owner-id":e.id,onFocus:()=>c(e.id),onClick:()=>{o(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),r(e.id)},leading:(0,Z.jsx)(`span`,{className:`tree-chevron ${a.has(e.id)?`expanded`:``}`,children:(0,Z.jsx)(y,{name:`chevron`,size:`small`})}),children:[(0,Z.jsx)(y,{name:`files`}),(0,Z.jsx)(`span`,{className:`tree-name`,title:e.id,children:e.displayName})]}),a.has(e.id)&&(0,Z.jsx)($,{owner:e.id,selected:n,onSession:i,focused:s,onFocus:c},`${e.id}/${t}`)]},e.id))})}function $({owner:e,selected:t,onSession:i,focused:a,onFocus:o}){let{request:s,projectId:c}=w(),l=(0,L.useCallback)(t=>s(`sessions?${new URLSearchParams({owner:e,limit:`50`,order:`updated`})}`,K,{signal:t}),[e,s]),d=r(l,15e3,n(c,`session-tree`,e)),[f,p]=(0,L.useState)(),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(``),v=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>v.current?.abort(),[]);let b=f?f.nextCursor:d.data?.nextCursor;return(0,Z.jsxs)(`div`,{role:`group`,"aria-busy":d.loading||m,children:[(0,Z.jsx)(k,{error:!0,children:d.error||g}),d.error&&(0,Z.jsx)(`button`,{onClick:()=>void d.reload(),children:`重试`}),d.loading&&!d.data&&(0,Z.jsx)(`span`,{className:`tree-status`,role:`status`,children:`正在加载…`}),[...new Map([...f?.sessions??[],...d.data?.sessions??[]].map(e=>[e.sessionKey,e])).values()].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)||e.sessionKey.localeCompare(t.sessionKey)).map(n=>(0,Z.jsxs)(E,{type:`button`,role:`treeitem`,"aria-level":2,"aria-selected":t?.owner===e&&t.key===n.sessionKey,className:`tree-item`,style:{"--tree-level":2},tabIndex:a===`${e}/${n.sessionKey}`?0:-1,"data-testid":`session-row`,"data-owner-id":e,"data-session-key":n.sessionKey,title:u(n.title||n.nativeId),onFocus:()=>o(`${e}/${n.sessionKey}`),onClick:()=>i({owner:e,key:n.sessionKey,title:n.title||n.nativeId}),leading:(0,Z.jsx)(`span`,{className:`tree-chevron`}),children:[(0,Z.jsx)(y,{name:`sessions`}),(0,Z.jsx)(`span`,{className:`tree-name`,children:u(n.title||n.nativeId)})]},n.sessionKey)),b!=null&&(0,Z.jsx)(`button`,{className:`tree-action`,"data-testid":`session-tree-more`,disabled:m,onClick:async()=>{h(!0),_(``);let t=new AbortController;v.current=t;try{let n=await s(`sessions?${new URLSearchParams({owner:e,after:String(b),limit:`50`,order:`updated`})}`,K,{signal:t.signal});p(e=>({sessions:[...e?.sessions??[],...n.sessions],nextCursor:n.nextCursor}))}catch(e){t.signal.aborted||_(S(e))}finally{t.signal.aborted||h(!1)}},children:`加载更多`})]})}function ee({info:e}){let[t,n]=(0,L.useState)(!1);return(0,Z.jsxs)(`details`,{className:`session-handoff`,onToggle:e=>n(e.currentTarget.open),children:[(0,Z.jsx)(`summary`,{children:`交接说明`}),t&&(0,Z.jsx)(te,{info:e})]})}function te({info:e}){let{request:t}=w(),n=`sessions/${encodeURIComponent(e.owner)}/${e.sessionKey}`,i=(0,L.useCallback)(e=>t(`${n}/analysis/handoff`,H,{signal:e}),[t,n]),a=r(i,5e3),o=m(),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(``),d=a.data,f=s||d?.status===`queued`||d?.status===`running`,p=d?.result&&`markdown`in d.result?d.result.markdown:void 0;return(0,Z.jsxs)(`div`,{className:`stack`,"data-testid":`session-handoff`,children:[(0,Z.jsx)(k,{error:!0,children:l||a.error}),d&&(0,Z.jsxs)(`div`,{className:`inline-actions`,children:[(!p||d.stale)&&(0,Z.jsx)(`button`,{"data-testid":`session-handoff-generate`,disabled:f||!d.available,onClick:async()=>{c(!0),u(``);try{await t(`${n}/handoff`,H,{method:`POST`,signal:o}),await a.reload()}catch(e){o.aborted||u(S(e))}finally{o.aborted||c(!1)}},children:f?`正在整理…`:d.status===`failed`?`重新生成`:p?`更新交接说明`:`生成交接说明`}),!d.available&&(0,Z.jsx)(`small`,{children:`请先配置项目模型接入点`}),d.status===`failed`&&(0,Z.jsx)(`small`,{children:`整理未完成,可重试`}),d.stale&&(0,Z.jsx)(`small`,{children:`对话已有新内容`}),d.currentRevision!==e.revision&&(0,Z.jsx)(`small`,{children:`交接说明使用最新对话;当前阅读的是历史原文`})]}),p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`small`,{children:[`基于版本 `,d.sourceRevision,` · `,(0,Z.jsx)(O,{value:d.generatedAt})]}),(0,Z.jsx)(`div`,{className:`markdown`,"data-testid":`session-handoff-body`,children:(0,Z.jsx)(N,{children:p})})]})]})}function ne({members:e}){let{request:t,projectId:i}=w(),a=(0,L.useCallback)(e=>t(`sessions/stats`,q,{signal:e}),[t]),o=r(a,!0,n(i,`session-stats`)),[s,c]=(0,L.useState)(``),[l,f]=(0,L.useState)(``),[p,m]=(0,L.useState)(0),[h]=(0,L.useState)(()=>X(location.search)),[g,_]=(0,L.useState)(h.target),[y,S]=(0,L.useState)(h.target),[C,T]=(0,L.useState)(h.error??``),[E,O]=(0,L.useState)(``),A=(0,L.useRef)(null),j=g?.key?g.title?`搜索对话:${u(g.title)}`:`搜索当前对话`:g?`搜索:${e.find(e=>e.id===g.owner)?.displayName??g.owner} 的对话内容`:``,M=()=>{_(void 0),O(``),N(),A.current?.focus()};function N(){if(!y?.messageId)return;let{messageId:e,...t}=y;S(t),history.replaceState(null,``,v(P(i,t.owner,t.key,t)))}let F=(0,L.useCallback)(e=>{_(t=>t?.owner===e.owner&&t.key===e.sessionKey&&t.title!==e.title?{...t,title:e.title}:t)},[]);(0,L.useEffect)(()=>{let e=()=>{let e=X(location.search);S(e.target),_(e.target),T(e.error??``),f(``),c(``),O(``)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let I=(e,t=``)=>{S(e),_(e),f(``),O(t),T(``),history.replaceState(null,``,v(P(i,e.owner,e.key,e)))};return(0,Z.jsxs)(`div`,{className:`split-layout file-explorer session-explorer`,children:[(0,Z.jsxs)(`section`,{className:`file-tree-pane`,"aria-label":`${d.sessions}目录`,children:[(0,Z.jsx)(b,{title:d.sessions,icon:`sessions`,count:(0,Z.jsx)(`span`,{"data-testid":`session-total`,children:o.data?.totalSessions??`—`}),children:(0,Z.jsx)(D,{icon:`refresh`,label:`刷新${d.sessions}`,"data-testid":`sessions-refresh`,disabled:o.loading,onClick:()=>{o.reload(),m(e=>e+1)}})}),(0,Z.jsx)(k,{error:!0,children:o.error}),(0,Z.jsx)(Q,{members:e,refresh:p,selected:g,onOwner:e=>{_({owner:e}),S(void 0),f(``),O(``),T(``),history.replaceState(null,``,v(`/projects/${encodeURIComponent(i)}/sessions`))},onSession:I})]}),(0,Z.jsxs)(`section`,{className:`session-reader`,"aria-label":`对话内容与搜索`,children:[(0,Z.jsx)(`div`,{className:`session-reader-content`,children:C?(0,Z.jsx)(k,{error:!0,children:C}):l?(0,Z.jsx)(re,{query:l,refresh:p,scope:{...g?{owner:g.owner}:{},...g?.key?{sessionKey:g.key}:{}},onSelect:e=>I(e,l)},`${l}/${g?.owner??``}/${g?.key??``}`):y?(0,Z.jsx)(ie,{selection:y,highlight:E,onLoaded:F,onLatest:()=>I({owner:y.owner,key:y.key})},`${y.owner}/${y.key}/${y.revision}/${p}`):(0,Z.jsx)(x,{mascot:!0,title:`选择对话开始阅读`,description:`也可以在下方搜索对话内容。`})}),(0,Z.jsxs)(`form`,{className:`session-search-dock`,"data-testid":`session-search-form`,onSubmit:e=>{e.preventDefault(),f(s.trim()),O(``),T(``),m(e=>e+1)},children:[g&&(0,Z.jsxs)(`button`,{type:`button`,className:`search-scope-chip`,"data-testid":`session-search-scope`,title:`清除搜索范围`,"aria-label":`清除范围:${j}`,onClick:M,children:[(0,Z.jsx)(`span`,{className:`scope-label`,children:j}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`×`})]}),(0,Z.jsxs)(`div`,{className:`session-search-input-row`,children:[(0,Z.jsx)(`input`,{ref:A,"aria-label":`搜索对话`,"data-testid":`session-query`,value:s,maxLength:500,placeholder:`搜索对话内容`,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Backspace`&&!s&&g&&(e.preventDefault(),M())}}),(l||s||E)&&(0,Z.jsx)(D,{icon:`close`,label:`清空搜索`,"data-testid":`session-search-clear`,onClick:()=>{c(``),f(``),O(``),N(),A.current?.focus()}}),(0,Z.jsx)(D,{icon:`search`,type:`submit`,label:`搜索`,"data-testid":`session-search`,disabled:!s.trim()})]})]})]})]})}function re({query:e,refresh:t,scope:n,onSelect:i}){let{request:a}=w(),[o,s]=(0,L.useState)(0),c=(0,L.useCallback)(t=>a(`sessions/search?${new URLSearchParams({q:e,after:String(o),limit:`30`,order:`updated`,...n.owner?{owner:n.owner}:{},...n.sessionKey?{sessionKey:n.sessionKey}:{}})}`,J,{signal:t}),[a,e,o,t,n.owner,n.sessionKey]),l=r(c);return(0,Z.jsxs)(`section`,{className:`session-results stack`,"aria-label":`搜索结果`,"aria-busy":l.loading,children:[(0,Z.jsx)(k,{error:!0,children:l.error}),l.error&&(0,Z.jsx)(`button`,{onClick:()=>void l.reload(),children:`重试`}),l.loading&&(0,Z.jsx)(`p`,{role:`status`,children:`正在搜索…`}),!l.loading&&l.data?.matches.map(t=>(0,Z.jsxs)(`button`,{className:`session-item`,"data-testid":`session-match`,"data-message-id":t.messageId,onClick:()=>i({owner:t.owner,key:t.sessionKey,revision:t.revision,messageId:t.messageId,title:t.title}),children:[(0,Z.jsx)(`strong`,{children:u(t.title)}),(0,Z.jsxs)(`small`,{children:[t.owner,` · `,t.role===`user`?`用户`:`助手`]}),(0,Z.jsx)(`span`,{className:`session-excerpt`,children:(0,Z.jsx)(j,{value:M(t.snippet,e),query:e})})]},`${t.owner}:${t.sessionKey}:${t.revision}:${t.messageId}`)),!l.loading&&l.data?.matches.length===0&&(0,Z.jsx)(`p`,{className:`empty`,children:`没有找到匹配的对话`}),l.data?.nextCursor!=null&&(0,Z.jsx)(`button`,{"data-testid":`sessions-next`,disabled:l.loading,onClick:()=>s(l.data.nextCursor),children:`下一页`}),o>0&&(0,Z.jsx)(`button`,{disabled:l.loading,onClick:()=>s(0),children:`返回第一页`})]})}function ie({selection:t,highlight:n,onLoaded:i,onLatest:a}){let{request:o}=w(),s=(0,L.useCallback)(async n=>{try{return await o(`sessions/${encodeURIComponent(t.owner)}/${t.key}${t.revision===void 0?``:`?revision=${t.revision}`}`,G,{signal:n})}catch(t){throw t instanceof e&&t.code===`SESSION_NOT_FOUND`?Error(`找不到这条对话或引用的版本,原链接可能已失效。`):t}},[o,t.owner,t.key,t.revision]),c=r(s,5e3);return(0,L.useEffect)(()=>{c.data&&i(c.data)},[c.data,i]),(0,Z.jsxs)(`section`,{className:`session-conversation stack`,"data-testid":`session-detail`,children:[(0,Z.jsx)(k,{error:!0,children:c.error}),c.error&&(0,Z.jsx)(`button`,{onClick:()=>void c.reload(),children:`重试`}),c.loading&&!c.data&&(0,Z.jsx)(`p`,{role:`status`,children:`正在读取对话…`}),c.data&&(0,Z.jsx)(ae,{info:c.data,messageId:t.messageId,highlight:n,pinned:t.revision!==void 0,onLatest:a},c.data.blob.sha256)]})}function ae({info:e,messageId:t,highlight:n,pinned:i,onLatest:a}){let{readTextBlob:o,projectId:s}=w(),c=(0,L.useCallback)(async t=>W.parse(JSON.parse(await o(e.blob,t))),[e.blob.sha256,e.blob.size]),l=r(c),d=(0,L.useRef)(null);return(0,L.useEffect)(()=>{l.data&&t&&d.current?.scrollIntoView({block:`center`})},[l.data,t]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`header`,{className:`conversation-header`,children:[(0,Z.jsx)(`h2`,{className:`session-title`,children:u(e.title||e.nativeId)}),(0,Z.jsxs)(`p`,{children:[e.owner,` · `,e.agent,` · `,e.messageCount,` 条消息`]}),(0,Z.jsxs)(`small`,{children:[(0,Z.jsx)(O,{value:e.updatedAt}),i&&(0,Z.jsxs)(Z.Fragment,{children:[` `,`· 引用版本 `,e.revision,` ·`,` `,(0,Z.jsx)(`a`,{href:v(P(s,e.owner,e.sessionKey)),onClick:e=>{e.preventDefault(),a()},children:`查看最新`})]})]}),e.overview&&(0,Z.jsx)(`p`,{"data-testid":`session-summary`,children:e.overview.summary}),e.overview?.stale&&(0,Z.jsx)(`small`,{children:`摘要待更新`})]}),(0,Z.jsx)(ee,{info:e}),(0,Z.jsx)(k,{error:!0,children:l.error}),l.error&&(0,Z.jsx)(`button`,{onClick:()=>void l.reload(),children:`重新读取`}),l.loading&&(0,Z.jsx)(`p`,{role:`status`,children:`正在读取对话…`}),l.data&&(0,Z.jsxs)(Z.Fragment,{children:[t&&!l.data.messages.some(e=>e.id===t)&&(0,Z.jsx)(k,{children:`该版本中找不到引用的消息,已打开对话原文。`}),(0,Z.jsx)(`div`,{className:`session-messages`,children:l.data.messages.map(e=>(0,Z.jsxs)(`article`,{className:`session-message ${e.role} ${e.id===t?`matched`:``}`,"data-testid":`session-message`,"data-message-id":e.id,ref:e.id===t?d:void 0,children:[(0,Z.jsx)(`div`,{className:`message-role`,children:e.role===`user`?`用户`:`助手`}),(0,Z.jsx)(`div`,{className:`markdown`,children:(0,Z.jsx)(N,{highlight:n,children:e.text})})]},e.id))})]})]})}export{ne as Sessions};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e,E as t,J as n,_ as r,j as i,k as a,l as o,o as s,s as c,u as l,x as u}from"./index-BXpTaAUz.js";var d=n(),f=new Intl.Collator(`zh-CN`,{numeric:!0,sensitivity:`base`});function p(e,t){return f.compare(e,t)||(e<t?-1:+(e>t))}var m=a();function h(e){let t=e.target.closest(`[role="treeitem"]`);if(!t)return;let n=[...e.currentTarget.querySelectorAll(`[role="treeitem"]`)],r=n.indexOf(t),i=Number(t.getAttribute(`aria-level`)),a;switch(e.key){case`ArrowDown`:a=n[r+1];break;case`ArrowUp`:a=n[r-1];break;case`Home`:a=n[0];break;case`End`:a=n.at(-1);break;case`ArrowRight`:t.getAttribute(`aria-expanded`)===`false`?t.click():Number(n[r+1]?.getAttribute(`aria-level`))>i&&(a=n[r+1]);break;case`ArrowLeft`:t.getAttribute(`aria-expanded`)===`true`?t.click():a=n.slice(0,r).reverse().find(e=>Number(e.getAttribute(`aria-level`))<i);break;default:return}e.preventDefault(),a?.focus()}var g=(e,t)=>`${e}/${t}`,_=e=>({"--tree-level":e});function v({members:e,...t}){let[n,r]=(0,d.useState)(`folder:${g(e[0]?.id??``,``)}`);return(0,m.jsx)(`div`,{role:`tree`,"aria-label":`工作区文件`,"data-testid":`workspace-tree`,onKeyDown:h,children:(0,m.jsx)(b,{owner:s,path:``,level:1,members:e,context:{...t,focused:n,onFocus:r}})})}function y({owner:e,path:t,level:n,context:i}){let a=i.expanded.has(g(e,t)),o=`folder:${g(e,t)}`;return(0,m.jsxs)(`div`,{role:`none`,children:[(0,m.jsxs)(l,{type:`button`,role:`treeitem`,className:`tree-item tree-folder`,style:_(n),"aria-label":t||e,"aria-level":n,"aria-expanded":a,"aria-selected":i.selected?.kind===`directory`&&i.selected.owner===e&&i.selected.path===t,tabIndex:i.focused===o?0:-1,"data-testid":`directory-row`,"data-owner-id":e,"data-directory-path":t,onFocus:()=>i.onFocus(o),onClick:()=>i.onToggle(e,t),leading:(0,m.jsx)(`span`,{className:`tree-chevron ${a?`expanded`:``}`,children:(0,m.jsx)(r,{name:`chevron`,size:`small`})}),children:[(0,m.jsx)(r,{name:`files`}),(0,m.jsx)(`span`,{className:`tree-name`,children:t.split(`/`).at(-1)||e})]}),a&&(0,m.jsx)(b,{owner:e,path:t,level:n+1,context:i})]})}function b({owner:n,path:a,level:s,context:f,members:h=[]}){let{api:v,projectId:b}=o(),x=(0,d.useCallback)(e=>v.tree(n,a,void 0,``,e),[n,a]),S=t(x,!1,e(b,`file-tree`,n,a)),[C,w]=(0,d.useState)(),[T,E]=(0,d.useState)(!1),[D,O]=(0,d.useState)(``),k=(0,d.useRef)(null);(0,d.useEffect)(()=>()=>k.current?.abort(),[]);let A=C?.revision===S.data?.revision?C:void 0,j=A?A.nextCursor:S.data?.nextCursor;async function M(){if(!j||!S.data||T)return;E(!0),O(``);let e=new AbortController;k.current=e;try{let t=await v.tree(n,a,S.data.revision,j,e.signal);e.signal.aborted||w({...t,entries:[...A?.entries??[],...t.entries]})}catch(t){e.signal.aborted||O(i(t))}finally{e.signal.aborted||E(!1)}}let N=[...(S.data?.entries??[]).filter(e=>!c(e.path)),...(A?.entries??[]).filter(e=>!c(e.path))],P=f.revealed;if(P?.owner===n&&!c(P.path)&&(!a||P.path.startsWith(a+`/`))){let e=a?P.path.slice(a.length+1):P.path,t=e.indexOf(`/`),n=t<0?P.path:[a,e.slice(0,t)].filter(Boolean).join(`/`);N.some(e=>e.path===n)||N.push(t<0?{...P.file,kind:`file`}:{kind:`directory`,path:n})}let F=[...N.map(e=>({...e,owner:n})),...h.map(e=>({kind:`directory`,path:``,owner:e.id}))].sort((e,t)=>e.kind===t.kind?p(e.path.split(`/`).at(-1)||e.owner,t.path.split(`/`).at(-1)||t.owner):e.kind===`directory`?-1:1);return(0,m.jsxs)(`div`,{role:`group`,"aria-label":g(n===`_project`?`workspaces`:n,a),"aria-busy":S.loading||T,children:[S.loading&&(0,m.jsx)(`p`,{className:`tree-status`,role:`status`,children:`正在加载…`}),(0,m.jsx)(u,{error:!0,children:S.error||D}),S.error&&(0,m.jsx)(`button`,{className:`tree-action`,onClick:()=>void S.reload(),children:`重试`}),F.map(e=>e.kind===`directory`?(0,m.jsx)(y,{owner:e.owner,path:e.path,level:s,context:f},g(e.owner,e.path)):(0,m.jsxs)(l,{type:`button`,role:`treeitem`,className:`tree-item`,style:_(s),"aria-label":e.path,"aria-level":s,"aria-selected":f.selected?.kind===`file`&&f.selected.owner===n&&f.selected.path===e.path,tabIndex:f.focused===`file:${g(n,e.path)}`?0:-1,"data-testid":`file-row`,"data-owner-id":n,"data-file-path":e.path,onFocus:()=>f.onFocus(`file:${g(n,e.path)}`),onClick:()=>f.onSelect(n,e.path),leading:(0,m.jsx)(`span`,{className:`tree-chevron`}),children:[(0,m.jsx)(r,{name:`file`}),(0,m.jsx)(`span`,{className:`tree-name`,children:e.path.split(`/`).at(-1)})]},e.path)),j&&(0,m.jsx)(`button`,{className:`tree-action`,"data-testid":`files-load-more`,disabled:T,onClick:()=>void M(),children:T?`正在加载…`:`加载更多`})]})}export{p as i,g as n,h as r,v as t};
|