@yiyi_zhang/laoshi 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/LICENSE +21 -0
- package/README.md +60 -2
- package/SCOPE.md +13 -0
- package/adapters/dsh/adapter.ts +75 -0
- package/adapters/dsh/dsh-runtime.ts +242 -0
- package/adapters/dsh/install.mjs +97 -0
- package/adapters/dsh/intranet/install.mjs +15 -0
- package/adapters/dsh/intranet/make-sample.mjs +52 -0
- package/adapters/dsh/plugin/channel.d.mts +2 -0
- package/adapters/dsh/plugin/channel.mjs +31 -0
- package/adapters/dsh/plugin/index.d.mts +3 -0
- package/adapters/dsh/plugin/index.mjs +292 -0
- package/adapters/dsh/plugin/package.json +18 -0
- package/adapters/paseo/adapter.ts +96 -0
- package/adapters/paseo/daemon-check.ts +80 -0
- package/adapters/paseo/daemon-version.ts +64 -0
- package/adapters/paseo/doctor.ts +161 -0
- package/adapters/paseo/install.mjs +30 -0
- package/adapters/paseo/paseo-json.ts +73 -0
- package/adapters/paseo/paseo-profiles.ts +127 -0
- package/adapters/paseo/paseo-runtime.ts +507 -0
- package/adapters/paseo/settings.ts +22 -0
- package/adapters/paseo/skill/setup.md +26 -0
- package/adapters/paseo/skill/templates/copy-local-files.mjs +32 -0
- package/adapters/paseo/skill/templates/with-port.mjs +36 -0
- package/adapters/paseo/smoke-test.ts +203 -0
- package/bin/bootstrap.mjs +170 -0
- package/bin/install.mjs +245 -0
- package/bin/locate.mjs +22 -0
- package/bin/req-docs.d.mts +5 -0
- package/bin/req-docs.mjs +167 -0
- package/bin/req-doctor.mjs +21 -0
- package/bin/req.mjs +236 -0
- package/bin/start-pipeline +21 -0
- package/bin/start-pipeline.mjs +22 -0
- package/config.example.json +134 -0
- package/contracts/README.md +21 -0
- package/contracts/agent-runtime.md +83 -0
- package/contracts/cli-json.md +76 -0
- package/contracts/feature-files.md +148 -0
- package/contracts/notifier-event.md +90 -0
- package/contracts/result-file.md +21 -0
- package/contracts/spec.md +37 -0
- package/contracts/state.md +69 -0
- package/contracts/usage-record.md +72 -0
- package/contracts/verify.md +41 -0
- package/docs/adr/0001-new-repo-core-and-adapters.md +20 -0
- package/docs/adr/0002-two-orchestration-modes.md +20 -0
- package/docs/adr/0003-generate-once-then-lock.md +20 -0
- package/docs/adr/0004-external-contracts-stay-stable.md +19 -0
- package/docs/adr/0005-skill-names.md +26 -0
- package/docs/adr/0006-deterministic-engine-platform-capabilities.md +42 -0
- package/docs/adr/0007-one-install-many-repos.md +63 -0
- package/docs/adr/0008-capability-sources-and-platform-plugin.md +81 -0
- package/docs/adr/README.md +14 -0
- package/docs/design/adapter-guide.md +90 -0
- package/docs/design/architecture.md +104 -0
- package/docs/design/builtin-capabilities.md +72 -0
- package/docs/design/compat-migration.md +65 -0
- package/docs/design/dsh-adapter.md +145 -0
- package/docs/design/in-chat-orchestration.md +67 -0
- package/docs/design/init-bootstrap.md +83 -0
- package/docs/design/internal-platform-adapter.md +76 -0
- package/docs/design/platform-discovery.md +117 -0
- package/docs/design/platform-vocabulary.md +44 -0
- package/docs/design/state-v2.md +71 -0
- package/docs/guide//344/275/277/347/224/250/350/200/205/346/214/207/345/215/227.md +130 -0
- package/docs/guide//345/256/211/350/243/205/344/270/216/345/215/207/347/272/247.md +211 -0
- package/docs/guide//347/273/264/346/212/244/350/200/205/346/214/207/345/215/227.md +86 -0
- package/docs/guide//351/241/271/347/233/256/345/256/232/345/210/266/344/270/216/350/277/220/350/241/214/350/247/204/345/210/231.md +595 -0
- package/docs/intranet/install-verify.md +278 -0
- package/engine/prompts/00-shared-context.md +107 -0
- package/engine/prompts/02-spec-review.md +46 -0
- package/engine/prompts/03-design.md +77 -0
- package/engine/prompts/03a-design-proposal.md +30 -0
- package/engine/prompts/04-design-review.md +73 -0
- package/engine/prompts/04b-design-revise.md +56 -0
- package/engine/prompts/05-implement.md +72 -0
- package/engine/prompts/06-code-review.md +81 -0
- package/engine/prompts/07-review-fix.md +41 -0
- package/engine/prompts/07b-handoff.md +45 -0
- package/engine/prompts/08-service-start.md +59 -0
- package/engine/prompts/09-verify.md +90 -0
- package/engine/prompts/10-defect-fix.md +41 -0
- package/engine/prompts/10b-reverify.md +43 -0
- package/engine/prompts/11-report.md +112 -0
- package/engine/prompts/browser-verify.md +14 -0
- package/engine/prompts/incremental.md +24 -0
- package/engine/prompts/joint.md +55 -0
- package/engine/prompts/managed-services.md +9 -0
- package/engine/prompts/panel-member.md +38 -0
- package/engine/prompts/related-repos.md +7 -0
- package/engine/prompts/review-axis-spec.md +10 -0
- package/engine/prompts/review-axis-standards.md +11 -0
- package/engine/prompts/types/assessment.md +41 -0
- package/engine/prompts/types/defect.md +55 -0
- package/engine/prompts/types/refactor.md +39 -0
- package/engine/prompts/ui-check.md +15 -0
- package/engine/prompts/verify-deployed.md +14 -0
- package/engine/skill-fragments/setup-builtin.md +24 -0
- package/engine/src/activity.ts +131 -0
- package/engine/src/api.ts +655 -0
- package/engine/src/builtin/index.ts +30 -0
- package/engine/src/builtin/project-services.ts +66 -0
- package/engine/src/builtin/service-runner.mjs +35 -0
- package/engine/src/builtin/services.ts +264 -0
- package/engine/src/builtin/setup-runner.mjs +26 -0
- package/engine/src/builtin/workspace.ts +139 -0
- package/engine/src/card-cmd.ts +505 -0
- package/engine/src/card.ts +541 -0
- package/engine/src/checklist-cmd.ts +37 -0
- package/engine/src/checklist.ts +254 -0
- package/engine/src/cli-args.ts +228 -0
- package/engine/src/code-review.ts +421 -0
- package/engine/src/codeowners.ts +87 -0
- package/engine/src/config-view.ts +310 -0
- package/engine/src/config.ts +862 -0
- package/engine/src/configure.ts +343 -0
- package/engine/src/control.ts +257 -0
- package/engine/src/danger-guard.ts +180 -0
- package/engine/src/digest.ts +141 -0
- package/engine/src/doctor.ts +410 -0
- package/engine/src/estimate.ts +95 -0
- package/engine/src/eval.ts +325 -0
- package/engine/src/factory.ts +545 -0
- package/engine/src/features.ts +311 -0
- package/engine/src/gate.ts +157 -0
- package/engine/src/git.ts +30 -0
- package/engine/src/identity.ts +72 -0
- package/engine/src/index-cmd.ts +34 -0
- package/engine/src/integration-cmd.ts +161 -0
- package/engine/src/integrations.ts +485 -0
- package/engine/src/joint.ts +173 -0
- package/engine/src/launch.ts +443 -0
- package/engine/src/lessons.ts +74 -0
- package/engine/src/locations.ts +83 -0
- package/engine/src/main.ts +390 -0
- package/engine/src/messages.ts +472 -0
- package/engine/src/notifiers.ts +114 -0
- package/engine/src/notify-test.ts +108 -0
- package/engine/src/outcomes.ts +145 -0
- package/engine/src/paths.ts +10 -0
- package/engine/src/pipeline.ts +2517 -0
- package/engine/src/platform.ts +121 -0
- package/engine/src/playbooks.ts +46 -0
- package/engine/src/preflight.ts +352 -0
- package/engine/src/prompts.ts +76 -0
- package/engine/src/queue.ts +61 -0
- package/engine/src/records.ts +403 -0
- package/engine/src/reply.ts +81 -0
- package/engine/src/review-assets/app.css +339 -0
- package/engine/src/review-assets/app.html +107 -0
- package/engine/src/review-assets/app.js +958 -0
- package/engine/src/review-assets/check.css +12 -0
- package/engine/src/review-assets/check.html +61 -0
- package/engine/src/review-assets/check.js +341 -0
- package/engine/src/review-assets/code.css +16 -0
- package/engine/src/review-assets/code.html +58 -0
- package/engine/src/review-assets/code.js +497 -0
- package/engine/src/review-assets/rk-icons.js +98 -0
- package/engine/src/review-assets/rk-tokens.css +252 -0
- package/engine/src/review-assets/rk.css +254 -0
- package/engine/src/review.ts +771 -0
- package/engine/src/runtime-loader.ts +110 -0
- package/engine/src/runtime.ts +186 -0
- package/engine/src/scan-guard.ts +132 -0
- package/engine/src/schedule-time.ts +51 -0
- package/engine/src/secret-scan.ts +177 -0
- package/engine/src/semver.ts +31 -0
- package/engine/src/skills-render.ts +104 -0
- package/engine/src/spec-review.ts +99 -0
- package/engine/src/state.ts +506 -0
- package/engine/src/stats.ts +810 -0
- package/engine/src/steps.ts +269 -0
- package/engine/src/try.ts +135 -0
- package/engine/src/ui-check-page.js +208 -0
- package/engine/src/ui-check.ts +366 -0
- package/engine/src/usage.ts +67 -0
- package/engine/src/watchdog.ts +139 -0
- package/engine/src/words.ts +95 -0
- package/engine/src/worktree.ts +227 -0
- package/notifiers/im-template.mjs +86 -0
- package/package.json +78 -4
- package/principles/INDEX.md +11 -0
- package/site-dist/404.html +27 -0
- package/site-dist/assets/app.Df99UgrJ.js +1 -0
- package/site-dist/assets/changelog.md.Df8vFhjK.js +1 -0
- package/site-dist/assets/changelog.md.Df8vFhjK.lean.js +1 -0
- package/site-dist/assets/chunks/@localSearchIndexroot.n-0kN-N0.js +1 -0
- package/site-dist/assets/chunks/VPLocalSearchBox.IEhP6Gw5.js +9 -0
- package/site-dist/assets/chunks/framework.BetZR81g.js +20 -0
- package/site-dist/assets/chunks/theme.DHubfO7g.js +2 -0
- package/site-dist/assets/guide_dsh.md.0X-eYB87.js +5 -0
- package/site-dist/assets/guide_dsh.md.0X-eYB87.lean.js +5 -0
- package/site-dist/assets/guide_getting-started.md.BZTWiHhH.js +1 -0
- package/site-dist/assets/guide_getting-started.md.BZTWiHhH.lean.js +1 -0
- package/site-dist/assets/guide_how-it-works.md.CkvlSgxO.js +25 -0
- package/site-dist/assets/guide_how-it-works.md.CkvlSgxO.lean.js +1 -0
- package/site-dist/assets/guide_index.md.D67QX_Vi.js +1 -0
- package/site-dist/assets/guide_index.md.D67QX_Vi.lean.js +1 -0
- package/site-dist/assets/guide_install.md.D7NiiOPu.js +19 -0
- package/site-dist/assets/guide_install.md.D7NiiOPu.lean.js +19 -0
- package/site-dist/assets/guide_intranet.md.Bz0sAHK0.js +9 -0
- package/site-dist/assets/guide_intranet.md.Bz0sAHK0.lean.js +9 -0
- package/site-dist/assets/guide_maintainer.md.C-Vt-DdK.js +1 -0
- package/site-dist/assets/guide_maintainer.md.C-Vt-DdK.lean.js +1 -0
- package/site-dist/assets/guide_phases.md.Cw0A9Vb1.js +1 -0
- package/site-dist/assets/guide_phases.md.Cw0A9Vb1.lean.js +1 -0
- package/site-dist/assets/guide_project.md.BIcaDhdS.js +77 -0
- package/site-dist/assets/guide_project.md.BIcaDhdS.lean.js +77 -0
- package/site-dist/assets/guide_user.md.B66TQvIA.js +1 -0
- package/site-dist/assets/guide_user.md.B66TQvIA.lean.js +1 -0
- package/site-dist/assets/index.md.CrBM3tiI.js +1 -0
- package/site-dist/assets/index.md.CrBM3tiI.lean.js +1 -0
- package/site-dist/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
- package/site-dist/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
- package/site-dist/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
- package/site-dist/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
- package/site-dist/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
- package/site-dist/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
- package/site-dist/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
- package/site-dist/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
- package/site-dist/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
- package/site-dist/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
- package/site-dist/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
- package/site-dist/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
- package/site-dist/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
- package/site-dist/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
- package/site-dist/assets/reference_adr_0001-new-repo-core-and-adapters.md.CjNHHmrf.js +1 -0
- package/site-dist/assets/reference_adr_0001-new-repo-core-and-adapters.md.CjNHHmrf.lean.js +1 -0
- package/site-dist/assets/reference_adr_0002-two-orchestration-modes.md.CHD05agO.js +1 -0
- package/site-dist/assets/reference_adr_0002-two-orchestration-modes.md.CHD05agO.lean.js +1 -0
- package/site-dist/assets/reference_adr_0003-generate-once-then-lock.md.BaRiZfXT.js +1 -0
- package/site-dist/assets/reference_adr_0003-generate-once-then-lock.md.BaRiZfXT.lean.js +1 -0
- package/site-dist/assets/reference_adr_0004-external-contracts-stay-stable.md.DUJ7CTV1.js +1 -0
- package/site-dist/assets/reference_adr_0004-external-contracts-stay-stable.md.DUJ7CTV1.lean.js +1 -0
- package/site-dist/assets/reference_adr_0005-skill-names.md.DuBVd1tl.js +1 -0
- package/site-dist/assets/reference_adr_0005-skill-names.md.DuBVd1tl.lean.js +1 -0
- package/site-dist/assets/reference_adr_0006-deterministic-engine-platform-capabilities.md.Dcrnx1-L.js +1 -0
- package/site-dist/assets/reference_adr_0006-deterministic-engine-platform-capabilities.md.Dcrnx1-L.lean.js +1 -0
- package/site-dist/assets/reference_adr_0007-one-install-many-repos.md.C78cd4_P.js +1 -0
- package/site-dist/assets/reference_adr_0007-one-install-many-repos.md.C78cd4_P.lean.js +1 -0
- package/site-dist/assets/reference_adr_0008-capability-sources-and-platform-plugin.md.B4vBkIDS.js +1 -0
- package/site-dist/assets/reference_adr_0008-capability-sources-and-platform-plugin.md.B4vBkIDS.lean.js +1 -0
- package/site-dist/assets/reference_adr_index.md.Dx8sPsjs.js +1 -0
- package/site-dist/assets/reference_adr_index.md.Dx8sPsjs.lean.js +1 -0
- package/site-dist/assets/reference_commands.md.BFJRjNju.js +1 -0
- package/site-dist/assets/reference_commands.md.BFJRjNju.lean.js +1 -0
- package/site-dist/assets/reference_config.md.Dt_TJ2y9.js +6 -0
- package/site-dist/assets/reference_config.md.Dt_TJ2y9.lean.js +1 -0
- package/site-dist/assets/reference_contracts_agent-runtime.md.Bu8q-uGl.js +1 -0
- package/site-dist/assets/reference_contracts_agent-runtime.md.Bu8q-uGl.lean.js +1 -0
- package/site-dist/assets/reference_contracts_cli-json.md.Bonk0m6-.js +1 -0
- package/site-dist/assets/reference_contracts_cli-json.md.Bonk0m6-.lean.js +1 -0
- package/site-dist/assets/reference_contracts_feature-files.md.9n332kF_.js +26 -0
- package/site-dist/assets/reference_contracts_feature-files.md.9n332kF_.lean.js +26 -0
- package/site-dist/assets/reference_contracts_index.md.dqNwNs6U.js +1 -0
- package/site-dist/assets/reference_contracts_index.md.dqNwNs6U.lean.js +1 -0
- package/site-dist/assets/reference_contracts_notifier-event.md.D6we9wWS.js +24 -0
- package/site-dist/assets/reference_contracts_notifier-event.md.D6we9wWS.lean.js +24 -0
- package/site-dist/assets/reference_contracts_result-file.md.BmCaSlEu.js +1 -0
- package/site-dist/assets/reference_contracts_result-file.md.BmCaSlEu.lean.js +1 -0
- package/site-dist/assets/reference_contracts_spec.md.CDQYgJz7.js +8 -0
- package/site-dist/assets/reference_contracts_spec.md.CDQYgJz7.lean.js +8 -0
- package/site-dist/assets/reference_contracts_state.md.DVHC4opX.js +1 -0
- package/site-dist/assets/reference_contracts_state.md.DVHC4opX.lean.js +1 -0
- package/site-dist/assets/reference_contracts_usage-record.md.CQI2chqh.js +10 -0
- package/site-dist/assets/reference_contracts_usage-record.md.CQI2chqh.lean.js +10 -0
- package/site-dist/assets/reference_contracts_verify.md.CkJy8LXk.js +29 -0
- package/site-dist/assets/reference_contracts_verify.md.CkJy8LXk.lean.js +29 -0
- package/site-dist/assets/reference_design_adapter-guide.md.BSziZJSM.js +16 -0
- package/site-dist/assets/reference_design_adapter-guide.md.BSziZJSM.lean.js +16 -0
- package/site-dist/assets/reference_design_architecture.md.Bfoc-F2B.js +23 -0
- package/site-dist/assets/reference_design_architecture.md.Bfoc-F2B.lean.js +23 -0
- package/site-dist/assets/reference_design_builtin-capabilities.md.CZYtjo_v.js +7 -0
- package/site-dist/assets/reference_design_builtin-capabilities.md.CZYtjo_v.lean.js +7 -0
- package/site-dist/assets/reference_design_platform-vocabulary.md.xWGv5QO8.js +3 -0
- package/site-dist/assets/reference_design_platform-vocabulary.md.xWGv5QO8.lean.js +3 -0
- package/site-dist/assets/reference_scope.md.aUo6vISB.js +1 -0
- package/site-dist/assets/reference_scope.md.aUo6vISB.lean.js +1 -0
- package/site-dist/assets/style.BX2ZxxqY.css +1 -0
- package/site-dist/changelog.html +30 -0
- package/site-dist/favicon.svg +10 -0
- package/site-dist/guide/dsh.html +34 -0
- package/site-dist/guide/getting-started.html +30 -0
- package/site-dist/guide/how-it-works.html +54 -0
- package/site-dist/guide/index.html +30 -0
- package/site-dist/guide/install.html +48 -0
- package/site-dist/guide/intranet.html +38 -0
- package/site-dist/guide/maintainer.html +30 -0
- package/site-dist/guide/phases.html +30 -0
- package/site-dist/guide/project.html +106 -0
- package/site-dist/guide/user.html +30 -0
- package/site-dist/hashmap.json +1 -0
- package/site-dist/index.html +30 -0
- package/site-dist/logo-light.svg +6 -0
- package/site-dist/logo.svg +6 -0
- package/site-dist/reference/adr/0001-new-repo-core-and-adapters.html +30 -0
- package/site-dist/reference/adr/0002-two-orchestration-modes.html +30 -0
- package/site-dist/reference/adr/0003-generate-once-then-lock.html +30 -0
- package/site-dist/reference/adr/0004-external-contracts-stay-stable.html +30 -0
- package/site-dist/reference/adr/0005-skill-names.html +30 -0
- package/site-dist/reference/adr/0006-deterministic-engine-platform-capabilities.html +30 -0
- package/site-dist/reference/adr/0007-one-install-many-repos.html +30 -0
- package/site-dist/reference/adr/0008-capability-sources-and-platform-plugin.html +30 -0
- package/site-dist/reference/adr/index.html +30 -0
- package/site-dist/reference/commands.html +30 -0
- package/site-dist/reference/config.html +35 -0
- package/site-dist/reference/contracts/agent-runtime.html +30 -0
- package/site-dist/reference/contracts/cli-json.html +30 -0
- package/site-dist/reference/contracts/feature-files.html +55 -0
- package/site-dist/reference/contracts/index.html +30 -0
- package/site-dist/reference/contracts/notifier-event.html +53 -0
- package/site-dist/reference/contracts/result-file.html +30 -0
- package/site-dist/reference/contracts/spec.html +37 -0
- package/site-dist/reference/contracts/state.html +30 -0
- package/site-dist/reference/contracts/usage-record.html +39 -0
- package/site-dist/reference/contracts/verify.html +58 -0
- package/site-dist/reference/design/adapter-guide.html +45 -0
- package/site-dist/reference/design/architecture.html +52 -0
- package/site-dist/reference/design/builtin-capabilities.html +36 -0
- package/site-dist/reference/design/platform-vocabulary.html +32 -0
- package/site-dist/reference/scope.html +30 -0
- package/site-dist/vp-icons.css +1 -0
- package/skills/acceptance-criteria/SKILL.md +61 -0
- package/skills/laoshi/SKILL.md +108 -0
- package/skills/laoshi/playbooks/accept.md +65 -0
- package/skills/laoshi/playbooks/change.md +51 -0
- package/skills/laoshi/playbooks/incident.md +55 -0
- package/skills/laoshi/playbooks/new.md +96 -0
- package/skills/laoshi/playbooks/small.md +48 -0
- package/skills/laoshi/playbooks/status.md +41 -0
- package/skills/laoshi/playbooks/takeover.md +51 -0
- package/skills/laoshi/playbooks/unattended.md +101 -0
- package/skills/laoshi/playbooks/verify.md +57 -0
- package/skills/laoshi-doctor/SKILL.md +36 -0
- package/skills/laoshi-retro/SKILL.md +81 -0
- package/skills/laoshi-setup/SKILL.md +107 -0
- package/skills/laoshi-setup/templates/copy-local-files.mjs +32 -0
- package/skills/principle-delete-before-add/SKILL.md +33 -0
- package/skills/principle-dont-block-on-humans/SKILL.md +35 -0
- package/skills/principle-fix-root-cause/SKILL.md +33 -0
- package/skills/principle-prove-it-works/SKILL.md +33 -0
- package/skills/principle-report-honestly/SKILL.md +33 -0
- package/skills/principle-speak-to-reader/SKILL.md +33 -0
- package/skills/principle-this-requirement-only/SKILL.md +33 -0
- package/skills/requirement-interview/SKILL.md +97 -0
- package/skills/result-report/SKILL.md +34 -0
- package/skills/spec-writing/SKILL.md +58 -0
- package/skills/spec-writing/spec-template.md +109 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
import { dshAdapter } from "../../adapters/dsh/adapter.js";
|
|
5
|
+
import { paseoAdapter } from "../../adapters/paseo/adapter.js";
|
|
6
|
+
import { withBuiltins } from "./builtin/index.js";
|
|
7
|
+
import type { AgentProfile, PipelineConfig } from "./config.js";
|
|
8
|
+
import { describeProfileDefault, type PlatformAdapter, withCapabilities } from "./platform.js";
|
|
9
|
+
import type { AgentRuntime, RuntimeFactory } from "./runtime.js";
|
|
10
|
+
import { BUILTIN_SERVICE_WORDS, NEUTRAL_WORDS, type PlatformWords } from "./words.js";
|
|
11
|
+
import { defaultConfigPath } from "./locations.js";
|
|
12
|
+
|
|
13
|
+
// laoshi: each agent platform has an adapter under adapters/<id>/ (engine/src/platform.ts); the
|
|
14
|
+
// config's platform.adapter picks one. This is the one core file that names the adapters.
|
|
15
|
+
const ADAPTERS: Record<string, PlatformAdapter> = {
|
|
16
|
+
paseo: paseoAdapter,
|
|
17
|
+
dsh: dshAdapter,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const ADAPTER_IDS = Object.keys(ADAPTERS);
|
|
21
|
+
export const DEFAULT_ADAPTER = "paseo";
|
|
22
|
+
|
|
23
|
+
/** The adapter id a config (or a raw config file's contents) names; the default when it names none. */
|
|
24
|
+
export function adapterIdOf(config: unknown): string {
|
|
25
|
+
const platform = (config as { platform?: unknown } | null | undefined)?.platform;
|
|
26
|
+
const id = platform && typeof platform === "object" ? (platform as { adapter?: unknown }).adapter : undefined;
|
|
27
|
+
return typeof id === "string" && id ? id : DEFAULT_ADAPTER;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** The adapter a config names; throws for an unknown one. */
|
|
31
|
+
export function adapterFor(config: unknown): PlatformAdapter {
|
|
32
|
+
const id = adapterIdOf(config);
|
|
33
|
+
const adapter = ADAPTERS[id];
|
|
34
|
+
if (!adapter) throw new Error(`没有名为「${id}」的平台适配器(platform.adapter),可用:${ADAPTER_IDS.join("、")}`);
|
|
35
|
+
return adapter;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The adapter a config file names, read leniently: the default when the file is missing or broken. */
|
|
39
|
+
export function adapterForFile(configPath: string): PlatformAdapter {
|
|
40
|
+
let raw: unknown = null;
|
|
41
|
+
try {
|
|
42
|
+
raw = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
43
|
+
} catch {
|
|
44
|
+
// Missing or not JSON: the config checks report it.
|
|
45
|
+
}
|
|
46
|
+
return ADAPTERS[adapterIdOf(raw)] ?? ADAPTERS[DEFAULT_ADAPTER];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Every adapter's chat environment names, so processes started outside a chat can drop them all. */
|
|
50
|
+
export function originEnvNames(): string[] {
|
|
51
|
+
return [...new Set(Object.values(ADAPTERS).flatMap((a) => [a.originEnv.id, ...(a.originEnv.cwd ? [a.originEnv.cwd] : [])]))];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** The chat this process runs in, from whichever platform's environment is set. */
|
|
55
|
+
export function originFromEnv(env: NodeJS.ProcessEnv = process.env, prefer?: PlatformAdapter): { adapter: string; id: string; cwd: string | null } | null {
|
|
56
|
+
const order = prefer ? [prefer, ...Object.values(ADAPTERS).filter((a) => a !== prefer)] : Object.values(ADAPTERS);
|
|
57
|
+
for (const a of order) {
|
|
58
|
+
const id = env[a.originEnv.id];
|
|
59
|
+
if (id) return { adapter: a.id, id, cwd: (a.originEnv.cwd && env[a.originEnv.cwd]) || null };
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** A copy of the environment without any platform's chat variables. */
|
|
65
|
+
export function scrubOriginEnv(env: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEnv {
|
|
66
|
+
const out = { ...env };
|
|
67
|
+
for (const name of originEnvNames()) delete out[name];
|
|
68
|
+
return out;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Resolve the platform's agent profiles the config refers to (a no-op for platforms without them). */
|
|
72
|
+
export async function resolveProfiles(config: PipelineConfig, runtime: AgentRuntime): Promise<PipelineConfig> {
|
|
73
|
+
const adapter = adapterFor(config);
|
|
74
|
+
return adapter.resolveProfiles ? adapter.resolveProfiles(config, runtime) : config;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The words for messages and prompts (engine/src/words.ts) of a configuration's platform: neutral
|
|
79
|
+
* ones, laoshi's for the capabilities it provides itself, then the adapter's. Without a
|
|
80
|
+
* configuration, the platform the install-level configuration names.
|
|
81
|
+
*/
|
|
82
|
+
export function wordsFor(config?: unknown): PlatformWords {
|
|
83
|
+
const adapter = config === undefined ? adapterForFile(defaultConfigPath()) : (ADAPTERS[adapterIdOf(config)] ?? ADAPTERS[DEFAULT_ADAPTER]);
|
|
84
|
+
const env = [adapter.originEnv.id, ...(adapter.originEnv.cwd ? [adapter.originEnv.cwd] : [])];
|
|
85
|
+
return {
|
|
86
|
+
...NEUTRAL_WORDS,
|
|
87
|
+
...(adapter.capabilities.services === "builtin" ? BUILTIN_SERVICE_WORDS : {}),
|
|
88
|
+
origin: `${adapter.words?.name ?? adapter.displayName} 提供的 ${env.map((e) => `\`${e}\``).join("、")}`,
|
|
89
|
+
...adapter.words,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** One line for an agent's settings, in the terms of the config's platform. */
|
|
94
|
+
export function describeProfile(config: unknown, profile: AgentProfile): string {
|
|
95
|
+
const adapter = ADAPTERS[adapterIdOf(config)];
|
|
96
|
+
return (adapter?.describeProfile ?? describeProfileDefault)(profile);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export async function loadRuntimeFactory(): Promise<RuntimeFactory> {
|
|
100
|
+
// Test hook: run the real orchestration against a scripted fake daemon.
|
|
101
|
+
const fake = process.env.REQ_PIPELINE_FAKE_RUNTIME;
|
|
102
|
+
if (fake) {
|
|
103
|
+
const module = (await import(pathToFileURL(path.resolve(fake)).href)) as { createRuntime: RuntimeFactory };
|
|
104
|
+
return module.createRuntime;
|
|
105
|
+
}
|
|
106
|
+
return async (input) => {
|
|
107
|
+
const adapter = adapterFor(input.config);
|
|
108
|
+
return withCapabilities(withBuiltins(await adapter.createRuntime(input), adapter, { log: input.log }), adapter);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
// The narrow surface the pipeline needs from the agent platform (contracts/agent-runtime.md).
|
|
2
|
+
// Each platform adapter implements it under adapters/<id>/ ;
|
|
3
|
+
// tests swap in a fake through REQ_PIPELINE_FAKE_RUNTIME.
|
|
4
|
+
|
|
5
|
+
export type AgentRole = "builder" | "reviewer";
|
|
6
|
+
|
|
7
|
+
/** An agent profile the platform offers: a named set of launch settings . */
|
|
8
|
+
export interface PlatformProfile {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
provider: string;
|
|
12
|
+
model?: string;
|
|
13
|
+
modeId?: string;
|
|
14
|
+
thinkingOptionId?: string;
|
|
15
|
+
featureValues?: Record<string, unknown>;
|
|
16
|
+
notes?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface PendingPermission {
|
|
20
|
+
id: string;
|
|
21
|
+
title: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface WaitOutcome {
|
|
25
|
+
/** Same values as the SDK's waitForFinish(). */
|
|
26
|
+
status: "idle" | "error" | "permission" | "timeout";
|
|
27
|
+
error: string | null;
|
|
28
|
+
lastMessage: string | null;
|
|
29
|
+
pendingPermissions: PendingPermission[];
|
|
30
|
+
/** Usage the agent reports (its latest snapshot), when the provider reports it. */
|
|
31
|
+
usage?: import("./usage.js").AgentUsage | null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface StepAgent {
|
|
35
|
+
readonly id: string;
|
|
36
|
+
/** Waits for the current turn, at most timeoutMs. Returns early on permission requests. */
|
|
37
|
+
wait(timeoutMs: number): Promise<WaitOutcome>;
|
|
38
|
+
/** Starts a new turn in the same session. Call wait() afterwards. */
|
|
39
|
+
followUp(text: string): Promise<void>;
|
|
40
|
+
archive(): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface StartAgentInput {
|
|
44
|
+
role: AgentRole;
|
|
45
|
+
title: string;
|
|
46
|
+
prompt: string;
|
|
47
|
+
cwd: string;
|
|
48
|
+
labels: Record<string, string>;
|
|
49
|
+
/** Attach the step agent under this chat agent (shows in its Subagents track). */
|
|
50
|
+
parentAgentId: string | null;
|
|
51
|
+
/** Agent settings to launch with (the role's, or a review panel member's), platform agent profiles resolved. */
|
|
52
|
+
profile?: import("./config.js").AgentProfile;
|
|
53
|
+
/** Place the agent in this platform workspace (a worktree created for the requirement); still a subagent of parentAgentId. */
|
|
54
|
+
workspaceId?: string | null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Where platform-managed services live: the chat's workspace, or the requirement's own worktree. */
|
|
58
|
+
export type ServiceTarget = { agentId: string } | { workspaceId: string };
|
|
59
|
+
|
|
60
|
+
export interface WorktreeRequest {
|
|
61
|
+
/** Checkout to cut the worktree from (the chat's directory). */
|
|
62
|
+
sourceRepo: string;
|
|
63
|
+
/** Branch or commit the new branch starts from. */
|
|
64
|
+
baseRef: string;
|
|
65
|
+
branchName: string;
|
|
66
|
+
title: string;
|
|
67
|
+
/** The chat; the platform shows the workspace as created from it. */
|
|
68
|
+
callerAgentId: string | null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** A service the pipeline runs through the platform (supervised, own port per worktree). */
|
|
72
|
+
export interface ManagedService {
|
|
73
|
+
name: string;
|
|
74
|
+
/** Address to use: the platform's proxy URL when there is one, otherwise http://127.0.0.1:<port>. */
|
|
75
|
+
url: string | null;
|
|
76
|
+
port: number | null;
|
|
77
|
+
running: boolean;
|
|
78
|
+
health: "healthy" | "unhealthy" | null;
|
|
79
|
+
exitCode: number | null;
|
|
80
|
+
/** Last lines of the service's terminal, when they could be read. */
|
|
81
|
+
output: string | null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** One subscription window of a provider (the platform's provider usage), e.g. "5 小时" at 92%. */
|
|
85
|
+
export interface ProviderQuota {
|
|
86
|
+
provider: string;
|
|
87
|
+
displayName: string;
|
|
88
|
+
window: string;
|
|
89
|
+
usedPct: number | null;
|
|
90
|
+
resetsAt: string | null;
|
|
91
|
+
tone: "default" | "ok" | "warning" | "danger" | null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** A recent thing an agent did, in plain words, e.g. "运行命令:npm test". */
|
|
95
|
+
export interface ActivityItem {
|
|
96
|
+
at: string;
|
|
97
|
+
text: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface ScheduledMessage {
|
|
101
|
+
agentId: string;
|
|
102
|
+
name: string;
|
|
103
|
+
prompt: string;
|
|
104
|
+
/** One run at this time; or `cron` for a recurring one. */
|
|
105
|
+
at?: Date;
|
|
106
|
+
cron?: string;
|
|
107
|
+
/** Recurring schedules stop by themselves at this time. */
|
|
108
|
+
expiresAt?: Date;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface ScheduledAgent {
|
|
112
|
+
name: string;
|
|
113
|
+
prompt: string;
|
|
114
|
+
cron: string;
|
|
115
|
+
cwd: string;
|
|
116
|
+
profile: import("./config.js").AgentProfile;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface AgentRuntime {
|
|
120
|
+
/**
|
|
121
|
+
* Checks that the chat which launched the pipeline exists and works in `cwd`.
|
|
122
|
+
* Step agents are created under that chat, and the platform gives a subagent its parent's
|
|
123
|
+
* working directory, so the two must match. Throws with a user-facing reason otherwise.
|
|
124
|
+
*/
|
|
125
|
+
verifyOrigin(agentId: string, cwd: string): Promise<void>;
|
|
126
|
+
startAgent(input: StartAgentInput): Promise<StepAgent>;
|
|
127
|
+
/** An agent started earlier (possibly by another pipeline process), to check on, wait for or follow up. */
|
|
128
|
+
attachAgent(agentId: string): StepAgent;
|
|
129
|
+
/**
|
|
130
|
+
* Starts a requirement's own chat (1.10): a top-level agent working in the repository, given
|
|
131
|
+
* `prompt` and not waited for. It is the chat the requirement's pipeline is later launched
|
|
132
|
+
* from. Returns the agent's ID.
|
|
133
|
+
*/
|
|
134
|
+
startSessionAgent(input: { title: string; prompt: string; cwd: string; profile: import("./config.js").AgentProfile; labels: Record<string, string> }): Promise<string>;
|
|
135
|
+
/** Delivers a message into an existing agent's conversation without interrupting it. */
|
|
136
|
+
notifyAgent(agentId: string, text: string): Promise<void>;
|
|
137
|
+
/** Interrupts the agent's current turn and gives it `text` instead (used to stop a step). */
|
|
138
|
+
interruptAgent(agentId: string, text: string): Promise<void>;
|
|
139
|
+
/** The working directory of an agent's session, for laoshi's builtin services of the chat's checkout; null when unknown. */
|
|
140
|
+
agentDirectory?(agentId: string): Promise<string | null>;
|
|
141
|
+
/** The platform's agent profiles ; null when they cannot be read. */
|
|
142
|
+
listProfiles(): Promise<PlatformProfile[] | null>;
|
|
143
|
+
/**
|
|
144
|
+
* Names of the service scripts (the platform's service definitions) of the workspace the chat works in. Null when
|
|
145
|
+
* the platform cannot run them for us: no chat, an older daemon, or no services configured.
|
|
146
|
+
*/
|
|
147
|
+
listServices(target: ServiceTarget): Promise<string[] | null>;
|
|
148
|
+
/** (Re)starts the services so they run the current code, and waits until they are ready or failed. */
|
|
149
|
+
startServices(target: ServiceTarget, names: string[], readyTimeoutMs: number): Promise<ManagedService[]>;
|
|
150
|
+
stopServices(target: ServiceTarget, names: string[]): Promise<void>;
|
|
151
|
+
/** Creates a platform worktree workspace (its setup runs in the background). */
|
|
152
|
+
createWorktree(request: WorktreeRequest): Promise<{ workspaceId: string; directory: string }>;
|
|
153
|
+
/** 1.14: the platform workspace of an existing directory (opened as one if it is not yet). */
|
|
154
|
+
openWorkspace?(directory: string): Promise<{ workspaceId: string }>;
|
|
155
|
+
/** Waits for the workspace's setup; "none" when there is nothing to wait for or it cannot be read. */
|
|
156
|
+
waitForWorkspaceSetup(workspaceId: string, timeoutMs: number): Promise<{ status: "completed" | "failed" | "none" | "timeout"; error: string | null }>;
|
|
157
|
+
/** Subscription windows of the given providers; null when the platform has no usage data. */
|
|
158
|
+
providerQuota(providers: string[]): Promise<ProviderQuota[] | null>;
|
|
159
|
+
/** The agent's latest actions, oldest first; null when they cannot be read. */
|
|
160
|
+
recentActivity(agentId: string, limit: number): Promise<ActivityItem[] | null>;
|
|
161
|
+
/** 1.13: the tool call the agent is running now (the latest one still running), or null. */
|
|
162
|
+
runningTool(agentId: string): Promise<import("./scan-guard.js").RunningTool | null>;
|
|
163
|
+
/** 1.14: the agent's latest tool calls, running or done (for the danger guard); null when they cannot be read. */
|
|
164
|
+
toolCalls?(agentId: string): Promise<import("./danger-guard.js").ToolCall[] | null>;
|
|
165
|
+
/** Which platform tools step agents get (Settings → Agents); null when unknown. */
|
|
166
|
+
capabilities(): Promise<{ platformTools: boolean; browser: boolean } | null>;
|
|
167
|
+
/** 1.12: whether each agent provider is installed and logged in ("ready"); null when the daemon does not say. */
|
|
168
|
+
providerStatus(): Promise<Array<{ provider: string; status: string }> | null>;
|
|
169
|
+
/**
|
|
170
|
+
* A platform schedule that sends `prompt` into an existing agent's conversation (the chat):
|
|
171
|
+
* once at `at`, or on `cron` (5 fields, local time zone). Returns the schedule ID, or
|
|
172
|
+
* null when this platform cannot schedule.
|
|
173
|
+
*/
|
|
174
|
+
scheduleMessage(input: ScheduledMessage): Promise<string | null>;
|
|
175
|
+
/** A platform schedule that starts a fresh agent on `cron` (e.g. to run a command weekly). */
|
|
176
|
+
scheduleNewAgent(input: ScheduledAgent): Promise<string | null>;
|
|
177
|
+
cancelSchedule(id: string): Promise<void>;
|
|
178
|
+
close(): Promise<void>;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface RuntimeFactoryInput {
|
|
182
|
+
config: import("./config.js").PipelineConfig;
|
|
183
|
+
log: (message: string) => void;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export type RuntimeFactory = (input: RuntimeFactoryInput) => Promise<AgentRuntime>;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Stopping commands that search very large directories (1.13): a step agent that looks for a
|
|
2
|
+
// class or a package by searching the whole home directory, the Maven repository (~/.m2), the
|
|
3
|
+
// global node_modules or a drive can sit for many minutes and never finish the step. While a step
|
|
4
|
+
// runs, the pipeline looks at the agent's running tool call about once a minute; a search of such
|
|
5
|
+
// a directory (after a minute) or any search that runs too long is interrupted, and the agent is
|
|
6
|
+
// told how to find what it needs without the scan. A plain check of the command text, no model.
|
|
7
|
+
import os from "node:os";
|
|
8
|
+
|
|
9
|
+
export interface RunningTool {
|
|
10
|
+
/** the platform's tool kind: "shell", "search", … */
|
|
11
|
+
kind: string;
|
|
12
|
+
/** The command (shell) or the pattern (search). */
|
|
13
|
+
text: string;
|
|
14
|
+
/** When the call started (ISO time). */
|
|
15
|
+
startedAt: string;
|
|
16
|
+
/** The tool call's ID, so the same call is interrupted at most once. */
|
|
17
|
+
callId: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ScanGuardSettings {
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
/** A search that runs this long is interrupted wherever it searches. */
|
|
23
|
+
minutes: number;
|
|
24
|
+
/** More directories never to be searched as a whole (e.g. a shared drive). */
|
|
25
|
+
paths: string[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A search of a large directory gets this long before it is interrupted (most are quick to fail or finish). */
|
|
29
|
+
export const BIG_DIR_GRACE_MS = 60_000;
|
|
30
|
+
|
|
31
|
+
/** Commands that walk a directory tree. */
|
|
32
|
+
const SCAN_COMMAND =
|
|
33
|
+
/(^|[\s;&|("'`])(find|fd|locate|mlocate|tree|du|rg|ag|ack|grep\s+(-\w*[rR]\w*|--recursive)|egrep\s+-\w*[rR]|ls\s+(-\w*R\w*)|Get-ChildItem\b[^|;]*-r(ecurse)?\b|gci\b[^|;]*-r(ecurse)?\b|dir\b[^|;]*(\/s\b|-r(ecurse)?\b)|findstr\b[^|;]*\/s\b|where\s+\/r|Select-String\b[^|;]*-Path\b[^|;]*\*\*)(?=$|[\s;&|)"'`])/i;
|
|
34
|
+
|
|
35
|
+
/** Option values that keep a directory out of a search: not what it searches. */
|
|
36
|
+
const EXCLUSIONS = [
|
|
37
|
+
/--exclude(-dir)?(=|\s+)("[^"]*"|'[^']*'|\S+)/gi,
|
|
38
|
+
/(-g|--glob|--iglob)(=|\s+)("![^"]*"|'![^']*'|!\S+)/gi,
|
|
39
|
+
/(-not|!)\s+-(i?path|i?name|wholename)\s+("[^"]*"|'[^']*'|\S+)/gi,
|
|
40
|
+
/-(i?path|i?name|wholename)\s+("[^"]*"|'[^']*'|\S+)\s+-prune/gi,
|
|
41
|
+
/--(ignore-dir|ignore-directory|exclude-from)(=|\s+)("[^"]*"|'[^']*'|\S+)/gi,
|
|
42
|
+
/-Exclude\s+("[^"]*"|'[^']*'|\S+)/gi,
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
const END = String.raw`(?=$|[\s"'*;|&)\]` + "`" + `])`;
|
|
46
|
+
const START = String.raw`(?:^|[\s"'=(\[` + "`" + `])`;
|
|
47
|
+
|
|
48
|
+
const escape = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
49
|
+
const norm = (s: string) => s.replace(/\\/g, "/");
|
|
50
|
+
|
|
51
|
+
interface BigDir {
|
|
52
|
+
re: RegExp;
|
|
53
|
+
label: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function bigDirs(home: string, extra: string[]): BigDir[] {
|
|
57
|
+
const h = escape(norm(home).replace(/\/+$/, ""));
|
|
58
|
+
const homes = String.raw`(?:~|\$HOME|\$\{HOME\}|%USERPROFILE%|\$env:USERPROFILE|\$env:HOME${h ? `|${h}` : ""})`;
|
|
59
|
+
const sub = (p: string) => new RegExp(`${START}(?:${homes}/|[^\\s"']*/)?${p}/?${END}`, "i");
|
|
60
|
+
const list: BigDir[] = [
|
|
61
|
+
{ re: new RegExp(`${START}/${END}`), label: "整个磁盘(/)" },
|
|
62
|
+
{ re: new RegExp(`${START}[a-z]:/?${END}`, "i"), label: "整个磁盘" },
|
|
63
|
+
{ re: new RegExp(`${START}${homes}/?${END}`, "i"), label: "用户目录" },
|
|
64
|
+
{ re: sub(String.raw`\.m2(?:/repository)?`), label: "Maven 本地仓库(.m2)" },
|
|
65
|
+
{ re: sub(String.raw`\.gradle(?:/caches)?`), label: "Gradle 缓存(.gradle)" },
|
|
66
|
+
{ re: sub(String.raw`\.ivy2`), label: "Ivy 缓存(.ivy2)" },
|
|
67
|
+
{ re: sub(String.raw`(?:\.npm|\.pnpm-store|\.yarn|AppData/Local/(?:npm-cache|pnpm|Yarn))`), label: "npm/pnpm/yarn 缓存" },
|
|
68
|
+
{ re: sub(String.raw`(?:\.nvm|\.volta|\.fnm|AppData/Roaming/nvm)`), label: "Node.js 版本目录" },
|
|
69
|
+
{ re: sub(String.raw`\.cache`), label: "缓存目录(.cache)" },
|
|
70
|
+
{ re: sub(String.raw`(?:\.cargo|go/pkg/mod|\.rustup)`), label: "Rust/Go 依赖缓存" },
|
|
71
|
+
{ re: sub(String.raw`AppData(?:/Roaming|/Local)?`), label: "AppData" },
|
|
72
|
+
{ re: sub(String.raw`(?:usr/(?:local/)?lib/node_modules|AppData/Roaming/npm(?:/node_modules)?)`), label: "全局 node_modules" },
|
|
73
|
+
{ re: /npm\s+root\s+-g|pnpm\s+root\s+-g/i, label: "全局 node_modules" },
|
|
74
|
+
{ re: sub("node_modules"), label: "node_modules" },
|
|
75
|
+
{ re: new RegExp(`${START}(?:[a-z]:)?/(?:usr(?:/lib|/share|/local)?|opt|var|Library|Program Files(?: \\(x86\\))?|Windows)/?${END}`, "i"), label: "系统目录" },
|
|
76
|
+
{ re: sub(String.raw`site-packages`), label: "Python 依赖目录(site-packages)" },
|
|
77
|
+
];
|
|
78
|
+
for (const p of extra) {
|
|
79
|
+
const n = escape(norm(p).replace(/\/+$/, ""));
|
|
80
|
+
if (n) list.push({ re: new RegExp(`${START}${n}/?${END}`, "i"), label: p });
|
|
81
|
+
}
|
|
82
|
+
return list;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** The large directory a command searches as a whole, or null. */
|
|
86
|
+
export function bigDirOf(command: string, options: { home?: string; paths?: string[] } = {}): string | null {
|
|
87
|
+
if (!SCAN_COMMAND.test(command)) return null;
|
|
88
|
+
let text = command;
|
|
89
|
+
for (const re of EXCLUSIONS) text = text.replace(re, " ");
|
|
90
|
+
text = norm(text);
|
|
91
|
+
for (const d of bigDirs(options.home ?? os.homedir(), options.paths ?? [])) if (d.re.test(text)) return d.label;
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function isScan(tool: Pick<RunningTool, "kind" | "text">): boolean {
|
|
96
|
+
return tool.kind === "search" || (tool.kind === "shell" && SCAN_COMMAND.test(tool.text));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface ScanVerdict {
|
|
100
|
+
/** Why: the large directory, or how long the search has run. */
|
|
101
|
+
reason: string;
|
|
102
|
+
/** What the agent is told (the interrupt message). */
|
|
103
|
+
message: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const clip = (s: string, n = 160) => {
|
|
107
|
+
const one = s.replace(/\s+/g, " ").trim();
|
|
108
|
+
return one.length > n ? `${one.slice(0, n - 1)}…` : one;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** Whether the running tool call should be interrupted, and what to tell the agent. */
|
|
112
|
+
export function judge(tool: RunningTool | null, settings: ScanGuardSettings, now = new Date(), home = os.homedir()): ScanVerdict | null {
|
|
113
|
+
if (!tool || !settings.enabled) return null;
|
|
114
|
+
const ran = now.getTime() - new Date(tool.startedAt).getTime();
|
|
115
|
+
if (!(ran >= 0)) return null;
|
|
116
|
+
const big = tool.kind === "shell" ? bigDirOf(tool.text, { home, paths: settings.paths }) : null;
|
|
117
|
+
let reason: string | null = null;
|
|
118
|
+
if (big && ran >= BIG_DIR_GRACE_MS) reason = `在搜索${big}`;
|
|
119
|
+
else if (isScan(tool) && ran >= settings.minutes * 60_000) reason = `搜索已经运行了 ${Math.round(ran / 60_000)} 分钟`;
|
|
120
|
+
if (!reason) return null;
|
|
121
|
+
return { reason, message: scanMessage(tool.text, reason) };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function scanMessage(command: string, reason: string): string {
|
|
125
|
+
return [
|
|
126
|
+
`【流水线提示】已停止你刚才的${command ? `命令「${clip(command)}」` : "搜索"}:它${reason},这类搜索要很久,会让这一步一直做不完。请继续完成本步骤的任务,但不要再搜索整个磁盘、用户目录或依赖缓存,改用下面的办法:`,
|
|
127
|
+
"- 在仓库里找:用 `git grep -n <内容>` 或 `git ls-files | grep <文件名>`;用 rg 时只在仓库目录里搜,它会跳过 .gitignore 里的目录。",
|
|
128
|
+
"- 找某个 Maven/Gradle 依赖里的类:先在 pom.xml / build.gradle 里确定 groupId、artifactId 和版本,直接打开 `~/.m2/repository/<groupId 的点换成 />/<artifactId>/<版本>/` 这一个目录,用 `unzip -l <jar> | grep <类名>` 或 `jar tf` 看那一个 jar;要源码时用 `mvn dependency:sources -DincludeArtifactIds=<artifactId>`。不知道是哪个依赖时,`mvn dependency:tree` 比搜索快。",
|
|
129
|
+
"- 找某个 npm 包:直接看仓库里的 `node_modules/<包名>/package.json`,以及其中 main、types 指向的文件;不要搜索整个 node_modules 或全局 node_modules。",
|
|
130
|
+
"- 实在找不到就不要再找了:按项目代码和文档里能确认的信息继续,把不确定的地方写进本步骤产物的\"假设\"一节。",
|
|
131
|
+
].join("\n");
|
|
132
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Times for platform schedules: parsing what people type ("22:00", "明天 8:30", "+2h")
|
|
2
|
+
// and turning a moment into a one-shot cron expression in the local time zone.
|
|
3
|
+
|
|
4
|
+
export function localTimeZone(): string {
|
|
5
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** "M H D Mon *" for one moment (the schedule is limited to one run). */
|
|
9
|
+
export function cronAt(at: Date): string {
|
|
10
|
+
return `${at.getMinutes()} ${at.getHours()} ${at.getDate()} ${at.getMonth() + 1} *`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Every N minutes, as cron: minutes under an hour, otherwise whole hours. */
|
|
14
|
+
export function cronEvery(minutes: number): string {
|
|
15
|
+
if (minutes < 60) return `*/${Math.max(5, Math.round(minutes))} * * * *`;
|
|
16
|
+
return `0 */${Math.min(23, Math.max(1, Math.round(minutes / 60)))} * * *`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Accepts "22:00" (today, or tomorrow when already past), "明天 8:30" / "tomorrow 8:30",
|
|
21
|
+
* "2026-10-14 08:30", "+90m", "+2h". Returns null when it cannot be read.
|
|
22
|
+
*/
|
|
23
|
+
export function parseStartTime(text: string, now = new Date()): Date | null {
|
|
24
|
+
const t = text.trim();
|
|
25
|
+
const rel = /^\+\s*(\d+(?:\.\d+)?)\s*(m|min|分钟|h|小时)$/i.exec(t);
|
|
26
|
+
if (rel) {
|
|
27
|
+
const n = Number(rel[1]);
|
|
28
|
+
const minutes = /^(m|min|分钟)$/i.test(rel[2]) ? n : n * 60;
|
|
29
|
+
return new Date(now.getTime() + Math.round(minutes * 60_000));
|
|
30
|
+
}
|
|
31
|
+
const full = /^(\d{4})-(\d{1,2})-(\d{1,2})[ T](\d{1,2}):(\d{2})$/.exec(t);
|
|
32
|
+
if (full) {
|
|
33
|
+
const d = new Date(Number(full[1]), Number(full[2]) - 1, Number(full[3]), Number(full[4]), Number(full[5]));
|
|
34
|
+
return Number.isNaN(d.getTime()) ? null : d;
|
|
35
|
+
}
|
|
36
|
+
const clock = /^(今天|明天|today|tomorrow)?\s*(\d{1,2})[::](\d{2})$/i.exec(t);
|
|
37
|
+
if (clock) {
|
|
38
|
+
const h = Number(clock[2]);
|
|
39
|
+
const m = Number(clock[3]);
|
|
40
|
+
if (h > 23 || m > 59) return null;
|
|
41
|
+
const d = new Date(now.getFullYear(), now.getMonth(), now.getDate(), h, m);
|
|
42
|
+
const tomorrow = /^(明天|tomorrow)$/i.test(clock[1] ?? "");
|
|
43
|
+
if (tomorrow || (!clock[1] && d.getTime() <= now.getTime())) d.setDate(d.getDate() + 1);
|
|
44
|
+
return d;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function describeTime(at: Date): string {
|
|
50
|
+
return at.toLocaleString("zh-CN", { hour12: false, month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit" });
|
|
51
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// Secret scan (1.14): before the change leaves the step (quality gate) and before the branch
|
|
2
|
+
// leaves the machine (push), the pipeline looks for keys, tokens and passwords in what the
|
|
3
|
+
// requirement added: the lines its commits added since the base and the changes not yet
|
|
4
|
+
// committed. Well-known key formats are found anywhere; "password = ..." style assignments
|
|
5
|
+
// only outside tests and docs, and not when the value is a placeholder or read from the
|
|
6
|
+
// environment. A line with "req-kit:allow-secret" (or "gitleaks:allow") is skipped.
|
|
7
|
+
import { execFileSync } from "node:child_process";
|
|
8
|
+
import fs from "node:fs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { matchesPath } from "./gate.js";
|
|
11
|
+
|
|
12
|
+
export interface SecretScanSettings {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
/** Files never scanned (paths or globs, e.g. "test/fixtures/**"). */
|
|
15
|
+
allow: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SecretFinding {
|
|
19
|
+
file: string;
|
|
20
|
+
line: number;
|
|
21
|
+
/** The commit that added it (short), or null for a change not committed yet. */
|
|
22
|
+
commit: string | null;
|
|
23
|
+
/** What it looks like, for the person ("私钥", "GitLab 令牌", "口令"). */
|
|
24
|
+
kind: string;
|
|
25
|
+
/** The line with the secret masked. */
|
|
26
|
+
preview: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const STRONG: Array<{ re: RegExp; kind: string }> = [
|
|
30
|
+
{ re: /-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP |ENCRYPTED )?PRIVATE KEY( BLOCK)?-----/, kind: "私钥" },
|
|
31
|
+
{ re: /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/, kind: "AWS 访问密钥" },
|
|
32
|
+
{ re: /\bgh[pousr]_[A-Za-z0-9]{36,}\b|\bgithub_pat_[A-Za-z0-9_]{40,}\b/, kind: "GitHub 令牌" },
|
|
33
|
+
{ re: /\bglpat-[A-Za-z0-9_-]{20,}\b/, kind: "GitLab 令牌" },
|
|
34
|
+
{ re: /\bxox[abprs]-[A-Za-z0-9-]{10,}\b/, kind: "Slack 令牌" },
|
|
35
|
+
{ re: /\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{24,}\b/, kind: "模型服务的 API 密钥" },
|
|
36
|
+
{ re: /\bAIza[0-9A-Za-z_-]{35}\b/, kind: "Google API 密钥" },
|
|
37
|
+
{ re: /\beyJ[A-Za-z0-9_-]{10,}\.eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/, kind: "令牌(JWT)" },
|
|
38
|
+
{ re: /\b[a-z][a-z0-9+.-]*:\/\/[^\s:/@'"]+:([^\s@/'"]{4,})@[^\s'"]+/i, kind: "地址里带口令" },
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
const ASSIGN = /(?:^|[\s"'{(,;])([A-Za-z0-9_.-]*(?:password|passwd|pwd|secret|token|api[_-]?key|access[_-]?key|private[_-]?key|client[_-]?secret|credential)[A-Za-z0-9_.-]*)["']?\s*(?:[:=]|:=|=>)\s*(["'`]?)([^\s"'`,;)}]+)\2/i;
|
|
42
|
+
|
|
43
|
+
/** Values that are not secrets: placeholders, environment lookups, words, booleans. */
|
|
44
|
+
function placeholder(value: string): boolean {
|
|
45
|
+
const v = value.trim();
|
|
46
|
+
if (v.length < 8) return true;
|
|
47
|
+
if (/[${}<>%]|\(|\[|^\*+$|^x+$|^\.+$/i.test(v)) return true;
|
|
48
|
+
if (/^(true|false|null|none|undefined|nil|required|optional|string|number|boolean)$/i.test(v)) return true;
|
|
49
|
+
if (/(change.?me|example|sample|dummy|fake|mock|placeholder|your[_-]?|xxx|todo|redacted|\*\*\*|test|demo|secret|password|token)/i.test(v)) return true;
|
|
50
|
+
// Code, not a value: a property path or a function name.
|
|
51
|
+
if (/^[A-Za-z_][\w]*(\.[A-Za-z_][\w]*)+$/.test(v) || /^(process\.env|os\.environ|System\.getenv|env\.)/.test(v)) return true;
|
|
52
|
+
// A secret has some mix: letters and digits, or symbols.
|
|
53
|
+
return !(/[A-Za-z]/.test(v) && (/\d/.test(v) || /[^A-Za-z0-9]/.test(v)));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const TEST_OR_DOC = /(^|\/)(tests?|__tests__|spec|specs|fixtures?|mocks?|testdata|examples?|docs?)\/|\.(test|spec)\.[a-z]+$|_test\.go$|Test\.java$|\.(md|txt|rst|adoc)$/i;
|
|
57
|
+
const SKIP_FILE = /(^|\/)(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|Cargo\.lock|go\.sum|poetry\.lock|composer\.lock)$|\.(min\.js|map|svg|png|jpe?g|gif|ico|pdf|zip|jar|woff2?)$/i;
|
|
58
|
+
const ALLOW_MARK = /laoshi:allow-secret|req-kit:allow-secret|gitleaks:allow/;
|
|
59
|
+
|
|
60
|
+
function mask(line: string, secret: string): string {
|
|
61
|
+
const shown = secret.length > 6 ? `${secret.slice(0, 4)}…` : "…";
|
|
62
|
+
const text = line.replace(secret, shown).trim();
|
|
63
|
+
return text.length > 140 ? `${text.slice(0, 139)}…` : text;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** The secret on one added line, if any. */
|
|
67
|
+
export function secretInLine(file: string, line: string): { kind: string; preview: string } | null {
|
|
68
|
+
if (ALLOW_MARK.test(line)) return null;
|
|
69
|
+
for (const { re, kind } of STRONG) {
|
|
70
|
+
const m = re.exec(line);
|
|
71
|
+
if (m) {
|
|
72
|
+
if (kind === "地址里带口令" && placeholder(m[1])) continue;
|
|
73
|
+
return { kind, preview: mask(line, m[1] ?? m[0]) };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (TEST_OR_DOC.test(file)) return null;
|
|
77
|
+
const a = ASSIGN.exec(line);
|
|
78
|
+
if (a && !placeholder(a[3])) return { kind: "口令或密钥", preview: mask(line, a[3]) };
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function git(repo: string, args: string[]): string | null {
|
|
83
|
+
try {
|
|
84
|
+
return execFileSync("git", args, { cwd: repo, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], maxBuffer: 256 * 1024 * 1024, windowsHide: true });
|
|
85
|
+
} catch {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Added lines of a patch (git log -p / git diff), with the file, the line in the new file and the commit. */
|
|
91
|
+
export function scanPatch(patch: string, allow: string[] = []): SecretFinding[] {
|
|
92
|
+
const out: SecretFinding[] = [];
|
|
93
|
+
let commit: string | null = null;
|
|
94
|
+
let file = "";
|
|
95
|
+
let line = 0;
|
|
96
|
+
for (const raw of patch.split("\n")) {
|
|
97
|
+
const c = /^commit ([0-9a-f]{7,40})$/.exec(raw) ?? /^([0-9a-f]{40})\0?$/.exec(raw);
|
|
98
|
+
if (c) {
|
|
99
|
+
commit = c[1].slice(0, 8);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (raw.startsWith("+++ ")) {
|
|
103
|
+
file = raw.slice(4).replace(/^b\//, "").trim();
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const h = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(raw);
|
|
107
|
+
if (h) {
|
|
108
|
+
line = Number(h[1]);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (!file || file === "/dev/null") continue;
|
|
112
|
+
if (raw.startsWith("+")) {
|
|
113
|
+
if (!SKIP_FILE.test(file) && !file.includes("/.pipeline/") && !allow.some((p) => matchesPath(file, p))) {
|
|
114
|
+
const s = secretInLine(file, raw.slice(1));
|
|
115
|
+
if (s) out.push({ file, line, commit, ...s });
|
|
116
|
+
}
|
|
117
|
+
line += 1;
|
|
118
|
+
} else if (raw.startsWith(" ")) line += 1;
|
|
119
|
+
}
|
|
120
|
+
return out;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Secrets the requirement added since `base`: in its commits (each commit's added lines) and in
|
|
125
|
+
* changes not committed yet (including new files). Null when it cannot be told (no git, no base).
|
|
126
|
+
*/
|
|
127
|
+
export function scanChange(repo: string, base: string | null, settings: Pick<SecretScanSettings, "allow">): SecretFinding[] | null {
|
|
128
|
+
if (!base || git(repo, ["rev-parse", "--verify", "--quiet", `${base}^{commit}`]) === null) return null;
|
|
129
|
+
const history = git(repo, ["log", "-p", "--no-color", "--no-ext-diff", "--format=commit %H", "-U0", `${base}..HEAD`]);
|
|
130
|
+
if (history === null) return null;
|
|
131
|
+
const pending = git(repo, ["diff", "--no-color", "--no-ext-diff", "-U0", "HEAD"]) ?? "";
|
|
132
|
+
const findings = [...scanPatch(history, settings.allow), ...scanPatch(pending, settings.allow)];
|
|
133
|
+
for (const f of (git(repo, ["ls-files", "--others", "--exclude-standard"]) ?? "").split("\n").map((s) => s.trim()).filter(Boolean)) {
|
|
134
|
+
if (SKIP_FILE.test(f) || f.includes("/.pipeline/") || settings.allow.some((p) => matchesPath(f, p))) continue;
|
|
135
|
+
const abs = path.join(repo, f);
|
|
136
|
+
try {
|
|
137
|
+
if (fs.statSync(abs).size > 1024 * 1024) continue;
|
|
138
|
+
const lines = fs.readFileSync(abs, "utf8").split("\n");
|
|
139
|
+
lines.forEach((l, i) => {
|
|
140
|
+
const s = secretInLine(f, l);
|
|
141
|
+
if (s) findings.push({ file: f, line: i + 1, commit: null, ...s });
|
|
142
|
+
});
|
|
143
|
+
} catch {
|
|
144
|
+
/* unreadable: skip */
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// The same line found in a commit and still pending counts once.
|
|
148
|
+
const seen = new Set<string>();
|
|
149
|
+
return findings.filter((f) => {
|
|
150
|
+
const k = `${f.file}:${f.preview}`;
|
|
151
|
+
if (seen.has(k)) return false;
|
|
152
|
+
seen.add(k);
|
|
153
|
+
return true;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function describeFinding(f: SecretFinding): string {
|
|
158
|
+
return `${f.file}:${f.line}(${f.kind}${f.commit ? `,提交 ${f.commit}` : ",还没提交"}):${f.preview}`;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** What the step's agent is told when the scan finds something. */
|
|
162
|
+
export function secretFollowUp(input: { findings: SecretFinding[]; base: string; round: number; max: number }): string {
|
|
163
|
+
const commits = [...new Set(input.findings.map((f) => f.commit).filter((c): c is string => !!c))];
|
|
164
|
+
return [
|
|
165
|
+
`流水线在你这一步结束后检查了本需求新增的内容,发现疑似密钥、令牌或口令(第 ${input.round} 次要求处理,最多 ${input.max} 次):`,
|
|
166
|
+
"",
|
|
167
|
+
...input.findings.slice(0, 30).map((f) => `- ${describeFinding(f)}`),
|
|
168
|
+
"",
|
|
169
|
+
"请处理:",
|
|
170
|
+
"1. 从文件里去掉这些值,改成从配置或环境变量读取(配置示例里只写变量名或占位符,例如 `<your-token>`)。测试需要的值用明显的假数据。",
|
|
171
|
+
commits.length > 0
|
|
172
|
+
? `2. 这些值已经写进了本需求的提交(${commits.join("、")})。这些提交还没有推送,要把它们从历史里去掉:改好文件后用 \`git commit --fixup=<那个提交>\` 提交,再运行 \`git -c sequence.editor=: rebase -i --autosquash <那个提交>^\`(不会打开编辑器);只在本需求的分支上做,不要动 ${input.base.slice(0, 8)} 之前的提交。`
|
|
173
|
+
: "2. 这些值还没有提交,改好文件再提交即可。",
|
|
174
|
+
"3. 确实不是密钥的(例如示例里的假值),在那一行末尾加注释 `laoshi:allow-secret`。",
|
|
175
|
+
"4. 在本步骤产物里记一笔:哪些地方、怎么处理的。如果它是真实的密钥,写明\"建议更换这个密钥\",由人来做。",
|
|
176
|
+
].join("\n");
|
|
177
|
+
}
|