sera-code 0.0.0-stage → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE-SERA.md +33 -0
- package/README.md +27 -2
- package/THIRD_PARTY_NOTICES.md +68 -0
- package/bin/sera.mjs +145 -0
- package/dist/bundle/chunks/anthropic-messages-RD7GXOQL.js +6 -0
- package/dist/bundle/chunks/anthropic.js +75 -0
- package/dist/bundle/chunks/azure-openai-responses-CJT3KTVK.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +89 -0
- package/dist/bundle/chunks/chunk-46WGNYIE.js +82 -0
- package/dist/bundle/chunks/chunk-4UNN5OGR.js +4 -0
- package/dist/bundle/chunks/chunk-53H5DPHA.js +16 -0
- package/dist/bundle/chunks/chunk-5AGIVGSV.js +6 -0
- package/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
- package/dist/bundle/chunks/chunk-7CBJINYJ.js +20 -0
- package/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
- package/dist/bundle/chunks/chunk-7RZ5BS7U.js +2 -0
- package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
- package/dist/bundle/chunks/chunk-AZC5WTED.js +1222 -0
- package/dist/bundle/chunks/chunk-BPHHHEET.js +9 -0
- package/dist/bundle/chunks/chunk-BSS6T6KQ.js +2 -0
- package/dist/bundle/chunks/chunk-CF5GWZHW.js +31 -0
- package/dist/bundle/chunks/chunk-EDSQGWII.js +44 -0
- package/dist/bundle/chunks/chunk-FFMDRXC4.js +10 -0
- package/dist/bundle/chunks/chunk-HODJBMOY.js +9 -0
- package/dist/bundle/chunks/chunk-HQBQWHLD.js +7 -0
- package/dist/bundle/chunks/chunk-HQJBN2MC.js +2 -0
- package/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
- package/dist/bundle/chunks/chunk-KXU77PUU.js +4 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
- package/dist/bundle/chunks/chunk-LOMPDCMP.js +2 -0
- package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
- package/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
- package/dist/bundle/chunks/chunk-M3LEVT3X.js +2 -0
- package/dist/bundle/chunks/chunk-P7FPUEYA.js +2 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
- package/dist/bundle/chunks/chunk-PMRZO46Y.js +2 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
- package/dist/bundle/chunks/chunk-QTM7S6TH.js +2 -0
- package/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
- package/dist/bundle/chunks/chunk-TLNP2BSO.js +2 -0
- package/dist/bundle/chunks/chunk-TMKHGABX.js +2 -0
- package/dist/bundle/chunks/chunk-TMTOQ7H7.js +2 -0
- package/dist/bundle/chunks/chunk-UKVNB6C4.js +2 -0
- package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
- package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
- package/dist/bundle/chunks/chunk-ZLAHUYDW.js +131 -0
- package/dist/bundle/chunks/chunk-ZNCN2NGY.js +60 -0
- package/dist/bundle/chunks/cli-MML2DU4A.js +51 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-QPZQRBK5.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +478 -0
- package/dist/bundle/chunks/dist-ZNZCJI7B.js +7 -0
- package/dist/bundle/chunks/easter-egg-3d-VOETWRJO.js +2 -0
- package/dist/bundle/chunks/execute-HXDNZ26B.js +505 -0
- package/dist/bundle/chunks/github-copilot.js +2 -0
- package/dist/bundle/chunks/google-generative-ai-SJXMIEPZ.js +2 -0
- package/dist/bundle/chunks/google-vertex-VSXQ3BDH.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +13 -0
- package/dist/bundle/chunks/image-resize-worker.js +2 -0
- package/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +21 -0
- package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +2 -0
- package/dist/bundle/chunks/kimi-coding.js +2 -0
- package/dist/bundle/chunks/lib-4AVRLBHM.js +9 -0
- package/dist/bundle/chunks/llama-cpp-classify-4KFSGAMH.js +22 -0
- package/dist/bundle/chunks/meta.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-JYWDZV2K.js +5 -0
- package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
- package/dist/bundle/chunks/node-AUOGOBCN.js +2 -0
- package/dist/bundle/chunks/node-KCMANYC2.js +16 -0
- package/dist/bundle/chunks/openai-chatgpt.js +75 -0
- package/dist/bundle/chunks/openai-codex-responses-OQV5DCFA.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +75 -0
- package/dist/bundle/chunks/openai-completions-RFDJM2W5.js +7 -0
- package/dist/bundle/chunks/openai-decisions-O6PHBSCB.js +5 -0
- package/dist/bundle/chunks/openai-responses-LVNAPALQ.js +4 -0
- package/dist/bundle/chunks/openrouter-images-4WG6OOLH.js +2 -0
- package/dist/bundle/chunks/openrouter.js +75 -0
- package/dist/bundle/chunks/pdfjs-BETXZQ7A.js +108 -0
- package/dist/bundle/chunks/pdfjs-decoders-37HBPYHX.js +2 -0
- package/dist/bundle/chunks/pdfjs-jbig2-MH7WRXUP.js +2 -0
- package/dist/bundle/chunks/pdfjs-jbig2_nowasm_fallback-UVK7AQLA.js +2 -0
- package/dist/bundle/chunks/pdfjs-openjpeg-TC2QHC4G.js +2 -0
- package/dist/bundle/chunks/pdfjs-openjpeg_nowasm_fallback-ZC2FTHCZ.js +3 -0
- package/dist/bundle/chunks/pi-messages-EZXKVRR6.js +8 -0
- package/dist/bundle/chunks/radius.js +75 -0
- package/dist/bundle/chunks/runtime-JAH75CB5.js +2 -0
- package/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
- package/dist/bundle/chunks/typesafe-system-one-X3JT6ECA.js +2 -0
- package/dist/bundle/chunks/virtual-modules-Z2V3PTLI.js +2 -0
- package/dist/bundle/chunks/xai.js +2 -0
- package/dist/bundle/cli-runtime.js +3 -0
- package/dist/bundle/cli.js +5 -0
- package/dist/bundle/index.js +2 -0
- package/dist/bundle/rpc-entry.js +3 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +249 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +37 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +228 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +1085 -0
- package/dist/core/export-html/template.html +56 -0
- package/dist/core/export-html/template.js +2044 -0
- package/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +110 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/dist/core/export-html/vendor/marked.min.js +79 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/theme/dark.json +81 -0
- package/dist/modes/interactive/theme/light.json +81 -0
- package/dist/modes/interactive/theme/system-theme.d.ts +55 -0
- package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/system-theme.js +546 -0
- package/dist/modes/interactive/theme/system-theme.js.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +81 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.js +210 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.js +105 -0
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.js +94 -0
- package/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts +155 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +905 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/docs/cli-integration.md +106 -0
- package/docs/cli.md +333 -0
- package/docs/codemode.md +230 -0
- package/docs/compaction.md +463 -0
- package/docs/configuration.md +47 -0
- package/docs/containerization.md +183 -0
- package/docs/custom-provider.md +227 -0
- package/docs/docs.json +220 -0
- package/docs/environment-variables.md +102 -0
- package/docs/extensions.md +400 -0
- package/docs/how-pi-works.md +49 -0
- package/docs/index.md +39 -0
- package/docs/json.md +226 -0
- package/docs/keybindings.md +195 -0
- package/docs/llama-cpp.md +121 -0
- package/docs/mcp.md +272 -0
- package/docs/message-types.md +279 -0
- package/docs/models-configuration.md +196 -0
- package/docs/models.md +225 -0
- package/docs/nvidia-rtx-llama-cpp.md +96 -0
- package/docs/packages.md +131 -0
- package/docs/prompt-templates.md +59 -0
- package/docs/providers.md +247 -0
- package/docs/quickstart.md +136 -0
- package/docs/rpc-commands.md +860 -0
- package/docs/rpc-extension-ui.md +200 -0
- package/docs/rpc.md +193 -0
- package/docs/sdk.md +147 -0
- package/docs/security.md +99 -0
- package/docs/session-format.md +293 -0
- package/docs/sessions.md +66 -0
- package/docs/settings.md +172 -0
- package/docs/shell-aliases.md +93 -0
- package/docs/skills.md +93 -0
- package/docs/slash-commands.md +61 -0
- package/docs/terminal-setup.md +233 -0
- package/docs/termux.md +117 -0
- package/docs/themes.md +138 -0
- package/docs/tmux.md +55 -0
- package/docs/tui.md +195 -0
- package/docs/usage.md +94 -0
- package/docs/virtual-models.md +114 -0
- package/docs/windows.md +81 -0
- package/lib/auth.js +377 -0
- package/lib/provider.js +71 -0
- package/package.json +43 -5
- package/sera-core/skills/apple-tasarim/SKILL.md +48 -0
- package/sera-core/skills/apple-tasarim/referanslar/apple-hig.md +55 -0
- package/sera-core/skills/belge-yarat/SKILL.md +64 -0
- package/sera-core/skills/belge-yarat/referanslar/belge-yazim.md +60 -0
- package/sera-core/skills/derin-arastirma/SKILL.md +52 -0
- package/sera-core/skills/derin-arastirma/referanslar/arastirma-yontem.md +50 -0
- package/sera-core/skills/dusunme-dogrulama/SKILL.md +59 -0
- package/sera-core/skills/dusunme-dogrulama/referanslar/dusunme-kontrol.md +54 -0
- package/sera-core/skills/film-stilleri/SKILL.md +51 -0
- package/sera-core/skills/hyperframes/LICENSE-UPSTREAM +190 -0
- package/sera-core/skills/hyperframes/SKILL.md +79 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/biennale-yellow/FRAME.md +289 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/blockframe/FRAME.md +275 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/blue-professional/FRAME.md +307 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/bold-poster/FRAME.md +275 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/broadside/FRAME.md +284 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/capsule/FRAME.md +284 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/cartesian/FRAME.md +278 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/cobalt-grid/FRAME.md +265 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/code-editorial/FRAME.md +277 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/coral/FRAME.md +314 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/creative-mode/FRAME.md +333 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/daisy-days/FRAME.md +274 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/editorial-forest/FRAME.md +265 -0
- package/sera-core/skills/hyperframes/references/captions.md +46 -0
- package/sera-core/skills/hyperframes/references/film.md +48 -0
- package/sera-core/skills/hyperframes/references/format.md +159 -0
- package/sera-core/skills/hyperframes/references/look.md +69 -0
- package/sera-core/skills/hyperframes/references/motion.md +95 -0
- package/sera-core/skills/hyperframes/references/overlays.md +39 -0
- package/sera-core/skills/hyperframes/references/path-tracing.md +36 -0
- package/sera-core/skills/hyperframes/references/plugin-installation.md +42 -0
- package/sera-core/skills/hyperframes/references/review.md +51 -0
- package/sera-core/skills/hyperframes/references/runtimes.md +69 -0
- package/sera-core/skills/hyperframes/references/skill-lifecycle.md +54 -0
- package/sera-core/skills/hyperframes/references/sound.md +43 -0
- package/sera-core/skills/hyperframes/references/spec.md +76 -0
- package/sera-core/skills/hyperframes/references/story.md +103 -0
- package/sera-core/skills/hyperframes/references/storyboard-format.md +107 -0
- package/sera-core/skills/hyperframes/references/storyboard.md +36 -0
- package/sera-core/skills/hyperframes/references/types/3d.md +25 -0
- package/sera-core/skills/hyperframes/references/types/character.md +20 -0
- package/sera-core/skills/hyperframes/references/types/data.md +19 -0
- package/sera-core/skills/hyperframes/references/types/explainer.md +34 -0
- package/sera-core/skills/hyperframes/references/types/launch.md +41 -0
- package/sera-core/skills/hyperframes/references/types/music.md +24 -0
- package/sera-core/skills/hyperframes/references/types/vertical.md +23 -0
- package/sera-core/skills/hyperframes-cli/LICENSE-UPSTREAM +190 -0
- package/sera-core/skills/hyperframes-cli/SKILL.md +99 -0
- package/sera-core/skills/hyperframes-cli/references/beats.md +17 -0
- package/sera-core/skills/hyperframes-cli/references/compare-and-batch.md +105 -0
- package/sera-core/skills/hyperframes-cli/references/conventions.md +16 -0
- package/sera-core/skills/hyperframes-cli/references/doctor-browser.md +80 -0
- package/sera-core/skills/hyperframes-cli/references/feedback.md +14 -0
- package/sera-core/skills/hyperframes-cli/references/init-and-scaffold.md +75 -0
- package/sera-core/skills/hyperframes-cli/references/lint-validate-inspect.md +164 -0
- package/sera-core/skills/hyperframes-cli/references/preview-render.md +204 -0
- package/sera-core/skills/hyperframes-cli/references/upgrade-info-misc.md +134 -0
- package/sera-core/skills/impeccable/LICENSE-UPSTREAM +191 -0
- package/sera-core/skills/impeccable/NOTICE-UPSTREAM.md +11 -0
- package/sera-core/skills/impeccable/SKILL.md +89 -0
- package/sera-core/skills/impeccable/reference/adapt.md +318 -0
- package/sera-core/skills/impeccable/reference/adapt.native.md +58 -0
- package/sera-core/skills/impeccable/reference/android.md +46 -0
- package/sera-core/skills/impeccable/reference/animate.md +89 -0
- package/sera-core/skills/impeccable/reference/audit.md +139 -0
- package/sera-core/skills/impeccable/reference/audit.native.md +139 -0
- package/sera-core/skills/impeccable/reference/bolder.md +33 -0
- package/sera-core/skills/impeccable/reference/clarify.md +94 -0
- package/sera-core/skills/impeccable/reference/colorize.md +86 -0
- package/sera-core/skills/impeccable/reference/component-review.md +63 -0
- package/sera-core/skills/impeccable/reference/craft-floor.md +44 -0
- package/sera-core/skills/impeccable/reference/craft.md +5 -0
- package/sera-core/skills/impeccable/reference/critique.md +819 -0
- package/sera-core/skills/impeccable/reference/degraded/asset-producer.md +42 -0
- package/sera-core/skills/impeccable/reference/degraded/documenter.md +24 -0
- package/sera-core/skills/impeccable/reference/degraded/finish-reviewer.md +38 -0
- package/sera-core/skills/impeccable/reference/degraded/manual-edit-applier.md +93 -0
- package/sera-core/skills/impeccable/reference/delight.md +70 -0
- package/sera-core/skills/impeccable/reference/distill.md +111 -0
- package/sera-core/skills/impeccable/reference/doctor.md +54 -0
- package/sera-core/skills/impeccable/reference/document.md +416 -0
- package/sera-core/skills/impeccable/reference/extract.md +69 -0
- package/sera-core/skills/impeccable/reference/generate.md +101 -0
- package/sera-core/skills/impeccable/reference/harden.md +362 -0
- package/sera-core/skills/impeccable/reference/hooks.md +120 -0
- package/sera-core/skills/impeccable/reference/init.md +133 -0
- package/sera-core/skills/impeccable/reference/ios.md +51 -0
- package/sera-core/skills/impeccable/reference/layout.md +84 -0
- package/sera-core/skills/impeccable/reference/live-setup.md +104 -0
- package/sera-core/skills/impeccable/reference/live.md +327 -0
- package/sera-core/skills/impeccable/reference/mode-operate.md +21 -0
- package/sera-core/skills/impeccable/reference/mode-persuade.md +19 -0
- package/sera-core/skills/impeccable/reference/mode-read.md +21 -0
- package/sera-core/skills/impeccable/reference/new-work.md +152 -0
- package/sera-core/skills/impeccable/reference/onboard.md +234 -0
- package/sera-core/skills/impeccable/reference/operate.md +61 -0
- package/sera-core/skills/impeccable/reference/optimize.md +257 -0
- package/sera-core/skills/impeccable/reference/overdrive.md +127 -0
- package/sera-core/skills/impeccable/reference/polish.md +105 -0
- package/sera-core/skills/impeccable/reference/quieter.md +99 -0
- package/sera-core/skills/impeccable/reference/region-map.md +26 -0
- package/sera-core/skills/impeccable/reference/routing.md +24 -0
- package/sera-core/skills/impeccable/reference/shape.md +59 -0
- package/sera-core/skills/impeccable/reference/typeset.md +90 -0
- package/sera-core/skills/impeccable/reference/visualize.md +47 -0
- package/sera-core/skills/oyun-yarat/SKILL.md +106 -0
- package/sera-core/skills/oyun-yarat/referanslar/3b-yaris.md +74 -0
- package/sera-core/skills/oyun-yarat/referanslar/kaplay.md +99 -0
- package/sera-core/skills/oyun-yarat/referanslar/oyun-desenleri.md +73 -0
- package/sera-core/skills/oyun-yarat/sablonlar/kaplay-2d.html +164 -0
- package/sera-core/skills/oyun-yarat/sablonlar/three-yaris.html +149 -0
- package/sera-core/skills/oyun-yarat/sablonlar/tuval-minimal.html +77 -0
- package/sera-core/skills/receiving-code-review/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/receiving-code-review/SKILL.md +205 -0
- package/sera-core/skills/refero-design/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/refero-design/SKILL.md +534 -0
- package/sera-core/skills/refero-design/references/anti-ai-slop.md +292 -0
- package/sera-core/skills/refero-design/references/color.md +563 -0
- package/sera-core/skills/refero-design/references/copywriting.md +222 -0
- package/sera-core/skills/refero-design/references/craft-details.md +525 -0
- package/sera-core/skills/refero-design/references/example-workflow.md +264 -0
- package/sera-core/skills/refero-design/references/icons.md +166 -0
- package/sera-core/skills/refero-design/references/mcp-tools.md +258 -0
- package/sera-core/skills/refero-design/references/motion.md +504 -0
- package/sera-core/skills/refero-design/references/typography.md +737 -0
- package/sera-core/skills/refero-design/references/visual-workflow.md +105 -0
- package/sera-core/skills/requesting-code-review/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/requesting-code-review/SKILL.md +95 -0
- package/sera-core/skills/requesting-code-review/code-reviewer.md +198 -0
- package/sera-core/skills/reverse-engineer-anything/DISCLAIMER.md +136 -0
- package/sera-core/skills/reverse-engineer-anything/LICENSE-REA-MIT +21 -0
- package/sera-core/skills/reverse-engineer-anything/SKILL.md +363 -0
- package/sera-core/skills/reverse-engineer-anything/THIRD_PARTY_NOTICES.md +135 -0
- package/sera-core/skills/reverse-engineer-anything/references/android-applications.md +36 -0
- package/sera-core/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/sera-core/skills/reverse-engineer-anything/references/evidence-workflows.md +71 -0
- package/sera-core/skills/reverse-engineer-anything/references/javascript-applications.md +218 -0
- package/sera-core/skills/reverse-engineer-anything/references/native-and-artifacts.md +297 -0
- package/sera-core/skills/reverse-engineer-anything/references/runtime-observation.md +78 -0
- package/sera-core/skills/seo-audit/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/seo-audit/SKILL.md +210 -0
- package/sera-core/skills/sera-guvenlik-denetim/SKILL.md +44 -0
- package/sera-core/skills/sera-guvenlik-denetim/referanslar/guvenlik-listesi.md +33 -0
- package/sera-core/skills/sera-hata-ayikla/SKILL.md +27 -0
- package/sera-core/skills/sera-hata-ayikla/referanslar/hata-ayiklama.md +37 -0
- package/sera-core/skills/sera-kod-inceleme/SKILL.md +44 -0
- package/sera-core/skills/sera-kod-inceleme/referanslar/inceleme-listesi.md +62 -0
- package/sera-core/skills/sera-ofis-dosya/SKILL.md +27 -0
- package/sera-core/skills/sera-ofis-dosya/referanslar/ofis-dosya.md +93 -0
- package/sera-core/skills/sera-research/SKILL.md +90 -0
- package/sera-core/skills/sera-tasarim/SKILL.md +149 -0
- package/sera-core/skills/sera-teslim-sozlesmesi/SKILL.md +592 -0
- package/sera-core/skills/sera-test-yaz/SKILL.md +26 -0
- package/sera-core/skills/sera-test-yaz/referanslar/test-yazimi.md +35 -0
- package/sera-core/skills/sera-veri-gorsel/SKILL.md +65 -0
- package/sera-core/skills/sera-web-test/SKILL.md +26 -0
- package/sera-core/skills/sera-web-test/referanslar/web-test.md +44 -0
- package/sera-core/skills/sera-zamanli-gorev/SKILL.md +22 -0
- package/sera-core/skills/sera-zamanli-gorev/referanslar/zamanli-gorev.md +58 -0
- package/sera-core/skills/systematic-debugging/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/systematic-debugging/SKILL.md +283 -0
- package/sera-core/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/sera-core/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/sera-core/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/sera-core/skills/test-driven-development/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/test-driven-development/SKILL.md +330 -0
- package/sera-core/skills/test-driven-development/writing-good-tests.md +198 -0
- package/sera-core/skills/ticaret-icerik/SKILL.md +49 -0
- package/sera-core/skills/ticaret-icerik/referanslar/ticaret-icerik.md +54 -0
- package/sera-core/skills/uygulama-yarat/SKILL.md +95 -0
- package/sera-core/skills/uygulama-yarat/referanslar/uygulama-desenleri.md +63 -0
- package/sera-core/skills/uygulama-yarat/sablonlar/uygulama-tek-dosya.html +121 -0
- package/sera-core/skills/uyumluluk-denetim/SKILL.md +56 -0
- package/sera-core/skills/uyumluluk-denetim/referanslar/mevzuat-tablosu.md +65 -0
- package/sera-core/skills/veri-analizi/SKILL.md +54 -0
- package/sera-core/skills/veri-analizi/referanslar/veri-analizi-yontem.md +49 -0
- package/sera-core/skills/veri-analizi/sablonlar/profil.mjs +79 -0
- package/sera-core/skills/video-duzen/SKILL.md +50 -0
- package/sera-core/skills/video-duzen/referanslar/video-duzen.md +100 -0
- package/sera-core/skills/web-yayin-listesi/SKILL.md +115 -0
- package/sera-core/skills/writing-plans/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/writing-plans/SKILL.md +204 -0
- package/sera-core/src/action-nudge.ts +200 -0
- package/sera-core/src/agent-mode.ts +143 -0
- package/sera-core/src/agents.ts +185 -0
- package/sera-core/src/app-master.ts +275 -0
- package/sera-core/src/app-verify.ts +551 -0
- package/sera-core/src/approval.ts +131 -0
- package/sera-core/src/budget.ts +136 -0
- package/sera-core/src/command-policy.ts +808 -0
- package/sera-core/src/config.ts +135 -0
- package/sera-core/src/context-diet.ts +272 -0
- package/sera-core/src/device-id.ts +48 -0
- package/sera-core/src/dogal-arac.ts +203 -0
- package/sera-core/src/dogal-niyet.ts +173 -0
- package/sera-core/src/egress-allow.ts +52 -0
- package/sera-core/src/export.ts +124 -0
- package/sera-core/src/exposure.ts +8 -0
- package/sera-core/src/extension.ts +2410 -0
- package/sera-core/src/fs-tools.ts +448 -0
- package/sera-core/src/generated/build-rules.ts +26 -0
- package/sera-core/src/generated/zero-knowledge.ts +170 -0
- package/sera-core/src/github-agent-command.ts +133 -0
- package/sera-core/src/github-agent-engine.ts +198 -0
- package/sera-core/src/github-agent-schedule.ts +180 -0
- package/sera-core/src/github-agent.ts +669 -0
- package/sera-core/src/github-ajan-akis.ts +193 -0
- package/sera-core/src/github-ajan-gercek.ts +102 -0
- package/sera-core/src/github-tick.ts +78 -0
- package/sera-core/src/github-yedek.ts +269 -0
- package/sera-core/src/goal.ts +119 -0
- package/sera-core/src/handoff.ts +132 -0
- package/sera-core/src/hooks.ts +284 -0
- package/sera-core/src/image-tool.ts +118 -0
- package/sera-core/src/intake-brief.ts +82 -0
- package/sera-core/src/intake-core.ts +1152 -0
- package/sera-core/src/intake-hook.ts +88 -0
- package/sera-core/src/ios-build-tool.ts +134 -0
- package/sera-core/src/lazy-capability.ts +125 -0
- package/sera-core/src/lazy-mcp.ts +300 -0
- package/sera-core/src/limit-command.ts +51 -0
- package/sera-core/src/loop-brake.ts +129 -0
- package/sera-core/src/lsp.ts +618 -0
- package/sera-core/src/mcp-bridge.ts +159 -0
- package/sera-core/src/mcp-pin.ts +105 -0
- package/sera-core/src/mcp-ssrf.ts +124 -0
- package/sera-core/src/message-cap.ts +45 -0
- package/sera-core/src/model-list.ts +108 -0
- package/sera-core/src/no-progress.ts +177 -0
- package/sera-core/src/notebook-tool.ts +179 -0
- package/sera-core/src/ofis.ts +473 -0
- package/sera-core/src/path-guard.ts +139 -0
- package/sera-core/src/permission-bridge.ts +228 -0
- package/sera-core/src/policy-chain.ts +122 -0
- package/sera-core/src/pricing.ts +71 -0
- package/sera-core/src/proc.ts +149 -0
- package/sera-core/src/rea.ts +188 -0
- package/sera-core/src/repo-map.ts +230 -0
- package/sera-core/src/research.ts +347 -0
- package/sera-core/src/rules-memory.ts +227 -0
- package/sera-core/src/sandbox.ts +476 -0
- package/sera-core/src/server-error.ts +78 -0
- package/sera-core/src/skills.ts +268 -0
- package/sera-core/src/snapshot.ts +143 -0
- package/sera-core/src/spec-gate.ts +112 -0
- package/sera-core/src/subagent.ts +261 -0
- package/sera-core/src/teslim.ts +121 -0
- package/sera-core/src/test-fix.ts +184 -0
- package/sera-core/src/todo-question.ts +163 -0
- package/sera-core/src/turn-snapshots.ts +126 -0
- package/sera-core/src/tuval/arac.ts +338 -0
- package/sera-core/src/tuval/arsiv.ts +106 -0
- package/sera-core/src/tuval/belge.ts +216 -0
- package/sera-core/src/tuval/birlestir.ts +282 -0
- package/sera-core/src/tuval/disa.ts +235 -0
- package/sera-core/src/tuval/editor.ts +583 -0
- package/sera-core/src/tuval/film-cekirdek.ts +170 -0
- package/sera-core/src/tuval/film-disa.ts +188 -0
- package/sera-core/src/tuval/film-oynatici.ts +307 -0
- package/sera-core/src/tuval/kimlik.ts +156 -0
- package/sera-core/src/tuval/pano.ts +763 -0
- package/sera-core/src/tuval/proje.ts +728 -0
- package/sera-core/src/tuval/sistem-cekirdek.ts +167 -0
- package/sera-core/src/tuval/sistem.ts +328 -0
- package/sera-core/src/tuval/sunucu.ts +413 -0
- package/sera-core/src/tuval/uretim.ts +24 -0
- package/sera-core/src/tuval/veri-cekirdek.ts +477 -0
- package/sera-core/src/tuval/xlsx.ts +215 -0
- package/sera-core/src/tuval/zip.ts +163 -0
- package/sera-core/src/untrusted.ts +201 -0
- package/sera-core/src/video-edit-tool.ts +411 -0
- package/sera-core/src/video-tool.ts +217 -0
- package/sera-core/src/web-tools.ts +257 -0
- package/sera-core/src/zk.ts +104 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beceriler (D1-7). Motor SKILL.md kesfini, sistem istemindeki dizini (yalniz ad + aciklama) ve `/skill:ad`
|
|
3
|
+
* acilimini zaten yapar. Sera burada:
|
|
4
|
+
* 1) Kesif klasorleri: ~/.sera/skills (kullanici) + <proje>/.sera/skills (motorun kendi `.pi/skills` yolu Sera'da
|
|
5
|
+
* kullaniciya gorunmez; ayni beceri iki yerde varsa motorun ad cakismasi kurali gecerli).
|
|
6
|
+
* 2) `disallowed-tools` kisiti: beceri etkinken (kullanici `/skill:ad` dedi ya da model SKILL.md'yi okudu) listedeki
|
|
7
|
+
* araclar o calistirma boyunca engellenir. Kisit izin katmanindan ONCE uygulanir ve yalniz DARALTIR.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
11
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
12
|
+
|
|
13
|
+
export function skillDirs(home: string, cwd: string): string[] {
|
|
14
|
+
return [join(home, "skills"), join(cwd, ".sera", "skills")].filter((d) => existsSync(d));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** SKILL.md on bilgisinden `disallowed-tools` (satir ici "bash, write" ya da YAML listesi). */
|
|
18
|
+
export function parseDisallowed(content: string): string[] {
|
|
19
|
+
const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(content);
|
|
20
|
+
if (!m) return [];
|
|
21
|
+
const lines = m[1]!.split(/\r?\n/);
|
|
22
|
+
const i = lines.findIndex((l) => /^disallowed-tools\s*:/.test(l));
|
|
23
|
+
if (i < 0) return [];
|
|
24
|
+
const inline = lines[i]!.replace(/^disallowed-tools\s*:\s*/, "").trim();
|
|
25
|
+
const items: string[] = [];
|
|
26
|
+
if (inline) items.push(...inline.replace(/^\[|\]$/g, "").split(/[,\s]+/));
|
|
27
|
+
else
|
|
28
|
+
for (const l of lines.slice(i + 1)) {
|
|
29
|
+
const li = /^\s*-\s*(.+)$/.exec(l);
|
|
30
|
+
if (!li) break;
|
|
31
|
+
items.push(li[1]!);
|
|
32
|
+
}
|
|
33
|
+
return items.map((s) => s.trim().replace(/^["']|["']$/g, "")).filter(Boolean);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const SKILL_BLOCK = /<skill name="([^"]+)" location="([^"]+)">/g;
|
|
37
|
+
|
|
38
|
+
export class SkillGuard {
|
|
39
|
+
private active = new Map<string, Set<string>>();
|
|
40
|
+
|
|
41
|
+
reset(): void {
|
|
42
|
+
this.active.clear();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private activate(name: string, file: string): void {
|
|
46
|
+
try {
|
|
47
|
+
const tools = parseDisallowed(readFileSync(file, "utf8"));
|
|
48
|
+
if (tools.length) this.active.set(name, new Set(tools));
|
|
49
|
+
} catch {
|
|
50
|
+
// okunamadi: kisit yok
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Kullanici istemi `/skill:ad` ile acildiysa motor <skill ...> blogu koyar. */
|
|
55
|
+
fromPrompt(prompt: string): void {
|
|
56
|
+
for (const m of prompt.matchAll(SKILL_BLOCK)) this.activate(m[1]!, m[2]!);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Model SKILL.md okuyorsa beceri etkinlesir; donus: engel gerekcesi (yoksa undefined). */
|
|
60
|
+
check(tool: string, input: unknown, cwd = process.cwd()): string | undefined {
|
|
61
|
+
for (const [name, tools] of this.active)
|
|
62
|
+
if (tools.has(tool)) return `'${name}' becerisi '${tool}' aracini kullanmaz (beceri kisiti).`;
|
|
63
|
+
if (tool === "read") {
|
|
64
|
+
const p = String((input as { path?: unknown } | undefined)?.path ?? "");
|
|
65
|
+
if (basename(p) === "SKILL.md") this.activate(basename(dirname(resolve(cwd, p))), resolve(cwd, p));
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// --- Sistem istemi beceri dizini butcesi (token tasarrufu) ---------------------------------------------------------
|
|
72
|
+
// Motor her becerinin ad + aciklama + tam yolunu (XML) HER istekte sistem istemine koyar: ~/.agents/skills altinda 150 beceri
|
|
73
|
+
// olan bir makinede olculen 28.8k token. Burada dizin ADLAR + KISALTILMIS aciklamalarla (butceye kadar) ve ortak klasor
|
|
74
|
+
// bir kez yazilarak verilir; hicbir beceri listeden CIKMAZ (adlar her zaman var), icerik yine read ile gerekince yuklenir.
|
|
75
|
+
export interface SkillLike {
|
|
76
|
+
name: string;
|
|
77
|
+
description: string;
|
|
78
|
+
filePath: string;
|
|
79
|
+
baseDir?: string;
|
|
80
|
+
disableModelInvocation?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const DEFAULT_SKILLS_MAX_TOKENS = 1500;
|
|
84
|
+
/** Sera'ya ait olmayan bir klasorde bundan fazla beceri varsa adlar listelenmez (isaretci satir). SERA_SKILLS_COLLAPSE_OVER=0 kapatir. */
|
|
85
|
+
export const DEFAULT_SKILLS_COLLAPSE_OVER = 12;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Yerlesik beceriler icin KISA yonlendirme dizini: tam aciklama yerine "- ad: birkac kelimelik ipucu" (her istekte giden maliyet
|
|
89
|
+
* budur; ayrinti gerekince read ile yuklenir). Kategori yalniz "[etiket]" satiridir — beceri adiyla karismasin diye ayri satirda ve
|
|
90
|
+
* koseli parantezde (eski "video: a, b" bicimi bazi modellerde "video"yu beceri adi sandirdi). Yeni yerlesik beceri buraya eklenir;
|
|
91
|
+
* listede olmayan yerlesik beceri yine normal (aciklamali) dizinde gorunur — hicbir beceri gizlenmez.
|
|
92
|
+
*/
|
|
93
|
+
export const BUILTIN_ROUTES: [string, [string, string][]][] = [
|
|
94
|
+
[
|
|
95
|
+
"video",
|
|
96
|
+
[
|
|
97
|
+
["video-duzen", "video yap/kes/birleştir, altyazı, müzik, reels/shorts"],
|
|
98
|
+
["hyperframes", "HTML/kodla animasyonlu MP4, ürün tanıtımı"],
|
|
99
|
+
["hyperframes-cli", "HyperFrames projesi init/lint/önizle/render"],
|
|
100
|
+
["film-stilleri", "belirli sinema stilinde (art deco, noir…) kısa film"],
|
|
101
|
+
],
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
"tasarım",
|
|
105
|
+
[
|
|
106
|
+
["sera-tasarim", "afiş, poster, site görünümü, slayt, pano"],
|
|
107
|
+
["apple-tasarim", "iPhone/iOS/Apple tarzı arayüz"],
|
|
108
|
+
["impeccable", "var olan arayüzü cilala, eleştir"],
|
|
109
|
+
["refero-design", "gerçek ürün örneklerine bakarak tasarla"],
|
|
110
|
+
["web-yayin-listesi", "site yayına hazır mı: 404, meta, KVKK listesi"],
|
|
111
|
+
],
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
"üretim",
|
|
115
|
+
[
|
|
116
|
+
["oyun-yarat", "oyun yap"],
|
|
117
|
+
["sera-teslim-sozlesmesi", "program/proje isteğinde teslim sözleşmesi (otomatik yüklenir)"],
|
|
118
|
+
["uygulama-yarat", "çalışan mini araç/uygulama, iPhone uygulaması"],
|
|
119
|
+
["belge-yarat", "dilekçe, rapor, CV, sözleşme metni"],
|
|
120
|
+
["sera-ofis-dosya", "Word/Excel/PowerPoint/PDF dosyası üret/düzenle"],
|
|
121
|
+
["ticaret-icerik", "ürün açıklaması, reklam, sosyal medya metni"],
|
|
122
|
+
],
|
|
123
|
+
],
|
|
124
|
+
[
|
|
125
|
+
"veri",
|
|
126
|
+
[
|
|
127
|
+
["veri-analizi", "CSV/Excel analizi"],
|
|
128
|
+
["sera-veri-gorsel", "grafik, görselleştirme"],
|
|
129
|
+
],
|
|
130
|
+
],
|
|
131
|
+
[
|
|
132
|
+
"araştırma ve denetim",
|
|
133
|
+
[
|
|
134
|
+
["derin-arastirma", "çok kaynaklı araştırma, karşılaştırma"],
|
|
135
|
+
["sera-research", "araştır / sistem kur: hesaplı, kaynaklı, tek dosya rapor (bash gerekir)"],
|
|
136
|
+
["dusunme-dogrulama", "zor problem, kritik karar"],
|
|
137
|
+
["seo-audit", "site SEO denetimi"],
|
|
138
|
+
["uyumluluk-denetim", "KVKK/mevzuat uygunluğu"],
|
|
139
|
+
["sera-guvenlik-denetim", "güvenlik açığı taraması"],
|
|
140
|
+
["reverse-engineer-anything", "exe/ikili dosya tersine mühendislik"],
|
|
141
|
+
],
|
|
142
|
+
],
|
|
143
|
+
[
|
|
144
|
+
"kod",
|
|
145
|
+
[
|
|
146
|
+
["systematic-debugging", "hatanın kök nedenini bul"],
|
|
147
|
+
["sera-hata-ayikla", "hata/çökme ayıkla"],
|
|
148
|
+
["test-driven-development", "önce test yazarak geliştir"],
|
|
149
|
+
["sera-test-yaz", "var olan koda test ekle"],
|
|
150
|
+
["writing-plans", "büyük iş için uygulama planı"],
|
|
151
|
+
["requesting-code-review", "iş bitince inceleme iste"],
|
|
152
|
+
["sera-kod-inceleme", "kodu/PR'ı incele"],
|
|
153
|
+
["receiving-code-review", "gelen inceleme yorumlarını uygula"],
|
|
154
|
+
["sera-web-test", "sayfayı gerçek tarayıcıda test et, ekran görüntüsü"],
|
|
155
|
+
["sera-zamanli-gorev", "tekrarlayan/zamanlanmış iş"],
|
|
156
|
+
],
|
|
157
|
+
],
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
const LEVELS = [Number.POSITIVE_INFINITY, 160, 100, 60, 30, 0];
|
|
161
|
+
const PRIORITY_DESC_MAX = 240;
|
|
162
|
+
|
|
163
|
+
const norm = (p: string) => p.split(String.fromCharCode(92)).join("/");
|
|
164
|
+
const firstSentence = (d: string) => d.replace(/\s+/g, " ").trim();
|
|
165
|
+
function clip(d: string, n: number): string {
|
|
166
|
+
const t = firstSentence(d);
|
|
167
|
+
if (n === Number.POSITIVE_INFINITY || t.length <= n) return t;
|
|
168
|
+
if (n <= 0) return "";
|
|
169
|
+
return `${t.slice(0, n - 1).trimEnd()}…`;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Beceri dizinini `maxTokens` (≈ karakter/4) butcesine sigdirir. Siralama: kullanici/proje/yerlesik (priorityDirs) becerileri tam
|
|
174
|
+
* aciklamayla (en fazla 240 karakter) kalir; digerlerinin aciklamasi butce asilmayana dek kademeli kisaltilir (160/100/60/30/0).
|
|
175
|
+
* maxTokens <= 0 → undefined (motorun kendi bicimi, degisiklik yok). Hic beceri yoksa undefined.
|
|
176
|
+
*/
|
|
177
|
+
export function compactSkillsSection(
|
|
178
|
+
skills: SkillLike[],
|
|
179
|
+
opts: { maxTokens?: number; priorityDirs?: string[]; builtinDir?: string; collapseOver?: number } = {},
|
|
180
|
+
): string | undefined {
|
|
181
|
+
const max = opts.maxTokens ?? DEFAULT_SKILLS_MAX_TOKENS;
|
|
182
|
+
let vis = skills.filter((s) => !s.disableModelInvocation);
|
|
183
|
+
if (vis.length === 0 || !(max > 0)) return undefined;
|
|
184
|
+
let routed = "";
|
|
185
|
+
if (opts.builtinDir) {
|
|
186
|
+
const root = norm(opts.builtinDir).replace(/\/+$/, "");
|
|
187
|
+
const pathOf = (n: string) => `${root}/${n}/SKILL.md`.toLowerCase();
|
|
188
|
+
const has = new Set(vis.filter((s) => norm(s.filePath).toLowerCase() === pathOf(s.name)).map((s) => s.name));
|
|
189
|
+
const lines: string[] = [];
|
|
190
|
+
const done = new Set<string>();
|
|
191
|
+
for (const [group, items] of BUILTIN_ROUTES) {
|
|
192
|
+
const shown = items.filter(([n]) => has.has(n));
|
|
193
|
+
if (!shown.length) continue;
|
|
194
|
+
lines.push(`[${group}]`);
|
|
195
|
+
for (const [n, h] of shown) {
|
|
196
|
+
done.add(n);
|
|
197
|
+
lines.push(`- ${n}: ${h}`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (lines.length) routed = `\n<skill_dir path="${root}">\n${lines.join("\n")}\n</skill_dir>`;
|
|
201
|
+
vis = vis.filter((s) => !done.has(s.name));
|
|
202
|
+
}
|
|
203
|
+
const prio = (opts.priorityDirs ?? []).map((d) => norm(d).replace(/\/+$/, "").toLowerCase());
|
|
204
|
+
const isPrio = (s: SkillLike) => {
|
|
205
|
+
const f = norm(s.filePath).toLowerCase();
|
|
206
|
+
return prio.some((d) => f.startsWith(`${d}/`));
|
|
207
|
+
};
|
|
208
|
+
// ortak klasor: <dir>/<ad>/SKILL.md duzeni
|
|
209
|
+
const groups = new Map<string, SkillLike[]>();
|
|
210
|
+
const loose: SkillLike[] = [];
|
|
211
|
+
for (const s of vis) {
|
|
212
|
+
const f = norm(s.filePath);
|
|
213
|
+
const suffix = `/${s.name}/SKILL.md`;
|
|
214
|
+
if (f.endsWith(suffix)) {
|
|
215
|
+
const dir = f.slice(0, f.length - suffix.length);
|
|
216
|
+
if (!groups.has(dir)) groups.set(dir, []);
|
|
217
|
+
groups.get(dir)!.push(s);
|
|
218
|
+
} else loose.push(s);
|
|
219
|
+
}
|
|
220
|
+
const head = [
|
|
221
|
+
"Skills: if the task matches one, FIRST read <dir>/<name>/SKILL.md and follow it ([labels] are categories; chit-chat needs no skill).",
|
|
222
|
+
].join("\n");
|
|
223
|
+
// Token tasarrufu (sahip 2026-11-11): Sera'ya ait olmayan buyuk beceri klasorleri (or. ~/.agents/skills, 150 beceri) her
|
|
224
|
+
// istekte ad ad listelenmez; tek satir isaretci gider. Beceriler kaybolmaz: model glob ile listeler, SKILL.md'yi read ile yukler.
|
|
225
|
+
// collapseOver <= 0 -> kapali (eski davranis: adlar hep listelenir).
|
|
226
|
+
const collapseOver = opts.collapseOver ?? DEFAULT_SKILLS_COLLAPSE_OVER;
|
|
227
|
+
const collapsed = (dir: string, list: SkillLike[]) =>
|
|
228
|
+
collapseOver > 0 && list.length > collapseOver && !list.some(isPrio)
|
|
229
|
+
? `\n<skill_dir path="${dir}" count="${list.length}">\n(${list.length} more skills here; names omitted to save tokens. If the task needs a specialized skill, list them with the glob tool pattern "${dir}/*/SKILL.md", then read the matching SKILL.md.)\n</skill_dir>`
|
|
230
|
+
: undefined;
|
|
231
|
+
const render = (level: number): string => {
|
|
232
|
+
const out: string[] = [head + routed];
|
|
233
|
+
const line = (s: SkillLike, withPath: boolean) => {
|
|
234
|
+
const d = clip(
|
|
235
|
+
s.description,
|
|
236
|
+
isPrio(s)
|
|
237
|
+
? Math.min(
|
|
238
|
+
PRIORITY_DESC_MAX,
|
|
239
|
+
level === Number.POSITIVE_INFINITY ? PRIORITY_DESC_MAX : Math.max(level, 100),
|
|
240
|
+
)
|
|
241
|
+
: level,
|
|
242
|
+
);
|
|
243
|
+
return `- ${s.name}${d ? `: ${d}` : ""}${withPath ? ` (${norm(s.filePath)})` : ""}`;
|
|
244
|
+
};
|
|
245
|
+
for (const [dir, list] of groups) {
|
|
246
|
+
const c = collapsed(dir, list);
|
|
247
|
+
if (c) {
|
|
248
|
+
out.push(c);
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
out.push(`\n<skill_dir path="${dir}">`);
|
|
252
|
+
for (const s of list) out.push(line(s, false));
|
|
253
|
+
out.push("</skill_dir>");
|
|
254
|
+
}
|
|
255
|
+
if (loose.length) {
|
|
256
|
+
out.push("\n<skills_other>");
|
|
257
|
+
for (const s of loose) out.push(line(s, true));
|
|
258
|
+
out.push("</skills_other>");
|
|
259
|
+
}
|
|
260
|
+
return out.join("\n");
|
|
261
|
+
};
|
|
262
|
+
const tokens = (t: string) => Math.ceil(t.length / 4);
|
|
263
|
+
for (const lv of LEVELS) {
|
|
264
|
+
const t = render(lv);
|
|
265
|
+
if (tokens(t) <= max) return t;
|
|
266
|
+
}
|
|
267
|
+
return render(0); // adlar her zaman listelenir (butce asilsa bile: hicbir beceri gizlenmez)
|
|
268
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anlik kopya (snapshot) / geri al / yeniden yap: proje klasorunun gizli bir git deposunda (kullanicinin
|
|
3
|
+
* kendi .git'ine DOKUNMADAN, ~/.sera/snapshots/<klasor-ozeti>) agac ozetleri tutulur.
|
|
4
|
+
*
|
|
5
|
+
* Ilke: geri alma yalniz o turun degistirdigi dosyalara dokunur; tur bittikten sonra kullanicinin kendisinin
|
|
6
|
+
* degistirdigi dosya ATLANIR (ustune yazilmaz) ve raporlanir. Proje .gitignore'u gecerlidir.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { spawn } from "node:child_process";
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
12
|
+
import { homedir } from "node:os";
|
|
13
|
+
import { dirname, join, resolve, sep } from "node:path";
|
|
14
|
+
|
|
15
|
+
export interface RestoreReport {
|
|
16
|
+
restored: string[];
|
|
17
|
+
deleted: string[];
|
|
18
|
+
/** Turdan sonra kullanicinin degistirdigi, bu yuzden dokunulmayan dosyalar. */
|
|
19
|
+
skipped: string[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const DEFAULT_EXCLUDES = ["node_modules/", ".sera/snapshots/", "*.log"];
|
|
23
|
+
|
|
24
|
+
function run(args: string[], env: NodeJS.ProcessEnv, cwd: string): Promise<{ code: number; out: Buffer }> {
|
|
25
|
+
return new Promise((res, rej) => {
|
|
26
|
+
const p = spawn("git", args, { cwd, env, stdio: ["ignore", "pipe", "pipe"], windowsHide: true });
|
|
27
|
+
const chunks: Buffer[] = [];
|
|
28
|
+
p.stdout.on("data", (c: Buffer) => chunks.push(c));
|
|
29
|
+
p.stderr.on("data", () => {});
|
|
30
|
+
p.on("error", rej);
|
|
31
|
+
p.on("close", (code) => res({ code: code ?? 1, out: Buffer.concat(chunks) }));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class SnapshotStore {
|
|
36
|
+
readonly gitDir: string;
|
|
37
|
+
readonly workTree: string;
|
|
38
|
+
private ready: Promise<void> | undefined;
|
|
39
|
+
|
|
40
|
+
constructor(workTree: string, baseDir = join(homedir(), ".sera", "snapshots")) {
|
|
41
|
+
this.workTree = resolve(workTree);
|
|
42
|
+
const key = createHash("sha1").update(this.workTree.toLowerCase()).digest("hex").slice(0, 16);
|
|
43
|
+
this.gitDir = join(baseDir, key);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private env(): NodeJS.ProcessEnv {
|
|
47
|
+
return { ...process.env, GIT_DIR: this.gitDir, GIT_WORK_TREE: this.workTree, GIT_INDEX_FILE: undefined };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private async git(args: string[]): Promise<Buffer> {
|
|
51
|
+
const r = await run(
|
|
52
|
+
["-c", "core.autocrlf=false", "-c", "core.safecrlf=false", "-c", "core.quotepath=false", ...args],
|
|
53
|
+
this.env(),
|
|
54
|
+
this.workTree,
|
|
55
|
+
);
|
|
56
|
+
if (r.code !== 0) throw new Error(`git ${args[0]} basarisiz (${r.code})`);
|
|
57
|
+
return r.out;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private init(): Promise<void> {
|
|
61
|
+
this.ready ??= (async () => {
|
|
62
|
+
if (!existsSync(join(this.gitDir, "HEAD"))) {
|
|
63
|
+
mkdirSync(this.gitDir, { recursive: true });
|
|
64
|
+
await this.git(["init", "-q"]);
|
|
65
|
+
mkdirSync(join(this.gitDir, "info"), { recursive: true });
|
|
66
|
+
writeFileSync(join(this.gitDir, "info", "exclude"), `${DEFAULT_EXCLUDES.join("\n")}\n`);
|
|
67
|
+
}
|
|
68
|
+
})();
|
|
69
|
+
return this.ready;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Calisma klasorunun su anki halini kaydeder; agac ozetini doner. */
|
|
73
|
+
async track(): Promise<string> {
|
|
74
|
+
await this.init();
|
|
75
|
+
await this.git(["add", "-A", "--", "."]);
|
|
76
|
+
return (await this.git(["write-tree"])).toString().trim();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** iki agac arasinda degisen dosyalar (goreli, / ayracli). */
|
|
80
|
+
async changed(from: string, to: string): Promise<string[]> {
|
|
81
|
+
if (from === to) return [];
|
|
82
|
+
const out = (await this.git(["diff-tree", "-r", "--name-only", "--no-renames", "-z", from, to])).toString();
|
|
83
|
+
return out.split("\0").filter(Boolean);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private async blobIn(tree: string, path: string): Promise<string | undefined> {
|
|
87
|
+
const r = await run(["rev-parse", "-q", "--verify", `${tree}:${path}`], this.env(), this.workTree);
|
|
88
|
+
return r.code === 0 ? r.out.toString().trim() : undefined;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private async blobNow(path: string): Promise<string | undefined> {
|
|
92
|
+
const abs = this.abs(path);
|
|
93
|
+
if (!existsSync(abs)) return undefined;
|
|
94
|
+
return (await this.git(["hash-object", "--", abs])).toString().trim();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private abs(path: string): string {
|
|
98
|
+
const abs = resolve(this.workTree, path);
|
|
99
|
+
if (abs !== this.workTree && !abs.startsWith(this.workTree + sep)) throw new Error(`klasor disi yol: ${path}`);
|
|
100
|
+
return abs;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* `to` halindeki dosyalari `from` haline dondurur (geri al: from=tur oncesi, to=tur sonu; yeniden yap: tersi).
|
|
105
|
+
* Simdiki icerigi `to` ile ayni olmayan dosya kullanicinin sonradan degistirdigidir: atlanir.
|
|
106
|
+
*/
|
|
107
|
+
async restore(from: string, to: string): Promise<RestoreReport> {
|
|
108
|
+
await this.init();
|
|
109
|
+
const rep: RestoreReport = { restored: [], deleted: [], skipped: [] };
|
|
110
|
+
for (const path of await this.changed(from, to)) {
|
|
111
|
+
const [want, after, now] = await Promise.all([
|
|
112
|
+
this.blobIn(from, path),
|
|
113
|
+
this.blobIn(to, path),
|
|
114
|
+
this.blobNow(path),
|
|
115
|
+
]);
|
|
116
|
+
if (now !== after) {
|
|
117
|
+
rep.skipped.push(path);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const abs = this.abs(path);
|
|
121
|
+
if (!want) {
|
|
122
|
+
rmSync(abs, { force: true });
|
|
123
|
+
rep.deleted.push(path);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
mkdirSync(dirname(abs), { recursive: true });
|
|
127
|
+
writeFileSync(abs, await this.git(["cat-file", "blob", want]));
|
|
128
|
+
rep.restored.push(path);
|
|
129
|
+
}
|
|
130
|
+
return rep;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Sade Turkce ozet (kullaniciya/modele). */
|
|
135
|
+
export function restoreSummary(rep: RestoreReport, verb: "geri alindi" | "yeniden uygulandi"): string {
|
|
136
|
+
const n = rep.restored.length + rep.deleted.length;
|
|
137
|
+
const parts = [n ? `${n} dosya ${verb}.` : "Degisen dosya yok."];
|
|
138
|
+
if (rep.skipped.length)
|
|
139
|
+
parts.push(
|
|
140
|
+
`Sonradan senin degistirdigin ${rep.skipped.length} dosyaya dokunulmadi: ${rep.skipped.slice(0, 5).join(", ")}${rep.skipped.length > 5 ? " ..." : ""}`,
|
|
141
|
+
);
|
|
142
|
+
return parts.join(" ");
|
|
143
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tarif kapsama kapısı (2026-11-12, sahip: "Sera bu projeyi bütün özellikleriyle kendi yapabilmeli").
|
|
3
|
+
*
|
|
4
|
+
* Gözlem (örgü mağazası denemesi, sera-zen): ajan SPEC.md'deki maddelerin bir kısmını hiç yazmadan "4/4 adım tamam,
|
|
5
|
+
* doğrulama GEÇTİ" dedi — kendi kaba yapılacaklar listesini doğruladı, tarifin kendisini değil. Bu kapı, kullanıcı
|
|
6
|
+
* bir tarif dosyası (ya da uzun madde listesi) verdiğinde, ajan bitirdiğinde tarifin HER maddesi için koddan kanıt
|
|
7
|
+
* ister; eksik bulunan maddeyi o turda uygulatır. En çok MAX_ROUNDS tur (bütçe güvenliği), SERA_SPEC_GATE=0 kapatır.
|
|
8
|
+
*
|
|
9
|
+
* Bu modül SAFtır (dosya okuma dışarıdan verilir); bağlama extension.ts'te.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export const MAX_ROUNDS = 3;
|
|
13
|
+
export const MAX_ITEMS = 60;
|
|
14
|
+
export const DONE_MARK = "SPEC_TAMAM";
|
|
15
|
+
|
|
16
|
+
export interface SpecGateState {
|
|
17
|
+
source: string;
|
|
18
|
+
items: string[];
|
|
19
|
+
rounds: number;
|
|
20
|
+
passed: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const BULLET = /^\s{0,6}(?:[-*+•]|\d{1,3}[.)])\s+(.+)$/;
|
|
24
|
+
|
|
25
|
+
/** Markdown/metinden atomik gereksinim maddeleri: madde işaretli satırlar (çok kısa olanlar ve kod blokları hariç). */
|
|
26
|
+
export function extractItems(text: string): string[] {
|
|
27
|
+
const out: string[] = [];
|
|
28
|
+
let inCode = false;
|
|
29
|
+
for (const raw of text.split(/\r?\n/)) {
|
|
30
|
+
if (/^\s*```/.test(raw)) {
|
|
31
|
+
inCode = !inCode;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (inCode) continue;
|
|
35
|
+
const m = BULLET.exec(raw);
|
|
36
|
+
if (!m) continue;
|
|
37
|
+
const item = m[1]!.replace(/\s+/g, " ").trim();
|
|
38
|
+
if (item.length < 12) continue;
|
|
39
|
+
out.push(item.length > 220 ? `${item.slice(0, 217)}...` : item);
|
|
40
|
+
if (out.length >= MAX_ITEMS) break;
|
|
41
|
+
}
|
|
42
|
+
return out;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** İstemde adı geçen tarif dosyaları (ör. SPEC.md, gereksinimler.txt, docs/plan.md). */
|
|
46
|
+
export function specFileRefs(prompt: string): string[] {
|
|
47
|
+
const refs = new Set<string>();
|
|
48
|
+
for (const m of prompt.matchAll(/(?:^|[\s"'`(])([\w./-]{1,160}\.(?:md|markdown|txt))(?=$|[\s"'`),.;:!?])/gi))
|
|
49
|
+
refs.add(m[1]!);
|
|
50
|
+
return [...refs];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Kullanıcı istemi için kapı durumu. Dosya okuyucu dışarıdan verilir (yoksa/okunamazsa undefined döner).
|
|
55
|
+
* En az 5 madde yoksa kapı açılmaz (kısa istekte ek tur/maliyet yok).
|
|
56
|
+
*/
|
|
57
|
+
export function startGate(prompt: string, readFile: (ref: string) => string | undefined): SpecGateState | undefined {
|
|
58
|
+
for (const ref of specFileRefs(prompt)) {
|
|
59
|
+
const body = readFile(ref);
|
|
60
|
+
if (!body) continue;
|
|
61
|
+
const items = extractItems(body);
|
|
62
|
+
if (items.length >= 5) return { source: ref, items, rounds: 0, passed: false };
|
|
63
|
+
}
|
|
64
|
+
const inline = extractItems(prompt);
|
|
65
|
+
if (inline.length >= 8) return { source: "istem", items: inline, rounds: 0, passed: false };
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Ajanın son cevabı denetimi geçti mi: işaret var ve EKSİK satırı yok. */
|
|
70
|
+
export function auditPassed(lastText: string): boolean {
|
|
71
|
+
if (!lastText.includes(DONE_MARK)) return false;
|
|
72
|
+
return !/\bEKS[İI]K\b/i.test(lastText.replace(new RegExp(DONE_MARK, "g"), ""));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Denetim turu istemi: her madde için koddan kanıt ya da EKSİK; eksikler şimdi uygulanır. */
|
|
76
|
+
export function auditPrompt(s: SpecGateState): string {
|
|
77
|
+
const list = s.items.map((it, i) => `${i + 1}. ${it}`).join("\n");
|
|
78
|
+
return [
|
|
79
|
+
`[Sera tarif kapsama denetimi ${s.rounds}/${MAX_ROUNDS} — kaynak: ${s.source}]`,
|
|
80
|
+
"Bitti demeden önce tarifin HER maddesini kodda doğrula. Kendi yapılacaklar listen değil, AŞAĞIDAKİ maddeler esas.",
|
|
81
|
+
"Her madde için grep/read ile ara; kanıt = dosya:satır. Varsayım yapma, hatırladığına güvenme.",
|
|
82
|
+
"1) Önce kısa tablo: `no | VAR dosya:satır` ya da `no | EKSİK neden`.",
|
|
83
|
+
"2) EKSİK olan her maddeyi ŞİMDİ uygula (dosyayı düzenle), sonra çalıştırarak/okuyarak doğrula.",
|
|
84
|
+
`3) Tüm maddeler VAR olduğunda son satıra tek başına ${DONE_MARK} yaz. Bir madde gerçekten yapılamıyorsa (dış hesap, anahtar, donanım) "YAPILAMAZ: neden" yaz; EKSİK bırakma.`,
|
|
85
|
+
"",
|
|
86
|
+
list,
|
|
87
|
+
].join("\n");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** agent_end kararı: devam turu istemi, bitiş notu ya da hiçbir şey. */
|
|
91
|
+
export function onAgentEnd(
|
|
92
|
+
s: SpecGateState | undefined,
|
|
93
|
+
lastText: string,
|
|
94
|
+
): { followUp?: string; note?: string; level?: "info" | "warning" } {
|
|
95
|
+
if (!s || s.passed) return {};
|
|
96
|
+
if (s.rounds > 0 && auditPassed(lastText)) {
|
|
97
|
+
s.passed = true;
|
|
98
|
+
return {
|
|
99
|
+
note: `[Sera] Tarif kapsama: ${s.items.length} maddenin tamamı kodda kanıtlandı (${s.source}).`,
|
|
100
|
+
level: "info",
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (s.rounds >= MAX_ROUNDS) {
|
|
104
|
+
s.passed = true; // daha fazla tur yok (bütçe); kullanıcı açıkça bilgilendirilir
|
|
105
|
+
return {
|
|
106
|
+
note: `[Sera] Tarif kapsama ${MAX_ROUNDS} turda doğrulanamadı (${s.source}); son tablodaki EKSİK maddeler hâlâ açık olabilir.`,
|
|
107
|
+
level: "warning",
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
s.rounds++;
|
|
111
|
+
return { followUp: auditPrompt(s) };
|
|
112
|
+
}
|