@leejungkiin/awkit 1.7.1 → 1.7.5

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 (262) hide show
  1. package/README.md +42 -5
  2. package/bin/awk.js +1148 -92
  3. package/core/CLAUDE.md +1 -1
  4. package/core/GEMINI.md +152 -167
  5. package/core/GEMINI.md.bak +153 -116
  6. package/core/GreetingEngine/index.js +225 -0
  7. package/core/GreetingEngine/locales/en.json +6 -0
  8. package/core/GreetingEngine/locales/ja.json +6 -0
  9. package/core/GreetingEngine/locales/vi.json +6 -0
  10. package/core/GreetingEngine/test.js +37 -0
  11. package/core/skill-runtime-manifest.json +3 -0
  12. package/docs/Claude Fable 5.md +3826 -0
  13. package/docs/PRD.md +57 -0
  14. package/docs/android_kotlin_system_instruction.md +210 -0
  15. package/docs/brainstorm_multi_agent_cli.md +211 -0
  16. package/docs/brainstorm_ponytail_integration.md +146 -0
  17. package/docs/brainstorm_smart_setup.md +113 -0
  18. package/docs/deep-research-report (1).md +293 -0
  19. package/docs/history/GEMINI.v1.md +135 -0
  20. package/docs/history/PRD.v1.md +55 -0
  21. package/docs/history/PRD.v2.md +57 -0
  22. package/docs/history/brainstorm_antigravity_unified_architecture.v1.md +105 -0
  23. package/docs/history/implementation_plan.v1.md +58 -0
  24. package/docs/history/memoizedfibonacci_spec.v1.md +127 -0
  25. package/docs/specs/greetingapp_spec.md +97 -0
  26. package/docs/specs/memoizedfibonacci_spec.md +211 -0
  27. package/package.json +4 -1
  28. package/scripts/artifact-storage.js +130 -0
  29. package/scripts/automation-gate.js +35 -2
  30. package/scripts/claude-plan.js +76 -0
  31. package/scripts/dependency-manager.js +210 -0
  32. package/scripts/exec-rtk.js +11 -5
  33. package/scripts/i18n-helper.js +381 -0
  34. package/scripts/multi-model-pipeline.js +386 -0
  35. package/scripts/qwen-exec.js +147 -0
  36. package/skill-packs/mobile-ios/pack.json +4 -2
  37. package/skill-packs/reverse-engineering/pack.json +1 -0
  38. package/skills/CATALOG.md +20 -0
  39. package/skills/GEMINI.md +9 -1
  40. package/skills/TRIGGER_INDEX.md +10 -0
  41. package/skills/ai-music/SKILL.md +275 -0
  42. package/skills/android-re-analyzer/SKILL.md +238 -0
  43. package/skills/android-re-analyzer/references/api-extraction-patterns.md +119 -0
  44. package/skills/android-re-analyzer/references/call-flow-analysis.md +176 -0
  45. package/skills/android-re-analyzer/references/fernflower-usage.md +115 -0
  46. package/skills/android-re-analyzer/references/jadx-usage.md +116 -0
  47. package/skills/android-re-analyzer/references/setup-guide.md +221 -0
  48. package/skills/android-re-analyzer/scripts/check-deps.sh +129 -0
  49. package/skills/android-re-analyzer/scripts/decompile.sh +375 -0
  50. package/skills/android-re-analyzer/scripts/find-api-calls.sh +118 -0
  51. package/skills/android-re-analyzer/scripts/install-dep.sh +448 -0
  52. package/skills/animal-island-ui-style/SKILL.md +1450 -0
  53. package/skills/app-store-review-agent/SKILL.md +164 -0
  54. package/skills/app-store-review-agent/references/guidelines/README.md +154 -0
  55. package/skills/app-store-review-agent/references/guidelines/by-app-type/ai_apps.md +37 -0
  56. package/skills/app-store-review-agent/references/guidelines/by-app-type/all_apps.md +50 -0
  57. package/skills/app-store-review-agent/references/guidelines/by-app-type/crypto_finance.md +31 -0
  58. package/skills/app-store-review-agent/references/guidelines/by-app-type/games.md +31 -0
  59. package/skills/app-store-review-agent/references/guidelines/by-app-type/health_fitness.md +31 -0
  60. package/skills/app-store-review-agent/references/guidelines/by-app-type/kids.md +27 -0
  61. package/skills/app-store-review-agent/references/guidelines/by-app-type/macos.md +38 -0
  62. package/skills/app-store-review-agent/references/guidelines/by-app-type/social_ugc.md +32 -0
  63. package/skills/app-store-review-agent/references/guidelines/by-app-type/subscription_iap.md +34 -0
  64. package/skills/app-store-review-agent/references/guidelines/by-app-type/vpn.md +18 -0
  65. package/skills/app-store-review-agent/references/rules/design/minimum_functionality.md +96 -0
  66. package/skills/app-store-review-agent/references/rules/design/sign_in_with_apple.md +54 -0
  67. package/skills/app-store-review-agent/references/rules/entitlements/unused_entitlements.md +83 -0
  68. package/skills/app-store-review-agent/references/rules/metadata/accurate_metadata.md +54 -0
  69. package/skills/app-store-review-agent/references/rules/metadata/apple_trademark.md +99 -0
  70. package/skills/app-store-review-agent/references/rules/metadata/china_storefront.md +72 -0
  71. package/skills/app-store-review-agent/references/rules/metadata/competitor_terms.md +56 -0
  72. package/skills/app-store-review-agent/references/rules/metadata/subscription_metadata.md +81 -0
  73. package/skills/app-store-review-agent/references/rules/privacy/privacy_manifest.md +84 -0
  74. package/skills/app-store-review-agent/references/rules/privacy/unnecessary_data.md +60 -0
  75. package/skills/app-store-review-agent/references/rules/subscription/misleading_pricing.md +63 -0
  76. package/skills/app-store-review-agent/references/rules/subscription/missing_tos_pp.md +54 -0
  77. package/skills/awf-ponytail/SKILL.md +91 -0
  78. package/skills/awf-ponytail-review/SKILL.md +67 -0
  79. package/skills/awf-session-restore/SKILL.md +3 -3
  80. package/skills/brainstorm-agent/SKILL.md +11 -2
  81. package/skills/brainstorm-agent/templates/brief-template.md +8 -0
  82. package/skills/claude-planner/SKILL.md +71 -0
  83. package/skills/code-review/SKILL.md +87 -0
  84. package/skills/codex-conductor/SKILL.md +25 -1
  85. package/skills/expo-game-development/SKILL.md +163 -0
  86. package/skills/flutter/LICENSE.txt +202 -0
  87. package/skills/flutter/SKILL.md +127 -0
  88. package/skills/flutter-project-creater/LICENSE.txt +202 -0
  89. package/skills/flutter-project-creater/SKILL.md +106 -0
  90. package/skills/game-developer/SKILL.md +163 -0
  91. package/skills/game-developer/references/ecs-patterns.md +501 -0
  92. package/skills/game-developer/references/multiplayer-networking.md +475 -0
  93. package/skills/game-developer/references/performance-optimization.md +422 -0
  94. package/skills/game-developer/references/unity-patterns.md +271 -0
  95. package/skills/game-developer/references/unreal-cpp.md +352 -0
  96. package/skills/generate-gui-assets/SKILL.md +305 -0
  97. package/skills/generate-gui-assets/agents/openai.yaml +4 -0
  98. package/skills/generate-gui-assets/references/catalog-schema.md +58 -0
  99. package/skills/generate-gui-assets/references/extraction-techniques.md +21 -0
  100. package/skills/generate-gui-assets/references/prompt-patterns.md +58 -0
  101. package/skills/generate-gui-assets/scripts/__pycache__/clean_chroma_edges.cpython-311.pyc +0 -0
  102. package/skills/generate-gui-assets/scripts/build_gui_contact_sheet.py +51 -0
  103. package/skills/generate-gui-assets/scripts/clean_chroma_edges.py +262 -0
  104. package/skills/generate-gui-assets/scripts/copy_approved_icons.py +64 -0
  105. package/skills/generate-gui-assets/scripts/prepare_gui_asset_run.py +91 -0
  106. package/skills/generate-gui-assets/scripts/suggest_grid_options.py +63 -0
  107. package/skills/generate-gui-assets/scripts/validate_gui_catalog.py +50 -0
  108. package/skills/godot-game-development/SKILL.md +142 -0
  109. package/skills/hatch-pet/LICENSE.txt +201 -0
  110. package/skills/hatch-pet/SKILL.md +420 -0
  111. package/skills/hatch-pet/agents/openai.yaml +4 -0
  112. package/skills/hatch-pet/references/animation-rows.md +29 -0
  113. package/skills/hatch-pet/references/codex-pet-contract.md +35 -0
  114. package/skills/hatch-pet/references/qa-rubric.md +60 -0
  115. package/skills/hatch-pet/scripts/__pycache__/clean_chroma_edges.cpython-311.pyc +0 -0
  116. package/skills/hatch-pet/scripts/clean_chroma_edges.py +262 -0
  117. package/skills/hatch-pet/scripts/compose_atlas.py +150 -0
  118. package/skills/hatch-pet/scripts/derive_running_left_from_running_right.py +143 -0
  119. package/skills/hatch-pet/scripts/extract_strip_frames.py +323 -0
  120. package/skills/hatch-pet/scripts/finalize_pet_run.py +382 -0
  121. package/skills/hatch-pet/scripts/generate_pet_images.py +287 -0
  122. package/skills/hatch-pet/scripts/inspect_frames.py +246 -0
  123. package/skills/hatch-pet/scripts/make_contact_sheet.py +96 -0
  124. package/skills/hatch-pet/scripts/package_custom_pet.py +108 -0
  125. package/skills/hatch-pet/scripts/pet_job_status.py +117 -0
  126. package/skills/hatch-pet/scripts/prepare_pet_run.py +673 -0
  127. package/skills/hatch-pet/scripts/queue_pet_repairs.py +172 -0
  128. package/skills/hatch-pet/scripts/record_imagegen_result.py +250 -0
  129. package/skills/hatch-pet/scripts/render_animation_videos.py +134 -0
  130. package/skills/hatch-pet/scripts/render_animation_videos.sh +5 -0
  131. package/skills/hatch-pet/scripts/validate_atlas.py +139 -0
  132. package/skills/i18n-orchestrator/SKILL.md +37 -0
  133. package/skills/ios-simulator-skill/SKILL.md +390 -0
  134. package/skills/ios-simulator-skill/scripts/accessibility_audit.py +300 -0
  135. package/skills/ios-simulator-skill/scripts/app_launcher.py +326 -0
  136. package/skills/ios-simulator-skill/scripts/app_state_capture.py +400 -0
  137. package/skills/ios-simulator-skill/scripts/appearance.py +385 -0
  138. package/skills/ios-simulator-skill/scripts/build_and_test.py +348 -0
  139. package/skills/ios-simulator-skill/scripts/clipboard.py +103 -0
  140. package/skills/ios-simulator-skill/scripts/common/__init__.py +61 -0
  141. package/skills/ios-simulator-skill/scripts/common/cache_utils.py +289 -0
  142. package/skills/ios-simulator-skill/scripts/common/device_utils.py +462 -0
  143. package/skills/ios-simulator-skill/scripts/common/env_config.py +35 -0
  144. package/skills/ios-simulator-skill/scripts/common/hang_pipeline.py +862 -0
  145. package/skills/ios-simulator-skill/scripts/common/hang_sessions.py +490 -0
  146. package/skills/ios-simulator-skill/scripts/common/idb_utils.py +180 -0
  147. package/skills/ios-simulator-skill/scripts/common/screenshot_utils.py +338 -0
  148. package/skills/ios-simulator-skill/scripts/container.py +668 -0
  149. package/skills/ios-simulator-skill/scripts/gesture.py +394 -0
  150. package/skills/ios-simulator-skill/scripts/hang_watcher.py +1533 -0
  151. package/skills/ios-simulator-skill/scripts/keyboard.py +391 -0
  152. package/skills/ios-simulator-skill/scripts/localization_audit.py +483 -0
  153. package/skills/ios-simulator-skill/scripts/location.py +467 -0
  154. package/skills/ios-simulator-skill/scripts/log_monitor.py +493 -0
  155. package/skills/ios-simulator-skill/scripts/model_inspector.py +645 -0
  156. package/skills/ios-simulator-skill/scripts/navigator.py +461 -0
  157. package/skills/ios-simulator-skill/scripts/privacy_manager.py +310 -0
  158. package/skills/ios-simulator-skill/scripts/push_notification.py +240 -0
  159. package/skills/ios-simulator-skill/scripts/screen_mapper.py +296 -0
  160. package/skills/ios-simulator-skill/scripts/sim_health_check.sh +245 -0
  161. package/skills/ios-simulator-skill/scripts/sim_list.py +299 -0
  162. package/skills/ios-simulator-skill/scripts/simctl_boot.py +312 -0
  163. package/skills/ios-simulator-skill/scripts/simctl_create.py +316 -0
  164. package/skills/ios-simulator-skill/scripts/simctl_delete.py +357 -0
  165. package/skills/ios-simulator-skill/scripts/simctl_erase.py +351 -0
  166. package/skills/ios-simulator-skill/scripts/simctl_shutdown.py +290 -0
  167. package/skills/ios-simulator-skill/scripts/simulator_selector.py +375 -0
  168. package/skills/ios-simulator-skill/scripts/status_bar.py +250 -0
  169. package/skills/ios-simulator-skill/scripts/test_recorder.py +323 -0
  170. package/skills/ios-simulator-skill/scripts/visual_diff.py +235 -0
  171. package/skills/ios-simulator-skill/scripts/xcode/__init__.py +13 -0
  172. package/skills/ios-simulator-skill/scripts/xcode/builder.py +397 -0
  173. package/skills/ios-simulator-skill/scripts/xcode/cache.py +204 -0
  174. package/skills/ios-simulator-skill/scripts/xcode/config.py +178 -0
  175. package/skills/ios-simulator-skill/scripts/xcode/reporter.py +343 -0
  176. package/skills/ios-simulator-skill/scripts/xcode/xcresult.py +451 -0
  177. package/skills/ios-visual-qa-strategist/SKILL.md +111 -0
  178. package/skills/ios-visual-qa-strategist/agents/openai.yaml +4 -0
  179. package/skills/ios-visual-qa-strategist/references/ios-tool-selection.md +61 -0
  180. package/skills/ios-visual-qa-strategist/references/minimal-capture-policy.md +56 -0
  181. package/skills/ios-visual-qa-strategist/references/visual-reasoning-heuristics.md +53 -0
  182. package/skills/orchestrator/SKILL.md +0 -20
  183. package/skills/persistent-storage/SKILL.md +55 -0
  184. package/skills/qwen-conductor/SKILL.md +100 -0
  185. package/skills/short-maker/SKILL.md +23 -0
  186. package/skills/short-maker/scripts/effects.js +56 -0
  187. package/skills/short-maker/scripts/shortmaker-bridge.js +332 -0
  188. package/skills/short-maker/scripts/videomix.js +601 -0
  189. package/skills/short-maker/templates/hyperframes/cinematic-character.template.html +172 -0
  190. package/skills/short-maker/templates/hyperframes/index.template.html +194 -0
  191. package/skills/smali-to-kotlin/SKILL.md +128 -0
  192. package/skills/smali-to-kotlin/examples/getting-started/tech-stack.md +58 -0
  193. package/skills/smali-to-kotlin/examples/pipeline/data-ui-parity.md +118 -0
  194. package/skills/smali-to-kotlin/examples/pipeline/scanner-and-bootstrap.md +106 -0
  195. package/skills/smali-to-kotlin/library-patterns.md +189 -0
  196. package/skills/smali-to-kotlin/phase-0-discovery.md +128 -0
  197. package/skills/smali-to-kotlin/phase-1-architecture.md +166 -0
  198. package/skills/smali-to-kotlin/phase-2-blueprint-ui.md +347 -0
  199. package/skills/smali-to-kotlin/phase-2-blueprint.md +228 -0
  200. package/skills/smali-to-kotlin/phase-3-build.md +248 -0
  201. package/skills/smali-to-kotlin/phase-3-logic-build.md +268 -0
  202. package/skills/smali-to-kotlin/smali-reading-guide.md +310 -0
  203. package/skills/smali-to-kotlin/templates/app-map.md +101 -0
  204. package/skills/smali-to-kotlin/templates/architecture.md +142 -0
  205. package/skills/smali-to-kotlin/templates/blueprint.md +145 -0
  206. package/skills/spec-gate/SKILL.md +6 -2
  207. package/skills/symphony-enforcer/SKILL.md +8 -0
  208. package/skills/symphony-enforcer/examples/mindful-stop.md +2 -0
  209. package/skills/symphony-enforcer/examples/three-phase.md +16 -0
  210. package/skills/symphony-enforcer/examples/trigger-points.md +7 -1
  211. package/skills/unity-game-development/SKILL.md +231 -0
  212. package/skills/video-edit/SKILL.md +36 -0
  213. package/skills/video-edit/scripts/video_edit.py +324 -0
  214. package/templates/project-identity/android.json +2 -2
  215. package/templates/project-identity/backend-nestjs.json +2 -2
  216. package/templates/project-identity/expo.json +2 -2
  217. package/templates/project-identity/ios.json +2 -2
  218. package/templates/project-identity/web-nextjs.json +2 -2
  219. package/templates/setup-mapping.json +48 -0
  220. package/templates/specs/design-template.md +161 -71
  221. package/templates/specs/requirements-template.md +65 -133
  222. package/templates/specs/task-spec-template.xml +3 -0
  223. package/workflows/_uncategorized/critic.md +40 -0
  224. package/workflows/_uncategorized/git-rebase-flow.md +81 -0
  225. package/workflows/_uncategorized/image-gen.md +118 -0
  226. package/workflows/_uncategorized/multi-model-pipeline.md +60 -0
  227. package/workflows/_uncategorized/pixel-gen.md +86 -0
  228. package/workflows/_uncategorized/pixel-setup.md +90 -0
  229. package/workflows/_uncategorized/ponytail-review.md +59 -0
  230. package/workflows/_uncategorized/reverse-android-build.md +222 -0
  231. package/workflows/_uncategorized/reverse-android-design.md +139 -0
  232. package/workflows/_uncategorized/reverse-android-discover.md +150 -0
  233. package/workflows/_uncategorized/reverse-android-scan.md +158 -0
  234. package/workflows/_uncategorized/reverse-android.md +143 -0
  235. package/workflows/_uncategorized/reverse-ios-build.md +240 -0
  236. package/workflows/_uncategorized/reverse-ios-design.md +112 -0
  237. package/workflows/_uncategorized/reverse-ios-discover.md +120 -0
  238. package/workflows/_uncategorized/reverse-ios-scan.md +155 -0
  239. package/workflows/_uncategorized/reverse-ios.md +152 -0
  240. package/workflows/_uncategorized/safety-router.md +34 -0
  241. package/workflows/_uncategorized/teach.md +89 -0
  242. package/workflows/_uncategorized/verify-ui.md +53 -0
  243. package/workflows/_uncategorized/visualize-screenshots.md +34 -0
  244. package/workflows/ads/ads-analyst.md +201 -0
  245. package/workflows/ads/ads-audit.md +106 -0
  246. package/workflows/ads/ads-optimize.md +97 -0
  247. package/workflows/ads/ads-targeting.md +241 -0
  248. package/workflows/ads/adsExpert.md +160 -0
  249. package/workflows/ads/smali-ads-config.md +400 -0
  250. package/workflows/ads/smali-ads-flow.md +331 -0
  251. package/workflows/ads/smali-ads-interstitial.md +377 -0
  252. package/workflows/ads/smali-ads-native.md +382 -0
  253. package/workflows/context/teach.md +89 -0
  254. package/workflows/gitnexus.md +8 -8
  255. package/workflows/lifecycle/brainstorm.md +43 -0
  256. package/workflows/lifecycle/code.md +5 -0
  257. package/workflows/lifecycle/init.md +23 -5
  258. package/workflows/lifecycle/multi-model-pipeline.md +60 -0
  259. package/workflows/multi-agent-pipeline.md +52 -0
  260. package/workflows/quality/ponytail-review.md +59 -0
  261. package/workflows/roles/critic.md +40 -0
  262. package/workflows/roles/safety-router.md +34 -0
