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.
Files changed (457) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE-SERA.md +33 -0
  3. package/README.md +27 -2
  4. package/THIRD_PARTY_NOTICES.md +68 -0
  5. package/bin/sera.mjs +145 -0
  6. package/dist/bundle/chunks/anthropic-messages-RD7GXOQL.js +6 -0
  7. package/dist/bundle/chunks/anthropic.js +75 -0
  8. package/dist/bundle/chunks/azure-openai-responses-CJT3KTVK.js +2 -0
  9. package/dist/bundle/chunks/bedrock-converse-stream.js +89 -0
  10. package/dist/bundle/chunks/chunk-46WGNYIE.js +82 -0
  11. package/dist/bundle/chunks/chunk-4UNN5OGR.js +4 -0
  12. package/dist/bundle/chunks/chunk-53H5DPHA.js +16 -0
  13. package/dist/bundle/chunks/chunk-5AGIVGSV.js +6 -0
  14. package/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
  15. package/dist/bundle/chunks/chunk-7CBJINYJ.js +20 -0
  16. package/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
  17. package/dist/bundle/chunks/chunk-7RZ5BS7U.js +2 -0
  18. package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
  19. package/dist/bundle/chunks/chunk-AZC5WTED.js +1222 -0
  20. package/dist/bundle/chunks/chunk-BPHHHEET.js +9 -0
  21. package/dist/bundle/chunks/chunk-BSS6T6KQ.js +2 -0
  22. package/dist/bundle/chunks/chunk-CF5GWZHW.js +31 -0
  23. package/dist/bundle/chunks/chunk-EDSQGWII.js +44 -0
  24. package/dist/bundle/chunks/chunk-FFMDRXC4.js +10 -0
  25. package/dist/bundle/chunks/chunk-HODJBMOY.js +9 -0
  26. package/dist/bundle/chunks/chunk-HQBQWHLD.js +7 -0
  27. package/dist/bundle/chunks/chunk-HQJBN2MC.js +2 -0
  28. package/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
  29. package/dist/bundle/chunks/chunk-KXU77PUU.js +4 -0
  30. package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
  31. package/dist/bundle/chunks/chunk-LOMPDCMP.js +2 -0
  32. package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
  33. package/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
  34. package/dist/bundle/chunks/chunk-M3LEVT3X.js +2 -0
  35. package/dist/bundle/chunks/chunk-P7FPUEYA.js +2 -0
  36. package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
  37. package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
  38. package/dist/bundle/chunks/chunk-PMRZO46Y.js +2 -0
  39. package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
  40. package/dist/bundle/chunks/chunk-QTM7S6TH.js +2 -0
  41. package/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
  42. package/dist/bundle/chunks/chunk-TLNP2BSO.js +2 -0
  43. package/dist/bundle/chunks/chunk-TMKHGABX.js +2 -0
  44. package/dist/bundle/chunks/chunk-TMTOQ7H7.js +2 -0
  45. package/dist/bundle/chunks/chunk-UKVNB6C4.js +2 -0
  46. package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
  47. package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
  48. package/dist/bundle/chunks/chunk-ZLAHUYDW.js +131 -0
  49. package/dist/bundle/chunks/chunk-ZNCN2NGY.js +60 -0
  50. package/dist/bundle/chunks/cli-MML2DU4A.js +51 -0
  51. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-QPZQRBK5.js +2 -0
  52. package/dist/bundle/chunks/codemode-worker.js +478 -0
  53. package/dist/bundle/chunks/dist-ZNZCJI7B.js +7 -0
  54. package/dist/bundle/chunks/easter-egg-3d-VOETWRJO.js +2 -0
  55. package/dist/bundle/chunks/execute-HXDNZ26B.js +505 -0
  56. package/dist/bundle/chunks/github-copilot.js +2 -0
  57. package/dist/bundle/chunks/google-generative-ai-SJXMIEPZ.js +2 -0
  58. package/dist/bundle/chunks/google-vertex-VSXQ3BDH.js +2 -0
  59. package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +13 -0
  60. package/dist/bundle/chunks/image-resize-worker.js +2 -0
  61. package/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +21 -0
  62. package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +2 -0
  63. package/dist/bundle/chunks/kimi-coding.js +2 -0
  64. package/dist/bundle/chunks/lib-4AVRLBHM.js +9 -0
  65. package/dist/bundle/chunks/llama-cpp-classify-4KFSGAMH.js +22 -0
  66. package/dist/bundle/chunks/meta.js +2 -0
  67. package/dist/bundle/chunks/mistral-conversations-JYWDZV2K.js +5 -0
  68. package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
  69. package/dist/bundle/chunks/node-AUOGOBCN.js +2 -0
  70. package/dist/bundle/chunks/node-KCMANYC2.js +16 -0
  71. package/dist/bundle/chunks/openai-chatgpt.js +75 -0
  72. package/dist/bundle/chunks/openai-codex-responses-OQV5DCFA.js +10 -0
  73. package/dist/bundle/chunks/openai-codex.js +75 -0
  74. package/dist/bundle/chunks/openai-completions-RFDJM2W5.js +7 -0
  75. package/dist/bundle/chunks/openai-decisions-O6PHBSCB.js +5 -0
  76. package/dist/bundle/chunks/openai-responses-LVNAPALQ.js +4 -0
  77. package/dist/bundle/chunks/openrouter-images-4WG6OOLH.js +2 -0
  78. package/dist/bundle/chunks/openrouter.js +75 -0
  79. package/dist/bundle/chunks/pdfjs-BETXZQ7A.js +108 -0
  80. package/dist/bundle/chunks/pdfjs-decoders-37HBPYHX.js +2 -0
  81. package/dist/bundle/chunks/pdfjs-jbig2-MH7WRXUP.js +2 -0
  82. package/dist/bundle/chunks/pdfjs-jbig2_nowasm_fallback-UVK7AQLA.js +2 -0
  83. package/dist/bundle/chunks/pdfjs-openjpeg-TC2QHC4G.js +2 -0
  84. package/dist/bundle/chunks/pdfjs-openjpeg_nowasm_fallback-ZC2FTHCZ.js +3 -0
  85. package/dist/bundle/chunks/pi-messages-EZXKVRR6.js +8 -0
  86. package/dist/bundle/chunks/radius.js +75 -0
  87. package/dist/bundle/chunks/runtime-JAH75CB5.js +2 -0
  88. package/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
  89. package/dist/bundle/chunks/typesafe-system-one-X3JT6ECA.js +2 -0
  90. package/dist/bundle/chunks/virtual-modules-Z2V3PTLI.js +2 -0
  91. package/dist/bundle/chunks/xai.js +2 -0
  92. package/dist/bundle/cli-runtime.js +3 -0
  93. package/dist/bundle/cli.js +5 -0
  94. package/dist/bundle/index.js +2 -0
  95. package/dist/bundle/rpc-entry.js +3 -0
  96. package/dist/core/export-html/ansi-to-html.d.ts +22 -0
  97. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  98. package/dist/core/export-html/ansi-to-html.js +249 -0
  99. package/dist/core/export-html/ansi-to-html.js.map +1 -0
  100. package/dist/core/export-html/index.d.ts +37 -0
  101. package/dist/core/export-html/index.d.ts.map +1 -0
  102. package/dist/core/export-html/index.js +228 -0
  103. package/dist/core/export-html/index.js.map +1 -0
  104. package/dist/core/export-html/template.css +1085 -0
  105. package/dist/core/export-html/template.html +56 -0
  106. package/dist/core/export-html/template.js +2044 -0
  107. package/dist/core/export-html/tool-renderer.d.ts +34 -0
  108. package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  109. package/dist/core/export-html/tool-renderer.js +110 -0
  110. package/dist/core/export-html/tool-renderer.js.map +1 -0
  111. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  112. package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
  113. package/dist/core/export-html/vendor/marked.min.js +79 -0
  114. package/dist/modes/interactive/assets/clankolas.png +0 -0
  115. package/dist/modes/interactive/theme/dark.json +81 -0
  116. package/dist/modes/interactive/theme/light.json +81 -0
  117. package/dist/modes/interactive/theme/system-theme.d.ts +55 -0
  118. package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
  119. package/dist/modes/interactive/theme/system-theme.js +546 -0
  120. package/dist/modes/interactive/theme/system-theme.js.map +1 -0
  121. package/dist/modes/interactive/theme/theme-controller.d.ts +81 -0
  122. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
  123. package/dist/modes/interactive/theme/theme-controller.js +210 -0
  124. package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
  125. package/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
  126. package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
  127. package/dist/modes/interactive/theme/theme-schema.js +105 -0
  128. package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
  129. package/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
  130. package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
  131. package/dist/modes/interactive/theme/theme-tokens.js +94 -0
  132. package/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
  133. package/dist/modes/interactive/theme/theme.d.ts +155 -0
  134. package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  135. package/dist/modes/interactive/theme/theme.js +905 -0
  136. package/dist/modes/interactive/theme/theme.js.map +1 -0
  137. package/docs/cli-integration.md +106 -0
  138. package/docs/cli.md +333 -0
  139. package/docs/codemode.md +230 -0
  140. package/docs/compaction.md +463 -0
  141. package/docs/configuration.md +47 -0
  142. package/docs/containerization.md +183 -0
  143. package/docs/custom-provider.md +227 -0
  144. package/docs/docs.json +220 -0
  145. package/docs/environment-variables.md +102 -0
  146. package/docs/extensions.md +400 -0
  147. package/docs/how-pi-works.md +49 -0
  148. package/docs/index.md +39 -0
  149. package/docs/json.md +226 -0
  150. package/docs/keybindings.md +195 -0
  151. package/docs/llama-cpp.md +121 -0
  152. package/docs/mcp.md +272 -0
  153. package/docs/message-types.md +279 -0
  154. package/docs/models-configuration.md +196 -0
  155. package/docs/models.md +225 -0
  156. package/docs/nvidia-rtx-llama-cpp.md +96 -0
  157. package/docs/packages.md +131 -0
  158. package/docs/prompt-templates.md +59 -0
  159. package/docs/providers.md +247 -0
  160. package/docs/quickstart.md +136 -0
  161. package/docs/rpc-commands.md +860 -0
  162. package/docs/rpc-extension-ui.md +200 -0
  163. package/docs/rpc.md +193 -0
  164. package/docs/sdk.md +147 -0
  165. package/docs/security.md +99 -0
  166. package/docs/session-format.md +293 -0
  167. package/docs/sessions.md +66 -0
  168. package/docs/settings.md +172 -0
  169. package/docs/shell-aliases.md +93 -0
  170. package/docs/skills.md +93 -0
  171. package/docs/slash-commands.md +61 -0
  172. package/docs/terminal-setup.md +233 -0
  173. package/docs/termux.md +117 -0
  174. package/docs/themes.md +138 -0
  175. package/docs/tmux.md +55 -0
  176. package/docs/tui.md +195 -0
  177. package/docs/usage.md +94 -0
  178. package/docs/virtual-models.md +114 -0
  179. package/docs/windows.md +81 -0
  180. package/lib/auth.js +377 -0
  181. package/lib/provider.js +71 -0
  182. package/package.json +43 -5
  183. package/sera-core/skills/apple-tasarim/SKILL.md +48 -0
  184. package/sera-core/skills/apple-tasarim/referanslar/apple-hig.md +55 -0
  185. package/sera-core/skills/belge-yarat/SKILL.md +64 -0
  186. package/sera-core/skills/belge-yarat/referanslar/belge-yazim.md +60 -0
  187. package/sera-core/skills/derin-arastirma/SKILL.md +52 -0
  188. package/sera-core/skills/derin-arastirma/referanslar/arastirma-yontem.md +50 -0
  189. package/sera-core/skills/dusunme-dogrulama/SKILL.md +59 -0
  190. package/sera-core/skills/dusunme-dogrulama/referanslar/dusunme-kontrol.md +54 -0
  191. package/sera-core/skills/film-stilleri/SKILL.md +51 -0
  192. package/sera-core/skills/hyperframes/LICENSE-UPSTREAM +190 -0
  193. package/sera-core/skills/hyperframes/SKILL.md +79 -0
  194. package/sera-core/skills/hyperframes/assets/frame-presets/biennale-yellow/FRAME.md +289 -0
  195. package/sera-core/skills/hyperframes/assets/frame-presets/blockframe/FRAME.md +275 -0
  196. package/sera-core/skills/hyperframes/assets/frame-presets/blue-professional/FRAME.md +307 -0
  197. package/sera-core/skills/hyperframes/assets/frame-presets/bold-poster/FRAME.md +275 -0
  198. package/sera-core/skills/hyperframes/assets/frame-presets/broadside/FRAME.md +284 -0
  199. package/sera-core/skills/hyperframes/assets/frame-presets/capsule/FRAME.md +284 -0
  200. package/sera-core/skills/hyperframes/assets/frame-presets/cartesian/FRAME.md +278 -0
  201. package/sera-core/skills/hyperframes/assets/frame-presets/cobalt-grid/FRAME.md +265 -0
  202. package/sera-core/skills/hyperframes/assets/frame-presets/code-editorial/FRAME.md +277 -0
  203. package/sera-core/skills/hyperframes/assets/frame-presets/coral/FRAME.md +314 -0
  204. package/sera-core/skills/hyperframes/assets/frame-presets/creative-mode/FRAME.md +333 -0
  205. package/sera-core/skills/hyperframes/assets/frame-presets/daisy-days/FRAME.md +274 -0
  206. package/sera-core/skills/hyperframes/assets/frame-presets/editorial-forest/FRAME.md +265 -0
  207. package/sera-core/skills/hyperframes/references/captions.md +46 -0
  208. package/sera-core/skills/hyperframes/references/film.md +48 -0
  209. package/sera-core/skills/hyperframes/references/format.md +159 -0
  210. package/sera-core/skills/hyperframes/references/look.md +69 -0
  211. package/sera-core/skills/hyperframes/references/motion.md +95 -0
  212. package/sera-core/skills/hyperframes/references/overlays.md +39 -0
  213. package/sera-core/skills/hyperframes/references/path-tracing.md +36 -0
  214. package/sera-core/skills/hyperframes/references/plugin-installation.md +42 -0
  215. package/sera-core/skills/hyperframes/references/review.md +51 -0
  216. package/sera-core/skills/hyperframes/references/runtimes.md +69 -0
  217. package/sera-core/skills/hyperframes/references/skill-lifecycle.md +54 -0
  218. package/sera-core/skills/hyperframes/references/sound.md +43 -0
  219. package/sera-core/skills/hyperframes/references/spec.md +76 -0
  220. package/sera-core/skills/hyperframes/references/story.md +103 -0
  221. package/sera-core/skills/hyperframes/references/storyboard-format.md +107 -0
  222. package/sera-core/skills/hyperframes/references/storyboard.md +36 -0
  223. package/sera-core/skills/hyperframes/references/types/3d.md +25 -0
  224. package/sera-core/skills/hyperframes/references/types/character.md +20 -0
  225. package/sera-core/skills/hyperframes/references/types/data.md +19 -0
  226. package/sera-core/skills/hyperframes/references/types/explainer.md +34 -0
  227. package/sera-core/skills/hyperframes/references/types/launch.md +41 -0
  228. package/sera-core/skills/hyperframes/references/types/music.md +24 -0
  229. package/sera-core/skills/hyperframes/references/types/vertical.md +23 -0
  230. package/sera-core/skills/hyperframes-cli/LICENSE-UPSTREAM +190 -0
  231. package/sera-core/skills/hyperframes-cli/SKILL.md +99 -0
  232. package/sera-core/skills/hyperframes-cli/references/beats.md +17 -0
  233. package/sera-core/skills/hyperframes-cli/references/compare-and-batch.md +105 -0
  234. package/sera-core/skills/hyperframes-cli/references/conventions.md +16 -0
  235. package/sera-core/skills/hyperframes-cli/references/doctor-browser.md +80 -0
  236. package/sera-core/skills/hyperframes-cli/references/feedback.md +14 -0
  237. package/sera-core/skills/hyperframes-cli/references/init-and-scaffold.md +75 -0
  238. package/sera-core/skills/hyperframes-cli/references/lint-validate-inspect.md +164 -0
  239. package/sera-core/skills/hyperframes-cli/references/preview-render.md +204 -0
  240. package/sera-core/skills/hyperframes-cli/references/upgrade-info-misc.md +134 -0
  241. package/sera-core/skills/impeccable/LICENSE-UPSTREAM +191 -0
  242. package/sera-core/skills/impeccable/NOTICE-UPSTREAM.md +11 -0
  243. package/sera-core/skills/impeccable/SKILL.md +89 -0
  244. package/sera-core/skills/impeccable/reference/adapt.md +318 -0
  245. package/sera-core/skills/impeccable/reference/adapt.native.md +58 -0
  246. package/sera-core/skills/impeccable/reference/android.md +46 -0
  247. package/sera-core/skills/impeccable/reference/animate.md +89 -0
  248. package/sera-core/skills/impeccable/reference/audit.md +139 -0
  249. package/sera-core/skills/impeccable/reference/audit.native.md +139 -0
  250. package/sera-core/skills/impeccable/reference/bolder.md +33 -0
  251. package/sera-core/skills/impeccable/reference/clarify.md +94 -0
  252. package/sera-core/skills/impeccable/reference/colorize.md +86 -0
  253. package/sera-core/skills/impeccable/reference/component-review.md +63 -0
  254. package/sera-core/skills/impeccable/reference/craft-floor.md +44 -0
  255. package/sera-core/skills/impeccable/reference/craft.md +5 -0
  256. package/sera-core/skills/impeccable/reference/critique.md +819 -0
  257. package/sera-core/skills/impeccable/reference/degraded/asset-producer.md +42 -0
  258. package/sera-core/skills/impeccable/reference/degraded/documenter.md +24 -0
  259. package/sera-core/skills/impeccable/reference/degraded/finish-reviewer.md +38 -0
  260. package/sera-core/skills/impeccable/reference/degraded/manual-edit-applier.md +93 -0
  261. package/sera-core/skills/impeccable/reference/delight.md +70 -0
  262. package/sera-core/skills/impeccable/reference/distill.md +111 -0
  263. package/sera-core/skills/impeccable/reference/doctor.md +54 -0
  264. package/sera-core/skills/impeccable/reference/document.md +416 -0
  265. package/sera-core/skills/impeccable/reference/extract.md +69 -0
  266. package/sera-core/skills/impeccable/reference/generate.md +101 -0
  267. package/sera-core/skills/impeccable/reference/harden.md +362 -0
  268. package/sera-core/skills/impeccable/reference/hooks.md +120 -0
  269. package/sera-core/skills/impeccable/reference/init.md +133 -0
  270. package/sera-core/skills/impeccable/reference/ios.md +51 -0
  271. package/sera-core/skills/impeccable/reference/layout.md +84 -0
  272. package/sera-core/skills/impeccable/reference/live-setup.md +104 -0
  273. package/sera-core/skills/impeccable/reference/live.md +327 -0
  274. package/sera-core/skills/impeccable/reference/mode-operate.md +21 -0
  275. package/sera-core/skills/impeccable/reference/mode-persuade.md +19 -0
  276. package/sera-core/skills/impeccable/reference/mode-read.md +21 -0
  277. package/sera-core/skills/impeccable/reference/new-work.md +152 -0
  278. package/sera-core/skills/impeccable/reference/onboard.md +234 -0
  279. package/sera-core/skills/impeccable/reference/operate.md +61 -0
  280. package/sera-core/skills/impeccable/reference/optimize.md +257 -0
  281. package/sera-core/skills/impeccable/reference/overdrive.md +127 -0
  282. package/sera-core/skills/impeccable/reference/polish.md +105 -0
  283. package/sera-core/skills/impeccable/reference/quieter.md +99 -0
  284. package/sera-core/skills/impeccable/reference/region-map.md +26 -0
  285. package/sera-core/skills/impeccable/reference/routing.md +24 -0
  286. package/sera-core/skills/impeccable/reference/shape.md +59 -0
  287. package/sera-core/skills/impeccable/reference/typeset.md +90 -0
  288. package/sera-core/skills/impeccable/reference/visualize.md +47 -0
  289. package/sera-core/skills/oyun-yarat/SKILL.md +106 -0
  290. package/sera-core/skills/oyun-yarat/referanslar/3b-yaris.md +74 -0
  291. package/sera-core/skills/oyun-yarat/referanslar/kaplay.md +99 -0
  292. package/sera-core/skills/oyun-yarat/referanslar/oyun-desenleri.md +73 -0
  293. package/sera-core/skills/oyun-yarat/sablonlar/kaplay-2d.html +164 -0
  294. package/sera-core/skills/oyun-yarat/sablonlar/three-yaris.html +149 -0
  295. package/sera-core/skills/oyun-yarat/sablonlar/tuval-minimal.html +77 -0
  296. package/sera-core/skills/receiving-code-review/LICENSE-UPSTREAM +21 -0
  297. package/sera-core/skills/receiving-code-review/SKILL.md +205 -0
  298. package/sera-core/skills/refero-design/LICENSE-UPSTREAM +21 -0
  299. package/sera-core/skills/refero-design/SKILL.md +534 -0
  300. package/sera-core/skills/refero-design/references/anti-ai-slop.md +292 -0
  301. package/sera-core/skills/refero-design/references/color.md +563 -0
  302. package/sera-core/skills/refero-design/references/copywriting.md +222 -0
  303. package/sera-core/skills/refero-design/references/craft-details.md +525 -0
  304. package/sera-core/skills/refero-design/references/example-workflow.md +264 -0
  305. package/sera-core/skills/refero-design/references/icons.md +166 -0
  306. package/sera-core/skills/refero-design/references/mcp-tools.md +258 -0
  307. package/sera-core/skills/refero-design/references/motion.md +504 -0
  308. package/sera-core/skills/refero-design/references/typography.md +737 -0
  309. package/sera-core/skills/refero-design/references/visual-workflow.md +105 -0
  310. package/sera-core/skills/requesting-code-review/LICENSE-UPSTREAM +21 -0
  311. package/sera-core/skills/requesting-code-review/SKILL.md +95 -0
  312. package/sera-core/skills/requesting-code-review/code-reviewer.md +198 -0
  313. package/sera-core/skills/reverse-engineer-anything/DISCLAIMER.md +136 -0
  314. package/sera-core/skills/reverse-engineer-anything/LICENSE-REA-MIT +21 -0
  315. package/sera-core/skills/reverse-engineer-anything/SKILL.md +363 -0
  316. package/sera-core/skills/reverse-engineer-anything/THIRD_PARTY_NOTICES.md +135 -0
  317. package/sera-core/skills/reverse-engineer-anything/references/android-applications.md +36 -0
  318. package/sera-core/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
  319. package/sera-core/skills/reverse-engineer-anything/references/evidence-workflows.md +71 -0
  320. package/sera-core/skills/reverse-engineer-anything/references/javascript-applications.md +218 -0
  321. package/sera-core/skills/reverse-engineer-anything/references/native-and-artifacts.md +297 -0
  322. package/sera-core/skills/reverse-engineer-anything/references/runtime-observation.md +78 -0
  323. package/sera-core/skills/seo-audit/LICENSE-UPSTREAM +21 -0
  324. package/sera-core/skills/seo-audit/SKILL.md +210 -0
  325. package/sera-core/skills/sera-guvenlik-denetim/SKILL.md +44 -0
  326. package/sera-core/skills/sera-guvenlik-denetim/referanslar/guvenlik-listesi.md +33 -0
  327. package/sera-core/skills/sera-hata-ayikla/SKILL.md +27 -0
  328. package/sera-core/skills/sera-hata-ayikla/referanslar/hata-ayiklama.md +37 -0
  329. package/sera-core/skills/sera-kod-inceleme/SKILL.md +44 -0
  330. package/sera-core/skills/sera-kod-inceleme/referanslar/inceleme-listesi.md +62 -0
  331. package/sera-core/skills/sera-ofis-dosya/SKILL.md +27 -0
  332. package/sera-core/skills/sera-ofis-dosya/referanslar/ofis-dosya.md +93 -0
  333. package/sera-core/skills/sera-research/SKILL.md +90 -0
  334. package/sera-core/skills/sera-tasarim/SKILL.md +149 -0
  335. package/sera-core/skills/sera-teslim-sozlesmesi/SKILL.md +592 -0
  336. package/sera-core/skills/sera-test-yaz/SKILL.md +26 -0
  337. package/sera-core/skills/sera-test-yaz/referanslar/test-yazimi.md +35 -0
  338. package/sera-core/skills/sera-veri-gorsel/SKILL.md +65 -0
  339. package/sera-core/skills/sera-web-test/SKILL.md +26 -0
  340. package/sera-core/skills/sera-web-test/referanslar/web-test.md +44 -0
  341. package/sera-core/skills/sera-zamanli-gorev/SKILL.md +22 -0
  342. package/sera-core/skills/sera-zamanli-gorev/referanslar/zamanli-gorev.md +58 -0
  343. package/sera-core/skills/systematic-debugging/LICENSE-UPSTREAM +21 -0
  344. package/sera-core/skills/systematic-debugging/SKILL.md +283 -0
  345. package/sera-core/skills/systematic-debugging/condition-based-waiting.md +115 -0
  346. package/sera-core/skills/systematic-debugging/defense-in-depth.md +122 -0
  347. package/sera-core/skills/systematic-debugging/root-cause-tracing.md +169 -0
  348. package/sera-core/skills/test-driven-development/LICENSE-UPSTREAM +21 -0
  349. package/sera-core/skills/test-driven-development/SKILL.md +330 -0
  350. package/sera-core/skills/test-driven-development/writing-good-tests.md +198 -0
  351. package/sera-core/skills/ticaret-icerik/SKILL.md +49 -0
  352. package/sera-core/skills/ticaret-icerik/referanslar/ticaret-icerik.md +54 -0
  353. package/sera-core/skills/uygulama-yarat/SKILL.md +95 -0
  354. package/sera-core/skills/uygulama-yarat/referanslar/uygulama-desenleri.md +63 -0
  355. package/sera-core/skills/uygulama-yarat/sablonlar/uygulama-tek-dosya.html +121 -0
  356. package/sera-core/skills/uyumluluk-denetim/SKILL.md +56 -0
  357. package/sera-core/skills/uyumluluk-denetim/referanslar/mevzuat-tablosu.md +65 -0
  358. package/sera-core/skills/veri-analizi/SKILL.md +54 -0
  359. package/sera-core/skills/veri-analizi/referanslar/veri-analizi-yontem.md +49 -0
  360. package/sera-core/skills/veri-analizi/sablonlar/profil.mjs +79 -0
  361. package/sera-core/skills/video-duzen/SKILL.md +50 -0
  362. package/sera-core/skills/video-duzen/referanslar/video-duzen.md +100 -0
  363. package/sera-core/skills/web-yayin-listesi/SKILL.md +115 -0
  364. package/sera-core/skills/writing-plans/LICENSE-UPSTREAM +21 -0
  365. package/sera-core/skills/writing-plans/SKILL.md +204 -0
  366. package/sera-core/src/action-nudge.ts +200 -0
  367. package/sera-core/src/agent-mode.ts +143 -0
  368. package/sera-core/src/agents.ts +185 -0
  369. package/sera-core/src/app-master.ts +275 -0
  370. package/sera-core/src/app-verify.ts +551 -0
  371. package/sera-core/src/approval.ts +131 -0
  372. package/sera-core/src/budget.ts +136 -0
  373. package/sera-core/src/command-policy.ts +808 -0
  374. package/sera-core/src/config.ts +135 -0
  375. package/sera-core/src/context-diet.ts +272 -0
  376. package/sera-core/src/device-id.ts +48 -0
  377. package/sera-core/src/dogal-arac.ts +203 -0
  378. package/sera-core/src/dogal-niyet.ts +173 -0
  379. package/sera-core/src/egress-allow.ts +52 -0
  380. package/sera-core/src/export.ts +124 -0
  381. package/sera-core/src/exposure.ts +8 -0
  382. package/sera-core/src/extension.ts +2410 -0
  383. package/sera-core/src/fs-tools.ts +448 -0
  384. package/sera-core/src/generated/build-rules.ts +26 -0
  385. package/sera-core/src/generated/zero-knowledge.ts +170 -0
  386. package/sera-core/src/github-agent-command.ts +133 -0
  387. package/sera-core/src/github-agent-engine.ts +198 -0
  388. package/sera-core/src/github-agent-schedule.ts +180 -0
  389. package/sera-core/src/github-agent.ts +669 -0
  390. package/sera-core/src/github-ajan-akis.ts +193 -0
  391. package/sera-core/src/github-ajan-gercek.ts +102 -0
  392. package/sera-core/src/github-tick.ts +78 -0
  393. package/sera-core/src/github-yedek.ts +269 -0
  394. package/sera-core/src/goal.ts +119 -0
  395. package/sera-core/src/handoff.ts +132 -0
  396. package/sera-core/src/hooks.ts +284 -0
  397. package/sera-core/src/image-tool.ts +118 -0
  398. package/sera-core/src/intake-brief.ts +82 -0
  399. package/sera-core/src/intake-core.ts +1152 -0
  400. package/sera-core/src/intake-hook.ts +88 -0
  401. package/sera-core/src/ios-build-tool.ts +134 -0
  402. package/sera-core/src/lazy-capability.ts +125 -0
  403. package/sera-core/src/lazy-mcp.ts +300 -0
  404. package/sera-core/src/limit-command.ts +51 -0
  405. package/sera-core/src/loop-brake.ts +129 -0
  406. package/sera-core/src/lsp.ts +618 -0
  407. package/sera-core/src/mcp-bridge.ts +159 -0
  408. package/sera-core/src/mcp-pin.ts +105 -0
  409. package/sera-core/src/mcp-ssrf.ts +124 -0
  410. package/sera-core/src/message-cap.ts +45 -0
  411. package/sera-core/src/model-list.ts +108 -0
  412. package/sera-core/src/no-progress.ts +177 -0
  413. package/sera-core/src/notebook-tool.ts +179 -0
  414. package/sera-core/src/ofis.ts +473 -0
  415. package/sera-core/src/path-guard.ts +139 -0
  416. package/sera-core/src/permission-bridge.ts +228 -0
  417. package/sera-core/src/policy-chain.ts +122 -0
  418. package/sera-core/src/pricing.ts +71 -0
  419. package/sera-core/src/proc.ts +149 -0
  420. package/sera-core/src/rea.ts +188 -0
  421. package/sera-core/src/repo-map.ts +230 -0
  422. package/sera-core/src/research.ts +347 -0
  423. package/sera-core/src/rules-memory.ts +227 -0
  424. package/sera-core/src/sandbox.ts +476 -0
  425. package/sera-core/src/server-error.ts +78 -0
  426. package/sera-core/src/skills.ts +268 -0
  427. package/sera-core/src/snapshot.ts +143 -0
  428. package/sera-core/src/spec-gate.ts +112 -0
  429. package/sera-core/src/subagent.ts +261 -0
  430. package/sera-core/src/teslim.ts +121 -0
  431. package/sera-core/src/test-fix.ts +184 -0
  432. package/sera-core/src/todo-question.ts +163 -0
  433. package/sera-core/src/turn-snapshots.ts +126 -0
  434. package/sera-core/src/tuval/arac.ts +338 -0
  435. package/sera-core/src/tuval/arsiv.ts +106 -0
  436. package/sera-core/src/tuval/belge.ts +216 -0
  437. package/sera-core/src/tuval/birlestir.ts +282 -0
  438. package/sera-core/src/tuval/disa.ts +235 -0
  439. package/sera-core/src/tuval/editor.ts +583 -0
  440. package/sera-core/src/tuval/film-cekirdek.ts +170 -0
  441. package/sera-core/src/tuval/film-disa.ts +188 -0
  442. package/sera-core/src/tuval/film-oynatici.ts +307 -0
  443. package/sera-core/src/tuval/kimlik.ts +156 -0
  444. package/sera-core/src/tuval/pano.ts +763 -0
  445. package/sera-core/src/tuval/proje.ts +728 -0
  446. package/sera-core/src/tuval/sistem-cekirdek.ts +167 -0
  447. package/sera-core/src/tuval/sistem.ts +328 -0
  448. package/sera-core/src/tuval/sunucu.ts +413 -0
  449. package/sera-core/src/tuval/uretim.ts +24 -0
  450. package/sera-core/src/tuval/veri-cekirdek.ts +477 -0
  451. package/sera-core/src/tuval/xlsx.ts +215 -0
  452. package/sera-core/src/tuval/zip.ts +163 -0
  453. package/sera-core/src/untrusted.ts +201 -0
  454. package/sera-core/src/video-edit-tool.ts +411 -0
  455. package/sera-core/src/video-tool.ts +217 -0
  456. package/sera-core/src/web-tools.ts +257 -0
  457. package/sera-core/src/zk.ts +104 -0
