gennady 0.6.1 → 0.7.1

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 (322) hide show
  1. package/README.md +2 -15
  2. package/ai/agents/agent-resolve-conflicts.xml +6 -0
  3. package/ai/agents/agent-review-verifier.xml +6 -0
  4. package/ai/directives/architecture/README.md +21 -0
  5. package/ai/directives/coding/README.md +23 -0
  6. package/ai/directives/coding/result-conventions.xml +55 -0
  7. package/ai/directives/coding/svelte5-runes.xml +248 -0
  8. package/ai/directives/coding/sveltekit-rules.xml +247 -0
  9. package/ai/directives/coding/typescript-rules.xml +589 -0
  10. package/ai/directives/coding/uikit-component-storybook.xml +347 -0
  11. package/ai/directives/coding/uikit-component-svelte.xml +344 -0
  12. package/ai/directives/coding/uikit-spec-drafting.xml +243 -0
  13. package/ai/directives/dbc-audit.directive.xml +131 -0
  14. package/ai/directives/dev-review.directive.xml +148 -0
  15. package/ai/directives/infra/README.md +11 -0
  16. package/ai/directives/infra/eslint-setup.xml +467 -0
  17. package/ai/directives/infra/git-setup.xml +261 -0
  18. package/ai/directives/infra/nodejs-npm-setup.xml +354 -0
  19. package/ai/directives/infra/storybook-setup.xml +153 -0
  20. package/ai/directives/knowledge.xml +206 -0
  21. package/ai/directives/perf-auditor/perf-auditor.directive.xml +75 -0
  22. package/ai/directives/perf-auditor/rules/async-latency.xml +101 -0
  23. package/ai/directives/perf-auditor/rules/data-structures.xml +103 -0
  24. package/ai/directives/perf-auditor/rules/iteration-fusion.xml +96 -0
  25. package/ai/directives/perf-auditor/rules/memory-gc.xml +102 -0
  26. package/ai/directives/sdd/README.md +49 -0
  27. package/ai/directives/sdd/audit.directive.xml +543 -0
  28. package/ai/directives/sdd/discovery.directive.xml +824 -0
  29. package/ai/directives/sdd/fix.directive.xml +249 -0
  30. package/ai/directives/sdd/module-decomposition.directive.xml +666 -0
  31. package/ai/directives/sdd/phase-execution-protocol.xml +339 -0
  32. package/ai/directives/sdd/scaffold.directive.xml +717 -0
  33. package/ai/directives/sdd/setup.directive.xml +213 -0
  34. package/ai/directives/sdd/svelte-ui-discovery.directive.xml +263 -0
  35. package/ai/directives/semantic-change-extractor.directive.xml +99 -0
  36. package/ai/directives/testing/README.md +25 -0
  37. package/ai/directives/testing/common.xml +234 -0
  38. package/ai/directives/testing/node-test.xml +288 -0
  39. package/ai/directives/testing/playwright-cli.xml +199 -0
  40. package/ai/directives/testing/playwright-e2e.xml +292 -0
  41. package/ai/directives/testing/storybook-usage.xml +173 -0
  42. package/ai/directives/testing/svelte-testing.xml +237 -0
  43. package/ai/directives/testing/vitest-rules.xml +326 -0
  44. package/ai/docs/README.md +17 -0
  45. package/ai/docs/ai-icl.md +538 -0
  46. package/ai/docs/ai-priming.md +548 -0
  47. package/ai/docs/ai-prompt-formats.md +406 -0
  48. package/ai/docs/ai-promting.md +572 -0
  49. package/ai/drafts/DRAFT.md +120 -0
  50. package/ai/drafts/agent-devgen-class-from-description.rules.xml +123 -0
  51. package/ai/drafts/agent-typescript-devgen.v1.xml +303 -0
  52. package/ai/drafts/d.md +65 -0
  53. package/ai/drafts/music-posts.md +105 -0
  54. package/ai/fw/v1/architecture/blueprint-factory.xml +77 -0
  55. package/ai/fw/v1/core/mental-model.xml +50 -0
  56. package/ai/fw/v1/discovery/intent-reactor.xml +92 -0
  57. package/ai/fw/v1/production/swarm-protocol.xml +122 -0
  58. package/ai/fw/v1/review/quality-pipeline.xml +102 -0
  59. package/ai/fw/v2/arch-universal.xml +73 -0
  60. package/ai/fw-draft/README.md +79 -0
  61. package/ai/fw-draft/bin/discovery.sh +116 -0
  62. package/ai/fw-draft/gennady.xml +58 -0
  63. package/ai/fw-draft/provider/claude.xml +16 -0
  64. package/ai/fw-draft/provider/cursor.xml +23 -0
  65. package/ai/fw-draft/provider/default.xml +12 -0
  66. package/ai/fw-draft/roles/developer.xml +18 -0
  67. package/ai/fw-draft/router.xml +39 -0
  68. package/ai/fw-draft/routes/development.xml +32 -0
  69. package/ai/fw-draft/routes/universal.xml +58 -0
  70. package/ai/fw-draft/rules/dev/base/file-structure-rules.xml +89 -0
  71. package/ai/fw-draft/rules/dev/typescript/contacts.xml +194 -0
  72. package/dist/ai/agents/agent-resolve-conflicts.xml +6 -0
  73. package/dist/ai/agents/agent-review-verifier.xml +6 -0
  74. package/dist/ai/directives/architecture/README.md +21 -0
  75. package/dist/ai/directives/coding/README.md +23 -0
  76. package/dist/ai/directives/coding/result-conventions.xml +55 -0
  77. package/dist/ai/directives/coding/svelte5-runes.xml +248 -0
  78. package/dist/ai/directives/coding/sveltekit-rules.xml +247 -0
  79. package/dist/ai/directives/coding/typescript-rules.xml +589 -0
  80. package/dist/ai/directives/coding/uikit-component-storybook.xml +347 -0
  81. package/dist/ai/directives/coding/uikit-component-svelte.xml +344 -0
  82. package/dist/ai/directives/coding/uikit-spec-drafting.xml +243 -0
  83. package/dist/ai/directives/dbc-audit.directive.xml +131 -0
  84. package/dist/ai/directives/dev-review.directive.xml +148 -0
  85. package/dist/ai/directives/infra/README.md +11 -0
  86. package/dist/ai/directives/infra/eslint-setup.xml +467 -0
  87. package/dist/ai/directives/infra/git-setup.xml +261 -0
  88. package/dist/ai/directives/infra/nodejs-npm-setup.xml +354 -0
  89. package/dist/ai/directives/infra/storybook-setup.xml +153 -0
  90. package/dist/ai/directives/knowledge.xml +206 -0
  91. package/dist/ai/directives/perf-auditor/perf-auditor.directive.xml +75 -0
  92. package/dist/ai/directives/perf-auditor/rules/async-latency.xml +101 -0
  93. package/dist/ai/directives/perf-auditor/rules/data-structures.xml +103 -0
  94. package/dist/ai/directives/perf-auditor/rules/iteration-fusion.xml +96 -0
  95. package/dist/ai/directives/perf-auditor/rules/memory-gc.xml +102 -0
  96. package/dist/ai/directives/sdd/README.md +49 -0
  97. package/dist/ai/directives/sdd/audit.directive.xml +543 -0
  98. package/dist/ai/directives/sdd/discovery.directive.xml +824 -0
  99. package/dist/ai/directives/sdd/fix.directive.xml +249 -0
  100. package/dist/ai/directives/sdd/module-decomposition.directive.xml +666 -0
  101. package/dist/ai/directives/sdd/phase-execution-protocol.xml +339 -0
  102. package/dist/ai/directives/sdd/scaffold.directive.xml +717 -0
  103. package/dist/ai/directives/sdd/setup.directive.xml +213 -0
  104. package/dist/ai/directives/sdd/svelte-ui-discovery.directive.xml +263 -0
  105. package/dist/ai/directives/semantic-change-extractor.directive.xml +99 -0
  106. package/dist/ai/directives/testing/README.md +25 -0
  107. package/dist/ai/directives/testing/common.xml +234 -0
  108. package/dist/ai/directives/testing/node-test.xml +288 -0
  109. package/dist/ai/directives/testing/playwright-cli.xml +199 -0
  110. package/dist/ai/directives/testing/playwright-e2e.xml +292 -0
  111. package/dist/ai/directives/testing/storybook-usage.xml +173 -0
  112. package/dist/ai/directives/testing/svelte-testing.xml +237 -0
  113. package/dist/ai/directives/testing/vitest-rules.xml +326 -0
  114. package/dist/ai/docs/README.md +17 -0
  115. package/dist/ai/docs/ai-icl.md +538 -0
  116. package/dist/ai/docs/ai-priming.md +548 -0
  117. package/dist/ai/docs/ai-prompt-formats.md +406 -0
  118. package/dist/ai/docs/ai-promting.md +572 -0
  119. package/dist/ai/drafts/DRAFT.md +120 -0
  120. package/dist/ai/drafts/agent-devgen-class-from-description.rules.xml +123 -0
  121. package/dist/ai/drafts/agent-typescript-devgen.v1.xml +303 -0
  122. package/dist/ai/drafts/d.md +65 -0
  123. package/dist/ai/drafts/music-posts.md +105 -0
  124. package/dist/ai/fw/v1/architecture/blueprint-factory.xml +77 -0
  125. package/dist/ai/fw/v1/core/mental-model.xml +50 -0
  126. package/dist/ai/fw/v1/discovery/intent-reactor.xml +92 -0
  127. package/dist/ai/fw/v1/production/swarm-protocol.xml +122 -0
  128. package/dist/ai/fw/v1/review/quality-pipeline.xml +102 -0
  129. package/dist/ai/fw/v2/arch-universal.xml +73 -0
  130. package/dist/ai/fw-draft/README.md +79 -0
  131. package/dist/ai/fw-draft/bin/discovery.sh +116 -0
  132. package/dist/ai/fw-draft/gennady.xml +58 -0
  133. package/dist/ai/fw-draft/provider/claude.xml +16 -0
  134. package/dist/ai/fw-draft/provider/cursor.xml +23 -0
  135. package/dist/ai/fw-draft/provider/default.xml +12 -0
  136. package/dist/ai/fw-draft/roles/developer.xml +18 -0
  137. package/dist/ai/fw-draft/router.xml +39 -0
  138. package/dist/ai/fw-draft/routes/development.xml +32 -0
  139. package/dist/ai/fw-draft/routes/universal.xml +58 -0
  140. package/dist/ai/fw-draft/rules/dev/base/file-structure-rules.xml +89 -0
  141. package/dist/ai/fw-draft/rules/dev/typescript/contacts.xml +194 -0
  142. package/dist/chunks/_commonjsHelpers-DaMA6jEr.js +8 -0
  143. package/dist/chunks/devtools-CPZ0IUNM.js +79 -0
  144. package/dist/chunks/{help.cmd-CWasx25o.js → help.cmd-B_G7EWzF.js} +9 -2
  145. package/dist/chunks/{index-Bh0p7rJg.js → index-BCqnKvNZ.js} +33 -9
  146. package/dist/chunks/{index-Gy1n7hRU.js → index-BLsDffzZ.js} +1 -1
  147. package/dist/chunks/index-Bq4d25CK.js +26964 -0
  148. package/dist/chunks/{index-D1Hurfwu.js → index-BrSutH7l.js} +57 -33
  149. package/dist/chunks/{index-DgAmONSz.js → index-BsD-J44e.js} +12 -12
  150. package/dist/chunks/{index-Bx_P7mlL.js → index-BzBhCTHq.js} +2 -2
  151. package/dist/chunks/{index-B3r-YFvt.js → index-CAWs-GED.js} +1 -1
  152. package/dist/chunks/index-CFd_iufb.js +16979 -0
  153. package/dist/chunks/index-DAU6h0aT.js +178 -0
  154. package/dist/chunks/index-Db09OODV.js +176 -0
  155. package/dist/chunks/{index-BrobNwbS.js → index-Dc44ukmL.js} +35 -19
  156. package/dist/chunks/index-DeYzAoxF.js +3789 -0
  157. package/dist/chunks/index-O5kqC9i_.js +443 -0
  158. package/dist/chunks/index-TX0TmKeu.js +540 -0
  159. package/dist/chunks/{run-review-command.logic-BQDGxh0f.js → run-review-command.logic-CwxYeLby.js} +2 -2
  160. package/dist/chunks/services-Dnk3nB2x.js +2732 -0
  161. package/dist/chunks/shared-COpFaV-w.js +665 -0
  162. package/dist/cli/cmd/_shared/prompt/io/load-agent-template.io.d.ts +3 -3
  163. package/dist/cli/cmd/_shared/prompt/logic/build-ai-first-knowledge-block.logic.d.ts +3 -3
  164. package/dist/cli/cmd/_shared/prompt/logic/build-ai-verify-placeholders.logic.d.ts +7 -4
  165. package/dist/cli/cmd/_shared/prompt/logic/verify-commands/resolve-verify-commands.logic.d.ts +5 -0
  166. package/dist/cli/cmd/_shared/update-check-worker.d.ts +1 -0
  167. package/dist/cli/cmd/_shared/update-check.d.ts +38 -0
  168. package/dist/cli/cmd/agent-mon/cmd/create-providers.d.ts +15 -0
  169. package/dist/cli/cmd/agent-mon/cmd/index.d.ts +1 -0
  170. package/dist/cli/cmd/agent-mon/cmd/run.d.ts +12 -0
  171. package/dist/cli/cmd/agent-mon/state/create-state-manager.d.ts +32 -0
  172. package/dist/cli/cmd/agent-mon/state/group-by-provider.d.ts +14 -0
  173. package/dist/cli/cmd/agent-mon/state/index.d.ts +5 -0
  174. package/dist/cli/cmd/agent-mon/state/is-waiting.d.ts +9 -0
  175. package/dist/cli/cmd/agent-mon/state/view-model.type.d.ts +74 -0
  176. package/dist/cli/cmd/agent-mon/ui/app.d.ts +16 -0
  177. package/dist/cli/cmd/agent-mon/ui/column-view.d.ts +14 -0
  178. package/dist/cli/cmd/agent-mon/ui/index.d.ts +10 -0
  179. package/dist/cli/cmd/agent-mon/ui/provider-column.d.ts +14 -0
  180. package/dist/cli/cmd/agent-mon/ui/session-card.d.ts +12 -0
  181. package/dist/cli/cmd/agent-mon/ui/status-badge.d.ts +10 -0
  182. package/dist/cli/cmd/alt-opinion/alt-opinion-parser.d.ts +18 -0
  183. package/dist/cli/cmd/alt-opinion/alt-opinion-runner.d.ts +32 -0
  184. package/dist/cli/cmd/alt-opinion/alt-opinion.cmd.d.ts +34 -0
  185. package/dist/cli/cmd/alt-opinion/alt-opinion.types.d.ts +88 -0
  186. package/dist/cli/cmd/alt-opinion/index.d.ts +1 -0
  187. package/dist/cli/cmd/cat/cat-url.fn.d.ts +19 -0
  188. package/dist/cli/cmd/lint/checks/anchor.check.d.ts +11 -0
  189. package/dist/cli/cmd/lint/checks/dbc-contract.check.d.ts +16 -0
  190. package/dist/cli/cmd/lint/checks/disables.check.d.ts +12 -0
  191. package/dist/cli/cmd/lint/checks/file-header.check.d.ts +10 -0
  192. package/dist/cli/cmd/lint/checks/language.check.d.ts +11 -0
  193. package/dist/cli/cmd/lint/index.d.ts +1 -0
  194. package/dist/cli/cmd/lint/lint.cmd.d.ts +18 -0
  195. package/dist/cli/cmd/lint/lint.types.d.ts +72 -0
  196. package/dist/cli/cmd/lint/utils/resolve-references.fn.d.ts +32 -0
  197. package/dist/cli/cmd/remote-console/index.d.ts +2 -0
  198. package/dist/cli/cmd/remote-console/remote-console.cmd.d.ts +55 -0
  199. package/dist/cli/cmd/resolve-conflicts/_core/io/resolve-conflicts-template-load.io.d.ts +2 -2
  200. package/dist/cli/cmd/resolve-conflicts/_core/logic/resolve-conflicts-command-args-parse.logic.d.ts +3 -3
  201. package/dist/cli/cmd/resolve-conflicts/_core/logic/resolve-conflicts-command-run.logic.d.ts +3 -3
  202. package/dist/cli/cmd/resolve-conflicts/_core/logic/resolve-conflicts-context-git-build.logic.d.ts +4 -4
  203. package/dist/cli/cmd/resolve-conflicts/_core/types/resolve-conflicts-artifact.type.d.ts +3 -1
  204. package/dist/cli/cmd/resolve-conflicts/_core/types/resolve-conflicts-command-args.type.d.ts +3 -1
  205. package/dist/cli/cmd/resolve-conflicts/_core/types/resolve-conflicts-command-result.type.d.ts +5 -1
  206. package/dist/cli/cmd/resolve-conflicts/_core/types/resolve-conflicts-context-git.type.d.ts +18 -2
  207. package/dist/cli/cmd/resolve-conflicts/_core/xml/resolve-conflicts-artifact-build.xml.d.ts +6 -6
  208. package/dist/cli/cmd/resolve-conflicts/_core/xml/resolve-conflicts-render.xml.d.ts +4 -4
  209. package/dist/cli/cmd/review/_core/io/load-review-verify-template.io.d.ts +2 -2
  210. package/dist/cli/cmd/review/_core/logic/build-review-context-git.logic.d.ts +3 -3
  211. package/dist/cli/cmd/review/_core/logic/build-review-context-vcs.logic.d.ts +2 -2
  212. package/dist/cli/cmd/review/_core/logic/load-review-context-mr.logic.d.ts +5 -5
  213. package/dist/cli/cmd/review/_core/logic/parse-review-command-args.logic.d.ts +3 -3
  214. package/dist/cli/cmd/review/_core/logic/resolve-review-intent.logic.d.ts +3 -3
  215. package/dist/cli/cmd/review/_core/logic/run-review-command.logic.d.ts +3 -3
  216. package/dist/cli/cmd/review/_core/types/review-artifact.type.d.ts +4 -1
  217. package/dist/cli/cmd/review/_core/types/review-command-args.type.d.ts +7 -1
  218. package/dist/cli/cmd/review/_core/types/review-command-mode.type.d.ts +1 -1
  219. package/dist/cli/cmd/review/_core/types/review-command-options.type.d.ts +3 -1
  220. package/dist/cli/cmd/review/_core/types/review-command-result.type.d.ts +5 -1
  221. package/dist/cli/cmd/review/_core/types/review-context-git.type.d.ts +3 -1
  222. package/dist/cli/cmd/review/_core/types/review-context-mr.type.d.ts +22 -3
  223. package/dist/cli/cmd/review/_core/types/review-context-vcs.type.d.ts +4 -1
  224. package/dist/cli/cmd/review/_core/types/review-intent.type.d.ts +1 -1
  225. package/dist/cli/cmd/review/_core/xml/build-review-artifact.xml.d.ts +10 -10
  226. package/dist/cli/cmd/review/_core/xml/render-review-issues.xml.d.ts +3 -3
  227. package/dist/cli/cmd/review/_core/xml/render-review-verify.xml.d.ts +4 -4
  228. package/dist/cli/cmd/sync/index.d.ts +1 -0
  229. package/dist/cli/cmd/sync/sync-core.d.ts +65 -0
  230. package/dist/cli/cmd/sync/sync-formatter.d.ts +12 -0
  231. package/dist/cli/cmd/sync/sync.cmd.d.ts +33 -0
  232. package/dist/cli/cmd/sync/sync.types.d.ts +50 -0
  233. package/dist/cli/cmd/vcs-reply/vcs-reply.cmd.d.ts +4 -4
  234. package/dist/cli/utils/ai-legacy/ai-legacy-agent.d.ts +12 -11
  235. package/dist/cli/utils/ai-legacy/ai-legacy-core.d.ts +33 -17
  236. package/dist/cli/utils/ai-legacy/ai-legacy-model.d.ts +42 -23
  237. package/dist/cli/utils/cat-gen/cat-gen.d.ts +19 -8
  238. package/dist/cli/utils/commit-gen/commit-gen.d.ts +39 -15
  239. package/dist/cli/utils/prompts/index.d.ts +6 -6
  240. package/dist/cli/utils/review-gen/review-gen.d.ts +33 -9
  241. package/dist/gennady.js +30 -10
  242. package/dist/index.d.ts +1 -0
  243. package/dist/index.js +43 -22
  244. package/dist/services/agent-mon/diff/diff.d.ts +9 -0
  245. package/dist/services/agent-mon/diff/index.d.ts +1 -0
  246. package/dist/services/agent-mon/index.d.ts +10 -0
  247. package/dist/services/agent-mon/model/agent-provider.type.d.ts +20 -0
  248. package/dist/services/agent-mon/model/agent-session.type.d.ts +49 -0
  249. package/dist/services/agent-mon/model/errors.d.ts +20 -0
  250. package/dist/services/agent-mon/model/index.d.ts +7 -0
  251. package/dist/services/agent-mon/model/observe-opts.type.d.ts +7 -0
  252. package/dist/services/agent-mon/model/scan-opts.type.d.ts +7 -0
  253. package/dist/services/agent-mon/model/session-changes.type.d.ts +10 -0
  254. package/dist/services/agent-mon/monitor/agent-monitor.d.ts +44 -0
  255. package/dist/services/agent-mon/monitor/create-monitor.d.ts +6 -0
  256. package/dist/services/agent-mon/monitor/index.d.ts +2 -0
  257. package/dist/services/agent-mon/observe/index.d.ts +1 -0
  258. package/dist/services/agent-mon/observe/observe.d.ts +12 -0
  259. package/dist/services/agent-mon/providers/claude/claude-provider.d.ts +50 -0
  260. package/dist/services/agent-mon/providers/claude/index.d.ts +5 -0
  261. package/dist/services/agent-mon/providers/claude/ps.d.ts +36 -0
  262. package/dist/services/agent-mon/providers/claude/session-json.d.ts +37 -0
  263. package/dist/services/agent-mon/providers/opencode/db.d.ts +41 -0
  264. package/dist/services/agent-mon/providers/opencode/index.d.ts +3 -0
  265. package/dist/services/agent-mon/providers/opencode/model-parser.d.ts +6 -0
  266. package/dist/services/agent-mon/providers/opencode/opencode-provider.d.ts +45 -0
  267. package/dist/services/ai-client/providers/ai-model.type.d.ts +14 -0
  268. package/dist/services/ai-client/providers/open-router/open-router-model.type.d.ts +1 -4
  269. package/dist/services/ai-client/providers/open-router/open-router-provider.d.ts +17 -0
  270. package/dist/services/ai-client/providers/openai-like-provider.d.ts +1 -0
  271. package/dist/services/data-ore/telegram/telegram-data-ore.d.ts +17 -0
  272. package/dist/services/data-ore/telegram/telegram-data-ore.types.d.ts +4 -0
  273. package/dist/services/data-ore/telegram/telegram-demo-music-helper.d.ts +1 -0
  274. package/dist/services/data-ore/telegram/telegram-demo.d.ts +1 -0
  275. package/dist/services/dbc/linter/dbc-ast-adapter.types.d.ts +82 -0
  276. package/dist/services/dbc/linter/dbc-linter.types.d.ts +95 -0
  277. package/dist/services/dbc/linter/implementations/ts/dbc-ts-ast-adapter.d.ts +184 -0
  278. package/dist/services/dbc/linter/implementations/ts/dbc-ts-linter.d.ts +152 -0
  279. package/dist/services/dbc/parser/dbc-parser.types.d.ts +16 -16
  280. package/dist/services/dbc/parser/implementations/jsdoc/dbc-jsdoc-parser.d.ts +14 -4
  281. package/dist/services/logger/logger.d.ts +26 -6
  282. package/dist/services/remote-console/client/remote-console-client-serializer.d.ts +7 -0
  283. package/dist/services/remote-console/client/remote-console-client.d.ts +20 -0
  284. package/dist/services/remote-console/client/remote-console-client.types.d.ts +88 -0
  285. package/dist/services/remote-console/remote-console.d.ts +6 -0
  286. package/dist/services/remote-console/server/remote-console-server.d.ts +10 -0
  287. package/dist/services/remote-console/server/remote-console-server.types.d.ts +44 -0
  288. package/dist/services/remote-console/server/remote-console-stdout-writer.d.ts +26 -0
  289. package/dist/services/vcs-client/abstract/vcs-client-merge-discussions.d.ts +22 -14
  290. package/dist/services/vcs-client/abstract/vcs-client-merge-requests.d.ts +31 -14
  291. package/dist/services/vcs-client/abstract/vcs-client-repository-files.d.ts +16 -0
  292. package/dist/services/vcs-client/abstract/vcs-client.d.ts +9 -5
  293. package/dist/services/vcs-client/entities/vcs-file-content.type.d.ts +24 -0
  294. package/dist/services/vcs-client/entities/vcs-merge-request-changes.type.d.ts +32 -0
  295. package/dist/services/vcs-client/entities/vcs-url.type.d.ts +14 -0
  296. package/dist/services/vcs-client/entities/vcs-user.type.d.ts +3 -0
  297. package/dist/services/vcs-client/github/vcs-github-client.d.ts +31 -0
  298. package/dist/services/vcs-client/github/vcs-github-merge-requests.d.ts +40 -0
  299. package/dist/services/vcs-client/github/vcs-github-repository-files.d.ts +27 -0
  300. package/dist/services/vcs-client/gitlab/vcs-gitlab-client.d.ts +13 -4
  301. package/dist/services/vcs-client/gitlab/vcs-gitlab-merge-discussions.d.ts +16 -5
  302. package/dist/services/vcs-client/gitlab/vcs-gitlab-merge-requests.d.ts +24 -5
  303. package/dist/services/vcs-client/gitlab/vcs-gitlab-repository-files.d.ts +27 -0
  304. package/dist/services/vcs-client/parse-vcs-url.d.ts +3 -0
  305. package/dist/shared/backend/git/git-core.d.ts +24 -22
  306. package/dist/shared/backend/git/git-diff.d.ts +16 -5
  307. package/dist/shared/backend/rc/rc-config.d.ts +27 -15
  308. package/dist/shared/common/exec.d.ts +4 -6
  309. package/dist/shared/common/files.d.ts +1 -3
  310. package/dist/shared/common/language.d.ts +3 -6
  311. package/dist/shared/common/parse-args.d.ts +1 -4
  312. package/dist/shared/common/style.d.ts +3 -3
  313. package/dist/shared/common/think.d.ts +1 -5
  314. package/dist/shared/common/tokens.d.ts +1 -5
  315. package/dist/shared/common/unguard.d.ts +4 -8
  316. package/dist/shared/common/xml.d.ts +16 -12
  317. package/package.json +20 -4
  318. package/dist/.ai/agents/agent-resolve-conflicts.xml +0 -148
  319. package/dist/.ai/agents/agent-review-verifier.xml +0 -181
  320. package/dist/chunks/index-C4jt5WBP.js +0 -3548
  321. package/dist/chunks/services-Sb7TwLxt.js +0 -122
  322. package/dist/chunks/shared-D0kSJB49.js +0 -601
