@preventive/triage 1.0.0-alpha.47 → 1.0.0-alpha.48

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 (80) hide show
  1. package/client/dependency-paths.d.ts +2 -1
  2. package/client/dependency-paths.js +16 -4
  3. package/common/managed/agent-tasks.ts +12 -14
  4. package/common/managed/github-agents.ts +7 -6
  5. package/out/activity.js +4 -4
  6. package/out/{chunk-NOZJULWS.js → chunk-6LNQTKAV.js} +1 -1
  7. package/out/chunk-7VAWINQF.js +6 -0
  8. package/out/{chunk-5AHIQFFG.js → chunk-C2AVODGZ.js} +1 -1
  9. package/out/{chunk-I2MDGSQX.js → chunk-IO7JTZ6O.js} +1 -1
  10. package/out/{chunk-UENXT2HK.js → chunk-MOACFRJ4.js} +1 -1
  11. package/out/chunk-O6M574JI.js +1 -0
  12. package/out/{chunk-ZCS4UYHI.js → chunk-PBZPYIG7.js} +1 -1
  13. package/out/{chunk-S6U2J62U.js → chunk-PENGGKX7.js} +42 -41
  14. package/out/{chunk-6WF3KNTL.js → chunk-SZD5CW5R.js} +2 -2
  15. package/out/{chunk-SPEFPML6.js → chunk-TQJDYHVE.js} +1 -1
  16. package/out/{chunk-FH24VHSJ.js → chunk-WYLQWYLA.js} +1 -1
  17. package/out/{chunk-VL43BTSO.js → chunk-X6PJAK3T.js} +1 -1
  18. package/out/client-managed-import.js +1 -1
  19. package/out/client-managed.js +26 -26
  20. package/out/compare.js +13 -13
  21. package/out/dialogs.js +17 -17
  22. package/out/graph.js +1 -1
  23. package/out/index.html +7 -7
  24. package/out/scan.js +1 -1
  25. package/out/terminal.js +214 -214
  26. package/out/view.css +1 -1
  27. package/out/view.js +15 -15
  28. package/package.json +8 -5
  29. package/risk/npm/score.js +1 -1
  30. package/server-managed/agent-merges.ts +10 -8
  31. package/server-managed/app-agents.ts +6 -8
  32. package/server-managed/cache-storage.ts +3 -2
  33. package/server-managed/commit-coauthors.ts +7 -2
  34. package/server-managed/commit-lockfiles.ts +22 -21
  35. package/server-managed/db-methods.ts +52 -38
  36. package/server-managed/db-neon.ts +21 -5
  37. package/server-managed/db.ts +2 -0
  38. package/server-managed/dependabot-access.ts +1 -1
  39. package/server-managed/dependency-review-comments.ts +7 -4
  40. package/server-managed/dependency-reviews.ts +71 -33
  41. package/server-managed/github-accounts.ts +28 -1
  42. package/server-managed/github-app.ts +27 -23
  43. package/server-managed/github-graphql.ts +39 -0
  44. package/server-managed/github-issue-links.ts +8 -1
  45. package/server-managed/github-metadata.ts +2 -2
  46. package/server-managed/http-response.ts +28 -10
  47. package/server-managed/http.ts +677 -230
  48. package/server-managed/index.ts +2 -2
  49. package/server-managed/managed-issues.ts +3 -0
  50. package/server-managed/npm-delta.ts +16 -0
  51. package/server-managed/npm-kept.ts +32 -5
  52. package/server-managed/npm-loads.ts +21 -13
  53. package/server-managed/npm-manifest.ts +1 -1
  54. package/server-managed/npm-packages.ts +13 -4
  55. package/server-managed/object-storage.ts +4 -3
  56. package/server-managed/public-workspace.ts +3 -3
  57. package/server-managed/pull-dependencies.ts +84 -36
  58. package/server-managed/pull-dependency-reviews.ts +13 -10
  59. package/server-managed/rename-diff-worker.js +1 -1
  60. package/server-managed/repository-agents.ts +9 -6
  61. package/server-managed/repository-browser.ts +13 -3
  62. package/server-managed/repository-code.ts +153 -7
  63. package/server-managed/repository-dependency-reviews.ts +7 -0
  64. package/server-managed/repository-history.ts +85 -152
  65. package/server-managed/repository-issues.ts +27 -13
  66. package/server-managed/repository-pulse.ts +9 -3
  67. package/server-managed/repository-squashes.ts +145 -0
  68. package/server-managed/request-timing.ts +63 -0
  69. package/server-managed/reviewed-dependencies.ts +3 -2
  70. package/server-managed/session.ts +34 -12
  71. package/server-managed/sql.ts +16 -8
  72. package/server-managed/storage-encryption.ts +16 -8
  73. package/server-managed/storage-maintenance.ts +5 -2
  74. package/server-managed/storage-payload.ts +18 -0
  75. package/server-managed/storage-stores.ts +3 -2
  76. package/server-managed/team-feed.ts +16 -11
  77. package/server-managed/team-npm-scopes.ts +29 -0
  78. package/server-managed/team-reports.ts +68 -16
  79. package/out/chunk-6ANSHRFQ.js +0 -6
  80. package/out/chunk-ZGNMDGSB.js +0 -1