@@ -0,0 +1,204 @@
1
+ ---
2
+ name: writing-plans
3
+ description: "Çok adımlı işe başlamadan uygulanabilir plan yaz."
4
+ ---
5
+
6
+ # Writing Plans
7
+
8
+ ## Overview
9
+
10
+ Write implementation plans for an engineer who has not seen this codebase or this spec. Assume they write idiomatic code in the project's language once they know the exact interface and the exact test, and that they will make a reasonable choice wherever the plan leaves one open. What they cannot know is what you decided: which files, which names and signatures, which values from the spec, which tests prove each task. Document those. Give them the whole plan as bite-sized tasks. DRY. YAGNI. TDD. Frequent commits.
11
+
12
+ **Announce at start:** "I'm using the writing-plans skill to create the implementation plan."
13
+
14
+ **Context:** If working in an isolated worktree, it should have been created via the `superpowers:using-git-worktrees` skill at execution time.
15
+
16
+ **Save plans to:** `docs/superpowers/plans/YYYY-MM-DD-<feature-name>.md`
17
+ - (User preferences for plan location override this default)
18
+
19
+ ## Scope Check
20
+
21
+ If the spec covers multiple independent subsystems, it should have been broken into sub-project specs during brainstorming. If it wasn't, suggest breaking this into separate plans — one per subsystem. Each plan should produce working, testable software on its own.
22
+
23
+ ## File Structure
24
+
25
+ Before defining tasks, map out which files will be created or modified and what each one is responsible for. This is where decomposition decisions get locked in.
26
+
27
+ - Design units with clear boundaries and well-defined interfaces. Each file should have one clear responsibility.
28
+ - You reason best about code you can hold in context at once, and your edits are more reliable when files are focused. Prefer smaller, focused files over large ones that do too much.
29
+ - Files that change together should live together. Split by responsibility, not by technical layer.
30
+ - In existing codebases, follow established patterns. If the codebase uses large files, don't unilaterally restructure - but if a file you're modifying has grown unwieldy, including a split in the plan is reasonable.
31
+
32
+ This structure informs the task decomposition. Each task should produce self-contained changes that make sense independently.
33
+
34
+ ## Task Right-Sizing
35
+
36
+ A task is the smallest unit that carries its own test cycle and is worth a
37
+ fresh reviewer's gate. When drawing task boundaries: fold setup,
38
+ configuration, scaffolding, and documentation steps into the task whose
39
+ deliverable needs them; split only where a reviewer could meaningfully
40
+ reject one task while approving its neighbor. Each task ends with an
41
+ independently testable deliverable.
42
+
43
+ ## Step Granularity
44
+
45
+ **Each step is one action with a checkable result:**
46
+ - "Write the failing test" - step
47
+ - "Run it to make sure it fails" - step
48
+ - "Implement the minimal code to make the test pass" - step
49
+ - "Run the tests and make sure they pass" - step
50
+ - "Commit" - step
51
+
52
+ ## Plan Document Header
53
+
54
+ **Every plan MUST start with this header:**
55
+
56
+ ```markdown
57
+ # [Feature Name] Implementation Plan
58
+
59
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
60
+
61
+ **Goal:** [One sentence describing what this builds]
62
+
63
+ **Architecture:** [2-3 sentences about approach]
64
+
65
+ **Tech Stack:** [Key technologies/libraries]
66
+
67
+ **Spec:** [path to the spec/design doc this plan implements — the plan
68
+ argues from the spec, so the spec travels with it; executors read both]
69
+
70
+ ## Global Constraints
71
+
72
+ [The spec's project-wide requirements — version floors, dependency limits,
73
+ naming and copy rules, platform requirements — one line each, with exact
74
+ values copied verbatim from the spec. Every task's requirements implicitly
75
+ include this section.]
76
+
77
+ ## Review Focus
78
+
79
+ [The five input classes or failure modes the spec implies but no task's
80
+ tests exercise that are most likely to bite a person using this software
81
+ — one line each, naming the input or condition and the behavior a
82
+ reasonable person would expect, most likely first. The spec is a vision
83
+ document: it says what the software must do, not everything it will
84
+ meet, and its silence on an input is not permission for that input to
85
+ break the program. Write the list here, once, with the spec in front of
86
+ you. Then, for each line, add the test that pins it to the task that
87
+ owns the code, in that task's own step style.]
88
+
89
+ ---
90
+ ```
91
+
92
+ ## Task Structure
93
+
94
+ ````markdown
95
+ ### Task N: [Component Name]
96
+
97
+ **Files:**
98
+ - Create: `exact/path/to/file.py`
99
+ - Modify: `exact/path/to/existing.py:123-145`
100
+ - Test: `tests/exact/path/to/test.py`
101
+
102
+ **Interfaces:**
103
+ - Consumes: [what this task uses from earlier tasks — exact signatures]
104
+ - Produces: [what later tasks rely on — exact function names, parameter
105
+ and return types. A task's implementer sees only their own task; this
106
+ block is how they learn the names and types neighboring tasks use.]
107
+
108
+ - [ ] **Step 1: Write the failing test**
109
+
110
+ ```python
111
+ def test_specific_behavior():
112
+ result = function(input)
113
+ assert result == expected
114
+ ```
115
+
116
+ - [ ] **Step 2: Run test to verify it fails**
117
+
118
+ Run: `pytest tests/path/test.py::test_name -v`
119
+ Expected: FAIL with "function not defined"
120
+
121
+ - [ ] **Step 3: Implement `function(input: InputType) -> ResultType` in `exact/path/to/file.py`**
122
+
123
+ One line on the approach when the signature and the test leave a choice
124
+ (which library call, which data structure); a code block only for an
125
+ algorithm they do not determine.
126
+
127
+ - [ ] **Step 4: Run test to verify it passes**
128
+
129
+ Run: `pytest tests/path/test.py::test_name -v`
130
+ Expected: PASS
131
+
132
+ - [ ] **Step 5: Commit**
133
+
134
+ ```bash
135
+ git add tests/path/test.py src/path/file.py
136
+ git commit -m "feat: add specific feature"
137
+ ```
138
+ ````
139
+
140
+ ## What a Step Contains
141
+
142
+ A step is done when the implementer can write exactly one reasonable thing
143
+ from it. That is the whole requirement: unambiguous, not complete. Each kind
144
+ of step carries what makes it unambiguous and nothing more:
145
+
146
+ - **A test step:** the test's name and its assertions, as code, with the
147
+ spec's exact values in them.
148
+ - **A code step:** the exact signature (name, parameters, return type), the
149
+ file it lives in, and the specific values the spec pins. The implementer
150
+ writes the body. A body appears only for an algorithm the signature and
151
+ tests do not determine, or for exact copy the spec fixes.
152
+ - **A verification step:** the command to run and the output that means it
153
+ passed.
154
+ - **A reference to another task:** that task's Interfaces block says what
155
+ to use; the plan does not repeat that task's code.
156
+
157
+ A plan is the set of decisions the implementer cannot make alone. A plan
158
+ longer than the code it describes has written the code instead. Lines that
159
+ decide nothing ("TBD", "handle edge cases", "add appropriate validation",
160
+ "write tests for the above", a type or function no task defines) are the
161
+ opposite failure, and the self-review catches both.
162
+
163
+ ## Self-Review
164
+
165
+ After writing the complete plan, look at the spec with fresh eyes and check the plan against it. This is a checklist you run yourself — not a subagent dispatch.
166
+
167
+ **1. Spec coverage:** Skim each section/requirement in the spec. Can you point to a task that implements it? List any gaps.
168
+
169
+ **2. Step scan:** Every step must let the implementer write exactly one reasonable thing, and no step may carry more than that: a line that decides nothing is a gap, a function body the signature and tests already determine is a transcript. Fix both.
170
+
171
+ **3. Type consistency:** Do the types, method signatures, and property names you used in later tasks match what you defined in earlier tasks? A function called `clearLayers()` in Task 3 but `clearFullLayers()` in Task 7 is a bug.
172
+
173
+ **4. Review Focus:** For each input class or failure mode the spec implies, is there a task whose tests exercise it? The five uncovered ones most likely to bite a person go in the Review Focus section, and each line there gets its test added to the owning task. An empty section means you checked and found none, not that you skipped the check.
174
+
175
+ **5. Proportion:** Compare the plan's length to the spec's. A plan several times longer than the spec it implements is a transcript of the program, not a plan. If code blocks are most of the document, replace bodies with signatures, test names and assertions, and check that each step is still unambiguous.
176
+
177
+ If you find issues, fix them inline. No need to re-review — just fix and move on. If you find a spec requirement with no task, add the task.
178
+
179
+ ## Execution Handoff
180
+
181
+ After saving and self-reviewing the plan, link it for your human partner
182
+ to read. If they have already explicitly supplied an execution method, ask
183
+ them to review the plan and confirm it captures what they want; wait for that
184
+ review before implementation, then use the preserved method. Otherwise, ask
185
+ them to review the plan and choose an execution method before implementation.
186
+
187
+ **When no execution method has already been supplied:**
188
+
189
+ **"Plan complete and saved to `docs/superpowers/plans/<filename>.md`. Please review the plan. Which execution approach would you prefer?**
190
+
191
+ - **Subagent-driven** - A fresh subagent implements each task and a fresh reviewer checks it before the next one starts, then a whole-branch review at the end. Most thorough; costs a fresh context per task and per review.
192
+ - **Native** - I implement every task myself in this session, the way this harness runs work, then one fresh reviewer on the most capable model checks the whole branch. Cheapest and fastest; no independent review until the end. Runs well with a mid-tier session model, since the plan carries the design.
193
+
194
+ **For this plan I recommend <one of the two>, because <one sentence from the plan: how much the tasks depend on each other's interfaces, how many there are, what a shipped mistake would cost>. Does the plan capture what you want, and which approach should we use?"**
195
+
196
+ **When an execution method has already been supplied:**
197
+
198
+ **"Plan complete and saved to `docs/superpowers/plans/<filename>.md`. Please review the plan. Does it capture what you want?"**
199
+
200
+ **If Subagent-driven chosen:**
201
+ - **REQUIRED SUB-SKILL:** Use superpowers:subagent-driven-development
202
+
203
+ **If Native chosen:**
204
+ - **REQUIRED SUB-SKILL:** Use superpowers:executing-plans
@@ -0,0 +1,200 @@
1
+ /**
2
+ * "Devam ediyorum" dediği halde işlem yapmayan model sorunu (sahip şikâyeti, 2026-11-03).
3
+ * Gerçek oturum kaydı: 38 metin-yalnız tur, hepsi stopReason=stop ("Şimdi başlıyorum, durmuyorum", "Devam ediyorum"),
4
+ * araç çağrısı yok → ajan döngüsü doğru biçimde biter ama iş yapılmamıştır. Ayrıca stopReason=length ile ortada kesilen
5
+ * turlar ve akışı takılan (veri gelmeyen) istekler. Bu modül SAF mantıktır (olay bağlama extension.ts'te):
6
+ * - classifyEnd: son asistan mesajı "söz verdi ama yapmadı" / "kesildi" mi?
7
+ * - NudgeState: kullanıcı istemi başına sınırlı (varsayılan 2) otomatik takip mesajı; döngü yok.
8
+ * - IdleWatch: akış sessizliği (veri gelmiyor) süresi ölçer.
9
+ * Kapatmak: SERA_ACTION_NUDGE=0. Sınır: SERA_ACTION_NUDGE_MAX. Akış zaman aşımı: SERA_STREAM_IDLE_S (0 = kapalı).
10
+ */
11
+
12
+ export interface ActionNudgeConfig {
13
+ enabled: boolean;
14
+ /** Kullanıcı istemi başına en fazla otomatik takip. */
15
+ max: number;
16
+ /** Akış sessizlik zaman aşımı (sn); 0 = kapalı. */
17
+ idleSeconds: number;
18
+ /** Akış zaman aşımından sonra otomatik yeniden deneme sayısı (kullanıcı istemi başına). */
19
+ idleRetries: number;
20
+ }
21
+
22
+ export function actionNudgeFromEnv(env: NodeJS.ProcessEnv = process.env): ActionNudgeConfig {
23
+ const num = (v: string | undefined, d: number) => {
24
+ const x = Number(v);
25
+ return v !== undefined && v.trim() !== "" && Number.isFinite(x) && x >= 0 ? x : d;
26
+ };
27
+ const off = env.SERA_ACTION_NUDGE === "0" || env.SERA_ACTION_NUDGE === "false";
28
+ return {
29
+ enabled: !off,
30
+ max: Math.floor(num(env.SERA_ACTION_NUDGE_MAX, 2)),
31
+ idleSeconds: num(env.SERA_STREAM_IDLE_S, 90),
32
+ idleRetries: 1,
33
+ };
34
+ }
35
+
36
+ export type EndKind = "none" | "promise" | "truncated";
37
+
38
+ export interface EndInfo {
39
+ kind: EndKind;
40
+ reason: string;
41
+ }
42
+
43
+ interface AsstLike {
44
+ role?: string;
45
+ stopReason?: string;
46
+ content?: unknown;
47
+ }
48
+
49
+ const textOf = (m: AsstLike): string =>
50
+ Array.isArray(m.content)
51
+ ? (m.content as Record<string, unknown>[])
52
+ .filter((c) => c.type === "text")
53
+ .map((c) => String(c.text ?? ""))
54
+ .join("\n")
55
+ : "";
56
+ const callsOf = (m: AsstLike): number =>
57
+ Array.isArray(m.content) ? (m.content as Record<string, unknown>[]).filter((c) => c.type === "toolCall").length : 0;
58
+
59
+ /** Türkçe/İngilizce "şimdi yapacağım / devam ediyorum" kalıpları (yalnız metnin son kısmında aranır). */
60
+ const PROMISE: RegExp[] = [
61
+ // Türkçe şimdiki zaman, eylem fiilleri: "devam ediyorum", "başlıyorum", "düzeltiyorum", "bakıyorum"...
62
+ /\b(?:devam\s+ed|başl|yap|düzelt|uygul|bak|geç|çalış|aç|hazırla|temizle|oku|tara|incele|ekle|kur|dene|sil|değiştir|güncelle|bitir|kontrol\s+ed|yaz|ara|bul|çöz|çıkar|taşı|birleştir|derle|kaydet)\p{L}{0,6}yorum\b/iu,
63
+ // gelecek / istek: "yapacağım", "düzelteceğim", "yazacağım", "bakayım", "başlayayım"
64
+ /\b\p{L}+(?:acağım|eceğim|acagim|ecegim|ayım|eyim)\b/iu,
65
+ // kalıplar
66
+ /\b(?:devam\s+ed(?:iyorum|eceğim|eyim)|hemen\s+(?:başl|yap|uygul|düzelt)|şimdi\s+\p{L}+)/iu,
67
+ // İngilizce
68
+ /\b(?:i['’]ll|i\s+will|i['’]m\s+(?:going\s+to|now|continuing|proceeding|starting)|let\s+me|now\s+i['’]?ll|next,?\s+i)\b/i,
69
+ ];
70
+
71
+ /** Bitti / sonuç özeti işaretleri: son cümlede varsa ve söz kalıbı yoksa nudge yok. */
72
+ const DONE = /\b(?:bitti|tamamlandı|tamamladım|yaptım|düzelttim|uyguladım|done|finished|completed|fixed|all set)\b/iu;
73
+
74
+ /** Gerçek kullanıcı kararı soran kapanış ("... ister misin?") — model bekliyor, nudge yok. */
75
+ const ASKS_USER = /\?\s*["”»*_)]*\s*$/u;
76
+ /** Ama bu sorular sahibin "sormadan yürüt" ilkesine aykırı kararsızlıktır: onları da dürt. */
77
+ const SOFT_ASK =
78
+ /(?:devam\s+edeyim|izin\s+(?:veriyor|ver)|onaylıyor\s+musun|\p{L}+(?:ayım|eyim)\s+mi\b|shall\s+i\b|should\s+i\b|want\s+me\s+to\b|may\s+i\b)/iu;
79
+
80
+ /** Son paragraf/cümleler (söz genelde sondadır). */
81
+ function tail(text: string): string {
82
+ const t = text.trim();
83
+ return t.slice(-420);
84
+ }
85
+
86
+ export function promisesAction(text: string): boolean {
87
+ const t = tail(text);
88
+ if (!t) return false;
89
+ if (SOFT_ASK.test(t)) return true;
90
+ if (ASKS_USER.test(t)) return false;
91
+ const hit = PROMISE.some((re) => re.test(t));
92
+ if (!hit) return false;
93
+ // Son cümlede açık "bitti" varsa, vaat de son iki cümlede değilse söz değil özet sayılır.
94
+ const sentences = t.split(/(?<=[.!?\n])\s+/u).filter(Boolean);
95
+ const lastTwo = sentences.slice(-2).join(" ");
96
+ if (DONE.test(sentences.at(-1) ?? t) && !PROMISE.some((re) => re.test(lastTwo))) return false;
97
+ return true;
98
+ }
99
+
100
+ /**
101
+ * Bir ajan koşusunun son asistan mesajını sınıflar.
102
+ * - stopReason "length": çıktı ortada kesildi (metin ya da yarım araç çağrısı) → "truncated".
103
+ * - stopReason "stop", araç çağrısı yok, metin eylem vaat ediyor → "promise".
104
+ * error/aborted/toolUse için "none" (hata yeniden-denemesi motorda, abort kullanıcı iradesi).
105
+ */
106
+ export function classifyEnd(last: unknown): EndInfo {
107
+ const m = (last ?? {}) as AsstLike;
108
+ if (m.role !== "assistant") return { kind: "none", reason: "asistan mesajı yok" };
109
+ if (m.stopReason === "length") return { kind: "truncated", reason: "yanıt uzunluk sınırında kesildi" };
110
+ if (m.stopReason !== "stop") return { kind: "none", reason: `stopReason=${m.stopReason}` };
111
+ if (callsOf(m) > 0) return { kind: "none", reason: "araç çağrısı var" };
112
+ const text = textOf(m);
113
+ if (promisesAction(text)) return { kind: "promise", reason: "metin eylem vaat ediyor ama araç çağrısı yok" };
114
+ return { kind: "none", reason: "vaat yok" };
115
+ }
116
+
117
+ export const PROMISE_NUDGE =
118
+ "Söylediğin adımı şimdi araç çağrısıyla uygula; bittiyse sonucu özetle. (Yalnız yazı yazıp durma: yapılacak iş varsa ilgili aracı çağır; kararı kullanıcıya bırakma.)";
119
+ export const TRUNCATED_NUDGE =
120
+ "Kaldığın yerden devam et; tekrar etme. Yanıtın uzunluk sınırında kesildi: uzun kodu/metni sohbete dökme, işi küçük adımlara böl ve dosyaları write/edit araçlarıyla yaz; kaldığın yerden ilk adımı araç çağrısıyla uygula.";
121
+ export const IDLE_NUDGE =
122
+ "Önceki istek takıldı (sağlayıcıdan veri gelmedi) ve iptal edildi. Kaldığın yerden devam et: bir sonraki adımı araç çağrısıyla uygula.";
123
+
124
+ export const nudgeText = (kind: EndKind): string => (kind === "truncated" ? TRUNCATED_NUDGE : PROMISE_NUDGE);
125
+
126
+ export const exhaustedMessage = (kind: EndKind | "idle", n: number): string =>
127
+ kind === "idle"
128
+ ? `[Sera] Sağlayıcıdan ${n} kez veri gelmedi; istek iptal edildi. Lütfen 'devam et' yaz ya da modeli değiştir.`
129
+ : kind === "truncated"
130
+ ? `[Sera] Model yanıtı ${n} kez ortada kesildi. 'devam et' yazarak sürdürebilir ya da işi daha küçük parçalara bölebilirsin.`
131
+ : `[Sera] Model 'devam ediyorum' dedi ama ${n} hatırlatmaya rağmen araç çağırmadı; durdum. 'devam et' yazarsan yeniden denerim.`;
132
+
133
+ /** Kullanıcı istemi başına sınırlı takip sayacı. Gerçek yeni kullanıcı isteminde reset(). */
134
+ export class NudgeState {
135
+ private used = 0;
136
+ private idleUsed = 0;
137
+ readonly cfg: ActionNudgeConfig;
138
+ constructor(cfg: ActionNudgeConfig) {
139
+ this.cfg = cfg;
140
+ }
141
+ reset(): void {
142
+ this.used = 0;
143
+ this.idleUsed = 0;
144
+ }
145
+ get nudges(): number {
146
+ return this.used;
147
+ }
148
+ /** true = bir takip daha gönderilebilir (ve sayaç artırılır). */
149
+ take(): boolean {
150
+ if (!this.cfg.enabled || this.used >= this.cfg.max) return false;
151
+ this.used++;
152
+ return true;
153
+ }
154
+ takeIdle(): boolean {
155
+ if (this.idleUsed >= this.cfg.idleRetries) return false;
156
+ this.idleUsed++;
157
+ return true;
158
+ }
159
+ get idleRetriesUsed(): number {
160
+ return this.idleUsed;
161
+ }
162
+ }
163
+
164
+ /** Akış sessizlik ölçer: etkinlik gelmeden geçen süre eşiği aşarsa true. İlk-token beklemesi için ek tolerans. */
165
+ export class IdleWatch {
166
+ private armed = false;
167
+ private last = 0;
168
+ private gotData = false;
169
+ private readonly idleMs: number;
170
+ private readonly now: () => number;
171
+ constructor(idleMs: number, now: () => number = Date.now) {
172
+ this.idleMs = idleMs;
173
+ this.now = now;
174
+ }
175
+ /** Model isteği gitmek üzere (context olayı). */
176
+ arm(): void {
177
+ this.armed = true;
178
+ this.gotData = false;
179
+ this.last = this.now();
180
+ }
181
+ /** Akıştan veri/olay geldi. */
182
+ touch(): void {
183
+ if (!this.armed) return;
184
+ this.gotData = true;
185
+ this.last = this.now();
186
+ }
187
+ /** Asistan mesajı bitti ya da koşu bitti. */
188
+ disarm(): void {
189
+ this.armed = false;
190
+ }
191
+ get isArmed(): boolean {
192
+ return this.armed;
193
+ }
194
+ /** İlk veri gelmeden önce akıl yürüten modeller için 1.5x tolerans. */
195
+ expired(): boolean {
196
+ if (!this.armed || this.idleMs <= 0) return false;
197
+ const limit = this.gotData ? this.idleMs : Math.round(this.idleMs * 1.5);
198
+ return this.now() - this.last >= limit;
199
+ }
200
+ }
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Ajan modu (Pi cekirdegine dokunmadan): Sera Code'un "plan" ajani icin yazma/calistirma araclarini kapatir.
3
+ * Etkinlestirme: SERA_AGENTS=1 (adaptor surec baslatirken verir). Kapaliyken hicbir etkisi yoktur.
4
+ * Adaptor modu `/sera-agent plan|build` extension komutuyla degistirir.
5
+ */
6
+
7
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
8
+ import { Type } from "typebox";
9
+ import { classifyCommand } from "./command-policy.ts";
10
+ import { normalizeQuestions, parseAnswers, QUESTION_PREFIX } from "./todo-question.ts";
11
+
12
+ export const AGENT_COMMAND = "sera-agent";
13
+ export type AgentName = "build" | "plan";
14
+
15
+ /** plan modunda tamamen kapali araclar: dosya yazma. */
16
+ /** Planı sunup onay alan araç: YALNIZ plan modunda aktif (Claude Code ExitPlanMode karşılığı). */
17
+ export const EXIT_PLAN_TOOL = "exit_plan";
18
+ export const EXIT_PLAN_APPROVE = "Onayla, uygulamaya geç";
19
+ export const EXIT_PLAN_REVISE = "Hayır, planı değiştir";
20
+
21
+ export const PLAN_BLOCKED_TOOLS: ReadonlySet<string> = new Set(["edit", "write", "notebook_edit"]);
22
+ /** plan modunda yalniz SALT-OKUNUR komutlarla calisan araclar (ls, git status, rg ...; command-policy "safe"). */
23
+ export const PLAN_READONLY_SHELLS: ReadonlySet<string> = new Set(["bash", "powershell", "proc", "app_verify"]);
24
+
25
+ export function parseAgentName(raw: string | undefined): AgentName | undefined {
26
+ const v = (raw ?? "").trim().toLowerCase();
27
+ return v === "plan" || v === "build" ? v : undefined;
28
+ }
29
+
30
+ export class AgentMode {
31
+ private mode: AgentName = "build";
32
+ private saved: string[] | undefined;
33
+ /** exit_plan aracı kayıtlıysa true: plan modunda aktif listeye eklenir. */
34
+ exitPlan = false;
35
+
36
+ get current(): AgentName {
37
+ return this.mode;
38
+ }
39
+
40
+ /** Modu degistirir; Pi'ye bildirilecek aktif arac listesini dondurur. */
41
+ set(next: AgentName, activeTools: string[]): string[] {
42
+ if (next === "plan") {
43
+ if (this.mode !== "plan") this.saved = activeTools;
44
+ this.mode = "plan";
45
+ const open = (this.saved ?? activeTools).filter((t) => !PLAN_BLOCKED_TOOLS.has(t) && t !== EXIT_PLAN_TOOL);
46
+ return this.exitPlan ? [...open, EXIT_PLAN_TOOL] : open;
47
+ }
48
+ this.mode = "build";
49
+ const restored = (this.saved ?? activeTools).filter((t) => t !== EXIT_PLAN_TOOL);
50
+ this.saved = undefined;
51
+ return restored;
52
+ }
53
+
54
+ /** undefined = calistir; {block} = engelle (savunma hatti: model arac listesini yok sayip yine de cagirirsa). */
55
+ check(toolName: string, input?: unknown): { block: true; reason: string } | undefined {
56
+ if (toolName === EXIT_PLAN_TOOL && this.mode !== "plan")
57
+ return {
58
+ block: true,
59
+ reason: "exit_plan yalnizca plan modunda kullanilir; zaten uygulama (build) modundasin.",
60
+ };
61
+ if (this.mode !== "plan") return undefined;
62
+ if (PLAN_READONLY_SHELLS.has(toolName)) {
63
+ const ci = input as { command?: unknown; serve_command?: unknown } | undefined;
64
+ const cmd = String(ci?.command ?? ci?.serve_command ?? "");
65
+ if ((toolName === "proc" || toolName === "app_verify") && !cmd.trim()) return undefined; // list/read/kill
66
+ if (classifyCommand(cmd).verdict === "safe") return undefined;
67
+ return {
68
+ block: true,
69
+ reason: `Plan modunda yalnizca okuyan komutlar calisir (ls, cat, git status, rg ...); "${cmd.slice(0, 80)}" calistirilmadi. Yalnizca okuyup plan yaz.`,
70
+ };
71
+ }
72
+ if (!PLAN_BLOCKED_TOOLS.has(toolName)) return undefined;
73
+ return {
74
+ block: true,
75
+ reason: `Plan modunda "${toolName}" araci kapali; dosya yazilmaz. Yalnizca okuyup plan yaz.`,
76
+ };
77
+ }
78
+ }
79
+
80
+ /**
81
+ * exit_plan: plan modunda modelin planı sunup KULLANICI ONAYIyla build moduna geçmesi. Onay `question` ile aynı arayüz
82
+ * yolundan (ctx.ui.input + QUESTION_PREFIX) sorulur. Onay yok / arayüz yok / kapatıldı / reddedildi -> plan modunda KALIR
83
+ * (yazma araçları açılmaz). Yalnız ust ajanda ve SERA_AGENTS=1 iken kaydedilir.
84
+ */
85
+ export function registerExitPlan(pi: ExtensionAPI, agent: AgentMode): void {
86
+ agent.exitPlan = true;
87
+ pi.registerTool({
88
+ name: EXIT_PLAN_TOOL,
89
+ label: "Plani sun",
90
+ description:
91
+ "YALNIZ plan modunda: planini kullaniciya sunar ve onay ister. Onaylarsa uygulama (build) moduna gecilir ve yazma araclari acilir; onaylamazsa plan modunda kalirsin ve geri bildirimini alirsin. Plan tamamlaninca ve kullanicinin onayi gerektiginde cagir; once okuyup plani hazirla.",
92
+ promptSnippet: "Plan hazirsa kullaniciya sunup onayla uygulamaya gec (exit_plan; yalniz plan modu)",
93
+ parameters: Type.Object({
94
+ plan: Type.String({ description: "Kullaniciya gosterilecek uygulama plani (adimlar, dosyalar, riskler)" }),
95
+ }),
96
+ async execute(_id, params, signal, _onUpdate, ctx) {
97
+ if (agent.current !== "plan")
98
+ throw new Error("exit_plan yalnizca plan modunda kullanilir; zaten uygulama (build) modundasin.");
99
+ const plan = String(params.plan ?? "").trim();
100
+ if (!plan) throw new Error("plan bos olamaz; sunulacak plani yaz.");
101
+ if (!ctx.hasUI)
102
+ throw new Error(
103
+ "Bu calismada kullaniciya onay sorulamiyor (etkilesimli arayuz yok); plan modunda kaliyorsun. Plani yazili cevap olarak sun.",
104
+ );
105
+ const qs = normalizeQuestions([
106
+ {
107
+ question: `${plan.slice(0, 6000)}
108
+
109
+ Bu plan onaylansin mi? Onaylarsan dosya yazma araclari acilir.`,
110
+ header: "Plan onayi",
111
+ options: [{ label: EXIT_PLAN_APPROVE }, { label: EXIT_PLAN_REVISE }],
112
+ },
113
+ ]);
114
+ const value = await ctx.ui.input(QUESTION_PREFIX + JSON.stringify({ questions: qs }), "", { signal });
115
+ if (value === undefined)
116
+ throw new Error("Kullanici onay penceresini kapatti; plan modunda kaliyorsun. Yazma araclari acilmadi.");
117
+ const answer = parseAnswers(value, 1)[0] ?? [];
118
+ // YALNIZ birebir onay etiketi build'i acar; serbest metin ("belki", "hayir ...") geri bildirimdir.
119
+ if (answer.length === 1 && answer[0] === EXIT_PLAN_APPROVE) {
120
+ pi.setActiveTools(agent.set("build", pi.getActiveTools()));
121
+ return {
122
+ content: [
123
+ {
124
+ type: "text",
125
+ text: "Plan onaylandi. Uygulama (build) moduna gecildi; yazma araclari acik. Plani uygula.",
126
+ },
127
+ ],
128
+ details: { sera_meta: { approved: true } },
129
+ };
130
+ }
131
+ const feedback = answer.filter((a) => a !== EXIT_PLAN_REVISE).join(", ");
132
+ return {
133
+ content: [
134
+ {
135
+ type: "text",
136
+ text: `Plan onaylanmadi; plan modunda kaliyorsun (yazma araclari kapali).${feedback ? ` Kullanici geri bildirimi: ${feedback}` : ""} Plani guncelle ve gerekirse tekrar exit_plan cagir.`,
137
+ },
138
+ ],
139
+ details: { sera_meta: { approved: false } },
140
+ };
141
+ },
142
+ });
143
+ }