@@ -1,14 +1,14 @@
1
1
  /**
2
- * @purpose Централизованный доступ к шаблонам промптов (agent, commit, review) из .md-файлов.
2
+ * @purpose Centralized access to prompt templates (agent, commit, review) from .md files.
3
+ * @invariant File names: agent/<name> → agent-{name}-prompt.md, commit → commit-{name}-prompt.md, review → review-{name}-prompt.md.
4
+ * @sideEffect Filesystem: file read on each call.
3
5
  * @consumer CommitGen, ReviewGen, cmd/agent
4
- * @invariant Имена файлов: agent/<name> → agent-{name}-prompt.md, commit → commit-{name}-prompt.md, review → review-{name}-prompt.md.
5
- * @sideEffect Filesystem: чтение файла при каждом вызове.
6
6
  */
7
7
  export declare const prompts: {
8
- /** @purpose Загрузить промпт для agent по имени (например 'keywords'). */
8
+ /** @purpose Load agent prompt by name (e.g. 'keywords'). */
9
9
  agent: (name: string) => string;
10
- /** @purpose Загрузить промпт для commit по имени ('message' | 'changeset'). */
10
+ /** @purpose Load commit prompt by name ('message' | 'changeset'). */
11
11
  commit: (name: string) => string;
12
- /** @purpose Загрузить промпт для review по имени (например 'base'). */
12
+ /** @purpose Load review prompt by name (e.g. 'base'). */
13
13
  review: (name: string) => string;
14
14
  };