@@ -1,2 +1,3 @@
1
1
  export function isDependencyFile(file: unknown, directory: string): boolean
2
- export function dependencyDirectory(reports: Iterable<{ groups?: Iterable<Iterable<{ file?: unknown }>>; tree?: unknown }>): 'node_modules' | 'vendor' | 'dependencies'
2
+ export function dependencyDirectory(reports: Iterable<{ groups?: Iterable<Iterable<{ file?: unknown }>>; tree?: unknown; treeDependencies?: unknown }>): 'node_modules' | 'vendor' | 'dependencies'
3
+ export function treeDependencyDirectory(tree: unknown): 'node_modules' | 'vendor' | null
@@ -6,6 +6,8 @@ export function isDependencyFile(file, directory) {
6
6
  return path.startsWith(`${directory}/`) || path.includes(`/${directory}/`)
7
7
  }
8
8
 
9
+ // A team's reports tell the one their tree names (`treeDependencies`) in place
10
+ // of the tree, which is asked for apart (server-managed/team-reports.ts).
9
11
  export function dependencyDirectory(reports) {
10
12
  let vendor = false
11
13
  for (const report of reports) {
@@ -15,10 +17,20 @@ export function dependencyDirectory(reports) {
15
17
  if (isDependencyFile(finding.file, 'vendor')) vendor = true
16
18
  }
17
19
  }
18
- for (const file of Object.keys(report.tree ?? {})) {
19
- if (isDependencyFile(file, 'node_modules')) return 'node_modules'
20
- if (isDependencyFile(file, 'vendor')) vendor = true
21
- }
20
+ const named = report.tree ? treeDependencyDirectory(report.tree) : report.treeDependencies
21
+ if (named === 'node_modules') return 'node_modules'
22
+ if (named === 'vendor') vendor = true
22
23
  }
23
24
  return vendor ? 'vendor' : 'dependencies'
24
25
  }
26
+
27
+ // The dependency directory a report's file tree names: node_modules, else
28
+ // vendor, else none.
29
+ export function treeDependencyDirectory(tree) {
30
+ let vendor = false
31
+ for (const file of Object.keys(tree ?? {})) {
32
+ if (isDependencyFile(file, 'node_modules')) return 'node_modules'
33
+ if (isDependencyFile(file, 'vendor')) vendor = true
34
+ }
35
+ return vendor ? 'vendor' : null
36
+ }
@@ -13,14 +13,16 @@
13
13
  // requests are one session, and a commit its own.
14
14
  //
15
15
  // The agents are Claude and Codex, and those the server knows by their GitHub
