@backendkit-labs/agent-coding 0.14.0

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 (193) hide show
  1. package/dist/agents/AgentLoader.d.ts +33 -0
  2. package/dist/agents/AgentLoader.d.ts.map +1 -0
  3. package/dist/agents/AgentLoader.js +167 -0
  4. package/dist/agents/AgentLoader.js.map +1 -0
  5. package/dist/agents/profiles.d.ts +3 -0
  6. package/dist/agents/profiles.d.ts.map +1 -0
  7. package/dist/agents/profiles.js +121 -0
  8. package/dist/agents/profiles.js.map +1 -0
  9. package/dist/agents/prompts/architecture.d.ts +2 -0
  10. package/dist/agents/prompts/architecture.d.ts.map +1 -0
  11. package/dist/agents/prompts/architecture.js +151 -0
  12. package/dist/agents/prompts/architecture.js.map +1 -0
  13. package/dist/agents/prompts/backend.d.ts +2 -0
  14. package/dist/agents/prompts/backend.d.ts.map +1 -0
  15. package/dist/agents/prompts/backend.js +96 -0
  16. package/dist/agents/prompts/backend.js.map +1 -0
  17. package/dist/agents/prompts/coder.d.ts +2 -0
  18. package/dist/agents/prompts/coder.d.ts.map +1 -0
  19. package/dist/agents/prompts/coder.js +50 -0
  20. package/dist/agents/prompts/coder.js.map +1 -0
  21. package/dist/agents/prompts/data.d.ts +2 -0
  22. package/dist/agents/prompts/data.d.ts.map +1 -0
  23. package/dist/agents/prompts/data.js +123 -0
  24. package/dist/agents/prompts/data.js.map +1 -0
  25. package/dist/agents/prompts/frontend.d.ts +2 -0
  26. package/dist/agents/prompts/frontend.d.ts.map +1 -0
  27. package/dist/agents/prompts/frontend.js +91 -0
  28. package/dist/agents/prompts/frontend.js.map +1 -0
  29. package/dist/agents/prompts/general.d.ts +2 -0
  30. package/dist/agents/prompts/general.d.ts.map +1 -0
  31. package/dist/agents/prompts/general.js +93 -0
  32. package/dist/agents/prompts/general.js.map +1 -0
  33. package/dist/agents/prompts/infrastructure.d.ts +2 -0
  34. package/dist/agents/prompts/infrastructure.d.ts.map +1 -0
  35. package/dist/agents/prompts/infrastructure.js +145 -0
  36. package/dist/agents/prompts/infrastructure.js.map +1 -0
  37. package/dist/agents/prompts/project-manager.d.ts +2 -0
  38. package/dist/agents/prompts/project-manager.d.ts.map +1 -0
  39. package/dist/agents/prompts/project-manager.js +66 -0
  40. package/dist/agents/prompts/project-manager.js.map +1 -0
  41. package/dist/agents/prompts/qa.d.ts +2 -0
  42. package/dist/agents/prompts/qa.d.ts.map +1 -0
  43. package/dist/agents/prompts/qa.js +166 -0
  44. package/dist/agents/prompts/qa.js.map +1 -0
  45. package/dist/agents/prompts/security.d.ts +2 -0
  46. package/dist/agents/prompts/security.d.ts.map +1 -0
  47. package/dist/agents/prompts/security.js +129 -0
  48. package/dist/agents/prompts/security.js.map +1 -0
  49. package/dist/config/ConfigLoader.d.ts +27 -0
  50. package/dist/config/ConfigLoader.d.ts.map +1 -0
  51. package/dist/config/ConfigLoader.js +167 -0
  52. package/dist/config/ConfigLoader.js.map +1 -0
  53. package/dist/index.d.ts +160 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +340 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/orchestration/capability-matrix.d.ts +10 -0
  58. package/dist/orchestration/capability-matrix.d.ts.map +1 -0
  59. package/dist/orchestration/capability-matrix.js +48 -0
  60. package/dist/orchestration/capability-matrix.js.map +1 -0
  61. package/dist/providers/AnthropicProvider.d.ts +20 -0
  62. package/dist/providers/AnthropicProvider.d.ts.map +1 -0
  63. package/dist/providers/AnthropicProvider.js +185 -0
  64. package/dist/providers/AnthropicProvider.js.map +1 -0
  65. package/dist/providers/DeepSeekProvider.d.ts +11 -0
  66. package/dist/providers/DeepSeekProvider.d.ts.map +1 -0
  67. package/dist/providers/DeepSeekProvider.js +18 -0
  68. package/dist/providers/DeepSeekProvider.js.map +1 -0
  69. package/dist/providers/OpenAICompatibleProvider.d.ts +22 -0
  70. package/dist/providers/OpenAICompatibleProvider.d.ts.map +1 -0
  71. package/dist/providers/OpenAICompatibleProvider.js +124 -0
  72. package/dist/providers/OpenAICompatibleProvider.js.map +1 -0
  73. package/dist/skills/builtins/global.d.ts +7 -0
  74. package/dist/skills/builtins/global.d.ts.map +1 -0
  75. package/dist/skills/builtins/global.js +208 -0
  76. package/dist/skills/builtins/global.js.map +1 -0
  77. package/dist/skills/builtins/go-pack.d.ts +7 -0
  78. package/dist/skills/builtins/go-pack.d.ts.map +1 -0
  79. package/dist/skills/builtins/go-pack.js +263 -0
  80. package/dist/skills/builtins/go-pack.js.map +1 -0
  81. package/dist/skills/builtins/java-pack.d.ts +7 -0
  82. package/dist/skills/builtins/java-pack.d.ts.map +1 -0
  83. package/dist/skills/builtins/java-pack.js +272 -0
  84. package/dist/skills/builtins/java-pack.js.map +1 -0
  85. package/dist/skills/builtins/kotlin-pack.d.ts +9 -0
  86. package/dist/skills/builtins/kotlin-pack.d.ts.map +1 -0
  87. package/dist/skills/builtins/kotlin-pack.js +292 -0
  88. package/dist/skills/builtins/kotlin-pack.js.map +1 -0
  89. package/dist/skills/builtins/node-pack.d.ts +7 -0
  90. package/dist/skills/builtins/node-pack.d.ts.map +1 -0
  91. package/dist/skills/builtins/node-pack.js +750 -0
  92. package/dist/skills/builtins/node-pack.js.map +1 -0
  93. package/dist/skills/builtins/python-pack.d.ts +7 -0
  94. package/dist/skills/builtins/python-pack.d.ts.map +1 -0
  95. package/dist/skills/builtins/python-pack.js +303 -0
  96. package/dist/skills/builtins/python-pack.js.map +1 -0
  97. package/dist/skills/index.d.ts +7 -0
  98. package/dist/skills/index.d.ts.map +1 -0
  99. package/dist/skills/index.js +16 -0
  100. package/dist/skills/index.js.map +1 -0
  101. package/dist/store/LearningRouter.d.ts +17 -0
  102. package/dist/store/LearningRouter.d.ts.map +1 -0
  103. package/dist/store/LearningRouter.js +165 -0
  104. package/dist/store/LearningRouter.js.map +1 -0
  105. package/dist/store/PersistentMemory.d.ts +10 -0
  106. package/dist/store/PersistentMemory.d.ts.map +1 -0
  107. package/dist/store/PersistentMemory.js +29 -0
  108. package/dist/store/PersistentMemory.js.map +1 -0
  109. package/dist/store/ProjectStore.d.ts +29 -0
  110. package/dist/store/ProjectStore.d.ts.map +1 -0
  111. package/dist/store/ProjectStore.js +191 -0
  112. package/dist/store/ProjectStore.js.map +1 -0
  113. package/dist/store/__tests__/PersistentMemory.test.d.ts +2 -0
  114. package/dist/store/__tests__/PersistentMemory.test.d.ts.map +1 -0
  115. package/dist/store/__tests__/PersistentMemory.test.js +46 -0
  116. package/dist/store/__tests__/PersistentMemory.test.js.map +1 -0
  117. package/dist/tools/__tests__/file-tools.test.d.ts +2 -0
  118. package/dist/tools/__tests__/file-tools.test.d.ts.map +1 -0
  119. package/dist/tools/__tests__/file-tools.test.js +144 -0
  120. package/dist/tools/__tests__/file-tools.test.js.map +1 -0
  121. package/dist/tools/__tests__/path-sandbox.test.d.ts +2 -0
  122. package/dist/tools/__tests__/path-sandbox.test.d.ts.map +1 -0
  123. package/dist/tools/__tests__/path-sandbox.test.js +45 -0
  124. package/dist/tools/__tests__/path-sandbox.test.js.map +1 -0
  125. package/dist/tools/__tests__/run-command.test.d.ts +2 -0
  126. package/dist/tools/__tests__/run-command.test.d.ts.map +1 -0
  127. package/dist/tools/__tests__/run-command.test.js +61 -0
  128. package/dist/tools/__tests__/run-command.test.js.map +1 -0
  129. package/dist/tools/append-log.d.ts +2 -0
  130. package/dist/tools/append-log.d.ts.map +1 -0
  131. package/dist/tools/append-log.js +3 -0
  132. package/dist/tools/append-log.js.map +1 -0
  133. package/dist/tools/edit-file.d.ts +2 -0
  134. package/dist/tools/edit-file.d.ts.map +1 -0
  135. package/dist/tools/edit-file.js +45 -0
  136. package/dist/tools/edit-file.js.map +1 -0
  137. package/dist/tools/list-directory.d.ts +2 -0
  138. package/dist/tools/list-directory.d.ts.map +1 -0
  139. package/dist/tools/list-directory.js +47 -0
  140. package/dist/tools/list-directory.js.map +1 -0
  141. package/dist/tools/path-sandbox.d.ts +31 -0
  142. package/dist/tools/path-sandbox.d.ts.map +1 -0
  143. package/dist/tools/path-sandbox.js +99 -0
  144. package/dist/tools/path-sandbox.js.map +1 -0
  145. package/dist/tools/read-file.d.ts +2 -0
  146. package/dist/tools/read-file.d.ts.map +1 -0
  147. package/dist/tools/read-file.js +28 -0
  148. package/dist/tools/read-file.js.map +1 -0
  149. package/dist/tools/run-command.d.ts +2 -0
  150. package/dist/tools/run-command.d.ts.map +1 -0
  151. package/dist/tools/run-command.js +192 -0
  152. package/dist/tools/run-command.js.map +1 -0
  153. package/dist/tools/save-audit.d.ts +4 -0
  154. package/dist/tools/save-audit.d.ts.map +1 -0
  155. package/dist/tools/save-audit.js +42 -0
  156. package/dist/tools/save-audit.js.map +1 -0
  157. package/dist/tools/save-context.d.ts +2 -0
  158. package/dist/tools/save-context.d.ts.map +1 -0
  159. package/dist/tools/save-context.js +18 -0
  160. package/dist/tools/save-context.js.map +1 -0
  161. package/dist/tools/save-learning.d.ts +2 -0
  162. package/dist/tools/save-learning.d.ts.map +1 -0
  163. package/dist/tools/save-learning.js +41 -0
  164. package/dist/tools/save-learning.js.map +1 -0
  165. package/dist/tools/save-user-preference.d.ts +3 -0
  166. package/dist/tools/save-user-preference.d.ts.map +1 -0
  167. package/dist/tools/save-user-preference.js +22 -0
  168. package/dist/tools/save-user-preference.js.map +1 -0
  169. package/dist/tools/search-files.d.ts +2 -0
  170. package/dist/tools/search-files.d.ts.map +1 -0
  171. package/dist/tools/search-files.js +170 -0
  172. package/dist/tools/search-files.js.map +1 -0
  173. package/dist/tools/secret-scanner.d.ts +15 -0
  174. package/dist/tools/secret-scanner.d.ts.map +1 -0
  175. package/dist/tools/secret-scanner.js +44 -0
  176. package/dist/tools/secret-scanner.js.map +1 -0
  177. package/dist/tools/update-session.d.ts +3 -0
  178. package/dist/tools/update-session.d.ts.map +1 -0
  179. package/dist/tools/update-session.js +49 -0
  180. package/dist/tools/update-session.js.map +1 -0
  181. package/dist/tools/write-file.d.ts +2 -0
  182. package/dist/tools/write-file.d.ts.map +1 -0
  183. package/dist/tools/write-file.js +32 -0
  184. package/dist/tools/write-file.js.map +1 -0
  185. package/dist/workflows/InitWorkflow.d.ts +6 -0
  186. package/dist/workflows/InitWorkflow.d.ts.map +1 -0
  187. package/dist/workflows/InitWorkflow.js +448 -0
  188. package/dist/workflows/InitWorkflow.js.map +1 -0
  189. package/dist/workflows/__tests__/InitWorkflow.test.d.ts +2 -0
  190. package/dist/workflows/__tests__/InitWorkflow.test.d.ts.map +1 -0
  191. package/dist/workflows/__tests__/InitWorkflow.test.js +43 -0
  192. package/dist/workflows/__tests__/InitWorkflow.test.js.map +1 -0
  193. package/package.json +34 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-pack.js","sourceRoot":"","sources":["../../../src/skills/builtins/node-pack.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACU,QAAA,gBAAgB,GAAY;IACrC;QACI,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,oFAAoF;QACjG,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC;QAChC,QAAQ,EAAE;YACN,cAAc,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB;YAC/D,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW;SAChE;QACD,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8EAqDgD;KACzE;IACD;QACI,IAAI,EAAE,oBAAoB;QAC1B,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,oFAAoF;QACjG,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC;QAChC,QAAQ,EAAE;YACN,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW;YAC9D,YAAY,E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AAI,EAAE,UAAU;QAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC;QAChC,QAAQ,EAAE;YACN,aAAa,EAAE,cAAc,EAAE,iBAAiB,EAAE,oBAAoB;YACtE,mBAAmB,EAAE,mBAAmB,EAAE,oBAAoB;YAC9D,YAAY,EAAE,mBAAmB,EAAE,iBAAiB;SACvD;QACD,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFAoEmD;KAC5E;IACD;QACI,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,2FAA2F;QACxG,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC;QAChC,QAAQ,EAAE;YACN,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc;YAC5D,gBAAgB,EAAE,cAAc,EAAE,sBAAsB,EAAE,oBAAoB;YAC9E,oBAAoB,EAAE,mBAAmB,EAAE,WAAW;SACzD;QACD,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uFAmFyD;KAClF;CACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { Skill } from '@backendkit-labs/agent-core';