@@ -19,32 +19,56 @@ type SpecMethods = {
19
19
  };
20
20
  type SpecShape = Record<string, SpecGlobal & SpecMethods>;
21
21
  /**
22
- * @purpose Генерировать ревью кода (критические замечания) через LLM с учётом языковых спеков.
22
+ * @purpose Generate code review (critical remarks) via LLM considering language specs.
23
+ * @invariant Uses AiLegacyCore and specs from specs/{lang}; returns empty string on error.
23
24
  * @consumer CLI (cmd/review)
24
- * @invariant Использует AiLegacyCore и specs из specs/{lang}; при ошибке возвращает пустую строку.
25
25
  */
26
26
  export declare class ReviewGen {
27
+ /** @purpose Cached language specs loaded from specs directory on first access. */
27
28
  protected _langSpecs: Record<string, SpecShape>;
29
+ /** @purpose Configuration with base prompt template and timeout. */
28
30
  protected init: ReviewGenInit & {
29
31
  basePromptTemplate: string;
30
32
  timeout: number;
31
33
  logger?: typeof import('../../../shared/common/logger.ts').logger;
32
34
  };
35
+ /**
36
+ * @purpose Initialize ReviewGen with configuration and AI core.
37
+ * @param [init] Configuration overrides (timeout, logger).
38
+ */
33
39
  constructor(init?: ReviewGenInit);
40
+ /** @purpose Instance of AiLegacyCore for calling LLM. */
34
41
  protected _ai: AiLegacyCore;
35
- /** @purpose Экземпляр AiLegacyCore для вызова LLM. */
42
+ /**
43
+ * @purpose Instance of AiLegacyCore for calling LLM.
44
+ * @returns AiLegacyCore instance.
45
+ */
36
46
  get ai(): AiLegacyCore;
37
- /** @purpose Логгер (если передан при инициализации). */
47
+ /**
48
+ * @purpose Logger (if passed during initialization).
49
+ * @returns Logger instance or undefined.
50
+ */
38
51
  get logger(): typeof import('../../../shared/common/logger.ts').logger | undefined;
39
52
  /**
40
- * @purpose Сгенерировать текст ревью по коду и списку языков.
41
- * @param code Исходный код для анализа.
42
- * @param [langs] Языки (по умолчанию выводятся из расширения в code).
43
- * @returns Текст ревью от LLM.
44
- * @sideEffect Network: запрос к AI; Filesystem: чтение specs при первом обращении.
53
+ * @purpose Generate review text from code and list of languages.
54
+ * @param code Source code for analysis.
55
+ * @param [langs] Languages (default derived from extension in code).
56
+ * @returns Review text from LLM.
57
+ * @sideEffect Network: request to AI; Filesystem: reading specs on first access.
45
58
  */
46
59
  generate(code: string, langs?: string[]): Promise<string>;
60
+ /**
61
+ * @purpose Build extra rules prompt from language specs matching the code under review.
62
+ * @param langs List of programming language names.
63
+ * @param code Source code to scan for known constructs.
64
+ * @returns Extra rules prompt string (empty if no matches found).
65
+ */
47
66
  protected _getExtraRulesPrompt(langs: string[], code: string): string;
67
+ /**
68
+ * @purpose Load and cache language specs from JSON files in the specs directory.
69
+ * @param langs List of programming language names.
70
+ * @returns Merged spec shape for all requested languages.
71
+ */
48
72
  protected _loadSpec(langs: string[]): SpecShape;
49
73
  }