16
- // Apps or accounts (repository-agents.ts APP_AGENTS): each told by its
17
- // fingerprint, a line of its texts, by the account its work is authored by,
18
- // or by its branches' prefix, the server's to read, and named to the client
16
+ // Apps or accounts (server-managed/app-agents.ts APP_AGENTS): each told by its
17
+ // fingerprint, a line of its texts, by the account its work is authored by
18
+ // (github-agents.ts githubAgent), or by its branches' prefix, the server's to
19
+ // read, and named to the client
19
20
  // by its id, name and avatar (AppAgent). Such an agent names no session:
20
21
  // a pull request of its is a session alone, with its branch; Claude's or
21
22
  // Codex's marks on its work show those as its tools. A pull request labelled
22
23
  // for an agent (labelAgents) is that agent's too, where its own texts and
23
24
  // branch name none: the mark one who ran it gives work it left unmarked.
25
+ import { githubAgent } from './github-agents.ts'
24
26
 
25
27
  // 'claude', 'codex', or an app agent's id.
26
28
  export type Agent = string
@@ -30,11 +32,10 @@ export type Agent = string
30
32
  // `app-<id>` a GitHub App's, `user-<id>` a GitHub account's), where the app
31
33
  // draws no mark of its own for it (Copilot's, ui/view/repository-tiles.js).
32
34
  export interface AppAgent { id: string; name: string; avatar?: string }
33
- // How the server tells one: its fingerprint, a line of an artifact's texts
34
- // starting with it; the GitHub account its work is authored by, its id and
35
- // the logins GitHub names it by, none for one known by its id alone; its
36
- // branches' prefix.
37
- export interface AppAgentMarks { id: string; fingerprint?: string; account?: { id: number; logins: readonly string[] }; prefix: string }
35
+ // How the server tells one, beside the accounts its work is authored by (its
36
+ // id githubAgent's): its fingerprint, a line of an artifact's texts starting
37
+ // with it; its branches' prefix.
38
+ export interface AppAgentMarks { id: string; fingerprint?: string; prefix: string }
38
39
  // An artifact's author, as GitHub names its account: its login and id.
39
40
  export interface AgentAuthor { login: string; id: number }
40
41
 
@@ -121,22 +122,19 @@ export function labelAgents(labels: unknown[], ids: readonly string[]): Agent[]
121
122
  // The sessions and tasks `texts` link, whether they carry Claude's marks and
122
123
  // Codex's, and the agents of `apps` whose fingerprints start a line of them
123
124
  // (not one a text quotes, as one describing it may), whose account `author`
124
- // is, by its id and login both (its id alone where it names no login), or
125
- // whose prefix the branch `branch` is under;
125
+ // is (githubAgent), or whose prefix the branch `branch` is under;
126
126
  // Claude, Codex or the agents of `apps` its `labels` name (labelAgents).
127
127
  export function agentSignals(texts: unknown[], apps: readonly AppAgentMarks[] = [], branch: string | null = null,
128
128
  author: AgentAuthor | null = null, labels: unknown[] = []): AgentSignals {
129
129
  const strings = texts.filter((text): text is string => typeof text === 'string')
130
130
  const found = (pattern: RegExp) => [...new Set(strings.flatMap(text => [...text.matchAll(pattern)].map(match => match[1]!)))].slice(0, MAX_LINKS)
131
131
  const lines = strings.flatMap(text => text.split('\n').map(line => line.trimStart()))
132
- const login = author?.login.toLowerCase()
133
- const authored = ({ account }: AppAgentMarks) => author !== null && account !== undefined && account.id === author.id
134
- && (account.logins.length === 0 || account.logins.some(name => name.toLowerCase() === login))
132
+ const authored = author ? githubAgent(author.login, author.id) : null
135
133
  const labelled = labelAgents(labels, ['claude', 'codex', ...apps.map(app => app.id)])
136
134
  return { sessions: found(SESSION), tasks: found(CODEX_TASK), claude: labelled.includes('claude') || strings.some(text => CLAUDE_MARK.test(text)),
137
135
  codex: labelled.includes('codex') || strings.some(text => CODEX_MARK.test(trailerBlock(text))),
138
136
  agents: apps.filter(app => (app.fingerprint && lines.some(line => line.startsWith(app.fingerprint!)))
139
- || authored(app) || branch?.startsWith(app.prefix) || labelled.includes(app.id)).map(app => app.id) }
137
+ || authored === app.id || branch?.startsWith(app.prefix) || labelled.includes(app.id)).map(app => app.id) }
140
138
  }