2
+ /**
3
+ * Python / FastAPI skill pack (@bk-python).
4
+ * Activated for projects with requirements.txt or pyproject.toml.
5
+ */
6
+ export declare const PYTHON_PACK_SKILLS: Skill[];
7
+ //# sourceMappingURL=python-pack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python-pack.d.ts","sourceRoot":"","sources":["../../../src/skills/builtins/python-pack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,EAsSrC,CAAC"}
@@ -0,0 +1,303 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PYTHON_PACK_SKILLS = void 0;
4
+ /**
5
+ * Python / FastAPI skill pack (@bk-python).
6
+ * Activated for projects with requirements.txt or pyproject.toml.
7
+ */
8
+ exports.PYTHON_PACK_SKILLS = [
9
+ {
10
+ name: 'fastapi-patterns',
11
+ version: '1.0.0',
12
+ description: 'FastAPI patterns: routers, Depends, Pydantic models, async handlers',
13
+ scope: 'pack',
14
+ pack: '@bk-python',
15
+ language: ['python'],
16
+ triggers: [
17
+ 'fastapi', 'api', 'router', 'endpoint', 'depends', 'dependency',
18
+ 'pydantic', 'schema', 'request', 'response', 'handler', 'route',
19
+ 'api rest', 'backend', 'servidor', 'server',
20
+ ],
21
+ systemPromptAddition: `## FastAPI Patterns
22
+
23
+ ### Router modular
24
+ \`\`\`python
25
+ # routers/users.py
26
+ from fastapi import APIRouter, Depends, HTTPException, status
27
+ from app.schemas.user import UserCreate, UserResponse
28
+ from app.services.user import UserService
29
+ from app.dependencies import get_user_service
30
+
31
+ router = APIRouter(prefix="/users", tags=["users"])
32
+
33
+ @router.get("/{user_id}", response_model=UserResponse)
34
+ async def get_user(user_id: UUID, service: UserService = Depends(get_user_service)):
35
+ user = await service.find_by_id(user_id)
36
+ if not user:
37
+ raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="User not found")
38
+ return user
39
+
40
+ @router.post("", response_model=UserResponse, status_code=status.HTTP_201_CREATED)
41
+ async def create_user(data: UserCreate, service: UserService = Depends(get_user_service)):
42
+ return await service.create(data)
43
+ \`\`\`
44
+
45
+ ### Pydantic schemas (separados de las entidades ORM)
46
+ \`\`\`python
47
+ from pydantic import BaseModel, EmailStr
48
+ from uuid import UUID
49
+
50
+ class UserCreate(BaseModel):
51
+ email: EmailStr
52
+ name: str
53
+
54
+ class UserResponse(BaseModel):
55
+ id: UUID
56
+ email: str
57
+ name: str
58
+
59
+ model_config = {"from_attributes": True} # para mapear desde ORM
60
+ \`\`\`
61
+
62
+ ### Dependencias con Depends
63
+ \`\`\`python
64
+ # dependencies.py
65
+ async def get_db() -> AsyncGenerator[AsyncSession, None]:
66
+ async with AsyncSessionLocal() as session:
67
+ yield session
68
+
69
+ async def get_user_service(db: AsyncSession = Depends(get_db)) -> UserService:
70
+ return UserService(UserRepository(db))
71
+ \`\`\`
72
+
73
+ ### Reglas
74
+ - Usa \`APIRouter\` por dominio — no pongas todo en \`main.py\`
75
+ - Los schemas de entrada (Create/Update) y salida (Response) son clases separadas
76
+ - Nunca devuelvas modelos ORM directamente — mapea a schemas Pydantic
77
+ - Usa \`status.HTTP_xxx\` en lugar de números crudos`,
78
+ },
79
+ {
80
+ name: 'python-error-handling',
81
+ version: '1.0.0',
82
+ description: 'FastAPI exception handling: custom exceptions, global handlers, HTTP errors',
83
+ scope: 'pack',
84
+ pack: '@bk-python',
85
+ language: ['python'],
86
+ triggers: [
87
+ 'exception', 'error', 'manejo de errores', 'error handling',
88
+ 'httpexception', 'exceptionhandler', '404', '400', '422', '500',
89
+ 'try', 'except', 'raise',
90
+ ],
91
+ systemPromptAddition: `## Python / FastAPI Error Handling
92
+
93
+ ### Excepciones de dominio
94
+ \`\`\`python
95
+ class AppError(Exception):
96
+ """Base para todos los errores de la aplicación."""
97
+ pass
98
+
99
+ class NotFoundError(AppError):
100
+ def __init__(self, resource: str, id: Any):
101
+ self.resource = resource
102
+ self.id = id
103
+ super().__init__(f"{resource} not found: {id}")
104
+
105
+ class ValidationError(AppError):
106
+ def __init__(self, message: str):
107
+ super().__init__(message)
108
+
109
+ class ConflictError(AppError):
110
+ def __init__(self, message: str):
111
+ super().__init__(message)
112
+ \`\`\`
113
+
114
+ ### Handler global en FastAPI
115
+ \`\`\`python
116
+ # main.py
117
+ from fastapi import FastAPI, Request
118
+ from fastapi.responses import JSONResponse
119
+
120
+ app = FastAPI()
121
+
122
+ @app.exception_handler(NotFoundError)
123
+ async def not_found_handler(request: Request, exc: NotFoundError):
124
+ return JSONResponse(status_code=404, content={"detail": str(exc)})
125
+
126
+ @app.exception_handler(ConflictError)
127
+ async def conflict_handler(request: Request, exc: ConflictError):
128
+ return JSONResponse(status_code=409, content={"detail": str(exc)})
129
+
130
+ @app.exception_handler(ValidationError)
131
+ async def validation_handler(request: Request, exc: ValidationError):
132
+ return JSONResponse(status_code=422, content={"detail": str(exc)})
133
+ \`\`\`
134
+
135
+ ### En los servicios — lanza excepciones de dominio
136
+ \`\`\`python
137
+ async def find_by_id(self, user_id: UUID) -> User:
138
+ user = await self.repo.find_by_id(user_id)
139
+ if not user:
140
+ raise NotFoundError("User", user_id)
141
+ return user
142
+ \`\`\`
143
+
144
+ ### Reglas
145
+ - Los servicios lanzan excepciones de dominio (NotFoundError, etc.) — no HTTPException
146
+ - Los handlers globales convierten excepciones de dominio a respuestas HTTP
147
+ - Nunca devuelvas stack traces al cliente en producción
148
+ - Usa logging estructurado: \`logger.exception("msg", exc_info=True)\``,
149
+ },
150
+ {
151
+ name: 'sqlalchemy-patterns',
152
+ version: '1.0.0',
153
+ description: 'Async SQLAlchemy, repository pattern, Alembic migrations',
154
+ scope: 'pack',
155
+ pack: '@bk-python',
156
+ language: ['python'],
157
+ triggers: [
158
+ 'sqlalchemy', 'database', 'base de datos', 'orm', 'model', 'modelo',
159
+ 'migration', 'migracion', 'alembic', 'session', 'query', 'repository',
160
+ 'repositorio', 'postgresql', 'postgres', 'mysql', 'sqlite',
161
+ ],
162
+ systemPromptAddition: `## SQLAlchemy (Async) + Repository Pattern
163
+
164
+ ### Modelo ORM
165
+ \`\`\`python
166
+ from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
167
+ from sqlalchemy import String
168
+ import uuid
169
+
170
+ class Base(DeclarativeBase):
171
+ pass
172
+
173
+ class UserModel(Base):
174
+ __tablename__ = "users"
175
+
176
+ id: Mapped[uuid.UUID] = mapped_column(primary_key=True, default=uuid.uuid4)
177
+ email: Mapped[str] = mapped_column(String(255), unique=True, nullable=False)
178
+ name: Mapped[str] = mapped_column(String(100), nullable=False)
179
+ created_at: Mapped[datetime] = mapped_column(default=func.now())
180
+ \`\`\`
181
+
182
+ ### Repository
183
+ \`\`\`python
184
+ from sqlalchemy.ext.asyncio import AsyncSession
185
+ from sqlalchemy import select
186
+
187
+ class UserRepository:
188
+ def __init__(self, session: AsyncSession):
189
+ self.session = session
190
+
191
+ async def find_by_id(self, user_id: UUID) -> UserModel | None:
192
+ result = await self.session.execute(
193
+ select(UserModel).where(UserModel.id == user_id)
194
+ )
195
+ return result.scalar_one_or_none()
196
+
197
+ async def save(self, user: UserModel) -> UserModel:
198
+ self.session.add(user)
199
+ await self.session.flush() # persiste en la transacción actual
200
+ await self.session.refresh(user)
201
+ return user
202
+ \`\`\`
203
+
204
+ ### Sesión async con context manager
205
+ \`\`\`python
206
+ from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker
207
+
208
+ engine = create_async_engine(settings.DATABASE_URL)
209
+ AsyncSessionLocal = async_sessionmaker(engine, expire_on_commit=False)
210
+
211
+ # En dependencies.py
212
+ async def get_db() -> AsyncGenerator[AsyncSession, None]:
213
+ async with AsyncSessionLocal() as session:
214
+ async with session.begin(): # commit/rollback automático
215
+ yield session
216
+ \`\`\`
217
+
218
+ ### Reglas
219
+ - Usa \`async_sessionmaker\` con \`session.begin()\` para transacciones automáticas
220
+ - Nunca expongas modelos ORM fuera del repositorio — mapea a schemas Pydantic
221
+ - Usa Alembic para migraciones — nunca \`Base.metadata.create_all()\` en producción
222
+ - \`expire_on_commit=False\` evita lazy-loading después del commit`,
223
+ },
224
+ {
225
+ name: 'python-testing',
226
+ version: '1.0.0',
227
+ description: 'pytest, fixtures, httpx AsyncClient for FastAPI integration tests',
228
+ scope: 'pack',
229
+ pack: '@bk-python',
230
+ language: ['python'],
231
+ triggers: [
232
+ 'test', 'tests', 'testing', 'pytest', 'fixture', 'mock', 'prueba',
233
+ 'async test', 'httpx', 'asyncclient', 'coverage', 'cobertura',
234
+ 'parametrize', 'conftest',
235
+ ],
236
+ systemPromptAddition: `## Python Testing (pytest + httpx)
237
+
238
+ ### Test unitario de servicio
239
+ \`\`\`python
240
+ import pytest
241
+ from unittest.mock import AsyncMock, MagicMock
242
+ from app.services.user import UserService
243
+ from app.errors import NotFoundError
244
+
245
+ @pytest.fixture
246
+ def mock_repo():
247
+ return MagicMock()
248
+
249
+ @pytest.fixture
250
+ def user_service(mock_repo):
251
+ return UserService(mock_repo)
252
+
253
+ @pytest.mark.asyncio
254
+ async def test_find_by_id_returns_user(user_service, mock_repo):
255
+ user = User(id=uuid4(), email="ana@example.com", name="Ana")
256
+ mock_repo.find_by_id = AsyncMock(return_value=user)
257
+
258
+ result = await user_service.find_by_id(user.id)
259
+
260
+ assert result.email == "ana@example.com"
261
+ mock_repo.find_by_id.assert_awaited_once_with(user.id)
262
+
263
+ @pytest.mark.asyncio
264
+ async def test_find_by_id_raises_not_found(user_service, mock_repo):
265
+ mock_repo.find_by_id = AsyncMock(return_value=None)
266
+
267
+ with pytest.raises(NotFoundError):
268
+ await user_service.find_by_id(uuid4())
269
+ \`\`\`
270
+
271
+ ### Test de API con httpx AsyncClient
272
+ \`\`\`python
273
+ # conftest.py
274
+ import pytest
275
+ from httpx import AsyncClient, ASGITransport
276
+ from app.main import app
277
+
278
+ @pytest.fixture
279
+ async def client():
280
+ async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as c:
281
+ yield c
282
+
283
+ # test_users.py
284
+ @pytest.mark.asyncio
285
+ async def test_get_user_returns_200(client):
286
+ response = await client.get(f"/users/{user_id}")
287
+ assert response.status_code == 200
288
+ assert response.json()["email"] == "ana@example.com"
289
+
290
+ @pytest.mark.asyncio
291
+ async def test_get_user_returns_404(client):
292
+ response = await client.get(f"/users/{uuid4()}")
293
+ assert response.status_code == 404
294
+ \`\`\`
295
+
296
+ ### Reglas
297
+ - Usa \`pytest-asyncio\` con \`asyncio_mode = "auto"\` en \`pyproject.toml\`
298
+ - Fixtures en \`conftest.py\` — no en cada archivo de test
299
+ - Usa \`AsyncMock\` para mockear funciones async
300
+ - Usa \`pytest.mark.parametrize\` para casos múltiples del mismo test`,
301
+ },
302
+ ];
303
+ //# sourceMappingURL=python-pack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python-pack.js","sourceRoot":"","sources":["../../../src/skills/builtins/python-pack.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACU,QAAA,kBAAkB,GAAY;IACvC;QACI,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,qEAAqE;QAClF,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACpB,QAAQ,EAAE;YACN,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY;YAC/D,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO;YAC/D,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ;SAC9C;QACD,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDAwDwB;KACjD;IACD;QACI,IAAI,EAAE,uBAAuB;QAC7B,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,6EAA6E;QAC1F,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACpB,QAAQ,EAAE;YACN,WAAW,EAAE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB;YAC3D,eAAe,EAAE,kBAAkB,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;YAC/D,KAAK,EAAE,QAAQ,EAAE,OAAO;SAC3B;QACD,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uEAyDyC;KAClE;IACD;QACI,IAAI,EAAE,qBAAqB;QAC3B,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,0DAA0D;QACvE,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACpB,QAAQ,EAAE;YACN,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ;YACnE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY;YACrE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ;SAC7D;QACD,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oEA4DsC;KAC/D;IACD;QACI,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,mEAAmE;QAChF,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACpB,QAAQ,EAAE;YACN,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ;YACjE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW;YAC7D,aAAa,EAAE,UAAU;SAC5B;QACD,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uEAgEyC;KAClE;CACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { GLOBAL_BUILTIN_SKILLS } from './builtins/global';
2
+ export { NODE_PACK_SKILLS } from './builtins/node-pack';
3
+ export { GO_PACK_SKILLS } from './builtins/go-pack';
4
+ export { JAVA_PACK_SKILLS } from './builtins/java-pack';
5
+ export { KOTLIN_PACK_SKILLS } from './builtins/kotlin-pack';
6
+ export { PYTHON_PACK_SKILLS } from './builtins/python-pack';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PYTHON_PACK_SKILLS = exports.KOTLIN_PACK_SKILLS = exports.JAVA_PACK_SKILLS = exports.GO_PACK_SKILLS = exports.NODE_PACK_SKILLS = exports.GLOBAL_BUILTIN_SKILLS = void 0;
4
+ var global_1 = require("./builtins/global");
5
+ Object.defineProperty(exports, "GLOBAL_BUILTIN_SKILLS", { enumerable: true, get: function () { return global_1.GLOBAL_BUILTIN_SKILLS; } });
6
+ var node_pack_1 = require("./builtins/node-pack");
7
+ Object.defineProperty(exports, "NODE_PACK_SKILLS", { enumerable: true, get: function () { return node_pack_1.NODE_PACK_SKILLS; } });
8
+ var go_pack_1 = require("./builtins/go-pack");
9
+ Object.defineProperty(exports, "GO_PACK_SKILLS", { enumerable: true, get: function () { return go_pack_1.GO_PACK_SKILLS; } });
10
+ var java_pack_1 = require("./builtins/java-pack");
11
+ Object.defineProperty(exports, "JAVA_PACK_SKILLS", { enumerable: true, get: function () { return java_pack_1.JAVA_PACK_SKILLS; } });
12
+ var kotlin_pack_1 = require("./builtins/kotlin-pack");
13
+ Object.defineProperty(exports, "KOTLIN_PACK_SKILLS", { enumerable: true, get: function () { return kotlin_pack_1.KOTLIN_PACK_SKILLS; } });
14
+ var python_pack_1 = require("./builtins/python-pack");
15
+ Object.defineProperty(exports, "PYTHON_PACK_SKILLS", { enumerable: true, get: function () { return python_pack_1.PYTHON_PACK_SKILLS; } });
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":";;;AAAA,4CAA0D;AAAjD,+GAAA,qBAAqB,OAAA;AAC9B,kDAAwD;AAA/C,6GAAA,gBAAgB,OAAA;AACzB,8CAAoD;AAA3C,yGAAA,cAAc,OAAA;AACvB,kDAAwD;AAA/C,6GAAA,gBAAgB,OAAA;AACzB,sDAA4D;AAAnD,iHAAA,kBAAkB,OAAA;AAC3B,sDAA4D;AAAnD,iHAAA,kBAAkB,OAAA"}
@@ -0,0 +1,17 @@
1
+ export type LearningType = 'tool_quirk' | 'skill' | 'project' | 'user' | 'session';
2
+ export type LearningScope = 'global' | 'project';
3
+ export type LLMFn = (prompt: string) => Promise<string>;
4
+ export interface RouterCtx {
5
+ projectDir: string;
6
+ homeDir: string;
7
+ llm: LLMFn;
8
+ /** Emit a compacting event to show progress bar in display */
9
+ emit?: (phase: 'start' | 'done' | 'fail', label: string) => void;
10
+ }
11
+ export interface RouteResult {
12
+ type: LearningType;
13
+ target: string;
14
+ skipped: boolean;
15
+ }
16
+ export declare function routeLearning(content: string, ctx: RouterCtx): Promise<RouteResult>;
17
+ //# sourceMappingURL=LearningRouter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LearningRouter.d.ts","sourceRoot":"","sources":["../../src/store/LearningRouter.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AACnF,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,SAAS,CAAC;AACjD,MAAM,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AASxD,MAAM,WAAW,SAAS;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAK,MAAM,CAAC;IACnB,GAAG,EAAS,KAAK,CAAC;IAClB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpE;AAED,MAAM,WAAW,WAAW;IACxB,IAAI,EAAK,YAAY,CAAC;IACtB,MAAM,EAAG,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CACpB;AAqGD,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CA+EzF"}
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.routeLearning = routeLearning;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ // ── Constants ─────────────────────────────────────────────────────────────────
7
+ const KNOWN_AGENTS = ['data', 'backend', 'frontend', 'infrastructure', 'qa-engineer', 'security', 'architecture', 'general'];
8
+ const MAX_NOTES_BYTES = 1_500;
9
+ const MAX_CTX_BYTES = 4_000;
10
+ const MAX_USER_BYTES = 2_000;
11
+ // ── Helpers ───────────────────────────────────────────────────────────────────
12
+ function safeRead(path) {
13
+ try {
14
+ return (0, fs_1.readFileSync)(path, 'utf-8').trim();
15
+ }
16
+ catch {
17
+ return '';
18
+ }
19
+ }
20
+ function safeWrite(path, content) {
21
+ (0, fs_1.mkdirSync)((0, path_1.dirname)(path), { recursive: true });
22
+ (0, fs_1.writeFileSync)(path, content, 'utf-8');
23
+ }
24
+ function parseJSON(raw, fallback) {
25
+ try {
26
+ const json = raw.match(/\{[\s\S]*\}/)?.[0] ?? raw;
27
+ return JSON.parse(json);
28
+ }
29
+ catch {
30
+ return fallback;
31
+ }
32
+ }
33
+ // ── LLM helpers ───────────────────────────────────────────────────────────────
34
+ async function classify(content, llm) {
35
+ const prompt = `Classify this learning and respond as JSON only (no markdown).
36
+
37
+ Categories:
38
+ - tool_quirk : specific behavior or limitation of a tool/library/framework
39
+ - skill : reusable step-by-step process worth packaging as a reusable skill
40
+ - project : architectural decision or project-specific fact
41
+ - user : user preference or working style
42
+ - session : ephemeral task info, not worth persisting
43
+
44
+ Fields required:
45
+ - type : one of the categories
46
+ - target_agent : which agent owns this — one of: ${KNOWN_AGENTS.join(', ')}
47
+ - skill_name : if type=skill, suggest a kebab-case name (else empty string "")
48
+ - scope : "global" if applies to all projects | "project" if specific to this one
49
+
50
+ Learning: "${content.slice(0, 500)}"
51
+
52
+ JSON only:`;
53
+ const raw = await llm(prompt).catch(() => '{}');
54
+ return parseJSON(raw, {
55
+ type: 'tool_quirk', target_agent: 'general', skill_name: '', scope: 'global',
56
+ });
57
+ }
58
+ async function isDuplicate(content, existing, llm) {
59
+ if (!existing.trim())
60
+ return false;
61
+ const prompt = `Does the new learning add any information not already present in the existing notes?
62
+ Existing (excerpt): "${existing.slice(0, 600)}"
63
+ New: "${content.slice(0, 300)}"
64
+ JSON only: {"is_duplicate": true or false}`;
65
+ const raw = await llm(prompt).catch(() => '{"is_duplicate":false}');
66
+ return parseJSON(raw, { is_duplicate: false }).is_duplicate;
67
+ }
68
+ async function compact(content, maxBytes, label, ctx) {
69
+ ctx.emit?.('start', label);
70
+ const prompt = `Compact these notes to under ${Math.floor(maxBytes / 2)} bytes. Keep all distinct facts. Remove redundancy. Output only the compacted text, no preamble:\n\n${content}`;
71
+ const result = await ctx.llm(prompt).catch(() => content);
72
+ ctx.emit?.('done', label);
73
+ return result.trim();
74
+ }
75
+ async function generateSkillMd(content, agent, name, llm) {
76
+ const prompt = `Generate a skill file in .md format with YAML frontmatter. Output the raw file content only, no extra explanation.
77
+
78
+ Format:
79
+ ---
80
+ name: ${name}
81
+ version: 1.0.0
82
+ description: <one concise line>
83
+ triggers:
84
+ - <keyword1>
85
+ - <keyword2>
86
+ agents:
87
+ - ${agent}
88
+ ---
89
+
90
+ <Step-by-step instructions derived from this learning, written in markdown>
91
+
92
+ Learning: "${content.slice(0, 500)}"`;
93
+ const raw = await llm(prompt).catch(() => '');
94
+ const cleaned = raw.replace(/^```(?:md|markdown)?\n?/im, '').replace(/```\s*$/m, '').trim();
95
+ return cleaned ||
96
+ `---\nname: ${name}\nversion: 1.0.0\ndescription: ${content.slice(0, 80)}\ntriggers: []\nagents:\n - ${agent}\n---\n\n${content}\n`;
97
+ }
98
+ // ── Main router ───────────────────────────────────────────────────────────────
99
+ async function routeLearning(content, ctx) {
100
+ const cls = await classify(content, ctx.llm);
101
+ const agent = KNOWN_AGENTS.includes(cls.target_agent) ? cls.target_agent : 'general';
102
+ // session learnings are ephemeral — discard
103
+ if (cls.type === 'session') {
104
+ return { type: 'session', target: 'discarded (ephemeral)', skipped: true };
105
+ }
106
+ if (cls.type === 'tool_quirk') {
107
+ const dir = cls.scope === 'global'
108
+ ? (0, path_1.join)(ctx.homeDir, 'agent-notes')
109
+ : (0, path_1.join)(ctx.projectDir, 'agent-notes');
110
+ const path = (0, path_1.join)(dir, `${agent}.md`);
111
+ const existing = safeRead(path);
112
+ if (await isDuplicate(content, existing, ctx.llm)) {
113
+ return { type: 'tool_quirk', target: `agent-notes/${agent}.md`, skipped: true };
114
+ }
115
+ let updated = existing ? `${existing}\n- ${content}` : `- ${content}`;
116
+ if (Buffer.byteLength(updated, 'utf-8') > MAX_NOTES_BYTES) {
117
+ updated = await compact(updated, MAX_NOTES_BYTES, `Compacting ${agent} notes`, ctx);
118
+ }
119
+ safeWrite(path, updated);
120
+ return { type: 'tool_quirk', target: `agent-notes/${agent}.md`, skipped: false };
121
+ }
122
+ if (cls.type === 'skill') {
123
+ const name = cls.skill_name || `skill-${Date.now()}`;
124
+ const dir = cls.scope === 'global'
125
+ ? (0, path_1.join)(ctx.homeDir, 'skills', 'global')
126
+ : (0, path_1.join)(ctx.projectDir, 'skills');
127
+ const filePath = (0, path_1.join)(dir, `${name}.md`);
128
+ if ((0, fs_1.existsSync)(filePath)) {
129
+ return { type: 'skill', target: `skills/${name}.md`, skipped: true };
130
+ }
131
+ ctx.emit?.('start', `Generating skill "${name}"`);
132
+ const md = await generateSkillMd(content, agent, name, ctx.llm);
133
+ ctx.emit?.('done', `Generating skill "${name}"`);
134
+ safeWrite(filePath, md);
135
+ return { type: 'skill', target: `skills/${name}.md`, skipped: false };
136
+ }
137
+ if (cls.type === 'project') {
138
+ const path = (0, path_1.join)(ctx.projectDir, 'memory', 'contexto-proyecto.md');
139
+ const existing = safeRead(path);
140
+ if (await isDuplicate(content, existing, ctx.llm)) {
141
+ return { type: 'project', target: 'contexto-proyecto.md', skipped: true };
142
+ }
143
+ let updated = existing ? `${existing}\n\n${content}` : content;
144
+ if (Buffer.byteLength(updated, 'utf-8') > MAX_CTX_BYTES) {
145
+ updated = await compact(updated, MAX_CTX_BYTES, 'Compacting project context', ctx);
146
+ }
147
+ safeWrite(path, updated);
148
+ return { type: 'project', target: 'contexto-proyecto.md', skipped: false };
149
+ }
150
+ if (cls.type === 'user') {
151
+ const path = (0, path_1.join)(ctx.homeDir, 'USER.md');
152
+ const existing = safeRead(path);
153
+ if (await isDuplicate(content, existing, ctx.llm)) {
154
+ return { type: 'user', target: 'USER.md', skipped: true };
155
+ }
156
+ let updated = existing ? `${existing}\n- ${content}` : `- ${content}`;
157
+ if (Buffer.byteLength(updated, 'utf-8') > MAX_USER_BYTES) {
158
+ updated = await compact(updated, MAX_USER_BYTES, 'Compacting user profile', ctx);
159
+ }
160
+ safeWrite(path, updated);
161
+ return { type: 'user', target: 'USER.md', skipped: false };
162
+ }
163
+ return { type: 'session', target: 'unclassified/discarded', skipped: true };
164
+ }
165
+ //# sourceMappingURL=LearningRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LearningRouter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AAC;QACD,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACzB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC/D,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,wBAAwB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAChF,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { SessionMemoryData } from '@backendkit-labs/agent-core';
2
+ export declare class PersistentMemory implements SessionMemoryData {
3
+ private data;
4
+ private readonly filePath;
5
+ constructor(projectDir: string);
6
+ get(key: string): string | undefined;
7
+ set(key: string, value: string): void;
8
+ getAll(): Record<string, string>;
9
+ }
10
+ //# sourceMappingURL=PersistentMemory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PersistentMemory.d.ts","sourceRoot":"","sources":["../../src/store/PersistentMemory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,qBAAa,gBAAiB,YAAW,iBAAiB;IACtD,OAAO,CAAC,IAAI,CAA8B;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,UAAU,EAAE,MAAM;IAO9B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIpC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAKrC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAGnC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PersistentMemory = void 0;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ const agent_core_1 = require("@backendkit-labs/agent-core");
7
+ class PersistentMemory {
8
+ data = {};
9
+ filePath;
10
+ constructor(projectDir) {
11
+ this.filePath = (0, path_1.join)(projectDir, 'memory.json');
12
+ try {
13
+ this.data = JSON.parse((0, fs_1.readFileSync)(this.filePath, 'utf-8'));
14
+ }
15
+ catch { /* first run — start empty */ }
16
+ }
17
+ get(key) {
18
+ return this.data[key];
19
+ }
20
+ set(key, value) {
21
+ this.data[key] = value;
22
+ (0, agent_core_1.atomicWriteSync)(this.filePath, JSON.stringify(this.data, null, 2));
23
+ }
24
+ getAll() {
25
+ return { ...this.data };
26
+ }
27
+ }
28
+ exports.PersistentMemory = PersistentMemory;
29
+ //# sourceMappingURL=PersistentMemory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PersistentMemory.js","sourceRoot":"","sources":["../../src/store/PersistentMemory.ts"],"names":[],"mappings":";;;AAAA,2BAAkC;AAClC,+BAA4B;AAC5B,4DAA8D;AAG9D,MAAa,gBAAgB;IACjB,IAAI,GAA2B,EAAE,CAAC;IACzB,QAAQ,CAAS;IAElC,YAAY,UAAkB;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAA,WAAI,EAAC,UAAU,EAAE,aAAa,CAAC,CAAC;QAChD,IAAI,CAAC;YACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;QACjE,CAAC;QAAC,MAAM,CAAC,CAAC,6BAA6B,CAAC,CAAC;IAC7C,CAAC;IAED,GAAG,CAAC,GAAW;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,KAAa;QAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACvB,IAAA,4BAAe,EAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;IAED,MAAM;QACF,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,CAAC;CACJ;AAvBD,4CAuBC"}
@@ -0,0 +1,29 @@
1
+ import type { ProjectStoreData, SessionUpdates } from '@backendkit-labs/agent-core';
2
+ export declare class ProjectStore implements ProjectStoreData {
3
+ readonly homeDir: string;
4
+ readonly projectDir: string;
5
+ constructor(cwd: string, appName?: string);
6
+ private initSessionFile;
7
+ getContext(): string;
8
+ appendContext(content: string): void;
9
+ getLearnings(): string;
10
+ appendLearning(content: string): void;
11
+ getAgentNotes(agentId: string): string;
12
+ saveAudit(agentId: string, content: string): void;
13
+ getLatestAudit(agentId: string): string | null;
14
+ listAudits(): string[];
15
+ getUserProfile(): string;
16
+ appendUserPreference(content: string): void;
17
+ buildSystemContext(agentMd?: string): string;
18
+ buildAgentContext(agentId: string, agentMd?: string): string;
19
+ updateSession(updates: SessionUpdates): void;
20
+ private read;
21
+ private readAbs;
22
+ private append;
23
+ private appendAbs;
24
+ /** Replace entire content of a markdown section. Creates section if absent. */
25
+ private setSection;
26
+ /** Append lines to a markdown section, skipping placeholder text. Creates section if absent. */
27
+ private appendToSection;
28
+ }
29
+ //# sourceMappingURL=ProjectStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProjectStore.d.ts","sourceRoot":"","sources":["../../src/store/ProjectStore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAKpF,qBAAa,YAAa,YAAW,gBAAgB;IACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,GAAG,EAAE,MAAM,EAAE,OAAO,SAAa;IAQ7C,OAAO,CAAC,eAAe;IA6BvB,UAAU,IAAI,MAAM;IACpB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAGpC,YAAY,IAAI,MAAM;IAC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