@@ -0,0 +1,57 @@
1
+ # Product Requirement Document (PRD) - GreetingApp
2
+
3
+ ## Revision History
4
+ | Version | Date | Description | Author |
5
+ |---|---|---|---|
6
+ | v1.0 | 2026-06-22 | Initial PRD for GreetingApp | Antigravity Orchestrator |
7
+
8
+ ---
9
+
10
+ ## 1. Executive Summary
11
+ GreetingApp is a micro-application designed to deliver personalized, localized, and dynamic greetings to users. It adapts to the user's name, current time of day, and language preferences.
12
+
13
+ ## 2. Objectives & Goals
14
+ - Provide dynamic greetings based on user local time (Morning, Afternoon, Evening, Night).
15
+ - Support multi-language greetings (English, Vietnamese, Japanese).
16
+ - Track user greeting history and statistics.
17
+ - Expose both CLI and REST API interfaces.
18
+
19
+ ## 3. User Personas & Use Cases
20
+ - **End User:** Wants to see a welcoming, contextual message when logging in or using the CLI.
21
+ - **Developer:** Wants an easy-to-integrate greeting microservice API for downstream services.
22
+
23
+ ## 4. Functional Requirements
24
+ 1. **Dynamic Greeting Generation:**
25
+ - Detects local time of user.
26
+ - Personalizes with name (fallback to "Guest").
27
+ 2. **Localization (i18n):**
28
+ - Supports: English (`en`), Vietnamese (`vi`), Japanese (`ja`).
29
+ 3. **Greeting Analytics / History:**
30
+ - Stores logs of generated greetings (User, Timestamp, Language).
31
+ - Exposes statistics (e.g., total greetings generated, most active user).
32
+ 4. **Interfaces:**
33
+ - Command Line Interface (CLI): `awkit greet --name=Alice`
34
+ - REST API endpoint: `GET /api/greet?name=Alice&lang=vi`
35
+
36
+ ## 5. Non-Functional Requirements
37
+ - **Performance:** Response time for greeting generation under 50ms.
38
+ - **Reliability:** Storage fallback to memory if database/file storage is offline.
39
+ - **Extensibility:** Easy configuration to add new languages.
40
+
41
+ ## 6. System Flow & Sequence Diagram
42
+ ```mermaid
43
+ sequenceDiagram
44
+ autonumber
45
+ actor User
46
+ participant Client as CLI / API Client
47
+ participant Engine as Greeting Engine
48
+ participant DB as Storage / History DB
49
+
50
+ User->>Client: Triggers greeting command/request (name, lang)
51
+ Client->>Engine: Resolve greeting configuration
52
+ Engine->>Engine: Validate input & detect Time of Day
53
+ Engine->>DB: Log transaction (user, time, format)
54
+ DB-->>Engine: Log confirmation
55
+ Engine->>Client: Return formatted greeting string
56
+ Client->>User: Display greeting output
57
+ ```
@@ -0,0 +1,105 @@
1
+ # Brainstorm: Tích hợp Kiến trúc Đa Tác tử và Triết lý Wise Teacher vào Antigravity (AWKit)
2
+
3
+ ## Lịch sử Hiệu chỉnh (Revision History)
4
+
5
+ | Phiên bản | Ngày | Người thực hiện | Nội dung thay đổi |
6
+ | :--- | :--- | :--- | :--- |
7
+ | v1.0 | 2026-06-14 | Antigravity Orchestrator | Khởi tạo tài liệu gộp thống nhất cả 3 nghiên cứu: Wise Teacher, Fable 5 Multi-Agent và Antigravity Subagents. |
8
+
9
+ ---
10
+
11
+ ## Tóm tắt Điều hành (Executive Summary)
12
+
13
+ Tài liệu này đề xuất phương án tối ưu hóa toàn diện Antigravity (AWKit) bằng cách kết hợp:
14
+ 1. **Triết lý giảng dạy cuốn chiếu (Wise Teacher):** Đảm bảo user nắm vững Vấn đề (Problem), Giải pháp (Solution), và Bối cảnh (Broader Context).
15
+ 2. **Kiến trúc đa tác tử phân lớp (Manager-Workers-Critic-Safety Router):** Chống "Context Rot" và tối ưu hóa hiệu năng theo mô hình của Fable 5.
16
+ 3. **Cơ chế Subagents của Antigravity:** Tận dụng tối đa built-in `research` và các custom sub-agents để thực thi an toàn, cô lập ngữ cảnh và nâng cao hiệu quả làm việc.
17
+
18
+ ---
19
+
20
+ ## 1. Triết lý Giảng dạy Cuốn chiếu (Wise Teacher Protocol)
21
+
22
+ Phương pháp này chuyển đổi hoạt động của Antigravity từ "chỉ bàn giao code" sang "chuyển giao tri thức sâu sắc" cho con người một cách cuốn chiếu (Incremental Learning).
23
+
24
+ ```mermaid
25
+ graph TD
26
+ A[Bắt đầu Mục tiêu] --> B[User tự trình bày hiểu biết - Restatement]
27
+ B --> C[AI phân tích & lấp đầy lỗ hổng kiến thức]
28
+ C --> D[Quiz kiểm tra bằng AskUserQuestion]
29
+ D -->|Sai/Chưa hiểu sâu| C
30
+ D -->|Đã Master| E[Đánh dấu hoàn thành mục trong checklist]
31
+ ```
32
+
33
+ ### 3 Trụ cột Kiến thức Bắt buộc:
34
+ - **The Problem (Vấn đề):** Tại sao vấn đề tồn tại, các nhánh hướng đi để giải quyết.
35
+ - **The Solution (Giải pháp):** Tại sao chọn phương án này, quyết định thiết kế và edge cases.
36
+ - **Broader Context (Bối cảnh rộng):** Tác động lâu dài của thay đổi đối với toàn bộ hệ thống.
37
+
38
+ ### Cơ chế Tương tác:
39
+ - **Proactive Restatement:** Buộc user tự tóm tắt trước để AI dò tìm lỗ hổng kiến thức thực tế.
40
+ - **Adaptive Explanations (ELI5 / ELI14 / ELII):** Giải thích linh hoạt từ mức cực kỳ đơn giản (cho khái niệm trừu tượng) tới mức chuyên sâu (cho logic mã nguồn chi tiết).
41
+ - **Interactive Quizzing:** Sử dụng tool `AskUserQuestion` để tạo các câu đố trắc nghiệm (đảo lộn đáp án, ẩn kết quả cho tới khi nộp bài).
42
+
43
+ ---
44
+
45
+ ## 2. Kiến trúc Điều phối Đa Tác tử (Multi-Agent Control Plane)
46
+
47
+ Dựa trên nghiên cứu về Fable 5 và các tài liệu chính thức từ OpenAI/Google, chúng ta cần tránh việc dồn mọi log thô vào một luồng chat duy nhất (gây ra **Context Rot**). Thay vào đó, thiết lập một Control Plane phân lớp:
48
+
49
+ ```mermaid
50
+ graph TD
51
+ Manager[Manager / Synthesizer] -->|1. Phân loại & Định tuyến| Router[Safety Router / Classifier]
52
+ Manager -->|2. Phân rã nhiệm vụ| Workers[Bounded Specialists / Workers]
53
+ Workers -->|3. Trả kết quả tóm tắt| Critic[Critic / Verifier Pass]
54
+ Critic -->|4. Phản biện & Đối chiếu| Manager
55
+ Manager -->|5. Cập nhật| Ledger[External Work Ledger]
56
+ ```
57
+
58
+ ### Các Thành phần Cốt lõi:
59
+ 1. **Manager (Trình điều phối):** Giữ bối cảnh điều hành chính, phân rã công việc và tổng hợp kết quả cuối cùng.
60
+ 2. **Workers (Tác tử chuyên biệt):** Chỉ thực hiện các tác vụ đọc-ghi trong ranh giới được chỉ định, chỉ trả về **Structured Summary JSON** thay vì log thô.
61
+ 3. **Critic / Verifier:** So chéo kết quả, phát hiện mâu thuẫn, ngăn ngừa việc AI "chốt quá sớm" vào các giả thuyết sai (early commitment).
62
+ 4. **Safety Router:** Nhận diện các tác vụ nguy cơ cao (cyber, database write) để định tuyến sang degraded mode hoặc kích hoạt cổng phê duyệt (Approval Gate).
63
+ 5. **External Work Ledger:** Sổ ghi chép trạng thái ngoài model (lưu tại `.brain/session.json`) giúp khôi phục ngữ cảnh (resumable state) trên mọi họ mô hình (Claude, GPT, Gemini).
64
+
65
+ ---
66
+
67
+ ## 3. Hiện thực hóa bằng Cơ chế Subagents của Antigravity
68
+
69
+ Chúng ta ứng dụng trực tiếp tài liệu hướng dẫn của Google Antigravity 2.0 để cấu trúc các vai trò trên:
70
+
71
+ ```mermaid
72
+ sequenceDiagram
73
+ autonumber
74
+ actor User
75
+ participant Manager as Manager (Orchestrator)
76
+ participant Research as Research Agent (Built-in)
77
+ participant Critic as Critic Agent (Custom)
78
+
79
+ User->>Manager: Yêu cầu task COMPLEX
80
+ Manager->>Research: invoke_subagent (Quét codebase cô lập)
81
+ Research-->>Manager: Trả về Structured Summary JSON (Idle)
82
+ Note over Manager: Xây dựng giải pháp
83
+ Manager->>Critic: invoke_subagent (Yêu cầu review chéo)
84
+ Critic-->>Manager: Trả về Báo cáo lỗi tiềm ẩn & phản biện (Idle)
85
+ Note over Manager: Điều chỉnh giải pháp hoàn thiện
86
+ Manager->>User: Trình bày giải pháp cuối cùng kèm minh chứng
87
+ ```
88
+
89
+ ### Cách thức Triển khai cụ thể:
90
+ - **Tận dụng Built-in `research`:** Dùng cho mọi tác vụ tìm kiếm codebase hoặc đọc file lớn. Session tìm kiếm thô sẽ tự giải phóng khi subagent hoàn thành, giữ cho context chính cực sạch.
91
+ - **Định nghĩa Custom `critic` qua `define_subagent`:**
92
+ - Thiết lập `system_prompt` hướng tới việc rà soát lỗi logic, stress-test các giả thuyết.
93
+ - Cấu hình **Read-Only** tools để bảo vệ codebase khỏi việc ghi đè vô ý.
94
+ - **Định nghĩa Custom `safety-router`:** Phân loại các hành động có side-effect (ví dụ: mutated file, write database, outbound network). Sử dụng tính năng interruption của Antigravity để dừng luồng và xin phê duyệt từ user (Approval Boundary).
95
+ - **Giao tiếp qua Tin nhắn (Inter-Agent Messaging):** Tận dụng trạng thái `Idle` và cơ chế thức tỉnh khi nhận tin nhắn để duy trì các sub-agents chạy ngầm trong suốt phiên làm việc, tránh khởi tạo lại nhiều lần gây hao phí token.
96
+
97
+ ---
98
+
99
+ ## 4. Kịch bản Kiểm thử & Đánh giá (Verification Cases)
100
+
101
+ | Kịch bản | Cách thức thực thi | Tiêu chí Đạt (Pass Criteria) |
102
+ | :--- | :--- | :--- |
103
+ | **Deep Research & Code Review** | Manager spawn `research` để tìm codebase, sau đó spawn 2 `critic` song song để review độc lập. | Báo cáo cuối đầy đủ bằng chứng, không lẫn log thô của `research`. |
104
+ | **Approval Boundary Test** | Thực thi một câu lệnh ghi đè file nhạy cảm. | Hệ thống bắt buộc phải kích hoạt `safety-router`, tạm dừng tiến trình và hiển thị yêu cầu Approve rõ ràng cho User. |
105
+ | **Wise Teacher Checkpoint** | Kích hoạt `/teach` sau một gate lớn. | Tạo thành công checklist học tập tại `.brain/teach_checklist.md`, hỏi user restate và đặt câu hỏi qua `AskUserQuestion`. |
@@ -0,0 +1,58 @@
1
+ # Add Game Development Skills (Unity, Godot, Expo)
2
+
3
+ Implement dedicated game development skills inside `main-awf/skills` to enhance the orchestrator's capability in building games using Unity, Godot, and Expo.
4
+
5
+ ## User Review Required
6
+
7
+ > [!NOTE]
8
+ > All new skills will be created directly in `skills/` of `main-awf` workspace and then deployed to `~/.gemini/antigravity` via `awkit install`.
9
+
10
+ ## Proposed Changes
11
+
12
+ ### AWKit Skills
13
+
14
+ ---
15
+
16
+ #### [NEW] [unity-game-development/SKILL.md](file:///Users/trungkientn/Dev/NodeJS/main-awf/skills/unity-game-development/SKILL.md)
17
+ Contains high-density instructions for Unity game development, enforcing:
18
+ - C# coding style (PascalCase public, camelCase private, `m_` fields prefix).
19
+ - Component-based architecture and ScriptableObjects for data-driven game structures.
20
+ - Performance optimization: avoiding `Find`/`GetComponent` in hot paths (`Update()`), caching, object pooling.
21
+ - Separate Editor code via `#if UNITY_EDITOR`.
22
+ - Direct Unity MCP server integration.
23
+
24
+ #### [NEW] [godot-game-development/SKILL.md](file:///Users/trungkientn/Dev/NodeJS/main-awf/skills/godot-game-development/SKILL.md)
25
+ Contains guidelines for Godot 4.x game development, enforcing:
26
+ - Godot 4 API standards (rejecting Godot 3 syntax).
27
+ - GDScript style preferences (`@export`, `@onready`, `await` signals).
28
+ - Composition-first scene tree structure over deep class inheritance.
29
+ - Signal connection best practices (`signal.connect(callback)`).
30
+ - Physics and locomotion handling via parameterless `move_and_slide()`.
31
+
32
+ #### [NEW] [expo-game-development/SKILL.md](file:///Users/trungkientn/Dev/NodeJS/main-awf/skills/expo-game-development/SKILL.md)
33
+ Contains instructions for Expo/React Native game development, covering:
34
+ - High-frequency drawing techniques (React Native Skia, Expo GL/Three.js).
35
+ - State optimization: keeping physics/game tick loop decoupled from heavy React re-renders.
36
+ - User input handling (React Native Gesture Handler).
37
+ - Game loop implementations using `requestAnimationFrame`.
38
+ - Asset management and sound effects via `expo-av`.
39
+
40
+ ---
41
+
42
+ #### [MODIFY] [CATALOG.md](file:///Users/trungkientn/Dev/NodeJS/main-awf/skills/CATALOG.md)
43
+ Add the three new skills to the active skills table.
44
+
45
+ #### [MODIFY] [TRIGGER_INDEX.md](file:///Users/trungkientn/Dev/NodeJS/main-awf/skills/TRIGGER_INDEX.md)
46
+ Register keywords and triggers for the new game skills.
47
+
48
+ ---
49
+
50
+ ## Verification Plan
51
+
52
+ ### Automated Verification
53
+ - Run `awkit status` to inspect mapping diffs.
54
+ - Deploy to runtime using `awkit install`.
55
+ - Verify CLI integration and syntax using `awkit doctor`.
56
+
57
+ ### Manual Verification
58
+ - Ask the user to verify the added skills locally or confirm availability in future workspace tasks.
@@ -0,0 +1,127 @@
1
+ # Technical Specification — MemoizedFibonacci
2
+
3
+ ## Revision History
4
+
5
+ | Version | Date | Author | Description |
6
+ | :--- | :--- | :--- | :--- |
7
+ | 1.0 | 2026-06-22 | Antigravity Orchestrator | Initial technical design with Mermaid diagram, class architecture, and caching strategy. |
8
+
9
+ ---
10
+
11
+ ## 1. System Architecture
12
+
13
+ The `MemoizedFibonacci` feature consists of three primary layers:
14
+ 1. **API & Interface Layer:** Exposes synchronous and asynchronous methods to users.
15
+ 2. **LRU Cache Layer:** Manages in-memory storage of computed sequences with automatic eviction based on Least Recently Used patterns.
16
+ 3. **Computation Engine:** Performs iterative sequence calculations to prevent call stack overflow, handles dynamic upgrading to `BigInt` for large numbers, and schedules asynchronous chunks for heavy inputs.
17
+
18
+ ---
19
+
20
+ ## 2. API Design & Core Interface
21
+
22
+ ```typescript
23
+ interface FibonacciConfig {
24
+ maxCacheSize?: number; // Maximum number of entries in the cache (default: 1000)
25
+ useBigInt?: boolean; // Force BigInt computation even for small inputs (default: false)
26
+ asyncThreshold?: number; // Input size to trigger asynchronous execution (default: 50000)
27
+ }
28
+
29
+ interface CacheStats {
30
+ hits: number;
31
+ misses: number;
32
+ size: number;
33
+ evictions: number;
34
+ }
35
+
36
+ class MemoizedFibonacci {
37
+ private cache: Map<number, number | bigint>;
38
+ private lruList: number[]; // Tracks usage order (least recently used at the front)
39
+ private config: Required<FibonacciConfig>;
40
+ private stats: CacheStats;
41
+
42
+ constructor(config?: FibonacciConfig);
43
+
44
+ /**
45
+ * Calculates Fibonacci of n. Automatically picks sync/async mode based on threshold.
46
+ */
47
+ public async calculate(n: number): Promise<number | bigint>;
48
+
49
+ /**
50
+ * Synchronously calculates Fibonacci of n.
51
+ * Throws warning/error if n is larger than asyncThreshold.
52
+ */
53
+ public calculateSync(n: number): number | bigint;
54
+
55
+ /**
56
+ * Retreives cache usage statistics.
57
+ */
58
+ public getStats(): CacheStats;
59
+
60
+ /**
61
+ * Clears all cache entries and metrics.
62
+ */
63
+ public clearCache(): void;
64
+
65
+ /**
66
+ * Private helper implementing iterative Fibonacci sequence.
67
+ */
68
+ private computeIterative(n: number, isBigInt: boolean): number | bigint;
69
+ }
70
+ ```
71
+
72
+ ---
73
+
74
+ ## 3. Detailed Logic Flow (Mermaid Diagram)
75
+
76
+ The following diagram illustrates the routing, validation, precision selection, and caching logic:
77
+
78
+ ```mermaid
79
+ graph TD
80
+ A[Start: Calculate F(n)] --> B{Validate input n >= 0}
81
+ B -- No --> C[Throw Error: Invalid Input]
82
+ B -- Yes --> D{Check Cache for n}
83
+ D -- Hit (Yes) --> E[Update LRU Order]
84
+ E --> F[Return Cached Value]
85
+ D -- Miss (No) --> G{Check Precision Mode: n > 78 or useBigInt}
86
+ G -- Standard Number (n <= 78) --> H[Compute using standard arithmetic]
87
+ G -- BigInt (n > 78) --> I{Is n >= asyncThreshold?}
88
+ I -- No (Sync BigInt) --> J[Compute iteratively using BigInt]
89
+ I -- Yes (Async BigInt) --> K[Offload computation to worker thread / chunked loop]
90
+ K --> L[Iterate asynchronously without blocking event loop]
91
+ H --> M[Store Result in Cache]
92
+ J --> M
93
+ L --> M
94
+ M --> N{Cache Size > maxCacheSize?}
95
+ N -- Yes --> O[Evict Least Recently Used entry]
96
+ O --> P[Return Computed Result]
97
+ N -- No --> P
98
+ ```
99
+
100
+ ---
101
+
102
+ ## 4. Key Implementation Mechanics
103
+
104
+ ### 4.1 LRU Eviction Implementation
105
+ To avoid linear scanning for evictions, the cache is backed by:
106
+ - A `Map` mapping `n` to the value (either `Number` or `BigInt`).
107
+ - A doubly-linked list or ordered array (`lruList`) tracking usage keys. On a cache hit, the key is moved to the end. On a cache insertion, if the map exceeds `maxCacheSize`, the key at the front of `lruList` is deleted from both the list and the map.
108
+
109
+ ### 4.2 Precision Safeguards
110
+ - **Standard Float Limits:** Standard numbers in JavaScript lose precision above $F(78)$ ($F(78) = 8944394323791464$, whereas $F(79) = 14472334024559020$ which exceeds `Number.MAX_SAFE_INTEGER`).
111
+ - **Automatic BigInt Upgrade:** If the class configuration is not explicitly set, inputs $n \ge 79$ automatically upgrade execution to `BigInt` mode.
112
+
113
+ ### 4.3 Async Slicing / Non-blocking Loop
114
+ For large values of $n$ (e.g. $n \ge 500,000$), calculating Fibonacci in a single synchronous loop blocks the JS single-threaded event loop for several milliseconds. The `MemoizedFibonacci` class handles this via:
115
+ - **Chunked execution:** Splitting the loop into chunks of 10,000 iterations and yielding back control using `setImmediate` or `setTimeout(..., 0)` to allow standard event-loop ticks to execute.
116
+ - Alternatively, utilizing **Worker Threads** via `node:worker_threads` for CPU offloading in Node.js environments.
117
+
118
+ ---
119
+
120
+ ## 5. Error Handling & Edge Cases
121
+
122
+ | Condition | System Response |
123
+ | :--- | :--- |
124
+ | Negative Input ($n < 0$) | Throws `RangeError: Input must be a non-negative integer.` |
125
+ | Floating point Input (e.g., $n = 3.5$) | Automatically truncated using `Math.floor(n)` with a console warning, or throws a `TypeError`. |
126
+ | Out of Memory Risk ($n > 1,000,000$) | Rejects promise with a warning about resource exhaustion unless a `force` flag is set. |
127
+ | Cache Collision (Standard vs BigInt) | Values in cache are stored with consistent type based on configuration to avoid mixed-type arithmetic downstream. |
@@ -0,0 +1,97 @@
1
+ # Technical Specification - GreetingApp
2
+
3
+ ## Revision History
4
+ | Version | Date | Description | Author |
5
+ |---|---|---|---|
6
+ | v1.0 | 2026-06-22 | Technical specification for GreetingApp | Antigravity Orchestrator |
7
+
8
+ ---
9
+
10
+ ## 1. System Architecture
11
+ The GreetingApp consists of three major components:
12
+ 1. **Greeting Engine (Core):** Performs validation, detects time-of-day categories, maps to localization files, and builds the string.
13
+ 2. **Storage Layer:** A lightweight JSON/SQLite file logger to record history.
14
+ 3. **Interfaces:**
15
+ - CLI Controller: Handles flags and standard output formatting.
16
+ - REST Controller: Express.js routes and JSON responses.
17
+
18
+ ## 2. Detailed Component Specs
19
+
20
+ ### 2.1 Greeting Engine (`core/GreetingEngine`)
21
+ - **Input:**
22
+ - `name`: string (optional, default: "Guest")
23
+ - `lang`: string (optional, default: "en")
24
+ - `timezone`: string (optional, default: system timezone)
25
+ - **Time Periods:**
26
+ - `Morning`: 05:00 - 11:59
27
+ - `Afternoon`: 12:00 - 17:59
28
+ - `Evening`: 18:00 - 21:59
29
+ - `Night`: 22:00 - 04:59
30
+ - **Localization Files (`locales/*.json`):**
31
+ - Example `en.json`:
32
+ ```json
33
+ {
34
+ "morning": "Good morning, {name}!",
35
+ "afternoon": "Good afternoon, {name}!",
36
+ "evening": "Good evening, {name}!",
37
+ "night": "Good night, {name}!"
38
+ }
39
+ ```
40
+
41
+ ### 2.2 Storage Schema
42
+ A SQLite or JSON lines file containing:
43
+ - `id`: UUID / Auto-increment integer
44
+ - `name`: String
45
+ - `language`: String
46
+ - `timestamp`: ISO-8601 string
47
+ - `greeting_message`: String
48
+
49
+ ## 3. Interface Design
50
+
51
+ ### 3.1 CLI Interface
52
+ `awkit greet [options]`
53
+ - `--name, -n`: Name of the user to greet.
54
+ - `--lang, -l`: Language code (en, vi, ja).
55
+ - `--help, -h`: Show usage description.
56
+
57
+ ### 3.2 REST API Specification
58
+ `GET /api/greet`
59
+ - **Query Parameters:**
60
+ - `name` (string)
61
+ - `lang` (string)
62
+ - **Response (200 OK):**
63
+ - Content-Type: `application/json`
64
+ - Body:
65
+ ```json
66
+ {
67
+ "status": "success",
68
+ "data": {
69
+ "message": "Good morning, Alice!",
70
+ "name": "Alice",
71
+ "lang": "en",
72
+ "timestamp": "2026-06-22T05:35:15Z"
73
+ }
74
+ }
75
+ ```
76
+
77
+ ## 4. Error Handling
78
+ - **Invalid Language:** Fallback to `en` and log warning.
79
+ - **Invalid Input characters:** Sanitize inputs to prevent command line injection or XSS (on API side).
80
+
81
+ ## 5. Flow Diagram
82
+ ```mermaid
83
+ graph TD
84
+ A[Start Request] --> B{Validate Inputs}
85
+ B -- Invalid --> C[Use Defaults: Guest/en]
86
+ B -- Valid --> D[Resolve User Local Time]
87
+ C --> D
88
+ D --> E{Determine Time of Day}
89
+ E -->|05:00-11:59| F[Morning Template]
90
+ E -->|12:00-17:59| G[Afternoon Template]
91
+ E -->|18:00-21:59| H[Evening Template]
92
+ E -->|22:00-04:59| I[Night Template]
93
+ F & G & H & I --> J[Replace {name} in Template]
94
+ J --> K[Log Transaction to History DB]
95
+ K --> L[Format Output CLI/REST]
96
+ L --> M[End Request]
97
+ ```
@@ -0,0 +1,211 @@
1
+ # Technical Specification — MemoizedFibonacci
2
+
3
+ ## Revision History
4
+
5
+ | Version | Date | Author | Description |
6
+ | :--- | :--- | :--- | :--- |
7
+ | 1.0 | 2026-06-22 | Antigravity Orchestrator | Initial technical design with Mermaid diagram, class architecture, and caching strategy. |
8
+ | 1.1 | 2026-06-22 | Antigravity Orchestrator | Refined LRU caching mechanism using ES6 Map insertion ordering. Added explicit detail on Async Slicing and Testing Strategy. |
9
+
10
+ ---
11
+
12
+ ## 1. System Architecture
13
+
14
+ The `MemoizedFibonacci` feature consists of three primary layers:
15
+ 1. **API & Interface Layer:** Exposes synchronous and asynchronous methods to users.
16
+ 2. **LRU Cache Layer:** Manages in-memory storage of computed sequences with automatic eviction based on Least Recently Used patterns.
17
+ 3. **Computation Engine:** Performs iterative sequence calculations to prevent call stack overflow, handles dynamic upgrading to `BigInt` for large numbers, and schedules asynchronous chunks for heavy inputs.
18
+
19
+ ---
20
+
21
+ ## 2. API Design & Core Interface
22
+
23
+ ```typescript
24
+ interface FibonacciConfig {
25
+ maxCacheSize?: number; // Maximum number of entries in the cache (default: 1000)
26
+ useBigInt?: boolean; // Force BigInt computation even for small inputs (default: false)
27
+ asyncThreshold?: number; // Input size to trigger asynchronous execution (default: 50000)
28
+ }
29
+
30
+ interface CacheStats {
31
+ hits: number;
32
+ misses: number;
33
+ size: number;
34
+ evictions: number;
35
+ }
36
+
37
+ class MemoizedFibonacci {
38
+ // Built-in ES6 Map maintains insertion order.
39
+ // By deleting and re-inserting a key on access, the most recently used keys move to the end.
40
+ // The first key in map.keys() represents the Least Recently Used (LRU) element.
41
+ private cache: Map<number, number | bigint>;
42
+ private config: Required<FibonacciConfig>;
43
+ private stats: CacheStats;
44
+
45
+ constructor(config?: FibonacciConfig);
46
+
47
+ /**
48
+ * Calculates Fibonacci of n. Automatically picks sync/async mode based on threshold.
49
+ * Returns a Promise resolving to number or bigint.
50
+ */
51
+ public calculate(n: number): Promise<number | bigint>;
52
+
53
+ /**
54
+ * Synchronously calculates Fibonacci of n.
55
+ * Throws RangeError if n exceeds asyncThreshold to protect the thread.
56
+ */
57
+ public calculateSync(n: number): number | bigint;
58
+
59
+ /**
60
+ * Checks if the value for n is currently cached.
61
+ */
62
+ public isCached(n: number): boolean;
63
+
64
+ /**
65
+ * Dynamically updates the cache capacity limit. Evicts items if size exceeds new limit.
66
+ */
67
+ public setMaxCacheSize(size: number): void;
68
+
69
+ /**
70
+ * Retrieves cache usage statistics.
71
+ */
72
+ public getStats(): CacheStats;
73
+
74
+ /**
75
+ * Clears all cache entries and resets statistics.
76
+ */
77
+ public clearCache(): void;
78
+
79
+ /**
80
+ * Internal helper implementing iterative computation.
81
+ */
82
+ private computeIterative(n: number, isBigInt: boolean): number | bigint;
83
+
84
+ /**
85
+ * Internal helper performing non-blocking chunked computation.
86
+ */
87
+ private computeAsyncChunked(n: number, chunkSize: number): Promise<bigint>;
88
+ }
89
+ ```
90
+
91
+ ---
92
+
93
+ ## 3. Detailed Logic Flow (Mermaid Diagram)
94
+
95
+ The following diagram illustrates the routing, validation, precision selection, and caching logic:
96
+
97
+ ```mermaid
98
+ graph TD
99
+ A[Start: Calculate F(n)] --> B{Validate input n >= 0}
100
+ B -- No --> C[Throw RangeError: Invalid Input]
101
+ B -- Yes --> D{Check Cache for n}
102
+
103
+ D -- Hit (Yes) --> E[Update Map Insertion Order: Delete & Re-insert]
104
+ E --> F[Increment Hit Metric]
105
+ F --> G[Return Cached Value]
106
+
107
+ D -- Miss (No) --> H[Increment Miss Metric]
108
+ H --> I{Check Precision Mode: n > 78 or useBigInt}
109
+
110
+ I -- Standard Number (n <= 78) --> J[Compute iteratively using standard Number]
111
+ I -- BigInt (n > 78) --> K{Is n >= asyncThreshold?}
112
+
113
+ K -- No (Sync BigInt) --> L[Compute iteratively using BigInt]
114
+ K -- Yes (Async BigInt) --> M[Invoke computeAsyncChunked]
115
+
116
+ M --> N[Loop in chunks of size 10,000 using setImmediate]
117
+ N --> O[Yield control back to Event Loop after each chunk]
118
+
119
+ J --> P[Store Result in Cache]
120
+ L --> P
121
+ O --> P
122
+
123
+ P --> Q{Cache Size > maxCacheSize?}
124
+ Q -- Yes --> R[Evict map.keys.next.value oldest entry]
125
+ R --> S[Increment Eviction Metric]
126
+ S --> T[Return Computed Result]
127
+ Q -- No --> T
128
+ ```
129
+
130
+ ---
131
+
132
+ ## 4. Key Implementation Mechanics
133
+
134
+ ### 4.1 LRU Eviction Implementation (ES6 Map)
135
+ Instead of managing a separate `lruList` array (which incurs $O(N)$ lookup/splice operations), the implementation relies entirely on the ordered property of JavaScript's `Map`.
136
+ * **Read (Cache Hit):**
137
+ ```javascript
138
+ const value = this.cache.get(key);
139
+ this.cache.delete(key);
140
+ this.cache.set(key, value); // Re-inserts at the end of the Map
141
+ ```
142
+ * **Write (Cache Miss & Capacity Exceeded):**
143
+ ```javascript
144
+ this.cache.set(key, value);
145
+ if (this.cache.size > this.config.maxCacheSize) {
146
+ const oldestKey = this.cache.keys().next().value;
147
+ this.cache.delete(oldestKey); // Deletes the oldest insertion
148
+ this.stats.evictions++;
149
+ }
150
+ ```
151
+ This architecture yields highly efficient $O(1)$ operations for both cache lookup and replacement.
152
+
153
+ ### 4.2 Precision Safeguards & Double Limits
154
+ - **Standard Float Limits:** Standard numbers in JavaScript lose precision above $F(78)$ ($F(78) = 8944394323791464$, whereas $F(79) = 14472334024559020$ which exceeds `Number.MAX_SAFE_INTEGER`).
155
+ - **Automatic BigInt Upgrade:** If the class configuration is not explicitly set, inputs $n \ge 79$ automatically upgrade execution to `BigInt` mode.
156
+
157
+ ### 4.3 Async Slicing / Non-blocking Loop
158
+ For large values of $n$ (e.g. $n \ge 100,000$), calculating Fibonacci in a single synchronous loop blocks the JS single-threaded event loop.
159
+ We employ a chunked calculation pattern:
160
+ ```javascript
161
+ private async computeAsyncChunked(n: number, chunkSize: number = 10000): Promise<bigint> {
162
+ let prev = 0n;
163
+ let curr = 1n;
164
+ let i = 2;
165
+
166
+ const runChunk = (): Promise<bigint> => {
167
+ return new Promise((resolve) => {
168
+ setImmediate(() => {
169
+ const target = Math.min(i + chunkSize, n + 1);
170
+ for (; i < target; i++) {
171
+ const next = prev + curr;
172
+ prev = curr;
173
+ curr = next;
174
+ }
175
+ if (i <= n) {
176
+ resolve(runChunk()); // Recursively queue the next chunk
177
+ } else {
178
+ resolve(curr);
179
+ }
180
+ });
181
+ });
182
+ };
183
+
184
+ return runChunk();
185
+ }
186
+ ```
187
+
188
+ ---
189
+
190
+ ## 5. Error Handling & Edge Cases
191
+
192
+ | Condition | System Response |
193
+ | :--- | :--- |
194
+ | Negative Input ($n < 0$) | Throws `RangeError: Input must be a non-negative integer.` |
195
+ | Floating point Input (e.g., $n = 3.5$) | Throws `TypeError: Input must be an integer.` |
196
+ | Maximum Guardrail Breach ($n > 1,000,000$) | Throws `RangeError: Calculation size exceeds maximum guardrail of 1,000,000.` |
197
+ | Sync Call beyond Threshold ($n > asyncThreshold$) | Throws `RangeError: Input exceeds asyncThreshold. Use calculate() instead.` |
198
+
199
+ ---
200
+
201
+ ## 6. Testing Strategy
202
+
203
+ ### 6.1 Unit Tests
204
+ * **Core Calculations:** Verify $F(0) = 0$, $F(1) = 1$, $F(10) = 55$, and $F(78) = 8944394323791464$.
205
+ * **BigInt Accuracy:** Verify $F(79)$ is correctly calculated as `14472334024559020n` (with tailing `n` specifying bigint).
206
+ * **Caching Performance:** Retrieve $F(50)$ twice. The second call must trigger a cache hit and have a latency under 1 microsecond.
207
+ * **LRU Eviction:** Set cache limit to 3. Populate cache with keys 1, 2, 3. Read key 1 (making it most recently used). Insert key 4. Verify key 2 is evicted.
208
+
209
+ ### 6.2 Performance & Memory Benchmarks
210
+ * **Sync vs Async Threshold:** Test the threshold boundary. Verify that calling `calculate(49999)` completes synchronously within milliseconds, and `calculate(50001)` returns a Promise and yields event loop control.
211
+ * **Leak Testing:** Execute calculation loop of random values up to $n = 10,000$ for 100,000 iterations. Verify heap memory remains flat (no leakage outside the bounds of `maxCacheSize`).
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@leejungkiin/awkit",
3
- "version": "1.7.1",
3
+ "version": "1.7.5",
4
4
  "description": "Antigravity Workflow Kit v1.6 Unified AI agent orchestration system with Mindful Checkpoints.",
5
5
  "main": "bin/awk.js",
6
6
  "private": false,
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
7
10
  "bin": {
8
11
  "awkit": "bin/awk.js",
9
12
  "ag": "bin/awk.js"