141
139
 
142
140
  // The agent a branch's name says made it, and the issue or pull request the
@@ -21,9 +21,9 @@
21
21
  // review pull requests, as GitHub Actions' bot, `github-actions` (41898282,
22
22
  // `[bot]` to the REST API), its mark the GitHub Actions App's avatar; other
23
23
  // workflows the bot runs are as much its own. Neo, its GitHub App (3115942),
24
- // as its account (274065190), known by its id alone, whatever GitHub names
25
- // it, and drawn by its App's avatar, wherever its account or its fingerprint
26
- // names it. Cursor's agents commit as whoever ran them, with a
24
+ // as its account (274065190) and its App's bot (268952163), each known by
25
+ // its id alone, whatever GitHub names it, and drawn by its App's avatar,
26
+ // wherever either or its fingerprint names it. Cursor's agents commit as whoever ran them, with a
27
27
  // `Co-authored-by: Cursor Agent <cursoragent@cursor.com>` trailer; the app
28
28
  // has no mark of Cursor's, and draws it by its name's letter. Each by the
29
29
  // addresses (`emails`) its commits name it by, as author or co-author.
@@ -31,8 +31,8 @@
31
31
  // Those the Agents tab tells beside Claude and Codex (whose sessions and
32
32
  // tasks it tells them by, common/managed/agent-tasks.ts), the server's app
33
33
  // agents (server-managed/app-agents.ts APP_AGENTS), by their branches'
34
- // prefix (`prefix`), their first account, the one their work is authored by,
35
- // and the fingerprint (`fingerprint`) they leave as a line of their pull
34
+ // prefix (`prefix`), the accounts their work is authored by, and the
35
+ // fingerprint (`fingerprint`) they leave as a line of their pull
36
36
  // requests' bodies and their commits' messages, where they leave one:
37
37
  // Neo's, on `neo/` branches; Copilot's coding agent's, on `copilot/`;
38
38
  // Dependabot's, on `dependabot/<ecosystem>/…`. Their work may carry
@@ -45,7 +45,8 @@ export const GITHUB_AGENTS = {
45
45
  claude: { name: 'Claude', mark: 'anthropic', accounts: [{ id: 81847, logins: ['claude'] }, { logins: ['claude[bot]'] }], names: ['Claude'], emails: ['noreply@anthropic.com'] },
46
46
  codex: { name: 'Codex', mark: 'openai', accounts: [{ id: 199175422, logins: ['chatgpt-codex-connector', 'chatgpt-codex-connector[bot]'] }], names: ['Codex'],
47
47
  emails: ['codex@openai.com'] },
48
- neo: { name: 'Neo', avatar: 'app-3115942', accounts: [{ id: 274065190, logins: [] }], names: [], prefix: 'neo/', fingerprint: '🤖 Generated with [Neo](' },
48
+ neo: { name: 'Neo', avatar: 'app-3115942', accounts: [{ id: 274065190, logins: [] }, { id: 268952163, logins: [] }], names: [], prefix: 'neo/',
49
+ fingerprint: '🤖 Generated with [Neo](' },
49
50
  copilot: { name: 'Copilot', mark: 'github-copilot', accounts: [{ id: 198982749, logins: ['Copilot', 'copilot-swe-agent'] },
50
51
  { id: 175728472, logins: ['Copilot', 'copilot-pull-request-reviewer', 'copilot-pull-request-reviewer[bot]'] }], names: ['Copilot'], prefix: 'copilot/' },
51
52
  dependabot: { name: 'Dependabot', avatar: 'app-29110', accounts: [{ id: 49699333, logins: ['dependabot', 'dependabot[bot]'] }], names: ['dependabot[bot]'],