50
74
  export {};
package/dist/gennady.js CHANGED
@@ -1,28 +1,48 @@
1
1
  #!/usr/bin/env node
2
- const e = /* @__PURE__ */ new Set(["help", "--help", "-h"]), a = process.argv[2];
3
- (!a || e.has(a)) && (await import("./chunks/help.cmd-CWasx25o.js"), process.exit(0));
2
+ import { c as e } from "./chunks/shared-COpFaV-w.js";
3
+ import "node:fs";
4
+ import "node:path";
5
+ import "node:url";
6
+ const i = "0.7.1", t = /* @__PURE__ */ new Set(["help", "--help", "-h"]), a = process.argv[2];
7
+ (!a || t.has(a)) && (await import("./chunks/help.cmd-B_G7EWzF.js"), process.exit(0));
8
+ e({ name: "gennady", version: i });
4
9
  switch (a) {
5
10
  case "cat":
6
- await import("./chunks/index-C4jt5WBP.js");
11
+ await import("./chunks/index-DeYzAoxF.js");
7
12
  break;
8
13
  case "review":
9
- await import("./chunks/index-Bh0p7rJg.js");
14
+ await import("./chunks/index-BCqnKvNZ.js");
10
15
  break;
11
16
  case "vcs-reply":
12
- await import("./chunks/index-Bx_P7mlL.js");
17
+ await import("./chunks/index-BzBhCTHq.js");
13
18
  break;
14
19
  case "review-verify":
15
- await import("./chunks/index-B3r-YFvt.js");
20
+ await import("./chunks/index-CAWs-GED.js");
16
21
  break;
17
22
  case "review-issues":
18
- await import("./chunks/index-Gy1n7hRU.js");
23
+ await import("./chunks/index-BLsDffzZ.js");
19
24
  break;
20
25
  case "resolve-conflicts":
21
- await import("./chunks/index-DgAmONSz.js");
26
+ await import("./chunks/index-BsD-J44e.js");
22
27
  break;
23
28
  case "commit":
24
- await import("./chunks/index-D1Hurfwu.js");
29
+ await import("./chunks/index-BrSutH7l.js");
30
+ break;
31
+ case "remote-console":
32
+ await import("./chunks/index-O5kqC9i_.js");
33
+ break;
34
+ case "lint":
35
+ await import("./chunks/index-TX0TmKeu.js");
36
+ break;
37
+ case "alt-opinion":
38
+ await import("./chunks/index-CFd_iufb.js");
39
+ break;
40
+ case "agent-mon":
41
+ await import("./chunks/index-Bq4d25CK.js");
42
+ break;
43
+ case "sync":
44
+ await import("./chunks/index-Db09OODV.js");
25
45
  break;
26
46
  default:
27
- await import("./chunks/help.cmd-CWasx25o.js"), process.exit(0);
47
+ await import("./chunks/help.cmd-B_G7EWzF.js"), process.exit(0);
28
48
  }
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from './shared/backend/rc/rc-config.js';
3
3
  export * from './shared/common/unguard.js';
