agentera 3.0.0-dev.5 → 3.0.0-dev.7

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 (510) hide show
  1. package/README.md +4 -3
  2. package/bundle/extract-corpus-parity.json +23 -0
  3. package/bundle/references/adapters/cursor.md +10 -9
  4. package/bundle/references/adapters/opencode.md +26 -26
  5. package/bundle/references/adapters/package-registry.yaml +0 -1
  6. package/bundle/references/adapters/package-surface-characterization.md +1 -2
  7. package/bundle/references/adapters/runtime-adapter-characterization.md +1 -1
  8. package/bundle/references/adapters/runtime-adapter-registry.yaml +16 -10
  9. package/bundle/references/adapters/runtime-feature-parity.md +2 -2
  10. package/bundle/references/analysis/benchmark.md +1 -1
  11. package/bundle/references/analysis/startup-measurement-contract.yaml +18 -18
  12. package/bundle/references/artifacts/artifact-registry-interface-model.yaml +4 -3
  13. package/bundle/references/cli/agent-ready-state-contract.yaml +6 -6
  14. package/bundle/references/cli/app-lifecycle-vocabulary.yaml +4 -4
  15. package/bundle/references/cli/audience-namespace-cli-migration.yaml +40 -26
  16. package/bundle/references/cli/bundle-skill-vocabulary.yaml +1 -29
  17. package/bundle/references/cli/capability-tool-classification.yaml +12 -12
  18. package/bundle/references/cli/coexistence-probe.yaml +13 -0
  19. package/bundle/references/cli/parity-expected-actual-template.md +30 -0
  20. package/bundle/references/cli/routing-execution-vocabulary.yaml +6 -6
  21. package/bundle/references/cli/routing-model.md +96 -0
  22. package/bundle/references/cli/single-name-protocol.yaml +42 -0
  23. package/bundle/references/cli/trigger-schema-enrichment.md +136 -0
  24. package/bundle/references/cli/update-channels.yaml +16 -0
  25. package/bundle/references/cli/upgrade-repair-wording.md +45 -0
  26. package/bundle/references/cli/v3-handoff-manifest.schema.yaml +98 -0
  27. package/bundle/references/cli/vocabulary-index.yaml +17 -12
  28. package/bundle/references/cli/vocabulary.md +316 -309
  29. package/bundle/references/meta/documentation-inventory.md +9 -3
  30. package/bundle/registry.json +13 -13
  31. package/bundle/skills/agentera/.claude-plugin/plugin.json +13 -13
  32. package/bundle/skills/agentera/SKILL.md +99 -415
  33. package/bundle/skills/agentera/agents/audit.toml +6 -0
  34. package/bundle/skills/agentera/agents/build.toml +6 -0
  35. package/bundle/skills/agentera/agents/design.toml +6 -0
  36. package/bundle/skills/agentera/agents/{planera.toml → discuss.toml} +3 -3
  37. package/bundle/skills/agentera/agents/{resonera.toml → document.toml} +3 -3
  38. package/bundle/skills/agentera/agents/{optimera.toml → optimize.toml} +2 -2
  39. package/bundle/skills/agentera/agents/orchestrate.toml +6 -0
  40. package/bundle/skills/agentera/agents/plan.toml +6 -0
  41. package/bundle/skills/agentera/agents/profile.toml +6 -0
  42. package/bundle/skills/agentera/agents/research.toml +6 -0
  43. package/bundle/skills/agentera/agents/status.toml +6 -0
  44. package/bundle/skills/agentera/agents/vision.toml +6 -0
  45. package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/artifacts.yaml +10 -10
  46. package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/triggers.yaml +15 -6
  47. package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/validation.yaml +9 -9
  48. package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/artifacts.yaml +11 -11
  49. package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/triggers.yaml +13 -3
  50. package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/validation.yaml +7 -7
  51. package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/artifacts.yaml +6 -6
  52. package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/triggers.yaml +15 -3
  53. package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/validation.yaml +5 -5
  54. package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/artifacts.yaml +6 -6
  55. package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/triggers.yaml +11 -3
  56. package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/validation.yaml +4 -4
  57. package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/artifacts.yaml +10 -10
  58. package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/triggers.yaml +14 -3
  59. package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/validation.yaml +8 -8
  60. package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/artifacts.yaml +8 -8
  61. package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/triggers.yaml +11 -3
  62. package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/validation.yaml +7 -7
  63. package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/artifacts.yaml +10 -10
  64. package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/triggers.yaml +16 -3
  65. package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/validation.yaml +27 -27
  66. package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/artifacts.yaml +8 -8
  67. package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/exit.yaml +2 -2
  68. package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/triggers.yaml +15 -3
  69. package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/validation.yaml +3 -3
  70. package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/artifacts.yaml +2 -2
  71. package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/exit.yaml +2 -1
  72. package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/triggers.yaml +7 -3
  73. package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/validation.yaml +2 -2
  74. package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/artifacts.yaml +5 -5
  75. package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/triggers.yaml +9 -3
  76. package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/validation.yaml +2 -2
  77. package/bundle/skills/agentera/capabilities/{hej → status}/schemas/artifacts.yaml +14 -11
  78. package/bundle/skills/agentera/capabilities/{hej → status}/schemas/triggers.yaml +10 -4
  79. package/bundle/skills/agentera/capabilities/{hej → status}/schemas/validation.yaml +5 -5
  80. package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/artifacts.yaml +8 -8
  81. package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/triggers.yaml +17 -3
  82. package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/validation.yaml +7 -7
  83. package/bundle/skills/agentera/capability_schema_contract.yaml +178 -34
  84. package/bundle/skills/agentera/protocol.yaml +29 -29
  85. package/bundle/skills/agentera/references/contract.md +328 -319
  86. package/bundle/skills/agentera/schemas/artifacts/changelog.yaml +4 -4
  87. package/bundle/skills/agentera/schemas/artifacts/decisions.yaml +9 -9
  88. package/bundle/skills/agentera/schemas/artifacts/design.yaml +4 -4
  89. package/bundle/skills/agentera/schemas/artifacts/docs.yaml +8 -7
  90. package/bundle/skills/agentera/schemas/artifacts/experiments.yaml +5 -5
  91. package/bundle/skills/agentera/schemas/artifacts/health.yaml +5 -5
  92. package/bundle/skills/agentera/schemas/artifacts/objective.yaml +4 -4
  93. package/bundle/skills/agentera/schemas/artifacts/plan.yaml +5 -5
  94. package/bundle/skills/agentera/schemas/artifacts/progress.yaml +5 -5
  95. package/bundle/skills/agentera/schemas/artifacts/todo.yaml +40 -35
  96. package/bundle/skills/agentera/schemas/artifacts/vision.yaml +3 -3
  97. package/dist/analytics/extractCorpus/cli.js +149 -0
  98. package/dist/analytics/extractCorpus/cli.js.map +1 -0
  99. package/dist/analytics/extractCorpus/copilotSessions.js +273 -0
  100. package/dist/analytics/extractCorpus/copilotSessions.js.map +1 -0
  101. package/dist/analytics/extractCorpus/core.js +364 -0
  102. package/dist/analytics/extractCorpus/core.js.map +1 -0
  103. package/dist/analytics/extractCorpus/corpus.js +145 -0
  104. package/dist/analytics/extractCorpus/corpus.js.map +1 -0
  105. package/dist/analytics/extractCorpus/coverageAudit.js +261 -0
  106. package/dist/analytics/extractCorpus/coverageAudit.js.map +1 -0
  107. package/dist/analytics/extractCorpus/cursorSessions.js +423 -0
  108. package/dist/analytics/extractCorpus/cursorSessions.js.map +1 -0
  109. package/dist/analytics/extractCorpus/extractCorpusParity.js +105 -0
  110. package/dist/analytics/extractCorpus/extractCorpusParity.js.map +1 -0
  111. package/dist/analytics/extractCorpus/filesystemSources.js +122 -0
  112. package/dist/analytics/extractCorpus/filesystemSources.js.map +1 -0
  113. package/dist/analytics/extractCorpus/index.js +12 -0
  114. package/dist/analytics/extractCorpus/index.js.map +1 -0
  115. package/dist/analytics/extractCorpus/jsonlSessions.js +185 -0
  116. package/dist/analytics/extractCorpus/jsonlSessions.js.map +1 -0
  117. package/dist/analytics/extractCorpus/sqliteCaps.js +44 -0
  118. package/dist/analytics/extractCorpus/sqliteCaps.js.map +1 -0
  119. package/dist/analytics/extractCorpus/sqliteSessions.js +368 -0
  120. package/dist/analytics/extractCorpus/sqliteSessions.js.map +1 -0
  121. package/dist/analytics/extractCorpus.js +2 -1790
  122. package/dist/analytics/extractCorpus.js.map +1 -1
  123. package/dist/analytics/usageStats.js +20 -20
  124. package/dist/analytics/usageStats.js.map +1 -1
  125. package/dist/capabilities/audit/instructions.js +6 -0
  126. package/dist/capabilities/audit/instructions.js.map +1 -0
  127. package/dist/capabilities/build/instructions.js +6 -0
  128. package/dist/capabilities/build/instructions.js.map +1 -0
  129. package/dist/capabilities/design/instructions.js +5 -0
  130. package/dist/capabilities/design/instructions.js.map +1 -0
  131. package/dist/capabilities/discuss/instructions.js +6 -0
  132. package/dist/capabilities/discuss/instructions.js.map +1 -0
  133. package/dist/capabilities/document/instructions.js +6 -0
  134. package/dist/capabilities/document/instructions.js.map +1 -0
  135. package/dist/capabilities/index.js +24 -24
  136. package/dist/capabilities/index.js.map +1 -1
  137. package/dist/capabilities/inspirera/instructions.js +1 -1
  138. package/dist/capabilities/inspirera/instructions.js.map +1 -1
  139. package/dist/capabilities/optimize/instructions.js +6 -0
  140. package/dist/capabilities/optimize/instructions.js.map +1 -0
  141. package/dist/capabilities/orchestrate/instructions.js +6 -0
  142. package/dist/capabilities/orchestrate/instructions.js.map +1 -0
  143. package/dist/capabilities/plan/instructions.js +6 -0
  144. package/dist/capabilities/plan/instructions.js.map +1 -0
  145. package/dist/capabilities/planera/instructions.js +1 -1
  146. package/dist/capabilities/planera/instructions.js.map +1 -1
  147. package/dist/capabilities/profile/instructions.js +6 -0
  148. package/dist/capabilities/profile/instructions.js.map +1 -0
  149. package/dist/capabilities/profilera/instructions.js +1 -1
  150. package/dist/capabilities/profilera/instructions.js.map +1 -1
  151. package/dist/capabilities/realisera/instructions.js +1 -1
  152. package/dist/capabilities/realisera/instructions.js.map +1 -1
  153. package/dist/capabilities/research/instructions.js +6 -0
  154. package/dist/capabilities/research/instructions.js.map +1 -0
  155. package/dist/capabilities/resonera/instructions.js +1 -1
  156. package/dist/capabilities/resonera/instructions.js.map +1 -1
  157. package/dist/capabilities/status/instructions.js +6 -0
  158. package/dist/capabilities/status/instructions.js.map +1 -0
  159. package/dist/capabilities/vision/instructions.js +6 -0
  160. package/dist/capabilities/vision/instructions.js.map +1 -0
  161. package/dist/capabilities/visionera/instructions.js +1 -1
  162. package/dist/capabilities/visionera/instructions.js.map +1 -1
  163. package/dist/capabilities/visualisera/instructions.js +3 -4
  164. package/dist/capabilities/visualisera/instructions.js.map +1 -1
  165. package/dist/cli/appContext.js +16 -17
  166. package/dist/cli/appContext.js.map +1 -1
  167. package/dist/cli/capabilityContext/benchmark.js +564 -0
  168. package/dist/cli/capabilityContext/benchmark.js.map +1 -0
  169. package/dist/cli/capabilityContext/bespoke.js +36 -0
  170. package/dist/cli/capabilityContext/bespoke.js.map +1 -0
  171. package/dist/cli/capabilityContext/build.js +177 -0
  172. package/dist/cli/capabilityContext/build.js.map +1 -0
  173. package/dist/cli/capabilityContext/closeout.js +230 -0
  174. package/dist/cli/capabilityContext/closeout.js.map +1 -0
  175. package/dist/cli/capabilityContext/contract.js +188 -0
  176. package/dist/cli/capabilityContext/contract.js.map +1 -0
  177. package/dist/cli/capabilityContext/evidence.js +456 -0
  178. package/dist/cli/capabilityContext/evidence.js.map +1 -0
  179. package/dist/cli/capabilityContext/index.js +4 -0
  180. package/dist/cli/capabilityContext/index.js.map +1 -0
  181. package/dist/cli/capabilityContext/orchestration.js +107 -0
  182. package/dist/cli/capabilityContext/orchestration.js.map +1 -0
  183. package/dist/cli/capabilityContext/planState.js +271 -0
  184. package/dist/cli/capabilityContext/planState.js.map +1 -0
  185. package/dist/cli/capabilityContext/progress.js +103 -0
  186. package/dist/cli/capabilityContext/progress.js.map +1 -0
  187. package/dist/cli/capabilityContext/realisera.js +174 -0
  188. package/dist/cli/capabilityContext/realisera.js.map +1 -0
  189. package/dist/cli/capabilityContext/shared.js +94 -0
  190. package/dist/cli/capabilityContext/shared.js.map +1 -0
  191. package/dist/cli/capabilityContext/slim.js +108 -0
  192. package/dist/cli/capabilityContext/slim.js.map +1 -0
  193. package/dist/cli/capabilityContext/startup.js +213 -0
  194. package/dist/cli/capabilityContext/startup.js.map +1 -0
  195. package/dist/cli/capabilityContext/types.js +40 -0
  196. package/dist/cli/capabilityContext/types.js.map +1 -0
  197. package/dist/cli/capabilityContext.js +1 -2486
  198. package/dist/cli/capabilityContext.js.map +1 -1
  199. package/dist/cli/commands/appHome.js +23 -0
  200. package/dist/cli/commands/appHome.js.map +1 -0
  201. package/dist/cli/commands/backfill.js +84 -0
  202. package/dist/cli/commands/backfill.js.map +1 -0
  203. package/dist/cli/commands/capability.js +2 -2
  204. package/dist/cli/commands/capability.js.map +1 -1
  205. package/dist/cli/commands/compact.js +1 -1
  206. package/dist/cli/commands/compact.js.map +1 -1
  207. package/dist/cli/commands/doctor.js +17 -98
  208. package/dist/cli/commands/doctor.js.map +1 -1
  209. package/dist/cli/commands/lint.js +4 -36
  210. package/dist/cli/commands/lint.js.map +1 -1
  211. package/dist/cli/commands/prime/bundleStatus.js +140 -0
  212. package/dist/cli/commands/prime/bundleStatus.js.map +1 -0
  213. package/dist/cli/commands/prime/collectOrientationState.js +156 -0
  214. package/dist/cli/commands/prime/collectOrientationState.js.map +1 -0
  215. package/dist/cli/commands/prime/orientationOutput.js +210 -0
  216. package/dist/cli/commands/prime/orientationOutput.js.map +1 -0
  217. package/dist/cli/commands/prime/routeOutput.js +50 -0
  218. package/dist/cli/commands/prime/routeOutput.js.map +1 -0
  219. package/dist/cli/commands/prime/types.js +2 -0
  220. package/dist/cli/commands/prime/types.js.map +1 -0
  221. package/dist/cli/commands/prime/v1Migration.js +39 -0
  222. package/dist/cli/commands/prime/v1Migration.js.map +1 -0
  223. package/dist/cli/commands/prime.js +11 -554
  224. package/dist/cli/commands/prime.js.map +1 -1
  225. package/dist/cli/commands/query.js +5 -2
  226. package/dist/cli/commands/query.js.map +1 -1
  227. package/dist/cli/commands/report.js +27 -10
  228. package/dist/cli/commands/report.js.map +1 -1
  229. package/dist/cli/commands/schema.js +24 -20
  230. package/dist/cli/commands/schema.js.map +1 -1
  231. package/dist/cli/commands/state/decisions.js +403 -0
  232. package/dist/cli/commands/state/decisions.js.map +1 -0
  233. package/dist/cli/commands/state/docs.js +97 -0
  234. package/dist/cli/commands/state/docs.js.map +1 -0
  235. package/dist/cli/commands/state/experiments.js +68 -0
  236. package/dist/cli/commands/state/experiments.js.map +1 -0
  237. package/dist/cli/commands/state/health.js +116 -0
  238. package/dist/cli/commands/state/health.js.map +1 -0
  239. package/dist/cli/commands/state/index.js +51 -0
  240. package/dist/cli/commands/state/index.js.map +1 -0
  241. package/dist/cli/commands/state/objective.js +69 -0
  242. package/dist/cli/commands/state/objective.js.map +1 -0
  243. package/dist/cli/commands/state/plan.js +173 -0
  244. package/dist/cli/commands/state/plan.js.map +1 -0
  245. package/dist/cli/commands/state/progress.js +47 -0
  246. package/dist/cli/commands/state/progress.js.map +1 -0
  247. package/dist/cli/commands/state/shared.js +15 -0
  248. package/dist/cli/commands/state/shared.js.map +1 -0
  249. package/dist/cli/commands/state/todo.js +121 -0
  250. package/dist/cli/commands/state/todo.js.map +1 -0
  251. package/dist/cli/commands/state.js +7 -7
  252. package/dist/cli/commands/state.js.map +1 -1
  253. package/dist/cli/commands/validate.js +50 -100
  254. package/dist/cli/commands/validate.js.map +1 -1
  255. package/dist/cli/commands/verify.js +1 -1
  256. package/dist/cli/commands/verify.js.map +1 -1
  257. package/dist/cli/contracts/bundleStatus.js +2 -0
  258. package/dist/cli/contracts/bundleStatus.js.map +1 -0
  259. package/dist/cli/contracts/orientationState.js +2 -0
  260. package/dist/cli/contracts/orientationState.js.map +1 -0
  261. package/dist/cli/dispatch/argvParser.js +33 -0
  262. package/dist/cli/dispatch/argvParser.js.map +1 -0
  263. package/dist/cli/dispatch/check.js +328 -0
  264. package/dist/cli/dispatch/check.js.map +1 -0
  265. package/dist/cli/dispatch/commands.js +27 -0
  266. package/dist/cli/dispatch/commands.js.map +1 -0
  267. package/dist/cli/dispatch/index.js +182 -0
  268. package/dist/cli/dispatch/index.js.map +1 -0
  269. package/dist/cli/dispatch/lifecycle.js +597 -0
  270. package/dist/cli/dispatch/lifecycle.js.map +1 -0
  271. package/dist/cli/dispatch/prime.js +104 -0
  272. package/dist/cli/dispatch/prime.js.map +1 -0
  273. package/dist/cli/dispatch/shared.js +64 -0
  274. package/dist/cli/dispatch/shared.js.map +1 -0
  275. package/dist/cli/dispatch/state.js +144 -0
  276. package/dist/cli/dispatch/state.js.map +1 -0
  277. package/dist/cli/dispatch.js +1 -1293
  278. package/dist/cli/dispatch.js.map +1 -1
  279. package/dist/cli/help.js +41 -8
  280. package/dist/cli/help.js.map +1 -1
  281. package/dist/cli/orientation/attention.js +61 -0
  282. package/dist/cli/orientation/attention.js.map +1 -0
  283. package/dist/cli/orientation/corpusCoverage.js +71 -0
  284. package/dist/cli/orientation/corpusCoverage.js.map +1 -0
  285. package/dist/cli/orientation.js +129 -78
  286. package/dist/cli/orientation.js.map +1 -1
  287. package/dist/cli/prime-blob.js +1 -1
  288. package/dist/cli/startupCompletenessContract.js +56 -0
  289. package/dist/cli/startupCompletenessContract.js.map +1 -0
  290. package/dist/cli/stateQuery.js +9 -2
  291. package/dist/cli/stateQuery.js.map +1 -1
  292. package/dist/cli/todoSeverity.js +19 -0
  293. package/dist/cli/todoSeverity.js.map +1 -0
  294. package/dist/core/envPaths.js +21 -0
  295. package/dist/core/envPaths.js.map +1 -0
  296. package/dist/core/git.js +43 -0
  297. package/dist/core/git.js.map +1 -0
  298. package/dist/core/jsonValue.js +6 -0
  299. package/dist/core/jsonValue.js.map +1 -0
  300. package/dist/core/pyjson.js +67 -2
  301. package/dist/core/pyjson.js.map +1 -1
  302. package/dist/eval/evalSkills.js +17 -12
  303. package/dist/eval/evalSkills.js.map +1 -1
  304. package/dist/eval/semanticEval.js +43 -19
  305. package/dist/eval/semanticEval.js.map +1 -1
  306. package/dist/eval/semanticFixtures.js +16 -4
  307. package/dist/eval/semanticFixtures.js.map +1 -1
  308. package/dist/hooks/common.js +8 -23
  309. package/dist/hooks/common.js.map +1 -1
  310. package/dist/hooks/compaction/apply.js +269 -0
  311. package/dist/hooks/compaction/apply.js.map +1 -0
  312. package/dist/hooks/compaction/dryRun.js +183 -0
  313. package/dist/hooks/compaction/dryRun.js.map +1 -0
  314. package/dist/hooks/compaction/index.js +23 -0
  315. package/dist/hooks/compaction/index.js.map +1 -0
  316. package/dist/hooks/compaction/parse.js +258 -0
  317. package/dist/hooks/compaction/parse.js.map +1 -0
  318. package/dist/hooks/compaction/retention.js +199 -0
  319. package/dist/hooks/compaction/retention.js.map +1 -0
  320. package/dist/hooks/compaction/status.js +241 -0
  321. package/dist/hooks/compaction/status.js.map +1 -0
  322. package/dist/hooks/compaction/todoResolved.js +137 -0
  323. package/dist/hooks/compaction/todoResolved.js.map +1 -0
  324. package/dist/hooks/compaction/types.js +6 -0
  325. package/dist/hooks/compaction/types.js.map +1 -0
  326. package/dist/hooks/compaction.js +20 -20
  327. package/dist/hooks/compaction.js.map +1 -1
  328. package/dist/hooks/cursorPreToolUse.js +1 -1
  329. package/dist/hooks/cursorPreToolUse.js.map +1 -1
  330. package/dist/hooks/cursorSessionStart.js +10 -2
  331. package/dist/hooks/cursorSessionStart.js.map +1 -1
  332. package/dist/hooks/sessionStart.js +18 -11
  333. package/dist/hooks/sessionStart.js.map +1 -1
  334. package/dist/hooks/sessionStop.js +6 -12
  335. package/dist/hooks/sessionStop.js.map +1 -1
  336. package/dist/hooks/todoLayout.js +177 -0
  337. package/dist/hooks/todoLayout.js.map +1 -0
  338. package/dist/hooks/validateArtifact/agentFacing.js +10 -0
  339. package/dist/hooks/validateArtifact/agentFacing.js.map +1 -0
  340. package/dist/hooks/validateArtifact/index.js +151 -0
  341. package/dist/hooks/validateArtifact/index.js.map +1 -0
  342. package/dist/hooks/validateArtifact/markdown.js +146 -0
  343. package/dist/hooks/validateArtifact/markdown.js.map +1 -0
  344. package/dist/hooks/validateArtifact/runtime.js +86 -0
  345. package/dist/hooks/validateArtifact/runtime.js.map +1 -0
  346. package/dist/hooks/validateArtifact/schema.js +459 -0
  347. package/dist/hooks/validateArtifact/schema.js.map +1 -0
  348. package/dist/hooks/validateArtifact/traversal.js +106 -0
  349. package/dist/hooks/validateArtifact/traversal.js.map +1 -0
  350. package/dist/hooks/validateArtifact/violations.js +105 -0
  351. package/dist/hooks/validateArtifact/violations.js.map +1 -0
  352. package/dist/hooks/validateArtifact.js +29 -40
  353. package/dist/hooks/validateArtifact.js.map +1 -1
  354. package/dist/migrate/v2HandoffManifest.js +447 -0
  355. package/dist/migrate/v2HandoffManifest.js.map +1 -0
  356. package/dist/registries/artifactProtocolIds.js +77 -0
  357. package/dist/registries/artifactProtocolIds.js.map +1 -0
  358. package/dist/registries/artifactRegistry.js +23 -9
  359. package/dist/registries/artifactRegistry.js.map +1 -1
  360. package/dist/registries/capabilityContract.js +144 -1
  361. package/dist/registries/capabilityContract.js.map +1 -1
  362. package/dist/registries/evaluatorHandoffContract.js +2 -2
  363. package/dist/registries/evaluatorHandoffContract.js.map +1 -1
  364. package/dist/registries/packageRegistry.js +4 -3
  365. package/dist/registries/packageRegistry.js.map +1 -1
  366. package/dist/registries/runtimeAdapterRegistry.js +5 -4
  367. package/dist/registries/runtimeAdapterRegistry.js.map +1 -1
  368. package/dist/registries/triggerLoader.js +211 -0
  369. package/dist/registries/triggerLoader.js.map +1 -0
  370. package/dist/release/releaseMetadata.js +235 -0
  371. package/dist/release/releaseMetadata.js.map +1 -0
  372. package/dist/routing/index.js +2 -0
  373. package/dist/routing/index.js.map +1 -0
  374. package/dist/routing/routeEngine.js +189 -0
  375. package/dist/routing/routeEngine.js.map +1 -0
  376. package/dist/setup/codex/agents.js +96 -0
  377. package/dist/setup/codex/agents.js.map +1 -0
  378. package/dist/setup/codex/cli.js +161 -0
  379. package/dist/setup/codex/cli.js.map +1 -0
  380. package/dist/setup/codex/configToml.js +639 -0
  381. package/dist/setup/codex/configToml.js.map +1 -0
  382. package/dist/setup/codex/constants.js +29 -0
  383. package/dist/setup/codex/constants.js.map +1 -0
  384. package/dist/setup/codex/installRoot.js +64 -0
  385. package/dist/setup/codex/installRoot.js.map +1 -0
  386. package/dist/setup/codex/state.js +270 -0
  387. package/dist/setup/codex/state.js.map +1 -0
  388. package/dist/setup/codex.js +11 -1196
  389. package/dist/setup/codex.js.map +1 -1
  390. package/dist/setup/cursor.js +6 -4
  391. package/dist/setup/cursor.js.map +1 -1
  392. package/dist/setup/cursorSurfaces.js +67 -0
  393. package/dist/setup/cursorSurfaces.js.map +1 -0
  394. package/dist/setup/doctor/core.js +300 -0
  395. package/dist/setup/doctor/core.js.map +1 -0
  396. package/dist/setup/doctor/diagnostics.js +240 -0
  397. package/dist/setup/doctor/diagnostics.js.map +1 -0
  398. package/dist/setup/doctor/opencode.js +313 -0
  399. package/dist/setup/doctor/opencode.js.map +1 -0
  400. package/dist/setup/doctor/report.js +425 -0
  401. package/dist/setup/doctor/report.js.map +1 -0
  402. package/dist/setup/doctor.js +9 -1296
  403. package/dist/setup/doctor.js.map +1 -1
  404. package/dist/setup/opencode.js +13 -0
  405. package/dist/setup/opencode.js.map +1 -0
  406. package/dist/setup/smokeChecks.js +11 -11
  407. package/dist/setup/smokeChecks.js.map +1 -1
  408. package/dist/state/installRoot.js +49 -18
  409. package/dist/state/installRoot.js.map +1 -1
  410. package/dist/state/progressCommit.js +289 -0
  411. package/dist/state/progressCommit.js.map +1 -0
  412. package/dist/state/startupAnalysis/benchmark.js +371 -0
  413. package/dist/state/startupAnalysis/benchmark.js.map +1 -0
  414. package/dist/state/startupAnalysis/contract.js +126 -0
  415. package/dist/state/startupAnalysis/contract.js.map +1 -0
  416. package/dist/state/startupAnalysis/helpers.js +287 -0
  417. package/dist/state/startupAnalysis/helpers.js.map +1 -0
  418. package/dist/state/startupAnalysis/index.js +7 -0
  419. package/dist/state/startupAnalysis/index.js.map +1 -0
  420. package/dist/state/startupAnalysis/metrics.js +341 -0
  421. package/dist/state/startupAnalysis/metrics.js.map +1 -0
  422. package/dist/state/startupAnalysis/records.js +199 -0
  423. package/dist/state/startupAnalysis/records.js.map +1 -0
  424. package/dist/state/startupAnalysis/report.js +112 -0
  425. package/dist/state/startupAnalysis/report.js.map +1 -0
  426. package/dist/state/startupAnalysis/threshold.js +500 -0
  427. package/dist/state/startupAnalysis/threshold.js.map +1 -0
  428. package/dist/state/startupAnalysis.js +2 -1952
  429. package/dist/state/startupAnalysis.js.map +1 -1
  430. package/dist/upgrade/appContentRefresh.js +342 -0
  431. package/dist/upgrade/appContentRefresh.js.map +1 -0
  432. package/dist/upgrade/appModel.js +8 -6
  433. package/dist/upgrade/appModel.js.map +1 -1
  434. package/dist/upgrade/bundleEvidence.js +34 -0
  435. package/dist/upgrade/bundleEvidence.js.map +1 -0
  436. package/dist/upgrade/channels.js +11 -4
  437. package/dist/upgrade/channels.js.map +1 -1
  438. package/dist/upgrade/cliProbe.js +22 -0
  439. package/dist/upgrade/cliProbe.js.map +1 -0
  440. package/dist/upgrade/coexistenceProbe.js +107 -0
  441. package/dist/upgrade/coexistenceProbe.js.map +1 -0
  442. package/dist/upgrade/compatibility.js +13 -4
  443. package/dist/upgrade/compatibility.js.map +1 -1
  444. package/dist/upgrade/doctor.js +165 -183
  445. package/dist/upgrade/doctor.js.map +1 -1
  446. package/dist/upgrade/doctorClassifier.js +177 -0
  447. package/dist/upgrade/doctorClassifier.js.map +1 -0
  448. package/dist/upgrade/installedHooksRetirement.js +190 -0
  449. package/dist/upgrade/installedHooksRetirement.js.map +1 -0
  450. package/dist/upgrade/legacyAgentCleanup.js +116 -0
  451. package/dist/upgrade/legacyAgentCleanup.js.map +1 -0
  452. package/dist/upgrade/migrateArtifactsV2ToV3.js +57 -109
  453. package/dist/upgrade/migrateArtifactsV2ToV3.js.map +1 -1
  454. package/dist/upgrade/nextMajorDoctor.js +42 -7
  455. package/dist/upgrade/nextMajorDoctor.js.map +1 -1
  456. package/dist/upgrade/npxPlatformStatus.js +23 -0
  457. package/dist/upgrade/npxPlatformStatus.js.map +1 -0
  458. package/dist/upgrade/projectIntegration.js +69 -73
  459. package/dist/upgrade/projectIntegration.js.map +1 -1
  460. package/dist/upgrade/projectIntegrationDecision.js +93 -0
  461. package/dist/upgrade/projectIntegrationDecision.js.map +1 -0
  462. package/dist/upgrade/runtimeMigration.js +169 -68
  463. package/dist/upgrade/runtimeMigration.js.map +1 -1
  464. package/dist/upgrade/v3CapabilitySurface.js +15 -0
  465. package/dist/upgrade/v3CapabilitySurface.js.map +1 -0
  466. package/dist/upgrade/versionResolution.js +8 -0
  467. package/dist/upgrade/versionResolution.js.map +1 -1
  468. package/dist/validate/appHomeContract.js +4 -4
  469. package/dist/validate/appHomeContract.js.map +1 -1
  470. package/dist/validate/capability.js +124 -11
  471. package/dist/validate/capability.js.map +1 -1
  472. package/dist/validate/crossCapability.js +1 -1
  473. package/dist/validate/crossCapability.js.map +1 -1
  474. package/dist/validate/lifecycleAdapters/legacyPythonParity.js +93 -0
  475. package/dist/validate/lifecycleAdapters/legacyPythonParity.js.map +1 -0
  476. package/dist/validate/lifecycleAdapters/nodeFormChecks.js +488 -0
  477. package/dist/validate/lifecycleAdapters/nodeFormChecks.js.map +1 -0
  478. package/dist/validate/lifecycleAdapters/shared.js +198 -0
  479. package/dist/validate/lifecycleAdapters/shared.js.map +1 -0
  480. package/dist/validate/lifecycleAdapters.js +13 -723
  481. package/dist/validate/lifecycleAdapters.js.map +1 -1
  482. package/dist/validate/selfAudit.js +62 -20
  483. package/dist/validate/selfAudit.js.map +1 -1
  484. package/dist/validate/vocabularyAuthority.js +303 -0
  485. package/dist/validate/vocabularyAuthority.js.map +1 -0
  486. package/package.json +27 -24
  487. package/bundle/references/v1-section-mapping.md +0 -47
  488. package/bundle/skills/agentera/agents/dokumentera.toml +0 -6
  489. package/bundle/skills/agentera/agents/hej.toml +0 -6
  490. package/bundle/skills/agentera/agents/inspektera.toml +0 -6
  491. package/bundle/skills/agentera/agents/inspirera.toml +0 -6
  492. package/bundle/skills/agentera/agents/orkestrera.toml +0 -6
  493. package/bundle/skills/agentera/agents/profilera.toml +0 -6
  494. package/bundle/skills/agentera/agents/realisera.toml +0 -6
  495. package/bundle/skills/agentera/agents/visionera.toml +0 -6
  496. package/bundle/skills/agentera/agents/visualisera.toml +0 -6
  497. package/bundle/skills/hej/.claude-plugin/plugin.json +0 -6
  498. package/bundle/skills/hej/SKILL.md +0 -69
  499. package/bundle/skills/hej/agents/hej.toml +0 -11
  500. package/bundle/skills/hej/agents/openai.yaml +0 -8
  501. /package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/exit.yaml +0 -0
  502. /package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/exit.yaml +0 -0
  503. /package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/exit.yaml +0 -0
  504. /package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/exit.yaml +0 -0
  505. /package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/exit.yaml +0 -0
  506. /package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/exit.yaml +0 -0
  507. /package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/exit.yaml +0 -0
  508. /package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/exit.yaml +0 -0
  509. /package/bundle/skills/agentera/capabilities/{hej → status}/schemas/exit.yaml +0 -0
  510. /package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/exit.yaml +0 -0
