@nexus-cortex/server 4.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/.cortex/agents/AGENT_PROFILE_GUIDE.md +307 -0
  2. package/.cortex/agents/README.md +268 -0
  3. package/.cortex/agents/a-frontend-landing-page-designer.md +41 -0
  4. package/.cortex/agents/autoresearch-agent.md +49 -0
  5. package/.cortex/agents/code-reviewer.md +63 -0
  6. package/.cortex/agents/context-research.md +26 -0
  7. package/.cortex/agents/doc-writer.md +92 -0
  8. package/.cortex/agents/explore.md +63 -0
  9. package/.cortex/agents/new-model-api-integrator-analyst.md +41 -0
  10. package/.cortex/agents/plan.md +109 -0
  11. package/.cortex/agents/pr-architecture-reviewer.md +77 -0
  12. package/.cortex/agents/pr-code-quality.md +78 -0
  13. package/.cortex/agents/pr-implementer.md +50 -0
  14. package/.cortex/agents/pr-security-auditor.md +62 -0
  15. package/.cortex/agents/pr-test-writer.md +67 -0
  16. package/.cortex/agents/refactor.md +118 -0
  17. package/.cortex/agents/test-writer.md +72 -0
  18. package/.cortex/agents/web-researcher.md +72 -0
  19. package/.cortex/bench/tasks/sample-tasks.json +20 -0
  20. package/.cortex/commands/compare.md +14 -0
  21. package/.cortex/commands/deps.md +16 -0
  22. package/.cortex/commands/diff.md +14 -0
  23. package/.cortex/commands/explain.md +16 -0
  24. package/.cortex/commands/find-bug.md +13 -0
  25. package/.cortex/commands/profile.md +15 -0
  26. package/.cortex/commands/review.md +18 -0
  27. package/.cortex/commands/search.md +16 -0
  28. package/.cortex/commands/test.md +15 -0
  29. package/.cortex/permissions.dev.json +20 -0
  30. package/.cortex/permissions.example.json +71 -0
  31. package/.cortex/permissions.prod.json +63 -0
  32. package/.cortex/permissions.test.json +19 -0
  33. package/.cortex/skills/autoresearch/SKILL.md +77 -0
  34. package/.cortex/skills/autoresearch/personas/README.md +45 -0
  35. package/.cortex/skills/autoresearch/personas/aggressive-refactor.md +25 -0
  36. package/.cortex/skills/autoresearch/personas/creative.md +29 -0
  37. package/.cortex/skills/autoresearch/personas/perf-hunter.md +27 -0
  38. package/.cortex/skills/autoresearch/personas/precise.md +23 -0
  39. package/.cortex/skills/autoresearch/personas/root-cause.md +26 -0
  40. package/.cortex/skills/autoresearch/personas/security-auditor.md +29 -0
  41. package/.cortex/skills/autoresearch/personas/skeptic-reviewer.md +31 -0
  42. package/.cortex/skills/autoresearch/personas/test-first.md +25 -0
  43. package/.cortex/skills/best-of-n/SKILL.md +76 -0
  44. package/.cortex/skills/cortex/SKILL.md +834 -0
  45. package/.cortex/skills/cortex-bench/SKILL.md +354 -0
  46. package/.cortex/skills/docx/SKILL.md +83 -0
  47. package/.cortex/skills/pdf-documents/SKILL.md +297 -0
  48. package/.cortex/skills/pdf-documents/sections/01-image-acquisition.md +132 -0
  49. package/.cortex/skills/pdf-documents/sections/02-ai-image-generation.md +274 -0
  50. package/.cortex/skills/pdf-documents/sections/03-paper-sizes.md +89 -0
  51. package/.cortex/skills/pdf-documents/sections/04-design-system.md +549 -0
  52. package/.cortex/skills/pdf-documents/sections/05-css-print-rules.md +135 -0
  53. package/.cortex/skills/pdf-documents/sections/06-svg-charts.md +100 -0
  54. package/.cortex/skills/pdf-documents/sections/07-templates.md +224 -0
  55. package/.cortex/skills/pdf-documents/sections/08-scaled-output.md +164 -0
  56. package/.cortex/skills/pdf-documents/sections/09-preview-qa.md +66 -0
  57. package/.cortex/skills/pdf-documents/sections/10-reading-pdfs.md +499 -0
  58. package/.cortex/skills/pdf-documents/sections/11-form-filling.md +241 -0
  59. package/.cortex/skills/pptx/SKILL.md +90 -0
  60. package/.cortex/skills/resume-analyst/SKILL.md +373 -0
  61. package/.cortex/skills/verify-work/SKILL.md +74 -0
  62. package/.cortex/skills/xlsx/SKILL.md +101 -0
  63. package/.cortex/system-messages/messages/WORK_QUALITY.md +159 -0
  64. package/.cortex/system-messages/registry.json +18 -0
  65. package/LICENSE +202 -0
  66. package/NOTICE +2 -0
  67. package/README.md +13 -0
  68. package/bin/cortex-daemon.js +47 -0
  69. package/bin/cortex-server.js +15 -0
  70. package/dist/index.d.ts +30 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +513 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/middleware/cors.d.ts +10 -0
  75. package/dist/middleware/cors.d.ts.map +1 -0
  76. package/dist/middleware/cors.js +11 -0
  77. package/dist/middleware/cors.js.map +1 -0
  78. package/dist/middleware/errorHandler.d.ts +10 -0
  79. package/dist/middleware/errorHandler.d.ts.map +1 -0
  80. package/dist/middleware/errorHandler.js +15 -0
  81. package/dist/middleware/errorHandler.js.map +1 -0
  82. package/dist/routes/approval.d.ts +2 -0
  83. package/dist/routes/approval.d.ts.map +1 -0
  84. package/dist/routes/approval.js +96 -0
  85. package/dist/routes/approval.js.map +1 -0
  86. package/dist/routes/config.d.ts +2 -0
  87. package/dist/routes/config.d.ts.map +1 -0
  88. package/dist/routes/config.js +70 -0
  89. package/dist/routes/config.js.map +1 -0
  90. package/dist/routes/health.d.ts +2 -0
  91. package/dist/routes/health.d.ts.map +1 -0
  92. package/dist/routes/health.js +1031 -0
  93. package/dist/routes/health.js.map +1 -0
  94. package/dist/routes/mcp.d.ts +2 -0
  95. package/dist/routes/mcp.d.ts.map +1 -0
  96. package/dist/routes/mcp.js +251 -0
  97. package/dist/routes/mcp.js.map +1 -0
  98. package/dist/routes/messages.d.ts +5 -0
  99. package/dist/routes/messages.d.ts.map +1 -0
  100. package/dist/routes/messages.js +136 -0
  101. package/dist/routes/messages.js.map +1 -0
  102. package/dist/routes/middleware.d.ts +2 -0
  103. package/dist/routes/middleware.d.ts.map +1 -0
  104. package/dist/routes/middleware.js +146 -0
  105. package/dist/routes/middleware.js.map +1 -0
  106. package/dist/routes/models.d.ts +2 -0
  107. package/dist/routes/models.d.ts.map +1 -0
  108. package/dist/routes/models.js +29 -0
  109. package/dist/routes/models.js.map +1 -0
  110. package/dist/routes/permissions.d.ts +2 -0
  111. package/dist/routes/permissions.d.ts.map +1 -0
  112. package/dist/routes/permissions.js +253 -0
  113. package/dist/routes/permissions.js.map +1 -0
  114. package/dist/routes/pr.d.ts +2 -0
  115. package/dist/routes/pr.d.ts.map +1 -0
  116. package/dist/routes/pr.js +222 -0
  117. package/dist/routes/pr.js.map +1 -0
  118. package/dist/routes/sessions.d.ts +2 -0
  119. package/dist/routes/sessions.d.ts.map +1 -0
  120. package/dist/routes/sessions.js +628 -0
  121. package/dist/routes/sessions.js.map +1 -0
  122. package/dist/routes/system-messages.d.ts +2 -0
  123. package/dist/routes/system-messages.d.ts.map +1 -0
  124. package/dist/routes/system-messages.js +146 -0
  125. package/dist/routes/system-messages.js.map +1 -0
  126. package/dist/routes/tools.d.ts +2 -0
  127. package/dist/routes/tools.d.ts.map +1 -0
  128. package/dist/routes/tools.js +79 -0
  129. package/dist/routes/tools.js.map +1 -0
  130. package/package.json +63 -0