4
4
  export * from './shared/backend/git/git-diff.js';
5
5
  export * from './shared/common/language.js';
6
+ export * from './services/remote-console/remote-console.js';
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
- import { u, r as m } from "./chunks/shared-D0kSJB49.js";
2
- import { G as y, h as d, i as A, j as f, k as w } from "./chunks/shared-D0kSJB49.js";
1
+ import { u, r as m } from "./chunks/shared-COpFaV-w.js";
2
+ import { G as y, i as d, j as A, k as f, m as R } from "./chunks/shared-COpFaV-w.js";
3
+ import { R as C, f as O, r as T, g as L, c as $ } from "./chunks/services-Dnk3nB2x.js";
3
4
  class h {
4
5
  /**
5
- * @purpose Создать экземпляр с дефолтными настройками (Ollama local).
6
- * @returns Экземпляр с model=llama3.1:8b, url=localhost:11434.
6
+ * @purpose Create an instance with default settings (Ollama local).
7
+ * @returns Instance with model=llama3.1:8b, url=localhost:11434.
7
8
  */
8
9
  static getDefault() {
9
10
  return new h({
@@ -11,8 +12,14 @@ class h {
11
12
  url: "http://127.0.0.1:11434/api/generate"
12
13
  });
13
14
  }
15
+ /** @purpose Model initialization config with name, URL, and key. */
14
16
  _init;
17
+ /** @purpose Cached ping promise to avoid duplicate pings. */
15
18
  _pingPromise = null;
19
+ /**
20
+ * @purpose Create an AI model instance with the given configuration.
21
+ * @param init Partial initialization config (model, url, key, extra).
22
+ */
16
23
  constructor(n) {
17
24
  this._init = {
18
25
  model: n.model ?? "llama3.1:8b",
@@ -20,23 +27,32 @@ class h {
20
27
  ...n
21
28
  };
22
29
  }
23
- /** @purpose Имя модели (для логов и заголовков). */
30
+ /**
31
+ * @purpose Model name (for logs and headers).
32
+ * @returns Model name string.
33
+ */
24
34
  get name() {
25
35
  return this._init.model;
26
36
  }
27
- /** @purpose URL эндпоинта API. */
37
+ /**
38
+ * @purpose API endpoint URL.
39
+ * @returns API URL string.
40
+ */
28
41
  get url() {
29
42
  return this._init.url;
30
43
  }
31
- /** @purpose API-ключ (если требуется авторизация). */
44
+ /**
45
+ * @purpose API key (if authorization is required).
46
+ * @returns API key string or undefined.
47
+ */
32
48
  get key() {
33
49
  return this._init.key;
34
50
  }
35
51
  /**
36
- * @purpose Проверить доступность модели коротким запросом.
37
- * @param [timeout] Таймаут в мс (по умолчанию 10e3).
38
- * @returns Кортеж [true, null] при успехе, [null, Error] при сбое.
39
- * @sideEffect Network: один запрос к API; Logs: debug/error.
52
+ * @purpose Check model availability with a short request.
53
+ * @param [timeout] Timeout in ms (default 10e3).
54
+ * @returns Tuple [true, null] on success, [null, Error] on failure.
55
+ * @sideEffect Network: single request to API; Logs: debug/error.
40
56
  */
41
57
  async ping(n = 1e4) {
42
58
  return this._pingPromise ??= (async () => {
@@ -56,11 +72,11 @@ class h {
56
72
  })(), this._pingPromise;
57
73
  }
58
74
  /**
59
- * @purpose Отправить промпт в LLM и получить ответ (с подстановкой __KEY__ и удалением think-блоков).
60
- * @param prompt Текст запроса пользователя.
61
- * @param [init] system, temperature, timeout, replacements для подстановки в промпт/system.
62
- * @returns Кортеж [текст ответа, null] при успехе, [null, Error] при ошибке сети/парсинга.
63
- * @sideEffect Network: POST к this.url.
75
+ * @purpose Send a prompt to the LLM and get a response (with __KEY__ substitution and think-block removal).
76
+ * @param prompt User prompt text.
77
+ * @param [init] system, temperature, timeout, replacements for substitution in prompt/system.
78
+ * @returns Tuple [response text, null] on success, [null, Error] on network/parsing error.
79
+ * @sideEffect Network: POST to this.url.
64
80
  */
65
81
  async generate(n, r = {}) {
66
82
  try {
@@ -99,11 +115,11 @@ class h {
99
115
  }
100
116
  }
101
117
  /**
102
- * @purpose Выполнить POST-запрос к API и вернуть JSON или ошибку.
103
- * @param params Тело запроса (Ollama- или OpenAI-формат).
104
- * @param [timeout] Таймаут в мс.
105
- * @returns Кортеж [parsed JSON, null] или [null, Error].
106
- * @sideEffect Network: fetch с AbortController.
118
+ * @purpose Execute a POST request to the API and return JSON or an error.
119
+ * @param params Request body (Ollama or OpenAI format).
120
+ * @param [timeout] Timeout in ms.
121
+ * @returns Tuple [parsed JSON, null] or [null, Error].
122
+ * @sideEffect Network: fetch with AbortController.
107
123
  */
108
124
  async _fetchAsJson(n, r = 12e4) {
109
125
  const e = new AbortController(), o = setTimeout(
@@ -155,9 +171,14 @@ class h {
155
171
  export {
156
172
  h as AiLegacyModel,
157
173
  y as GennadyRc,
174
+ C as RemoteConsoleStdoutWriter,
175
+ O as connectRemoteConsoleClient,
158
176
  d as getProgrammingLanguage,
159
177
  A as getSysLang,
160
178
  f as parseGitDiff,
161
- w as unguard,
179
+ T as remoteConsoleClient,
180
+ L as serializeRemoteConsoleArg,
181
+ $ as startRemoteConsoleServer,
182
+ R as unguard,
162
183
  u as unguardOrThrow
163
184
  };
@@ -0,0 +1,9 @@
1
+ import type { AgentSession } from '../model/agent-session.type.js';
2
+ import type { SessionChanges } from '../model/session-changes.type.js';
3
+ /**
4
+ * @purpose Compare two AgentSession snapshots and produce added, removed, updated change categories.
5
+ * @param prev Previous snapshot of sessions — may be empty.
6
+ * @param curr Current snapshot of sessions — may be empty.
7
+ * @returns SessionChanges with sessions partitioned by change type (all arrays may be empty).
8
+ */
9
+ export declare function diff(prev: AgentSession[], curr: AgentSession[]): SessionChanges;
@@ -0,0 +1 @@
1
+ export { diff } from './diff.js';
@@ -0,0 +1,10 @@
1
+ export { createMonitor } from './monitor/index.js';
2
+ export { diff } from './diff/index.js';
3
+ export { observe } from './observe/index.js';
4
+ export type { AgentSession } from './model/index.js';
5
+ export type { SessionChanges } from './model/index.js';
6
+ export type { ScanOpts } from './model/index.js';
7
+ export type { ObserveOpts } from './model/index.js';
8
+ export type { AgentProvider } from './model/index.js';
9
+ export { DuplicateProviderError } from './model/index.js';
10
+ export { ProviderNotFoundError } from './model/index.js';
@@ -0,0 +1,20 @@
1
+ import type { AgentSession } from './agent-session.type.js';
2
+ import type { ScanOpts } from './scan-opts.type.js';
3
+ /**
4
+ * @purpose Contract for agent session providers — single extension point for new agent systems.
5
+ * @invariant Scan is stateless: calling scan() does not change provider state.
6
+ * @invariant Error policy: scan failures return empty array ([]), never propagate to scanAll() — graceful degradation.
7
+ * @invariant Read-only: scan() must not write to the source data.
8
+ */
9
+ export interface AgentProvider {
10
+ /** @purpose Unique provider key for registration | @invariant Non-empty string, unique per AgentMonitor */
11
+ readonly key: string;
12
+ /**
13
+ * @purpose Scan the provider's source and return normalized agent sessions.
14
+ * @param [opts] Optional scan filtering parameters.
15
+ * @throws Never — failures return [] per graceful degradation contract.
16
+ * @returns Normalized agent sessions (may be empty).
17
+ * @sideEffect Read access to provider's data source (filesystem, database).
18
+ */
19
+ scan(opts?: ScanOpts): Promise<AgentSession[]>;
20
+ }
@@ -0,0 +1,49 @@
1
+ /** @purpose Normalized representation of an agent session across all providers. */
2
+ export type AgentSession = {
3
+ /** @purpose Provider key this session belongs to | @invariant Non-empty string, unique per AgentMonitor */
4
+ provider: string;
5
+ /** @purpose Process ID | @invariant null for providers without OS process (OpenCode) */
6
+ pid: number | null;
7
+ /** @purpose Unique session identifier */
8
+ sessionId: string;
9
+ /** @purpose Parent session ID for subagent chains | @invariant V1 optional, tree deferred to V2 */
10
+ parentId?: string;
11
+ /** @purpose Display title of the session */
12
+ title: string;
13
+ /** @purpose Human-readable slug identifier | @invariant OpenCode-specific, absent in Claude */
14
+ slug?: string;
15
+ /** @purpose Working directory of the session */
16
+ cwd: string;
17
+ /** @purpose Project name derived from cwd | @invariant basename of working directory */
18
+ project: string;
19
+ /** @purpose AI model used in the session */
20
+ model?: string;
21
+ /** @purpose Agent kind identifier */
22
+ agent?: string;
23
+ /** @purpose Current lifecycle state | @invariant 'active' — process alive, 'idle' — no activity > threshold, 'completed' — process dead or archived */
24
+ status: 'active' | 'idle' | 'completed';
25
+ /** @purpose Session start timestamp | @invariant Epoch milliseconds */
26
+ startedAt: number;
27
+ /** @purpose Session completion timestamp | @invariant Epoch milliseconds */
28
+ completedAt?: number;
29
+ /** @purpose Last activity timestamp | @invariant Epoch milliseconds */
30
+ lastActivityAt?: number;
31
+ /** @purpose Total elapsed time | @invariant Seconds */
32
+ elapsedSeconds: number;
33
+ /** @purpose Idle time since last activity | @invariant Seconds, computed from lastActivityAt */
34
+ idleSeconds?: number;
35
+ /** @purpose CPU usage percentage | @invariant Claude-only, absent for OpenCode */
36
+ cpuPercent?: number;
37
+ /** @purpose Memory usage in megabytes | @invariant Claude-only, absent for OpenCode */
38
+ memoryMb?: number;
39
+ /** @purpose Total tool call count */
40
+ toolCallCount?: number;
41
+ /** @purpose Total error count */
42
+ errorCount?: number;
43
+ /** @purpose Last message content, truncated | @invariant Truncated for display, not full text */
44
+ lastMessage?: string;
45
+ /** @purpose Input token count | @invariant OpenCode-specific */
46
+ tokensInput?: number;
47
+ /** @purpose Output token count | @invariant OpenCode-specific */
48
+ tokensOutput?: number;
49
+ };
@@ -0,0 +1,20 @@
1
+ /** @purpose Raised when attempting to register a provider with a key already in use. */
2
+ export declare class DuplicateProviderError extends Error {
3
+ /** @purpose The conflicting provider key */
4
+ readonly key: string;
5
+ /**
6
+ * @purpose Construct with the duplicate key and a trace-prefixed message.
7
+ * @param key The provider key that is already registered.
8
+ */
9
+ constructor(key: string);
10
+ }
11
+ /** @purpose Raised when attempting to access a provider that is not registered. */
12
+ export declare class ProviderNotFoundError extends Error {
13
+ /** @purpose The missing provider key */
14
+ readonly key: string;
15
+ /**
16
+ * @purpose Construct with the missing key and a trace-prefixed message.
17
+ * @param key The provider key that was not found.
18
+ */
19
+ constructor(key: string);
20
+ }
@@ -0,0 +1,7 @@
1
+ export type { AgentSession } from './agent-session.type.js';
2
+ export type { SessionChanges } from './session-changes.type.js';
3
+ export type { ScanOpts } from './scan-opts.type.js';
4
+ export type { ObserveOpts } from './observe-opts.type.js';
5
+ export type { AgentProvider } from './agent-provider.type.js';
6
+ export { DuplicateProviderError } from './errors.js';
7
+ export { ProviderNotFoundError } from './errors.js';
@@ -0,0 +1,7 @@
1
+ /** @purpose Configuration for the observe polling cycle. */
2
+ export type ObserveOpts = {
3
+ /** @purpose Polling interval in milliseconds */
4
+ interval: number;
5
+ /** @purpose Idle detection threshold in milliseconds | @invariant Default 300000 when absent */
6
+ idleThresholdMs?: number;
7
+ };
@@ -0,0 +1,7 @@
1
+ /** @purpose Filtering options for session scanning. */
2
+ export type ScanOpts = {
3
+ /** @purpose Return sessions started after this timestamp or today's date | @invariant Epoch ms or the string 'today' */
4
+ since?: number | 'today';
5
+ /** @purpose Idle detection threshold in milliseconds | @invariant Default 300000 (5 min) when absent */
6
+ idleThresholdMs?: number;
7
+ };
@@ -0,0 +1,10 @@
1
+ import type { AgentSession } from './agent-session.type.js';
2
+ /** @purpose Result of comparing two session snapshots — what appeared, disappeared, or changed. */
3
+ export type SessionChanges = {
4
+ /** @purpose Sessions present in current but absent in previous */
5
+ added: AgentSession[];
6
+ /** @purpose Sessions present in previous but absent in current */
7
+ removed: AgentSession[];
8
+ /** @purpose Sessions present in both but with semantic fields changed */
9
+ updated: AgentSession[];
10
+ };
@@ -0,0 +1,44 @@
1
+ import type { AgentProvider } from '../model/agent-provider.type.js';
2
+ import type { AgentSession } from '../model/agent-session.type.js';
3
+ import type { ScanOpts } from '../model/scan-opts.type.js';
4
+ /**
5
+ * @purpose Provider registry and scan coordination — owns the provider map, orchestrates scanning across all registered providers.
6
+ * @invariant Undamaged-by-one: provider failure in scanAll does not interrupt remaining providers (graceful degradation per N3).
7
+ * @invariant Stateless scans: no caching between calls; each scanAll / scanOne is a fresh invocation.
8
+ */
9
+ /** @implements {AgentMonitor} in specs/agent-mon/monitor/monitor.spec.md#agentmonitor */
10
+ export declare class AgentMonitor {
11
+ /** @purpose Provider registry — maps string keys to AgentProvider instances | @invariant Empty on construction; mutated only via register/unregister */
12
+ protected readonly _providers: Map<string, AgentProvider>;
13
+ /**
14
+ * @purpose Register a provider under a unique key; rejects on duplicate.
15
+ * @param key Unique provider identifier — non-empty string.
16
+ * @param provider The provider instance implementing AgentProvider.
17
+ * @throws {DuplicateProviderError} When key is already registered.
18
+ * @post Provider is stored in the registry under the given key.
19
+ */
20
+ register(key: string, provider: AgentProvider): void;
21
+ /**
22
+ * @purpose Remove a provider from the registry; no-op when the key is not found.
23
+ * @param key Provider key to remove.
24
+ * @post Provider with the given key is no longer in the registry.
25
+ */
26
+ unregister(key: string): void;
27
+ /**
28
+ * @purpose Scan all registered providers concurrently, aggregate and sort results by startedAt descending.
29
+ * @invariant Graceful degradation: a failing provider returns [] and does not abort other providers.
30
+ * @param [opts] Optional scan filtering (since timestamp or 'today').
31
+ * @returns All sessions from all providers, sorted by startedAt descending.
32
+ * @sideEffect Calls each registered provider's scan() — may read filesystem / database.
33
+ */
34
+ scanAll(opts?: ScanOpts): Promise<AgentSession[]>;
35
+ /**
36
+ * @purpose Scan a single provider by key; rejects when the provider is not registered.
37
+ * @param key Registered provider key.
38
+ * @param [opts] Optional scan filtering.
39
+ * @throws {ProviderNotFoundError} When the key is not registered.
40
+ * @returns Sessions from the specified provider.
41
+ * @sideEffect Calls the provider's scan() — may read filesystem / database.
42
+ */
43
+ scanOne(key: string, opts?: ScanOpts): Promise<AgentSession[]>;
44
+ }
@@ -0,0 +1,6 @@
1
+ import { AgentMonitor } from './agent-monitor.js';
2
+ /**
3
+ * @purpose Create a fresh AgentMonitor instance with an empty provider registry.
4
+ * @returns A new AgentMonitor ready for provider registration.
5
+ */
6
+ export declare function createMonitor(): AgentMonitor;
@@ -0,0 +1,2 @@
1
+ export { AgentMonitor } from './agent-monitor.js';
2
+ export { createMonitor } from './create-monitor.js';
@@ -0,0 +1 @@
1
+ export { observe } from './observe.js';
@@ -0,0 +1,12 @@
1
+ import type { AgentMonitor } from '../monitor/agent-monitor.js';
2
+ import type { ObserveOpts } from '../model/observe-opts.type.js';
3
+ import type { SessionChanges } from '../model/session-changes.type.js';
4
+ /**
5
+ * @purpose Continuous async iterable yielding session changes at a configurable interval.
6
+ * @param monitor AgentMonitor instance with registered providers — used for scanAll() each cycle.
7
+ * @param opts Observation options: interval (≥100ms), idleThresholdMs (default 300000).
8
+ * @throws {RangeError} When opts.interval &lt; 100 — contract violation per DbC.
9
+ * @returns AsyncIterable yielding SessionChanges after each poll cycle; first iteration establishes baseline and does NOT yield.
10
+ * @sideEffect Polling: calls monitor.scanAll() per cycle; uses setTimeout for non-blocking delay.
11
+ */
12
+ export declare function observe(monitor: AgentMonitor, opts: ObserveOpts): AsyncIterable<SessionChanges>;
@@ -0,0 +1,50 @@
1
+ import { logger } from '#logger';
2
+ import type { AgentSession } from '../../model/agent-session.type.js';
3
+ import type { ScanOpts } from '../../model/scan-opts.type.js';
4
+ import type { AgentProvider } from '../../model/agent-provider.type.js';
5
+ import { psInfo as defaultPsInfo, parseClaudeArgs as defaultParseClaudeArgs } from './ps.js';
6
+ import { readSessionJson as defaultReadSessionJson, readSessionTitle as defaultReadSessionTitle } from './session-json.js';
7
+ /** @purpose DI-injectable dependencies for ClaudeProvider — enables test mocking without global monkey-patching. */
8
+ type ClaudeProviderDeps = {
9
+ /** @purpose Batch ps inspection function */
10
+ psInfo?: typeof defaultPsInfo;
11
+ /** @purpose Claude CLI argument parser */
12
+ parseClaudeArgs?: typeof defaultParseClaudeArgs;
13
+ /** @purpose Session JSON file reader */
14
+ readSessionJson?: typeof defaultReadSessionJson;
15
+ /** @purpose Session title extractor from JSONL */
16
+ readSessionTitle?: typeof defaultReadSessionTitle;
17
+ };
18
+ /**
19
+ * @purpose Adapter scanning Claude Code sessions from ~/.claude/sessions/.
20
+ * @implements {AgentProvider} in ../../model/agent-provider.type.ts
21
+ * @invariant Stateless — every scan() call is independent.
22
+ * @invariant Graceful degradation: missing sessions dir or ps failure returns [], never throws.
23
+ * @invariant Batch ps: one spawn per scan (not per PID).
24
+ */
25
+ export declare class ClaudeProvider implements AgentProvider {
26
+ /** @see {AgentProvider#key} in ../../model/agent-provider.type.ts */
27
+ readonly key: 'claude';
28
+ /** @purpose Batch ps inspection function */
29
+ protected _psInfo: typeof defaultPsInfo;
30
+ /** @purpose Claude CLI argument parser */
31
+ protected _parseClaudeArgs: typeof defaultParseClaudeArgs;
32
+ /** @purpose Session JSON file reader */
33
+ protected _readSessionJson: typeof defaultReadSessionJson;
34
+ /** @purpose Session title extractor from JSONL */
35
+ protected _readSessionTitle: typeof defaultReadSessionTitle;
36
+ /** @purpose Logger instance */
37
+ protected _logger: typeof logger;
38
+ /**
39
+ * @purpose Construct with optional DI overrides for testing.
40
+ * @param [deps] Injectable function replacements; omitted deps use real implementations.
41
+ */
42
+ constructor(deps?: ClaudeProviderDeps);
43
+ /**
44
+ * @param [opts] Optional scan filtering parameters.
45
+ * @returns Parsed agent sessions array.
46
+ * @see {AgentProvider#scan} in ../../model/agent-provider.type.ts
47
+ */
48
+ scan(opts?: ScanOpts): Promise<AgentSession[]>;
49
+ }
50
+ export {};
@@ -0,0 +1,5 @@
1
+ export { ClaudeProvider } from './claude-provider.js';
2
+ export { psInfo, parseClaudeArgs } from './ps.js';
3
+ export type { PsInfoEntry } from './ps.js';
4
+ export { readSessionJson, readSessionTitle } from './session-json.js';
5
+ export type { SessionJsonData } from './session-json.js';
@@ -0,0 +1,36 @@
1
+ /** @purpose Result of a batch ps query for a single alive process. */
2
+ export type PsInfoEntry = {
3
+ /** @purpose Process ID */
4
+ pid: number;
5
+ /** @purpose CPU usage percentage */
6
+ cpuPercent: number;
7
+ /** @purpose Memory usage in megabytes | @invariant Converted from RSS KB: rss / 1024 */
8
+ memoryMb: number;
9
+ /** @purpose Full command-line arguments of the process */
10
+ args: string;
11
+ };
12
+ /**
13
+ * @purpose Batch process inspection: one ps spawn for all PIDs — returns alive processes only.
14
+ * @invariant Single `ps -p` call regardless of PID count; dead PIDs are absent from the result Map.
15
+ * @invariant On ps command failure: warn-log and return empty Map — graceful degradation.
16
+ * @param pids Array of process IDs to inspect.
17
+ * @returns Map of pid → PsInfoEntry for alive processes; empty Map if no PIDs or ps fails.
18
+ * @sideEffect Process: spawns `ps` via execSync.
19
+ */
20
+ export declare function psInfo(pids: number[]): Map<number, PsInfoEntry>;
21
+ /**
22
+ * @purpose Extract --model and --effort values from Claude process command-line arguments.
23
+ * @param args Full command-line arguments string from ps.
24
+ * @returns Parsed model and effort strings (undefined when absent).
25
+ */
26
+ export declare function parseClaudeArgs(args: string): {
27
+ model?: string;
28
+ effort?: string;
29
+ };
30
+ /**
31
+ * @purpose Extract a context hint from Claude process args — uses Read/Edit allowed paths.
32
+ * @invariant Returns the most specific path segment from allowedTools, or undefined.
33
+ * @param args Full ps command-line string.
34
+ * @returns Short context description, e.g. "sdd/directives" or undefined.
35
+ */
36
+ export declare function parseContextHint(args: string): string | undefined;
@@ -0,0 +1,37 @@
1
+ /** @purpose Parsed data from a Claude session JSON file (sessions/PID.json). */
2
+ export type SessionJsonData = {
3
+ /** @purpose Process ID of the Claude session */
4
+ pid: number;
5
+ /** @purpose Unique session identifier */
6
+ sessionId: string;
7
+ /** @purpose Working directory of the session */
8
+ cwd: string;
9
+ /** @purpose Session start timestamp | @invariant Epoch milliseconds */
10
+ startedAt: number;
11
+ };
12
+ /**
13
+ * @purpose Read and parse a Claude session JSON file from ~/.claude/sessions/PID.json.
14
+ * @invariant Validates presence of required fields (pid, sessionId, cwd, startedAt); returns null on missing fields.
15
+ * @invariant On parse failure: error-log and return null — does not throw.
16
+ * @param filePath Absolute path to the session JSON file.
17
+ * @returns Parsed session data or null when file is invalid or unreadable.
18
+ * @sideEffect Filesystem: readFileSync on the session JSON file.
19
+ */
20
+ export declare function readSessionJson(filePath: string): SessionJsonData | null;
21
+ /**
22
+ * @purpose Extract session title from Claude JSONL project file.
23
+ * @invariant cwd path encoding: '/' replaced with '-', leading '-' stripped — matches Claude project directory naming.
24
+ * @invariant Priority: ai-title entry > first user message > 'Unknown' fallback.
25
+ * @param cwd Working directory of the session.
26
+ * @param sessionId Unique session identifier.
27
+ * @returns Session title string; 'Unknown' when JSONL is missing or unparseable.
28
+ * @sideEffect Filesystem: existsSync + readFileSync on ~/.claude/projects/.../<sessionId>.jsonl.
29
+ */
30
+ export declare function readSessionTitle(cwd: string, sessionId: string): string;
31
+ /**
32
+ * @purpose Read active task title from ~/.claude/tasks/<sessionId>/ as fallback when JSONL is missing.
33
+ * @invariant Returns the subject of the first in-progress task, or the first task overall.
34
+ * @param sessionId Unique session identifier.
35
+ * @returns Active task subject or 'Unknown' when no tasks directory exists.
36
+ */
37
+ export declare function readActiveTaskTitle(sessionId: string): string;