@@ -0,0 +1,273 @@
1
+ import fs from "node:fs";
2
+ import { resolvePath } from "../../core/paths.js";
3
+ import { isoFromMtime, record, signalType, textFromContent, } from "./core.js";
4
+ import { isPlainObject, rglob, isFilePath } from "./core.js";
5
+ import { resolveSqliteCaps, } from "./sqliteCaps.js";
6
+ import { PermissionDeniedError, openSqlite, sqliteTimestamp, tableColumns, firstColumn, qualified, } from "./sqliteSessions.js";
7
+ function copilotDbCandidates(storePath) {
8
+ if (isFilePath(storePath))
9
+ return [storePath];
10
+ return rglob(storePath, "session-store.db");
11
+ }
12
+ function copilotRows(conn, caps) {
13
+ const tables = new Set(conn.prepare("SELECT name FROM sqlite_master WHERE type = 'table'").all().map((r) => String(r.name)));
14
+ for (const t of ["sessions", "turns"]) {
15
+ if (!tables.has(t)) {
16
+ const missing = ["sessions", "turns"].filter((x) => !tables.has(x)).sort().join(",");
17
+ throw new Error(`missing copilot tables: ${missing}`);
18
+ }
19
+ }
20
+ const sessionCols = tableColumns(conn, "sessions");
21
+ const turnCols = tableColumns(conn, "turns");
22
+ const sessionId = firstColumn(sessionCols, ["id", "session_id", "sessionID"]);
23
+ const turnId = firstColumn(turnCols, ["id", "turn_id", "turnID"]);
24
+ const turnSession = firstColumn(turnCols, ["session_id", "sessionID", "session", "sessionId"]);
25
+ if (!(sessionId && turnSession))
26
+ throw new Error("missing copilot join columns");
27
+ const roleCol = firstColumn(turnCols, ["role", "actor", "author"]);
28
+ const textCol = firstColumn(turnCols, ["content", "text", "message", "prompt", "response"]);
29
+ if (roleCol === null)
30
+ throw new Error("missing copilot turn role column");
31
+ if (textCol === null)
32
+ throw new Error("missing copilot turn text column");
33
+ const sessionTime = firstColumn(sessionCols, ["time", "timestamp", "created_at", "createdAt"]);
34
+ const turnTime = firstColumn(turnCols, ["time", "timestamp", "created_at", "createdAt"]);
35
+ const turnOrder = firstColumn(turnCols, ["turn_index", "turnIndex", "idx", "position", "sequence"]);
36
+ const projectCol = firstColumn(sessionCols, ["cwd", "project_path", "projectPath", "directory", "path"]);
37
+ const turnData = firstColumn(turnCols, ["data", "payload", "json"]);
38
+ const turnType = firstColumn(turnCols, ["type", "kind"]);
39
+ const toolNameCol = firstColumn(turnCols, ["tool_name", "toolName", "tool", "name", "command_name", "commandName"]);
40
+ const toolArgs = firstColumn(turnCols, [
41
+ "arguments", "args", "input", "tool_input", "toolInput", "command", "command_line", "commandLine",
42
+ ]);
43
+ const orderExpr = turnOrder ? `t."${turnOrder}"` : `t."${turnTime || turnSession}"`;
44
+ const idExpr = turnId ? `t."${turnId}"` : "t.rowid";
45
+ const query = `
46
+ SELECT
47
+ ${qualified("s", sessionId, "session_id")},
48
+ ${qualified("s", projectCol, "project_path")},
49
+ ${qualified("t", turnId, "turn_id")},
50
+ ${qualified("t", roleCol, "role")},
51
+ ${qualified("t", turnTime, "turn_time")},
52
+ ${qualified("s", sessionTime, "session_time")},
53
+ ${qualified("t", textCol, "turn_text")},
54
+ ${qualified("t", turnData, "turn_data")},
55
+ ${qualified("t", turnType, "turn_type")},
56
+ ${qualified("t", toolNameCol, "tool_name")},
57
+ ${qualified("t", toolArgs, "tool_args")}
58
+ FROM turns t
59
+ JOIN sessions s ON t."${turnSession}" = s."${sessionId}"
60
+ ORDER BY COALESCE(${orderExpr}, t."${turnSession}"),
61
+ CASE LOWER(t."${roleCol}") WHEN 'user' THEN 0 WHEN 'assistant' THEN 1 ELSE 2 END,
62
+ ${idExpr}
63
+ LIMIT ?
64
+ `;
65
+ return conn.prepare(query).all(caps.maxRows);
66
+ }
67
+ export function probeCopilotTruncation(conn, caps, fallback) {
68
+ const tables = new Set(conn.prepare("SELECT name FROM sqlite_master WHERE type = 'table'").all().map((r) => String(r.name)));
69
+ if (!tables.has("sessions") || !tables.has("turns"))
70
+ return null;
71
+ const sessionCols = tableColumns(conn, "sessions");
72
+ const turnCols = tableColumns(conn, "turns");
73
+ const sessionId = firstColumn(sessionCols, ["id", "session_id", "sessionID"]);
74
+ const turnSession = firstColumn(turnCols, ["session_id", "sessionID", "session", "sessionId"]);
75
+ const roleCol = firstColumn(turnCols, ["role", "actor", "author"]);
76
+ if (!(sessionId && turnSession && roleCol))
77
+ return null;
78
+ const turnId = firstColumn(turnCols, ["id", "turn_id", "turnID"]);
79
+ const sessionTime = firstColumn(sessionCols, ["time", "timestamp", "created_at", "createdAt"]);
80
+ const turnTime = firstColumn(turnCols, ["time", "timestamp", "created_at", "createdAt"]);
81
+ const turnOrder = firstColumn(turnCols, ["turn_index", "turnIndex", "idx", "position", "sequence"]);
82
+ const orderExpr = turnOrder ? `t."${turnOrder}"` : `t."${turnTime || turnSession}"`;
83
+ const idExpr = turnId ? `t."${turnId}"` : "t.rowid";
84
+ const turnCount = Number(conn.prepare("SELECT COUNT(*) AS c FROM turns t JOIN sessions s ON t.\"" + turnSession + "\" = s.\"" + sessionId + "\"").get()?.c ?? 0);
85
+ if (turnCount <= caps.maxRows)
86
+ return null;
87
+ const timeExpr = `COALESCE(t."${turnTime || turnSession}", s."${sessionTime || sessionId}")`;
88
+ const query = `
89
+ SELECT MIN(turn_ts) AS truncated_at
90
+ FROM (
91
+ SELECT ${timeExpr} AS turn_ts
92
+ FROM turns t
93
+ JOIN sessions s ON t."${turnSession}" = s."${sessionId}"
94
+ ORDER BY COALESCE(${orderExpr}, t."${turnSession}"),
95
+ CASE LOWER(t."${roleCol}") WHEN 'user' THEN 0 WHEN 'assistant' THEN 1 ELSE 2 END,
96
+ ${idExpr}
97
+ LIMIT -1 OFFSET ?
98
+ )
99
+ `;
100
+ const row = conn.prepare(query).get(caps.maxRows);
101
+ const truncatedAt = sqliteTimestamp(row?.truncated_at, fallback);
102
+ return { truncatedAt, cap: "rows", limit: caps.maxRows };
103
+ }
104
+ function copilotArgumentDict(value) {
105
+ if (isPlainObject(value)) {
106
+ const stateInput = value.input;
107
+ if (isPlainObject(stateInput) && !("command" in value))
108
+ return stateInput;
109
+ return value;
110
+ }
111
+ if (typeof value === "string" && value) {
112
+ try {
113
+ const parsed = JSON.parse(value);
114
+ return isPlainObject(parsed) ? parsed : { value: parsed };
115
+ }
116
+ catch {
117
+ return { command: value };
118
+ }
119
+ }
120
+ return {};
121
+ }
122
+ function copilotJsonTools(value, errors, malformedLabel) {
123
+ if (typeof value === "string" && value) {
124
+ const raw = value;
125
+ try {
126
+ value = JSON.parse(value);
127
+ }
128
+ catch {
129
+ if (errors && malformedLabel && /^\s*[{[]/.test(raw))
130
+ errors.push(malformedLabel);
131
+ return [];
132
+ }
133
+ }
134
+ if (Array.isArray(value)) {
135
+ const tools = [];
136
+ for (const item of value)
137
+ tools.push(...copilotJsonTools(item, errors, malformedLabel));
138
+ return tools;
139
+ }
140
+ if (!isPlainObject(value))
141
+ return [];
142
+ const toolName = value.tool_name || value.toolName || value.tool || value.name;
143
+ const valueType = String(value.type || value.kind || "").toLowerCase();
144
+ if (typeof toolName === "string" &&
145
+ toolName &&
146
+ ["", "tool", "tool_call", "function_call", "tool_use", "command"].includes(valueType)) {
147
+ return [
148
+ {
149
+ tool_name: toolName,
150
+ arguments: copilotArgumentDict(value.arguments || value.args || value.input || value.state || {}),
151
+ },
152
+ ];
153
+ }
154
+ const tools = [];
155
+ for (const key of ["tool_calls", "toolCalls", "tools", "content", "parts", "items"]) {
156
+ const nested = value[key];
157
+ if (isPlainObject(nested) || Array.isArray(nested))
158
+ tools.push(...copilotJsonTools(nested, errors, malformedLabel));
159
+ }
160
+ return tools;
161
+ }
162
+ function copilotRowTools(row, errors) {
163
+ const tools = copilotJsonTools(row.turn_data, errors, "copilot malformed json tool payload");
164
+ tools.push(...copilotJsonTools(row.turn_text));
165
+ const toolName = row.tool_name;
166
+ if (typeof toolName === "string" && toolName) {
167
+ tools.push({ tool_name: toolName, arguments: copilotArgumentDict(row.tool_args) });
168
+ }
169
+ else if (String(row.turn_type || "").toLowerCase() === "command") {
170
+ const command = row.tool_args || row.turn_text;
171
+ if (typeof command === "string" && command)
172
+ tools.push({ tool_name: "bash", arguments: { command } });
173
+ }
174
+ return tools.filter((t) => typeof t.tool_name === "string" && t.tool_name);
175
+ }
176
+ export function extractCopilotSessions(storePath, errors, ctx) {
177
+ if (storePath === null || !fs.existsSync(storePath))
178
+ return [];
179
+ const caps = ctx?.sqliteCaps ?? resolveSqliteCaps();
180
+ const records = [];
181
+ for (const dbPath of copilotDbCandidates(storePath).slice(0, 1)) {
182
+ const fallbackTimestamp = isoFromMtime(dbPath);
183
+ let rows;
184
+ let conn = null;
185
+ try {
186
+ conn = openSqlite(dbPath);
187
+ const truncation = probeCopilotTruncation(conn, caps, fallbackTimestamp);
188
+ if (truncation && ctx)
189
+ ctx.truncation = truncation;
190
+ rows = copilotRows(conn, caps);
191
+ }
192
+ catch (exc) {
193
+ const msg = exc.message || "";
194
+ if (/lock|busy/i.test(msg))
195
+ throw new PermissionDeniedError(msg);
196
+ errors.push(`${dbPath}: copilot sqlite read failed: ${exc.name || "Error"}`);
197
+ continue;
198
+ }
199
+ finally {
200
+ try {
201
+ conn?.close();
202
+ }
203
+ catch {
204
+ /* ignore */
205
+ }
206
+ }
207
+ let previousAssistant = "";
208
+ let index = 0;
209
+ for (const row of rows) {
210
+ index += 1;
211
+ const role = String(row.role).toLowerCase();
212
+ if (role !== "user" && role !== "assistant")
213
+ continue;
214
+ const content = textFromContent(row.turn_text);
215
+ const toolItems = copilotRowTools(row, errors);
216
+ if (!content && toolItems.length === 0)
217
+ continue;
218
+ const projectPath = row.project_path ? String(row.project_path) : null;
219
+ const timestamp = sqliteTimestamp(row.turn_time || row.session_time, fallbackTimestamp);
220
+ if (content) {
221
+ const data = { actor: role, content };
222
+ if (role === "user") {
223
+ if (previousAssistant)
224
+ data.preceding_context = previousAssistant.slice(-2000);
225
+ const sig = signalType(content);
226
+ if (sig)
227
+ data.signal_type = sig;
228
+ }
229
+ else {
230
+ previousAssistant = content;
231
+ }
232
+ records.push(record({
233
+ sourceKind: "conversation_turn",
234
+ timestamp,
235
+ projectPath,
236
+ runtime: "github-copilot",
237
+ sourceParts: [resolvePath(dbPath), index, role, content.slice(0, 80)],
238
+ sessionId: String(row.session_id),
239
+ data,
240
+ }));
241
+ }
242
+ let toolIndex = 0;
243
+ for (const toolItem of toolItems) {
244
+ toolIndex += 1;
245
+ records.push(record({
246
+ sourceKind: "tool_call",
247
+ timestamp,
248
+ projectPath,
249
+ runtime: "github-copilot",
250
+ sourceParts: [resolvePath(dbPath), index, toolIndex, "tool", toolItem.tool_name, row.turn_id],
251
+ sessionId: String(row.session_id),
252
+ data: { tool_name: String(toolItem.tool_name), arguments: toolItem.arguments || {} },
253
+ }));
254
+ }
255
+ if (role === "user") {
256
+ const sig = signalType(content);
257
+ if (sig) {
258
+ records.push(record({
259
+ sourceKind: "history_prompt",
260
+ timestamp,
261
+ projectPath,
262
+ runtime: "github-copilot",
263
+ sourceParts: [resolvePath(dbPath), index, "history", content.slice(0, 120)],
264
+ sessionId: String(row.session_id),
265
+ data: { prompt: content, signal_type: sig },
266
+ }));
267
+ }
268
+ }
269
+ }
270
+ }
271
+ return records;
272
+ }
273
+ //# sourceMappingURL=copilotSessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilotSessions.js","sourceRoot":"","sources":["../../../src/analytics/extractCorpus/copilotSessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EACL,YAAY,EACZ,MAAM,EACN,UAAU,EACV,eAAe,GAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAGL,iBAAiB,GAClB,MAAM,iBA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AC,EAAE,GAAG,CAAC,CAAC;wBAC3E,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;wBACjC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE;qBAC5C,CAAC,CACH,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,364 @@
1
+ import fs from "node:fs";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ import { resolveProfileDirOverride, resolveXdgDataHome } from "../../core/envPaths.js";
5
+ import { expanduser } from "../../core/paths.js";
6
+ import crypto from "node:crypto";
7
+ import { resolvePath } from "../../core/paths.js";
8
+ export const ADAPTER_VERSION = "agentera-v2-corpus-1";
9
+ export const FAMILIES = [
10
+ "instruction_document",
11
+ "history_prompt",
12
+ "conversation_turn",
13
+ "tool_call",
14
+ "project_config_signal",
15
+ ];
16
+ export const RUNTIME_STORE_GLOBS = {
17
+ codex: "*.jsonl",
18
+ "claude-code": "*.jsonl",
19
+ cursor: "*.jsonl",
20
+ "cursor-agent": "store.db",
21
+ opencode: "opencode.db",
22
+ "github-copilot": "session-store.db",
23
+ };
24
+ export const MAX_TOOL_ARG_TEXT = 500;
25
+ export const MAX_SQLITE_ROWS = 100_000;
26
+ export const MAX_SQLITE_SESSIONS = 60;
27
+ export const COPILOT_SPARSE_REMEDIATION = "/chronicle reindex";
28
+ const DECISION_RE = /\b(decide|decision|prefer|preference|instead|avoid|don't|do not|should|trade[- ]?off|scope|plan|commit|review|fix|why|question|blocked|stuck|approve|reject|change|keep|remove)\b/i;
29
+ const CORRECTION_RE = /\b(no|not quite|actually|rather|instead|wrong|correction|that's not|that is not|don't|do not)\b/i;
30
+ const QUESTION_RE = /\?|^\s*(why|what|how|should|can|could|would)\b/i;
31
+ export function isoNow() {
32
+ // Python datetime.now(utc).isoformat() -> microseconds + "+00:00" -> "Z".
33
+ // JS gives milliseconds; corpus extracted_at is a wall-clock stamp, not a
34
+ // parity-critical record value.
35
+ return new Date().toISOString().replace(/Z$/, "Z");
36
+ }
37
+ export function isoFromMtime(p) {
38
+ const ms = fs.statSync(p).mtimeMs;
39
+ return new Date(ms).toISOString().replace(/Z$/, "Z");
40
+ }
41
+ export function stableId(...parts) {
42
+ const raw = parts.map((p) => pyStr(p)).join("\0");
43
+ return crypto.createHash("sha256").update(raw, "utf-8").digest("hex").slice(0, 24);
44
+ }
45
+ /** Python str() for the scalar/None values stable_id receives. */
46
+ function pyStr(value) {
47
+ if (value === null || value === undefined)
48
+ return "None";
49
+ if (value === true)
50
+ return "True";
51
+ if (value === false)
52
+ return "False";
53
+ return String(value);
54
+ }
55
+ export function projectIdFromPath(p) {
56
+ if (p === null)
57
+ return "global";
58
+ const name = path.basename(p) || p;
59
+ const slug = name
60
+ .replace(/[^A-Za-z0-9._-]+/g, "-")
61
+ .replace(/^-+/, "")
62
+ .replace(/-+$/, "")
63
+ .toLowerCase();
64
+ return slug || "global";
65
+ }
66
+ export function defaultAgenteraHome(env = process.env, platform = process.platform) {
67
+ const override = env.AGENTERA_HOME;
68
+ if (override)
69
+ return expanduser(override);
70
+ if (platform === "darwin")
71
+ return path.join(os.homedir(), "Library", "Application Support", "agentera");
72
+ if (platform === "win32") {
73
+ const appdata = env.APPDATA || path.join(os.homedir(), "AppData", "Roaming");
74
+ return path.join(expanduser(appdata), "agentera");
75
+ }
76
+ return path.join(resolveXdgDataHome(env), "agentera");
77
+ }
78
+ export function defaultProfileDir(env = process.env, platform = process.platform) {
79
+ const override = resolveProfileDirOverride(env);
80
+ if (override)
81
+ return expanduser(override);
82
+ return defaultAgenteraHome(env, platform);
83
+ }
84
+ export function defaultOutputPath(env = process.env, platform = process.platform) {
85
+ return path.join(defaultProfileDir(env, platform), "intermediate", "corpus.json");
86
+ }
87
+ export function runtimeStatus(runtime, opts) {
88
+ const item = { runtime, status: opts.status, reason: opts.reason };
89
+ if (opts.storePath !== null && opts.storePath !== undefined)
90
+ item.store_path = opts.storePath;
91
+ if (opts.fileCount !== null && opts.fileCount !== undefined)
92
+ item.file_count = opts.fileCount;
93
+ if (opts.recordCount !== null && opts.recordCount !== undefined)
94
+ item.record_count = opts.recordCount;
95
+ if (opts.errorCount !== null && opts.errorCount !== undefined)
96
+ item.error_count = opts.errorCount;
97
+ if (opts.remediationLabels && opts.remediationLabels.length > 0)
98
+ item.remediation_labels = opts.remediationLabels;
99
+ if (opts.truncatedAt)
100
+ item.truncated_at = opts.truncatedAt;
101
+ if (opts.truncationCap)
102
+ item.truncation_cap = opts.truncationCap;
103
+ if (opts.truncationLimit !== null && opts.truncationLimit !== undefined)
104
+ item.truncation_limit = opts.truncationLimit;
105
+ return item;
106
+ }
107
+ function isDir(p) {
108
+ try {
109
+ return fs.statSync(p).isDirectory();
110
+ }
111
+ catch {
112
+ return false;
113
+ }
114
+ }
115
+ function isFilePath(p) {
116
+ try {
117
+ return fs.statSync(p).isFile();
118
+ }
119
+ catch {
120
+ return false;
121
+ }
122
+ }
123
+ /** Recursive glob for a simple pattern ("*.jsonl" or an exact filename). */
124
+ function rglob(root, pattern) {
125
+ const out = [];
126
+ const matchesExt = pattern.startsWith("*.") ? pattern.slice(1) : null; // ".jsonl"
127
+ const exact = matchesExt ? null : pattern;
128
+ const walk = (dir) => {
129
+ let entries;
130
+ try {
131
+ entries = fs.readdirSync(dir, { withFileTypes: true });
132
+ }
133
+ catch {
134
+ return;
135
+ }
136
+ for (const e of entries) {
137
+ const full = path.join(dir, e.name);
138
+ if (e.isDirectory())
139
+ walk(full);
140
+ else if (e.isFile()) {
141
+ if (matchesExt ? e.name.endsWith(matchesExt) : e.name === exact)
142
+ out.push(full);
143
+ }
144
+ }
145
+ };
146
+ walk(root);
147
+ return out.sort();
148
+ }
149
+ export function discoverRuntimeStore(runtime, storePath) {
150
+ if (storePath === null) {
151
+ return runtimeStatus(runtime, { status: "skipped", reason: "disabled", storePath: null });
152
+ }
153
+ if (!fs.existsSync(storePath)) {
154
+ return runtimeStatus(runtime, {
155
+ status: "missing",
156
+ reason: "store_absent",
157
+ storePath,
158
+ remediationLabels: runtime === "github-copilot" ? [COPILOT_SPARSE_REMEDIATION] : null,
159
+ });
160
+ }
161
+ if ((runtime === "opencode" || runtime === "github-copilot") && isFilePath(storePath)) {
162
+ return runtimeStatus(runtime, {
163
+ status: "available",
164
+ reason: "candidate_files_found",
165
+ storePath,
166
+ fileCount: 1,
167
+ });
168
+ }
169
+ if (!isDir(storePath)) {
170
+ return runtimeStatus(runtime, { status: "degraded", reason: "store_not_directory", storePath });
171
+ }
172
+ let candidates;
173
+ try {
174
+ candidates = rglob(storePath, RUNTIME_STORE_GLOBS[runtime]);
175
+ }
176
+ catch {
177
+ return runtimeStatus(runtime, { status: "degraded", reason: "store_unreadable", storePath });
178
+ }
179
+ if (candidates.length === 0) {
180
+ return runtimeStatus(runtime, {
181
+ status: "sparse",
182
+ reason: "no_candidate_files",
183
+ storePath,
184
+ fileCount: 0,
185
+ remediationLabels: runtime === "github-copilot" ? [COPILOT_SPARSE_REMEDIATION] : null,
186
+ });
187
+ }
188
+ return runtimeStatus(runtime, {
189
+ status: "available",
190
+ reason: "candidate_files_found",
191
+ storePath,
192
+ fileCount: candidates.length,
193
+ });
194
+ }
195
+ // ── record builders + content helpers ──────────────────────────────
196
+ export function splitLines(text) {
197
+ const parts = text.split(/\r\n|\r|\n/);
198
+ if (parts.length > 0 && parts[parts.length - 1] === "")
199
+ parts.pop();
200
+ return parts;
201
+ }
202
+ export function record(opts) {
203
+ const item = {
204
+ source_id: stableId(opts.sourceKind, ...opts.sourceParts),
205
+ timestamp: opts.timestamp,
206
+ project_id: projectIdFromPath(opts.projectPath),
207
+ source_kind: opts.sourceKind,
208
+ runtime: opts.runtime,
209
+ adapter_version: ADAPTER_VERSION,
210
+ data: opts.data,
211
+ };
212
+ if (opts.projectPath !== null && opts.projectPath !== undefined)
213
+ item.project_path = opts.projectPath;
214
+ if (opts.sessionId) {
215
+ item.session_id = opts.sessionId;
216
+ item.conversation_key = opts.sessionId;
217
+ }
218
+ return item;
219
+ }
220
+ function isPlainObject(v) {
221
+ return typeof v === "object" && v !== null && !Array.isArray(v);
222
+ }
223
+ export function payloadItem(event) {
224
+ const payload = event.payload;
225
+ if (isPlainObject(payload)) {
226
+ const nested = payload.item;
227
+ if (isPlainObject(nested))
228
+ return nested;
229
+ return payload;
230
+ }
231
+ return event;
232
+ }
233
+ export function eventKind(event) {
234
+ for (const key of ["type", "event", "name"]) {
235
+ const value = event[key];
236
+ if (typeof value === "string")
237
+ return value;
238
+ }
239
+ return "";
240
+ }
241
+ export function eventTimestamp(item, fallback) {
242
+ const payload = isPlainObject(item.payload) ? item.payload : {};
243
+ const nested = isPlainObject(payload.item) ? payload.item : {};
244
+ for (const source of [item, payload, nested]) {
245
+ for (const key of ["timestamp", "created_at", "createdAt", "time"]) {
246
+ const value = source[key];
247
+ if (typeof value === "string" && value)
248
+ return value;
249
+ if (typeof value === "number") {
250
+ return new Date(value * 1000).toISOString();
251
+ }
252
+ }
253
+ }
254
+ return fallback;
255
+ }
256
+ export function textFromContent(value) {
257
+ if (value === null || value === undefined)
258
+ return "";
259
+ if (typeof value === "string")
260
+ return value;
261
+ if (Array.isArray(value)) {
262
+ const parts = value.map((it) => textFromContent(it));
263
+ return parts.filter((p) => p).join("\n");
264
+ }
265
+ if (isPlainObject(value)) {
266
+ for (const key of ["text", "input_text", "output_text", "message", "content"]) {
267
+ const text = textFromContent(value[key]);
268
+ if (text)
269
+ return text;
270
+ }
271
+ return "";
272
+ }
273
+ return pyStr(value);
274
+ }
275
+ export function claudeContentItems(event) {
276
+ const items = [];
277
+ const msg = isPlainObject(event.message) ? event.message : null;
278
+ for (const source of [event, msg]) {
279
+ if (!isPlainObject(source))
280
+ continue;
281
+ const content = source.content;
282
+ if (Array.isArray(content)) {
283
+ for (const it of content)
284
+ if (isPlainObject(it))
285
+ items.push(it);
286
+ }
287
+ else if (isPlainObject(content)) {
288
+ items.push(content);
289
+ }
290
+ }
291
+ return items;
292
+ }
293
+ export function* iterJsonl(p, errors) {
294
+ let text;
295
+ try {
296
+ text = fs.readFileSync(p, "utf-8");
297
+ }
298
+ catch (exc) {
299
+ errors.push(`${p}: cannot read: ${exc.message}`);
300
+ return;
301
+ }
302
+ const lines = text.split("\n");
303
+ for (let i = 0; i < lines.length; i++) {
304
+ const stripped = lines[i].trim();
305
+ if (!stripped)
306
+ continue;
307
+ let item;
308
+ try {
309
+ item = JSON.parse(stripped);
310
+ }
311
+ catch (exc) {
312
+ errors.push(`${p}:${i + 1}: invalid jsonl: ${exc.message}`);
313
+ continue;
314
+ }
315
+ if (isPlainObject(item))
316
+ yield item;
317
+ }
318
+ }
319
+ export function signalType(text) {
320
+ if (!text || !DECISION_RE.test(text))
321
+ return null;
322
+ if (CORRECTION_RE.test(text))
323
+ return "correction";
324
+ if (QUESTION_RE.test(text))
325
+ return "question";
326
+ return "decision";
327
+ }
328
+ export function toolCallRecordFromItem(args) {
329
+ const { item, event } = args;
330
+ const kind = eventKind(event);
331
+ const itemType = item.type;
332
+ if (!["tool_call", "function_call"].includes(kind) &&
333
+ !["tool_call", "function_call", "tool_use"].includes(itemType)) {
334
+ return null;
335
+ }
336
+ const toolName = item.tool_name || item.name || item.tool;
337
+ if (typeof toolName !== "string" || !toolName)
338
+ return null;
339
+ let argumentsVal = item.arguments || item.input || item.args || {};
340
+ if (typeof argumentsVal === "string") {
341
+ try {
342
+ argumentsVal = JSON.parse(argumentsVal);
343
+ }
344
+ catch {
345
+ argumentsVal = { raw: argumentsVal };
346
+ }
347
+ }
348
+ if (!isPlainObject(argumentsVal))
349
+ argumentsVal = { value: argumentsVal };
350
+ return record({
351
+ sourceKind: "tool_call",
352
+ timestamp: eventTimestamp(event, args.fallbackTimestamp),
353
+ projectPath: args.projectPath,
354
+ runtime: args.runtime,
355
+ sourceParts: [resolvePath(args.sourcePath), args.index, "tool", toolName],
356
+ sessionId: args.sessionId,
357
+ data: { tool_name: toolName, arguments: argumentsVal }, // cast: parsed JSON IO boundary
358
+ });
359
+ }
360
+ export function toolCallRecord(args) {
361
+ return toolCallRecordFromItem({ ...args, item: payloadItem(args.event) });
362
+ }
363
+ export { isPlainObject, rglob, isDir, isFilePath };
364
+ //# sourceMappingURL=core.js.map