@@ -0,0 +1,253 @@
1
+ /**
2
+ * Permissions Routes
3
+ * Exposes permission management for tools
4
+ *
5
+ * Updated to use orchestrator public methods (following direct-wired pattern)
6
+ */
7
+ import { Router } from 'express';
8
+ import { getServerOrchestrator } from './messages.js';
9
+ import { WhitelistPolicy, BlacklistPolicy } from '@nexus-cortex/core';
10
+ export const permissionsRouter = Router();
11
+ /**
12
+ * GET /permissions/policies
13
+ * List permission policies
14
+ */
15
+ permissionsRouter.get('/permissions/policies', async (req, res) => {
16
+ try {
17
+ const orchestrator = getServerOrchestrator();
18
+ if (!orchestrator) {
19
+ return res.status(503).json({
20
+ error: { message: 'Server not initialized', type: 'server_error' }
21
+ });
22
+ }
23
+ // Use orchestrator public method
24
+ const policies = orchestrator.getPolicies();
25
+ res.json({
26
+ policies,
27
+ count: policies.length
28
+ });
29
+ }
30
+ catch (error) {
31
+ res.status(500).json({
32
+ error: { message: error.message, type: 'server_error' }
33
+ });
34
+ }
35
+ });
36
+ /**
37
+ * POST /permissions/tool/:name
38
+ * Grant permission for a tool (creates WhitelistPolicy)
39
+ */
40
+ permissionsRouter.post('/permissions/tool/:name', async (req, res) => {
41
+ try {
42
+ const { name } = req.params;
43
+ const { action } = req.body;
44
+ const orchestrator = getServerOrchestrator();
45
+ if (!orchestrator) {
46
+ return res.status(503).json({
47
+ error: { message: 'Server not initialized', type: 'server_error' }
48
+ });
49
+ }
50
+ if (action === 'grant' || !action) {
51
+ // Create WhitelistPolicy for this tool
52
+ const policy = new WhitelistPolicy([name], 40);
53
+ orchestrator.registerPolicy(policy);
54
+ res.json({
55
+ success: true,
56
+ tool: name,
57
+ action: 'grant',
58
+ message: `Permission granted for tool: ${name}`
59
+ });
60
+ }
61
+ else if (action === 'revoke') {
62
+ // Create BlacklistPolicy for this tool
63
+ const policy = new BlacklistPolicy([name], 100);
64
+ orchestrator.registerPolicy(policy);
65
+ res.json({
66
+ success: true,
67
+ tool: name,
68
+ action: 'revoke',
69
+ message: `Permission revoked for tool: ${name}`
70
+ });
71
+ }
72
+ else {
73
+ return res.status(400).json({
74
+ error: {
75
+ message: 'action must be "grant" or "revoke"',
76
+ type: 'invalid_request'
77
+ }
78
+ });
79
+ }
80
+ }
81
+ catch (error) {
82
+ res.status(500).json({
83
+ error: { message: error.message, type: 'server_error' }
84
+ });
85
+ }
86
+ });
87
+ /**
88
+ * DELETE /permissions/tool/:name
89
+ * Revoke permission for a tool (creates BlacklistPolicy)
90
+ */
91
+ permissionsRouter.delete('/permissions/tool/:name', async (req, res) => {
92
+ try {
93
+ const { name } = req.params;
94
+ const orchestrator = getServerOrchestrator();
95
+ if (!orchestrator) {
96
+ return res.status(503).json({
97
+ error: { message: 'Server not initialized', type: 'server_error' }
98
+ });
99
+ }
100
+ // Create BlacklistPolicy for this tool
101
+ const policy = new BlacklistPolicy([name], 100);
102
+ orchestrator.registerPolicy(policy);
103
+ res.json({
104
+ success: true,
105
+ tool: name,
106
+ message: `Permission revoked for tool: ${name}`
107
+ });
108
+ }
109
+ catch (error) {
110
+ res.status(500).json({
111
+ error: { message: error.message, type: 'server_error' }
112
+ });
113
+ }
114
+ });
115
+ /**
116
+ * GET /permissions/audit/statistics
117
+ * Get audit statistics (must come before /:sessionId route)
118
+ */
119
+ permissionsRouter.get('/permissions/audit/statistics', async (req, res) => {
120
+ try {
121
+ const orchestrator = getServerOrchestrator();
122
+ if (!orchestrator) {
123
+ return res.status(503).json({
124
+ error: { message: 'Server not initialized', type: 'server_error' }
125
+ });
126
+ }
127
+ // Use orchestrator public method
128
+ const statistics = await orchestrator.getAuditStatistics();
129
+ res.json(statistics || { message: 'No statistics available' });
130
+ }
131
+ catch (error) {
132
+ res.status(500).json({
133
+ error: { message: error.message, type: 'server_error' }
134
+ });
135
+ }
136
+ });
137
+ /**
138
+ * GET /permissions/audit
139
+ * GET /permissions/audit/:sessionId
140
+ * Get audit log entries
141
+ */
142
+ permissionsRouter.get('/permissions/audit/:sessionId?', async (req, res) => {
143
+ try {
144
+ const { sessionId } = req.params;
145
+ const orchestrator = getServerOrchestrator();
146
+ if (!orchestrator) {
147
+ return res.status(503).json({
148
+ error: { message: 'Server not initialized', type: 'server_error' }
149
+ });
150
+ }
151
+ // Use orchestrator public method
152
+ const entries = orchestrator.getAuditLog(sessionId);
153
+ res.json({
154
+ entries,
155
+ count: entries.length,
156
+ sessionId: sessionId || orchestrator.getSessionId()
157
+ });
158
+ }
159
+ catch (error) {
160
+ res.status(500).json({
161
+ error: { message: error.message, type: 'server_error' }
162
+ });
163
+ }
164
+ });
165
+ /**
166
+ * GET /permissions/denied
167
+ * Get all denied operations
168
+ */
169
+ permissionsRouter.get('/permissions/denied', async (req, res) => {
170
+ try {
171
+ const orchestrator = getServerOrchestrator();
172
+ if (!orchestrator) {
173
+ return res.status(503).json({
174
+ error: { message: 'Server not initialized', type: 'server_error' }
175
+ });
176
+ }
177
+ // Use orchestrator public method
178
+ const operations = await orchestrator.getAllDeniedOperations();
179
+ res.json({
180
+ operations,
181
+ count: operations.length
182
+ });
183
+ }
184
+ catch (error) {
185
+ res.status(500).json({
186
+ error: { message: error.message, type: 'server_error' }
187
+ });
188
+ }
189
+ });
190
+ /**
191
+ * POST /permissions/policies
192
+ * Register a custom permission policy
193
+ */
194
+ permissionsRouter.post('/permissions/policies', async (req, res) => {
195
+ try {
196
+ const { policy } = req.body;
197
+ if (!policy) {
198
+ return res.status(400).json({
199
+ error: {
200
+ message: 'policy object required in request body',
201
+ type: 'invalid_request'
202
+ }
203
+ });
204
+ }
205
+ const orchestrator = getServerOrchestrator();
206
+ if (!orchestrator) {
207
+ return res.status(503).json({
208
+ error: { message: 'Server not initialized', type: 'server_error' }
209
+ });
210
+ }
211
+ // Use orchestrator public method
212
+ orchestrator.registerPolicy(policy);
213
+ res.json({
214
+ success: true,
215
+ message: `Policy registered: ${policy.name}`
216
+ });
217
+ }
218
+ catch (error) {
219
+ res.status(500).json({
220
+ error: { message: error.message, type: 'server_error' }
221
+ });
222
+ }
223
+ });
224
+ /**
225
+ * DELETE /permissions/policies/:policyName
226
+ * Unregister a permission policy
227
+ */
228
+ permissionsRouter.delete('/permissions/policies/:policyName', async (req, res) => {
229
+ try {
230
+ const { policyName } = req.params;
231
+ const orchestrator = getServerOrchestrator();
232
+ if (!orchestrator) {
233
+ return res.status(503).json({
234
+ error: { message: 'Server not initialized', type: 'server_error' }
235
+ });
236
+ }
237
+ // Use orchestrator public method
238
+ const removed = orchestrator.unregisterPolicy(policyName);
239
+ res.json({
240
+ success: removed,
241
+ removed,
242
+ message: removed
243
+ ? `Policy unregistered: ${policyName}`
244
+ : `Policy not found: ${policyName}`
245
+ });
246
+ }
247
+ catch (error) {
248
+ res.status(500).json({
249
+ error: { message: error.message, type: 'server_error' }
250
+ });
251
+ }
252
+ });
253
+ //# sourceMappingURL=permissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../src/routes/permissions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AACpD,OAAO,E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,CAAC;gBAC1B,KAAK,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE,IAAI,EAAE,cAAc,EAAE;aACnE,CAAC,CAAC;QACL,CAAC;QAED,iCAAiC;QACjC,MAAM,OAAO,GAAG,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAE1D,GAAG,CAAC,IAAI,CAAC;YACP,OAAO,EAAE,OAAO;YAChB,OAAO;YACP,OAAO,EAAE,OAAO;gBACd,CAAC,CAAC,wBAAwB,UAAU,EAAE;gBACtC,CAAC,CAAC,qBAAqB,UAAU,EAAE;SACtC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE;SACxD,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const prRouter: import("express-serve-static-core").Router;
2
+ //# sourceMappingURL=pr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr.d.ts","sourceRoot":"","sources":["../../src/routes/pr.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,QAAQ,4CAAW,CAAC"}
@@ -0,0 +1,222 @@
1
+ /**
2
+ * PR Management Routes
3
+ * Exposes pull request review, creation, listing, and webhook endpoints.
4
+ * These routes use the orchestrator to send prompts that trigger PRAgent tool calls.
5
+ *
6
+ * Security:
7
+ * - Every `repo` is validated through GitPolicy (format regex + allow-list) BEFORE it
8
+ * is interpolated into an orchestrator prompt, so unauthenticated callers can't smuggle
9
+ * shell metacharacters or out-of-policy repos into tool execution.
10
+ * - The webhook verifies GitHub's X-Hub-Signature-256 HMAC against GITHUB_WEBHOOK_SECRET.
11
+ * With no secret configured the webhook is disabled (401) rather than open.
12
+ */
13
+ import { Router } from 'express';
14
+ import { createHmac, timingSafeEqual } from 'crypto';
15
+ import { GitPolicy } from '@nexus-cortex/executors';
16
+ import { getServerOrchestrator } from './messages.js';
17
+ export const prRouter = Router();
18
+ const policy = GitPolicy.fromEnv();
19
+ /** Validate a PR number from the request (positive integer). */
20
+ function validPrNumber(n) {
21
+ const num = typeof n === 'string' && /^\d+$/.test(n) ? Number(n) : n;
22
+ return Number.isInteger(num) && num > 0 ? num : null;
23
+ }
24
+ /**
25
+ * POST /v1/pr/review
26
+ * Trigger a PR review pipeline
27
+ *
28
+ * Body: { repo: "owner/repo", prNumber: number, options?: { pathFilter, maxLines } }
29
+ */
30
+ prRouter.post('/v1/pr/review', async (req, res) => {
31
+ try {
32
+ const orchestrator = getServerOrchestrator();
33
+ if (!orchestrator) {
34
+ return res.status(503).json({
35
+ error: { message: 'Server not initialized', type: 'server_error' },
36
+ });
37
+ }
38
+ const { repo, prNumber, options } = req.body;
39
+ const repoErr = policy.validateRepo(repo);
40
+ if (repoErr) {
41
+ return res.status(400).json({ error: { message: repoErr, type: 'invalid_request' } });
42
+ }
43
+ const pr = validPrNumber(prNumber);
44
+ if (pr === null) {
45
+ return res.status(400).json({
46
+ error: { message: 'prNumber must be a positive integer', type: 'invalid_request' },
47
+ });
48
+ }
49
+ // Only forward a known-safe, structured subset of options into the prompt.
50
+ const safeOptions = {};
51
+ if (options && typeof options === 'object') {
52
+ if (typeof options.pathFilter === 'string')
53
+ safeOptions.pathFilter = options.pathFilter;
54
+ if (Number.isInteger(options.maxLines))
55
+ safeOptions.maxLines = options.maxLines;
56
+ }
57
+ const diffOptionsStr = Object.keys(safeOptions).length
58
+ ? `, diffOptions: ${JSON.stringify(safeOptions)}`
59
+ : '';
60
+ const prompt = `Review pull request #${pr} in ${repo}.
61
+
62
+ Use PRAgent(mode=review, repo="${repo}", prNumber=${pr}${diffOptionsStr}) to get the PR diff and metadata.
63
+
64
+ Then dispatch these review agents IN PARALLEL using the Task tool:
65
+ 1. pr-security-auditor: Scan for security vulnerabilities
66
+ 2. pr-code-quality: Review code quality and patterns
67
+ 3. pr-architecture-reviewer: Assess architectural impact
68
+
69
+ After all agents complete, synthesize their findings into a final review recommendation.`;
70
+ const response = await orchestrator.sendMessage(prompt);
71
+ res.json({
72
+ review: {
73
+ repo,
74
+ prNumber: pr,
75
+ response: response.content,
76
+ toolUses: response.toolUses,
77
+ usage: response.usage,
78
+ metadata: response.metadata,
79
+ },
80
+ });
81
+ }
82
+ catch (error) {
83
+ res.status(500).json({
84
+ error: { message: error.message, type: 'server_error' },
85
+ });
86
+ }
87
+ });
88
+ /**
89
+ * POST /v1/pr/create
90
+ * Trigger a PR creation pipeline
91
+ *
92
+ * Body: { repo: "owner/repo", branch: string, description?: string }
93
+ */
94
+ prRouter.post('/v1/pr/create', async (req, res) => {
95
+ try {
96
+ const orchestrator = getServerOrchestrator();
97
+ if (!orchestrator) {
98
+ return res.status(503).json({
99
+ error: { message: 'Server not initialized', type: 'server_error' },
100
+ });
101
+ }
102
+ const { repo, branch, description } = req.body;
103
+ const repoErr = policy.validateRepo(repo);
104
+ if (repoErr) {
105
+ return res.status(400).json({ error: { message: repoErr, type: 'invalid_request' } });
106
+ }
107
+ if (branch !== undefined) {
108
+ const branchErr = policy.validateBranch(branch);
109
+ if (branchErr) {
110
+ return res.status(400).json({ error: { message: branchErr, type: 'invalid_request' } });
111
+ }
112
+ }
113
+ // description is free-text but is delivered as data, not a command. Cap its length.
114
+ const desc = typeof description === 'string' ? description.slice(0, 4000) : undefined;
115
+ const prompt = `Create a pull request for ${repo}${branch ? ` on branch "${branch}"` : ''}.
116
+ ${desc ? `\nDescription: ${desc}` : ''}
117
+
118
+ Use WorkspaceManager to set up an isolated worktree, then use PRAgent(mode=create) to prepare the PR context.
119
+ Dispatch a pr-implementer agent to make the changes in the worktree.`;
120
+ const response = await orchestrator.sendMessage(prompt);
121
+ res.json({
122
+ create: {
123
+ repo,
124
+ branch,
125
+ response: response.content,
126
+ toolUses: response.toolUses,
127
+ metadata: response.metadata,
128
+ },
129
+ });
130
+ }
131
+ catch (error) {
132
+ res.status(500).json({
133
+ error: { message: error.message, type: 'server_error' },
134
+ });
135
+ }
136
+ });
137
+ /**
138
+ * GET /v1/pr/list
139
+ * List open PRs for a repository
140
+ *
141
+ * Query: ?repo=owner/repo
142
+ */
143
+ prRouter.get('/v1/pr/list', async (req, res) => {
144
+ try {
145
+ const orchestrator = getServerOrchestrator();
146
+ if (!orchestrator) {
147
+ return res.status(503).json({
148
+ error: { message: 'Server not initialized', type: 'server_error' },
149
+ });
150
+ }
151
+ const repo = req.query.repo;
152
+ const repoErr = policy.validateRepo(repo);
153
+ if (repoErr) {
154
+ return res.status(400).json({ error: { message: repoErr, type: 'invalid_request' } });
155
+ }
156
+ const prompt = `List open pull requests for ${repo}. Use PRAgent(mode=list, repo="${repo}") and return the results.`;
157
+ const response = await orchestrator.sendMessage(prompt);
158
+ res.json({
159
+ list: {
160
+ repo,
161
+ response: response.content,
162
+ toolUses: response.toolUses,
163
+ },
164
+ });
165
+ }
166
+ catch (error) {
167
+ res.status(500).json({
168
+ error: { message: error.message, type: 'server_error' },
169
+ });
170
+ }
171
+ });
172
+ /**
173
+ * Verify a GitHub webhook HMAC (X-Hub-Signature-256) against GITHUB_WEBHOOK_SECRET.
174
+ * Returns true only on a constant-time match. Missing secret/signature/body → false.
175
+ */
176
+ function verifyWebhookSignature(req) {
177
+ const secret = process.env.GITHUB_WEBHOOK_SECRET;
178
+ if (!secret)
179
+ return false;
180
+ const signature = req.headers['x-hub-signature-256'];
181
+ const rawBody = req.rawBody;
182
+ if (typeof signature !== 'string' || !rawBody)
183
+ return false;
184
+ const expected = 'sha256=' + createHmac('sha256', secret).update(rawBody).digest('hex');
185
+ const a = Buffer.from(signature);
186
+ const b = Buffer.from(expected);
187
+ return a.length === b.length && timingSafeEqual(a, b);
188
+ }
189
+ /**
190
+ * POST /v1/pr/webhook
191
+ * GitHub webhook endpoint for auto-review on PR open.
192
+ *
193
+ * Requires GITHUB_WEBHOOK_SECRET + a valid X-Hub-Signature-256. Disabled (401) otherwise.
194
+ */
195
+ prRouter.post('/v1/pr/webhook', async (req, res) => {
196
+ if (!process.env.GITHUB_WEBHOOK_SECRET) {
197
+ return res.status(401).json({
198
+ status: 'disabled',
199
+ message: 'Webhook disabled: set GITHUB_WEBHOOK_SECRET to enable signature-verified delivery.',
200
+ });
201
+ }
202
+ if (!verifyWebhookSignature(req)) {
203
+ return res.status(401).json({ status: 'unauthorized', message: 'Invalid webhook signature' });
204
+ }
205
+ const event = req.headers['x-github-event'];
206
+ const payload = req.body;
207
+ if (event === 'pull_request' && payload.action === 'opened') {
208
+ const repo = payload.repository?.full_name;
209
+ const prNumber = payload.number;
210
+ // Enforce the same repo allow-list the manual routes use.
211
+ if (repo && validPrNumber(prNumber) !== null && policy.validateRepo(repo) === null) {
212
+ // Acknowledge immediately, process async
213
+ res.status(202).json({ status: 'accepted', message: 'Review will be processed asynchronously' });
214
+ // TODO: Trigger review pipeline in background
215
+ // const orchestrator = getServerOrchestrator();
216
+ // if (orchestrator) { ... }
217
+ return;
218
+ }
219
+ }
220
+ res.status(200).json({ status: 'ok', message: 'Event received but no action taken' });
221
+ });
222
+ //# sourceMappingURL=pr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr.js","sourceRoot":"","sources":["../../src/routes/pr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC;AAEjC,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;AAEnC,gEAAgE;AAChE,SAAS,aAAa,CAAC,CAAU;IAC/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AE,CAAC;YACnF,yCAAyC;YACzC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,yCAAyC,EAAE,CAAC,CAAC;YAEjG,8CAA8C;YAC9C,gDAAgD;YAChD,4BAA4B;YAC5B,OAAO;QACT,CAAC;IACH,CAAC;IAED,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,oCAAoC,EAAE,CAAC,CAAC;AACxF,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const sessionsRouter: import("express-serve-static-core").Router;
2
+ //# sourceMappingURL=sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../src/routes/sessions.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc,4CAAW,CAAC"}