@taiga-ai/mcp-server 0.42.0-dev.1245 → 0.43.0-dev.1247

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 (3) hide show
  1. package/README.md +17 -15
  2. package/dist/index.js +552 -501
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,7 +14,7 @@ You need an access key, made in Taiga under **Settings > Account > MCP**, where
14
14
 
15
15
  Create the key first, and choose when it expires: in 30 days, 90 days, a year, or never. Taiga copies it to your clipboard, shows it once, and keeps it on the page until you say you have saved it, so copying the setup next does not lose it.
16
16
 
17
- The same page shows the setup for your client and environment, with the key already filled in where a config file needs it, and a one-click install for Cursor. The examples here pin a release (`@taiga-ai/mcp-server@0.42.0`), so an install runs the version you chose rather than whatever `latest` is at the next start.
17
+ The same page shows the setup for your client and environment, with the key already filled in where a config file needs it, and a one-click install for Cursor. The examples here pin a release (`@taiga-ai/mcp-server@0.43.0`), so an install runs the version you chose rather than whatever `latest` is at the next start.
18
18
 
19
19
  ## Install
20
20
 
@@ -23,29 +23,29 @@ The same page shows the setup for your client and environment, with the key alre
23
23
  Run the command. When it asks for your access key, paste it once and press Enter. Nothing appears as you paste (PowerShell shows asterisks), and the key stays out of your shell history:
24
24
 
25
25
  ```sh
26
- printf 'Taiga access key: ' && read -rs TAIGA_API_KEY && echo && claude mcp add taiga --scope user -e TAIGA_API_KEY="$TAIGA_API_KEY" -- npx -y @taiga-ai/mcp-server@0.42.0
26
+ printf 'Taiga access key: ' && read -rs TAIGA_API_KEY && echo && claude mcp add taiga --scope user -e TAIGA_API_KEY="$TAIGA_API_KEY" -- npx -y @taiga-ai/mcp-server@0.43.0
27
27
  ```
28
28
 
29
29
  ```sh
30
- printf 'Taiga access key: ' && read -rs TAIGA_API_KEY && echo && codex mcp add taiga --env TAIGA_API_KEY="$TAIGA_API_KEY" -- npx -y @taiga-ai/mcp-server@0.42.0
30
+ printf 'Taiga access key: ' && read -rs TAIGA_API_KEY && echo && codex mcp add taiga --env TAIGA_API_KEY="$TAIGA_API_KEY" -- npx -y @taiga-ai/mcp-server@0.43.0
31
31
  ```
32
32
 
33
33
  ```sh
34
- printf 'Taiga access key: ' && read -rs TAIGA_API_KEY && echo && copilot mcp add taiga --env TAIGA_API_KEY="$TAIGA_API_KEY" -- npx -y @taiga-ai/mcp-server@0.42.0
34
+ printf 'Taiga access key: ' && read -rs TAIGA_API_KEY && echo && copilot mcp add taiga --env TAIGA_API_KEY="$TAIGA_API_KEY" -- npx -y @taiga-ai/mcp-server@0.43.0
35
35
  ```
36
36
 
37
37
  On Windows, in PowerShell (Claude Code and Copilot start `npx` through `cmd /c`; the quoted `'--'` survives npm's PowerShell shims):
38
38
 
39
39
  ```powershell
40
- $k = Read-Host 'Taiga access key' -AsSecureString; claude mcp add taiga --scope user -e "TAIGA_API_KEY=$([Net.NetworkCredential]::new('', $k).Password)" '--' cmd /c npx -y @taiga-ai/mcp-server@0.42.0
40
+ $k = Read-Host 'Taiga access key' -AsSecureString; claude mcp add taiga --scope user -e "TAIGA_API_KEY=$([Net.NetworkCredential]::new('', $k).Password)" '--' cmd /c npx -y @taiga-ai/mcp-server@0.43.0
41
41
  ```
42
42
 
43
43
  ```powershell
44
- $k = Read-Host 'Taiga access key' -AsSecureString; codex mcp add taiga --env "TAIGA_API_KEY=$([Net.NetworkCredential]::new('', $k).Password)" '--' npx -y @taiga-ai/mcp-server@0.42.0
44
+ $k = Read-Host 'Taiga access key' -AsSecureString; codex mcp add taiga --env "TAIGA_API_KEY=$([Net.NetworkCredential]::new('', $k).Password)" '--' npx -y @taiga-ai/mcp-server@0.43.0
45
45
  ```
46
46
 
47
47
  ```powershell
48
- $k = Read-Host 'Taiga access key' -AsSecureString; copilot mcp add taiga --env "TAIGA_API_KEY=$([Net.NetworkCredential]::new('', $k).Password)" '--' cmd /c npx -y @taiga-ai/mcp-server@0.42.0
48
+ $k = Read-Host 'Taiga access key' -AsSecureString; copilot mcp add taiga --env "TAIGA_API_KEY=$([Net.NetworkCredential]::new('', $k).Password)" '--' cmd /c npx -y @taiga-ai/mcp-server@0.43.0
49
49
  ```
50
50
 
51
51
  The Copilot command also sets up the GitHub Copilot app. If you have the app but no `copilot` command, add the server to `~/.copilot/mcp-config.json` instead, beside any servers already there. It holds your key, so keep it out of repositories:
@@ -56,7 +56,7 @@ The Copilot command also sets up the GitHub Copilot app. If you have the app but
56
56
  "taiga": {
57
57
  "type": "local",
58
58
  "command": "npx",
59
- "args": ["-y", "@taiga-ai/mcp-server@0.42.0"],
59
+ "args": ["-y", "@taiga-ai/mcp-server@0.43.0"],
60
60
  "env": { "TAIGA_API_KEY": "YOUR_ACCESS_KEY" },
61
61
  "tools": ["*"]
62
62
  }
@@ -73,7 +73,7 @@ Most clients read the same `mcpServers` block. Add it with your key in place of
73
73
  "mcpServers": {
74
74
  "taiga": {
75
75
  "command": "npx",
76
- "args": ["-y", "@taiga-ai/mcp-server@0.42.0"],
76
+ "args": ["-y", "@taiga-ai/mcp-server@0.43.0"],
77
77
  "env": { "TAIGA_API_KEY": "YOUR_ACCESS_KEY" }
78
78
  }
79
79
  }
@@ -101,7 +101,7 @@ In `.vscode/mcp.json`. VS Code reads `servers`, and prompts for the key once and
101
101
  "taiga": {
102
102
  "type": "stdio",
103
103
  "command": "npx",
104
- "args": ["-y", "@taiga-ai/mcp-server@0.42.0"],
104
+ "args": ["-y", "@taiga-ai/mcp-server@0.43.0"],
105
105
  "env": { "TAIGA_API_KEY": "${input:taiga-api-key}" }
106
106
  }
107
107
  }
@@ -110,11 +110,12 @@ In `.vscode/mcp.json`. VS Code reads `servers`, and prompts for the key once and
110
110
 
111
111
  ## Configuration
112
112
 
113
- | Variable | Required | Meaning |
114
- | ---------------- | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
115
- | `TAIGA_API_KEY` | Yes | Your access key. |
116
- | `TAIGA_API_URL` | For `@dev` and `@staging` builds | The Taiga API. A release defaults to `https://api.eu.tai.ga`. It must be https (plain http only for `localhost`), with no query or fragment. |
117
- | `TAIGA_TOOLSETS` | No | Overrides the key's toolsets for this server, comma-separated, or `all`. See [Toolsets](#toolsets). |
113
+ | Variable | Required | Meaning |
114
+ | ----------------- | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
115
+ | `TAIGA_API_KEY` | Yes | Your access key. |
116
+ | `TAIGA_API_URL` | For `@dev` and `@staging` builds | The Taiga API. A release defaults to `https://api.eu.tai.ga`. It must be https (plain http only for `localhost`), with no query or fragment. |
117
+ | `TAIGA_TOOLSETS` | No | Overrides the key's toolsets for this server, comma-separated, or `all`. See [Toolsets](#toolsets). |
118
+ | `TAIGA_TELEMETRY` | No | `off` stops the usage report this server sends Taiga after each tool call. See [How it behaves](#how-it-behaves). |
118
119
 
119
120
  ## Toolsets
120
121
 
@@ -149,6 +150,7 @@ This is what a security reviewer should know.
149
150
  - **Record text is data.** Initiative descriptions, document text, findings and pull request titles were written by people or agents. The server tells the assistant to read them as data, never as instructions.
150
151
  - **Version check.** The server checks at start that the Taiga API it reached supports this version, and refuses to start if not, saying why.
151
152
  - **Nothing on stdout but the protocol.** The server writes only protocol messages to stdout. Its log goes to stderr and does not include your email.
153
+ - **Usage report.** After each tool call the server tells the Taiga API which tool answered, whether it failed and with which error code, how long it took, the name and version your client gives, the protocol version and its own version. It never sends the arguments or the result. The report is sent after the answer and never waited for. `TAIGA_TELEMETRY=off` turns it off.
152
154
 
153
155
  Organization administration stays in the web. That covers members and roles, SSO, access keys, connecting GitHub, GitLab or Azure DevOps, the Discovery conversation, and deleting factories and products.
154
156
 
package/dist/index.js CHANGED
@@ -23815,6 +23815,10 @@ var TaigaClient = class {
23815
23815
  const qs = origin ? `?${new URLSearchParams({ origin })}` : "";
23816
23816
  return this.request("GET", `/products/${seg(productId)}/documents/${seg(type)}${qs}`);
23817
23817
  }
23818
+ /** One tool call, for usage telemetry (PRO-2845): 204, and nothing is read back. */
23819
+ async reportToolCall(report) {
23820
+ await this.request("POST", "/mcp/tool-calls", report);
23821
+ }
23818
23822
  /** Every published version of a product document type, newest first, each with its content (PRO-5088). */
23819
23823
  async listProductDocumentVersions(productId, type, origin) {
23820
23824
  const qs = origin ? `?${new URLSearchParams({ origin })}` : "";
@@ -28675,16 +28679,495 @@ function createdInitiativesOf(result) {
28675
28679
  return parsed.success ? parsed.data.createdInitiatives : null;
28676
28680
  }
28677
28681
  //#endregion
28678
- //#region ../../packages/types/dist/trackers.js
28682
+ //#region ../../packages/types/dist/findings.js
28683
+ /**
28684
+ * Maintenance taxonomy + API DTOs.
28685
+ *
28686
+ * Single source of truth shared by the `maintenance_*` DB schema, the
28687
+ * maintenance API, the maintenance batch agent's output contract, and the
28688
+ * Maintaining page. Maintenance is the operational-hygiene system of record,
28689
+ * deliberately SEPARATE from the product backlog.
28690
+ */
28691
+ /**
28692
+ * - vulnerable_dependency / outdated_dependency: the dependency scanner
28693
+ * - secret: the secrets scanner -- a credential committed to the repository
28694
+ * - sast: the SAST scanner over Taiga-authored rules -- an insecure code pattern
28695
+ * - iac_misconfig: the IaC scanner -- a Terraform/Kubernetes/Dockerfile/CI misconfiguration
28696
+ *
28697
+ * Which tool implements each category lives in the agents' scanner manifest
28698
+ * (apps/agents/core/src/agent_core/scanners/scanners.toml), not here.
28699
+ *
28700
+ * Column semantics per kind (PRO-1350, PRO-1725): the dependency-shaped
28701
+ * columns are reused rather than nulled so grouping and the UI keep working.
28702
+ * For code kinds `ecosystem` is the CATEGORY (secrets / sast / iac), never the
28703
+ * tool, so swapping a tool does not change a finding's identity; the tool that
28704
+ * reported it is `data.tool`. `packageName` is the RULE id, so "group by
28705
+ * package" reads "CKV_AWS_20 x4"; file, line, snippet and rule URL live in
28706
+ * `sourcePaths` + `data`.
28707
+ *
28708
+ * Canonical copy; the DB schema (findings.ts) self-defines the
28709
+ * same values for its CHECK constraint and the agent (maintenance/models.py)
28710
+ * for its Literal -- keep the three in sync.
28711
+ */
28712
+ const MAINTENANCE_FINDING_KINDS = [
28713
+ "vulnerable_dependency",
28714
+ "outdated_dependency",
28715
+ "license_violation",
28716
+ "secret",
28717
+ "sast",
28718
+ "iac_misconfig",
28719
+ "ci",
28720
+ "code_health",
28721
+ "policy_divergence"
28722
+ ];
28723
+ /**
28724
+ * Kinds a finding was once recorded under, by the kind it is now: a Factory on
28725
+ * an older contract still names a CI problem `engineering` (PRO-4697).
28726
+ */
28727
+ const LEGACY_FINDING_KINDS = { engineering: "ci" };
28728
+ /** The kind a finding of `kind` is recorded under: its own, or the one a legacy kind became. */
28729
+ function currentFindingKind(kind) {
28730
+ return LEGACY_FINDING_KINDS[kind] ?? kind;
28731
+ }
28732
+ /**
28733
+ * The kinds whose remediation is a CODE change rather than a version bump
28734
+ * (PRO-1384).
28735
+ *
28736
+ * Shared rather than duplicated per side, because the two sides disagreeing is
28737
+ * a silent dead feature: the API decides whether a remediation is ACCEPTED and
28738
+ * the web decides whether the button is OFFERED, and when this split lived only
28739
+ * in the API the client kept gating on `recommendedVersion` -- which a code
28740
+ * finding never has -- so the endpoint was reachable and unreachable at the
28741
+ * same time.
28742
+ *
28743
+ * A dependency is fixed by moving to a published version, so the absence of one
28744
+ * is a real blocker. A code finding has no version by construction.
28745
+ */
28746
+ const CODE_REMEDIATION_KINDS = [
28747
+ "secret",
28748
+ "sast",
28749
+ "iac_misconfig",
28750
+ "ci",
28751
+ "code_health"
28752
+ ];
28753
+ /** True when the fix is a code change, so no fixed version is required. */
28754
+ function isCodeRemediationKind(kind) {
28755
+ return CODE_REMEDIATION_KINDS.includes(currentFindingKind(kind));
28756
+ }
28757
+ /**
28758
+ * Whether a remediation build IN THIS REPOSITORY may act on the finding.
28759
+ *
28760
+ * A POSITIVE test, deliberately (PR #1781). `remediableBy` is an open
28761
+ * vocabulary: `pointer_bump` is already a value the CHECK constraint accepts,
28762
+ * reserved for work that does not exist yet, and every gate written as
28763
+ * `!== 'upstream_only'` would wave it straight through into planning and a
28764
+ * build with no idea what to do with it. A value this release does not
28765
+ * understand is not a value it may act on.
28766
+ *
28767
+ * Absent or null reads as `coding_agent`: rows written before PRO-1837 carry
28768
+ * no value at all and are ordinary first-party findings, so the migration's
28769
+ * default and this predicate agree.
28770
+ */
28771
+ function isAgentRemediable(finding) {
28772
+ return !finding.remediableBy || finding.remediableBy === "coding_agent";
28773
+ }
28774
+ /**
28775
+ * Whether a finding can be remediated right now (PRO-1384, PRO-1448, PRO-1837).
28776
+ *
28777
+ * Three shapes of "not fixable": a dependency finding with no advised version
28778
+ * to bump to; a secret that exists only in git history; and a finding whose
28779
+ * code belongs to another repository. A code finding (secret, sast,
28780
+ * iac_misconfig) in this repository is otherwise always fixable -- its remedy
28781
+ * is a change at the location, not a version. Three surfaces (the row, the
28782
+ * group header, the detail page) each hand-wrote this and one drifted: a code
28783
+ * finding had a Fix button in the list and none on its own page. One
28784
+ * predicate, so a rule added here reaches every surface at once.
28785
+ */
28786
+ function isFixableFinding(finding) {
28787
+ if (finding.status !== "open") return false;
28788
+ if (finding.location?.historyOnly) return false;
28789
+ if (!isAgentRemediable(finding)) return false;
28790
+ if (finding.fingerprint?.startsWith("base-image:") || finding.baseImageFix) {
28791
+ if (finding.baseImageFix) return finding.baseImageFix.way === "move" || finding.baseImageFix.way === "upgrade";
28792
+ return typeof finding.baseMove === "boolean" ? finding.baseMove : baseImageMoveRemoves(finding.data);
28793
+ }
28794
+ if (finding.kind === "vulnerable_dependency" && isMaliciousPackageFinding(finding)) return true;
28795
+ if (isPinBlocked(finding)) return false;
28796
+ return isCodeRemediationKind(finding.kind) || !!finding.recommendedVersion;
28797
+ }
28798
+ /**
28799
+ * Whether a Fix cannot work: another package's pin caps this finding's fix, and
28800
+ * the last fix ended still vulnerable against it (`opentelemetry-api` under
28801
+ * `aws-opentelemetry-distro`'s `==1.44.0`). Another would spend a run to meet
28802
+ * it again. Blocked with no such fix, a person's Fix still runs (AC-17): they
28803
+ * may know a way round. The gate lifts the hold when the pin moves.
28804
+ */
28805
+ function isPinBlocked(finding) {
28806
+ return finding.autoFixHeld?.reason === "blocked_by_dependency" && finding.autoFixHeld.fixFailed === true;
28807
+ }
28808
+ function baseImageMoveRemoves(data) {
28809
+ const baseImage = typeof data === "object" && data !== null ? data.baseImage : null;
28810
+ const bases = typeof baseImage === "object" && baseImage !== null ? baseImage.bases : null;
28811
+ return Array.isArray(bases) && bases.length > 0 && bases.every((b) => typeof b === "object" && b !== null && typeof b.movesTo === "string" && b.removed === true);
28812
+ }
28813
+ /**
28814
+ * A malicious package (OSV `MAL-*`): its advisory id or one of its aliases
28815
+ * says so, or its tier is Act now with no KEV listing, which only a malware
28816
+ * advisory earns (`findingTierReason`). The id and aliases come first: a
28817
+ * malware report that also aliases a KEV-listed CVE is tiered `kev`. Its fix
28818
+ * is removing the package, not a version. The one rule the API's gate, its
28819
+ * Fix, the web and the MCP read (PRO-3601).
28820
+ */
28821
+ function isMaliciousPackageFinding(finding) {
28822
+ if (typeof finding.malicious === "boolean") return finding.malicious;
28823
+ const mal = (id) => typeof id === "string" && /^MAL-/i.test(id);
28824
+ if (mal(finding.advisoryId)) return true;
28825
+ const aliases = finding.data && typeof finding.data === "object" ? finding.data.aliases : void 0;
28826
+ if (Array.isArray(aliases) && aliases.some(mal)) return true;
28827
+ return finding.tier === "act_now" && finding.kevListedAt == null;
28828
+ }
28829
+ /**
28830
+ * The scanner CATEGORIES a sweep reports, in the order the agent reports them
28831
+ * (PRO-1725). Outcomes are keyed on the category, not the tool, so replacing a
28832
+ * tool in the agents' scanner manifest changes nothing here.
28833
+ */
28834
+ const MAINTENANCE_SCANNERS = [
28835
+ "deps",
28836
+ "secrets",
28837
+ "sast",
28838
+ "iac"
28839
+ ];
28840
+ new Map(Object.entries({
28841
+ deps: [
28842
+ "vulnerable_dependency",
28843
+ "outdated_dependency",
28844
+ "license_violation"
28845
+ ],
28846
+ secrets: ["secret"],
28847
+ sast: ["sast"],
28848
+ iac: ["iac_misconfig"]
28849
+ }).flatMap(([scanner, kinds]) => kinds.map((kind) => [kind, scanner])));
28850
+ const MAINTENANCE_FINDING_SEVERITIES = [
28851
+ "critical",
28852
+ "high",
28853
+ "medium",
28854
+ "low",
28855
+ "none"
28856
+ ];
28857
+ const MAINTENANCE_FINDING_STATUSES = [
28858
+ "open",
28859
+ "remediating",
28860
+ "resolved",
28861
+ "ignored",
28862
+ "superseded"
28863
+ ];
28864
+ /**
28865
+ * Why a human dismissed a finding (required when ignoring). Modelled on
28866
+ * Dependabot's dismiss-reason enum + Snyk's ignore reasons:
28867
+ * - false_positive: not actually a vulnerability / inaccurate advisory
28868
+ * - not_reachable: the vulnerable code path isn't used by this project
28869
+ * - accepted_risk: understood and tolerated (usually time-boxed via expiry)
28870
+ * - wont_fix: won't address (e.g. no fix available, or out of scope)
28871
+ *
28872
+ * Canonical copy; the DB schema (findings.ts) self-defines the same
28873
+ * values for its CHECK constraint -- keep the two in sync.
28874
+ */
28875
+ const MAINTENANCE_IGNORE_REASONS = [
28876
+ "false_positive",
28877
+ "not_reachable",
28878
+ "accepted_risk",
28879
+ "wont_fix"
28880
+ ];
28881
+ /**
28882
+ * What one lockfile's group list says, read against what its osv-scanner
28883
+ * (osv-scalibr) extractor actually writes. Checked per extractor, because the
28884
+ * same list means different things in different files:
28885
+ *
28886
+ * - package-lock.json / npm-shrinkwrap.json: every package entry carries npm's
28887
+ * `dev` / `optional` / `devOptional` flags, transitive ones included, so an
28888
+ * EMPTY list is a runtime dependency, `dev` alone is dev-only, `optional`
28889
+ * alone is shipped, and `dev` + `optional` (devOptional) is left undecided.
28890
+ * - pnpm-lock.yaml: `dev` comes from a per-package `dev: true` that lockfile
28891
+ * v9 no longer writes, so an empty list says nothing; `dev` still means dev.
28892
+ * From a v9 lockfile the sweep walks the `snapshots` graph (PRO-2943): a
28893
+ * copy reachable from any workspace's `dependencies` or
28894
+ * `optionalDependencies` gets Taiga's own `prod` and reads runtime; one
28895
+ * reachable only from `devDependencies` gets `dev`. From an older lockfile
28896
+ * only a copy a workspace declares under `dependencies` or
28897
+ * `optionalDependencies` gets `prod`, and the rest stays unknown.
28898
+ * - poetry.lock: group names with `main` dropped; a non-main, non-optional
28899
+ * group is not in the runtime install. Poetry 1.x lockfiles carry no groups
28900
+ * at all, so an empty list says nothing.
28901
+ * - uv.lock: only direct members of a group are tagged, so an empty list says
28902
+ * nothing; `dev` means dev. Where osv-scanner said nothing, the sweep walks
28903
+ * the lockfile's package graph (PRO-2994): a package reachable from any
28904
+ * workspace member's runtime dependencies gets `prod` and reads runtime,
28905
+ * one reachable only from its development groups gets `dev`.
28906
+ * - bun.lock, yarn.lock, composer.lock, Cargo.lock, Gemfile.lock and NuGet's
28907
+ * packages.lock.json: where osv-scanner names no group, the sweep walks the
28908
+ * lockfile's graph (PRO-3395) and writes `prod` for a package reachable from
28909
+ * a runtime declaration and `dev` for one reachable only from development
28910
+ * ones, where the lockfile or its manifest says which is which (Cargo,
28911
+ * Gemfile and NuGet do not). `prod` reads runtime, `dev` alone dev.
28912
+ * - The sweep's `prod` reads runtime in package-lock.json and poetry.lock as
28913
+ * well, where the graph decides a package osv-scanner said nothing about.
28914
+ * - go.mod/go.sum and the rest carry no group information: unknown whatever
28915
+ * the list says.
28916
+ *
28917
+ * Anything this cannot place is `unknown`, never `runtime`: a wrong "runtime"
28918
+ * on a build tool is the claim this exists to stop, and a wrong "dev only" on a
28919
+ * shipped package is worse.
28920
+ */
28921
+ function lockfileScope(path, groups) {
28922
+ const name = path.slice(path.lastIndexOf("/") + 1);
28923
+ const set = new Set(groups.map((g) => g.trim().toLowerCase()).filter((g) => g !== ""));
28924
+ if (set.has("taiga:runtime")) return "runtime";
28925
+ if (set.has("taiga:dev")) return "dev";
28926
+ switch (name) {
28927
+ case "package-lock.json":
28928
+ case "npm-shrinkwrap.json": {
28929
+ if (set.size === 0 || set.has("prod")) return "runtime";
28930
+ const dev = set.has("dev");
28931
+ const optional = set.has("optional");
28932
+ if (dev && optional) return "unknown";
28933
+ if (dev) return "dev";
28934
+ if (optional && set.size === 1) return "runtime";
28935
+ return "unknown";
28936
+ }
28937
+ case "pnpm-lock.yaml":
28938
+ if (set.has("prod")) return "runtime";
28939
+ return set.size === 1 && set.has("dev") ? "dev" : "unknown";
28940
+ case "uv.lock":
28941
+ case "bun.lock":
28942
+ case "yarn.lock":
28943
+ case "composer.lock":
28944
+ case "Cargo.lock":
28945
+ case "Gemfile.lock":
28946
+ case "packages.lock.json":
28947
+ if (set.has("prod")) return "runtime";
28948
+ return set.size === 1 && set.has("dev") ? "dev" : "unknown";
28949
+ case "pom.xml":
28950
+ if (set.has("prod") || set.has("compile") || set.has("runtime")) return "runtime";
28951
+ return set.size > 0 && [...set].every((g) => g === "test" || g === "dev") ? "dev" : "unknown";
28952
+ case "poetry.lock":
28953
+ if (set.has("taiga:prod")) return "runtime";
28954
+ return set.size > 0 && !set.has("optional") && !set.has("main") ? "dev" : "unknown";
28955
+ default: return "unknown";
28956
+ }
28957
+ }
28958
+ /**
28959
+ * The kinds that are a package in a lockfile (PRO-2862): the ones with a
28960
+ * dependency scope, a relation and an inventory entry. A code kind reuses the
28961
+ * dependency columns for its rule and category and has none of those.
28962
+ */
28963
+ const DEPENDENCY_FINDING_KINDS = [
28964
+ "vulnerable_dependency",
28965
+ "outdated_dependency",
28966
+ "license_violation"
28967
+ ];
28968
+ function isDependencyFindingKind(kind) {
28969
+ return DEPENDENCY_FINDING_KINDS.includes(kind);
28970
+ }
28971
+ /**
28972
+ * Whether a dependency finding sits only in development dependencies, in at
28973
+ * least one runtime dependency set, or in lockfiles that do not say. Decided
28974
+ * per lockfile (`lockfileScope`) and combined pessimistically: one runtime
28975
+ * lockfile makes the finding runtime, one lockfile that cannot say makes it
28976
+ * unknown, and only all-dev reads as dev. Groups the sweep did not record
28977
+ * (older images, code kinds) are unknown. Presentation only: the tier and the
28978
+ * auto-remediation gate do not read this, and a malicious package runs its
28979
+ * install script in any group.
28980
+ */
28981
+ function dependencyScope(finding) {
28982
+ if (!isDependencyFindingKind(finding.kind)) return "unknown";
28983
+ return scopeFromGroups(finding.dependencyGroups);
28984
+ }
28985
+ /** The scope read from per-lockfile groups alone: for an inventory record, which is a package by construction. */
28986
+ function scopeFromGroups(dependencyGroups) {
28987
+ const entries = Object.entries(dependencyGroups ?? {});
28988
+ if (entries.length === 0) return "unknown";
28989
+ return combineScopes(entries.map(([path, groups]) => lockfileScope(path, Array.isArray(groups) ? groups : [])));
28990
+ }
28991
+ function combineScopes(scopes) {
28992
+ if (scopes.includes("runtime")) return "runtime";
28993
+ if (scopes.includes("unknown") || scopes.length === 0) return "unknown";
28994
+ return "dev";
28995
+ }
28996
+ /**
28997
+ * Whether the repository declares the package itself. Per lockfile the sweep
28998
+ * says direct or transitive; across lockfiles one direct declaration makes the
28999
+ * finding direct (that copy is the repository's to bump), transitive only when
29000
+ * every readable lockfile says so, unknown when the sweep could read none of
29001
+ * them or did not record it (older images, code kinds). Presentation only; the
29002
+ * remediation step already finds every resolved copy and its parent itself.
29003
+ */
29004
+ function dependencyRelation(finding) {
29005
+ if (!isDependencyFindingKind(finding.kind)) return "unknown";
29006
+ return relationFromLockfiles(finding.dependencyRelation);
29007
+ }
29008
+ /** The relation read from per-lockfile answers alone: for an inventory record, which is a package by construction. */
29009
+ function relationFromLockfiles(dependencyRelation) {
29010
+ const values = Object.values(dependencyRelation ?? {});
29011
+ if (values.includes("direct")) return "direct";
29012
+ if (values.length > 0 && values.every((v) => v === "transitive")) return "transitive";
29013
+ return "unknown";
29014
+ }
29015
+ new Set(CODE_REMEDIATION_KINDS);
29016
+ /** A non-empty string, or null. */
29017
+ const locationText = string$2().min(1).nullable().catch(null);
29018
+ /**
29019
+ * A source line is a positive integer or nothing: the response schema declares
29020
+ * `int()`, so a fractional value here would fail serialization for the WHOLE
29021
+ * list rather than blank one row; and 0 is "no position" for scanners that
29022
+ * report [0, 0] for a check with no concrete line.
29023
+ */
29024
+ const sourceLine = number$1().refine((n) => Number.isInteger(n) && n > 0).nullable().catch(null);
29025
+ object({
29026
+ rule_id: locationText,
29027
+ rule_url: locationText,
29028
+ tool: locationText,
29029
+ line: sourceLine,
29030
+ end_line: sourceLine,
29031
+ resource: locationText,
29032
+ in_tree: unknown$1().optional(),
29033
+ commit: string$2().regex(/^[0-9a-f]{7,40}$/).nullable().catch(null)
29034
+ }).transform((d) => ({
29035
+ ruleId: d.rule_id,
29036
+ ruleUrl: d.rule_url,
29037
+ tool: d.tool,
29038
+ line: d.line,
29039
+ endLine: d.end_line,
29040
+ resource: d.resource,
29041
+ historyOnly: d.in_tree === false,
29042
+ commit: d.commit
29043
+ }));
29044
+ /**
29045
+ * The sources whose findings no agent scanner's outcome decides (PRO-4070):
29046
+ * the API's runtime judge (PRO-3659) and base OS judge (PRO-4074), and the
29047
+ * base image reading (PRO-1728) and the reading of what a Dockerfile installs
29048
+ * (PRO-4077), whose findings the agent drafts but only a sweep that read them
29049
+ * may settle.
29050
+ */
29051
+ const MAINTENANCE_JUDGED_SOURCES = [
29052
+ "runtime",
29053
+ "base_os",
29054
+ "base_image",
29055
+ "dockerfile_install",
29056
+ ...["ci_analysis", "code_health"],
29057
+ "policy"
29058
+ ];
29059
+ [...MAINTENANCE_SCANNERS, ...MAINTENANCE_JUDGED_SOURCES];
29060
+ new Set(MAINTENANCE_SCANNERS);
29061
+ /** The reasons that come and go with a sweep: a finding naming the file holds rather than resolves. */
29062
+ const MAINTENANCE_DOCKERFILE_INSTALL_HELD_REASONS = [
29063
+ "base_not_read",
29064
+ "definition_unreadable",
29065
+ "index_unavailable",
29066
+ "over_limit"
29067
+ ];
28679
29068
  /**
28680
- * Ticket trackers (PRO-4954): the systems outside Taiga where an organization
28681
- * keeps its requests, and what Taiga reads from and writes to them.
29069
+ * The licences a package may carry without a `license_violation` finding
29070
+ * (PRO-2862), as SPDX identifiers. osv-scanner evaluates each package's
29071
+ * licence expression against this list, so `MIT OR GPL-3.0-only` passes and
29072
+ * `Apache-2.0 AND LGPL-3.0-or-later` does not.
28682
29073
  *
28683
- * A tracker is reached through one port with an adapter per provider, as a
28684
- * forge is (`forge.ts`). This file is the part both ends share: the providers,
28685
- * what each can do, and the one shape a ticket takes whichever tracker it
28686
- * came from.
29074
+ * The default for regulated enterprises (PRO-3310), by classification: on it
29075
+ * when Google's licence policy classes it "notice" or "unencumbered" and the
29076
+ * Apache Software Foundation's puts it in Category A (where it lists it), and
29077
+ * the Blue Oak Council does not rate it Lead -- the permissive family, which
29078
+ * no copyleft obligation follows however the software ships. Approval is not
29079
+ * compliance: each licence's own conditions still apply (notices, Apache's
29080
+ * change notices on modified files). So MPL-2.0 (Google reciprocal, Apache B), OFL-1.1 (Google by
29081
+ * exception, Apache B) and WTFPL (Blue Oak Lead) are not; Unicode-3.0, which
29082
+ * most Rust builds carry through unicode-ident, is. Anything else raises a
29083
+ * finding the product decides on. The starting value of every organization's
29084
+ * list, which a tenant admin can replace (PRO-2896, `tenantLicenseAllowlist`);
29085
+ * an organization with its own list keeps it. `UNKNOWN` is never a violation.
29086
+ */
29087
+ const DEFAULT_LICENSE_ALLOWLIST = [
29088
+ "MIT",
29089
+ "Apache-2.0",
29090
+ "BSD-2-Clause",
29091
+ "BSD-3-Clause",
29092
+ "BSD-2-Clause-Patent",
29093
+ "ISC",
29094
+ "X11",
29095
+ "MIT-CMU",
29096
+ "MIT-0",
29097
+ "0BSD",
29098
+ "Zlib",
29099
+ "BSL-1.0",
29100
+ "PostgreSQL",
29101
+ "NCSA",
29102
+ "UPL-1.0",
29103
+ "BlueOak-1.0.0",
29104
+ "PSF-2.0",
29105
+ "Python-2.0",
29106
+ "CNRI-Python",
29107
+ "Unicode-3.0",
29108
+ "Unicode-DFS-2016",
29109
+ "Unlicense",
29110
+ "CC0-1.0",
29111
+ "CC-BY-4.0",
29112
+ "CDLA-Permissive-2.0",
29113
+ "Artistic-2.0"
29114
+ ];
29115
+ /**
29116
+ * The longest licence string the package list filters by (PRO-2920). The
29117
+ * inventory keeps every expression whole whatever its length; this bounds only
29118
+ * the query string, far above any expression seen. A longer one is listed in
29119
+ * the summary and the SBOM, and cannot be opened as a filter.
28687
29120
  */
29121
+ const MAINTENANCE_LICENSE_FILTER_MAX = 4096;
29122
+ /** osv-scanner's words for a licence deps.dev could not name. */
29123
+ const UNKNOWN_LICENSES = ["UNKNOWN", "non-standard"];
29124
+ [...MAINTENANCE_DOCKERFILE_INSTALL_HELD_REASONS];
29125
+ const FIX_STAGES = [
29126
+ "under_way",
29127
+ "awaiting_sweep",
29128
+ "did_not_clear"
29129
+ ];
29130
+ function licensePackageStanding(decisions, pkg) {
29131
+ const name = pkg.platformBuildOf ?? pkg.packageName;
29132
+ const own = decisions.filter((d) => d.ecosystem === pkg.ecosystem && d.packageName === name).sort((a, b) => a.decidedAt.localeCompare(b.decidedAt) || a.id.localeCompare(b.id));
29133
+ const latest = /* @__PURE__ */ new Map();
29134
+ const replacements = /* @__PURE__ */ new Map();
29135
+ for (const d of own) if (d.action === "replace") replacements.set(d.productRepositoryId, d);
29136
+ else latest.set(d.license, d);
29137
+ const allowed = [...latest.values()].find((d) => d.action === "allow") ?? null;
29138
+ const fixes = [...replacements.values()].flatMap((d) => {
29139
+ if (!d.backlogItemId || !d.initiative || d.initiative.state === "canceled") return [];
29140
+ const stage = d.initiative.state !== "done" ? "under_way" : d.initiative.sweptSince ? "did_not_clear" : "awaiting_sweep";
29141
+ return [{
29142
+ backlogItemId: d.backlogItemId,
29143
+ stage
29144
+ }];
29145
+ });
29146
+ return {
29147
+ allowed,
29148
+ fix: FIX_STAGES.flatMap((stage) => fixes.filter((f) => f.stage === stage))[0] ?? null
29149
+ };
29150
+ }
29151
+ /** The longest attestation link taken, in characters (PRO-4387). */
29152
+ const ATTESTATION_LINK_MAX_LENGTH = 2e3;
29153
+ /**
29154
+ * Whether `value` is a link an attestation may carry (PRO-4387): an absolute
29155
+ * http or https URL, no longer than {@link ATTESTATION_LINK_MAX_LENGTH}. Any
29156
+ * other scheme (`javascript:`, `data:`, `file:`) is refused, because the link
29157
+ * is shown to every reader of the control and opened on a click.
29158
+ */
29159
+ function isAttestationLink(value) {
29160
+ if (value.length === 0 || value.length > 2e3) return false;
29161
+ if (/[\s<>"]/.test(value) || Array.from(value).some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127)) return false;
29162
+ try {
29163
+ const url = new URL(value);
29164
+ return (url.protocol === "https:" || url.protocol === "http:") && url.hostname.length > 0;
29165
+ } catch {
29166
+ return false;
29167
+ }
29168
+ }
29169
+ //#endregion
29170
+ //#region ../../packages/types/dist/trackers.js
28688
29171
  const TRACKER_PROVIDERS = [
28689
29172
  "jira",
28690
29173
  "servicenow",
@@ -29235,494 +29718,6 @@ const REQUEST_EXITS = [
29235
29718
  /** The most ids an answer's `seen` carries; a longer list is not sent, and the review is not checked. */
29236
29719
  const REVIEW_SEEN_MAX = 1e4;
29237
29720
  //#endregion
29238
- //#region ../../packages/types/dist/findings.js
29239
- /**
29240
- * Maintenance taxonomy + API DTOs.
29241
- *
29242
- * Single source of truth shared by the `maintenance_*` DB schema, the
29243
- * maintenance API, the maintenance batch agent's output contract, and the
29244
- * Maintaining page. Maintenance is the operational-hygiene system of record,
29245
- * deliberately SEPARATE from the product backlog.
29246
- */
29247
- /**
29248
- * - vulnerable_dependency / outdated_dependency: the dependency scanner
29249
- * - secret: the secrets scanner -- a credential committed to the repository
29250
- * - sast: the SAST scanner over Taiga-authored rules -- an insecure code pattern
29251
- * - iac_misconfig: the IaC scanner -- a Terraform/Kubernetes/Dockerfile/CI misconfiguration
29252
- *
29253
- * Which tool implements each category lives in the agents' scanner manifest
29254
- * (apps/agents/core/src/agent_core/scanners/scanners.toml), not here.
29255
- *
29256
- * Column semantics per kind (PRO-1350, PRO-1725): the dependency-shaped
29257
- * columns are reused rather than nulled so grouping and the UI keep working.
29258
- * For code kinds `ecosystem` is the CATEGORY (secrets / sast / iac), never the
29259
- * tool, so swapping a tool does not change a finding's identity; the tool that
29260
- * reported it is `data.tool`. `packageName` is the RULE id, so "group by
29261
- * package" reads "CKV_AWS_20 x4"; file, line, snippet and rule URL live in
29262
- * `sourcePaths` + `data`.
29263
- *
29264
- * Canonical copy; the DB schema (findings.ts) self-defines the
29265
- * same values for its CHECK constraint and the agent (maintenance/models.py)
29266
- * for its Literal -- keep the three in sync.
29267
- */
29268
- const MAINTENANCE_FINDING_KINDS = [
29269
- "vulnerable_dependency",
29270
- "outdated_dependency",
29271
- "license_violation",
29272
- "secret",
29273
- "sast",
29274
- "iac_misconfig",
29275
- "ci",
29276
- "code_health",
29277
- "policy_divergence"
29278
- ];
29279
- /**
29280
- * Kinds a finding was once recorded under, by the kind it is now: a Factory on
29281
- * an older contract still names a CI problem `engineering` (PRO-4697).
29282
- */
29283
- const LEGACY_FINDING_KINDS = { engineering: "ci" };
29284
- /** The kind a finding of `kind` is recorded under: its own, or the one a legacy kind became. */
29285
- function currentFindingKind(kind) {
29286
- return LEGACY_FINDING_KINDS[kind] ?? kind;
29287
- }
29288
- /**
29289
- * The kinds whose remediation is a CODE change rather than a version bump
29290
- * (PRO-1384).
29291
- *
29292
- * Shared rather than duplicated per side, because the two sides disagreeing is
29293
- * a silent dead feature: the API decides whether a remediation is ACCEPTED and
29294
- * the web decides whether the button is OFFERED, and when this split lived only
29295
- * in the API the client kept gating on `recommendedVersion` -- which a code
29296
- * finding never has -- so the endpoint was reachable and unreachable at the
29297
- * same time.
29298
- *
29299
- * A dependency is fixed by moving to a published version, so the absence of one
29300
- * is a real blocker. A code finding has no version by construction.
29301
- */
29302
- const CODE_REMEDIATION_KINDS = [
29303
- "secret",
29304
- "sast",
29305
- "iac_misconfig",
29306
- "ci",
29307
- "code_health"
29308
- ];
29309
- /** True when the fix is a code change, so no fixed version is required. */
29310
- function isCodeRemediationKind(kind) {
29311
- return CODE_REMEDIATION_KINDS.includes(currentFindingKind(kind));
29312
- }
29313
- /**
29314
- * Whether a remediation build IN THIS REPOSITORY may act on the finding.
29315
- *
29316
- * A POSITIVE test, deliberately (PR #1781). `remediableBy` is an open
29317
- * vocabulary: `pointer_bump` is already a value the CHECK constraint accepts,
29318
- * reserved for work that does not exist yet, and every gate written as
29319
- * `!== 'upstream_only'` would wave it straight through into planning and a
29320
- * build with no idea what to do with it. A value this release does not
29321
- * understand is not a value it may act on.
29322
- *
29323
- * Absent or null reads as `coding_agent`: rows written before PRO-1837 carry
29324
- * no value at all and are ordinary first-party findings, so the migration's
29325
- * default and this predicate agree.
29326
- */
29327
- function isAgentRemediable(finding) {
29328
- return !finding.remediableBy || finding.remediableBy === "coding_agent";
29329
- }
29330
- /**
29331
- * Whether a finding can be remediated right now (PRO-1384, PRO-1448, PRO-1837).
29332
- *
29333
- * Three shapes of "not fixable": a dependency finding with no advised version
29334
- * to bump to; a secret that exists only in git history; and a finding whose
29335
- * code belongs to another repository. A code finding (secret, sast,
29336
- * iac_misconfig) in this repository is otherwise always fixable -- its remedy
29337
- * is a change at the location, not a version. Three surfaces (the row, the
29338
- * group header, the detail page) each hand-wrote this and one drifted: a code
29339
- * finding had a Fix button in the list and none on its own page. One
29340
- * predicate, so a rule added here reaches every surface at once.
29341
- */
29342
- function isFixableFinding(finding) {
29343
- if (finding.status !== "open") return false;
29344
- if (finding.location?.historyOnly) return false;
29345
- if (!isAgentRemediable(finding)) return false;
29346
- if (finding.fingerprint?.startsWith("base-image:") || finding.baseImageFix) {
29347
- if (finding.baseImageFix) return finding.baseImageFix.way === "move" || finding.baseImageFix.way === "upgrade";
29348
- return typeof finding.baseMove === "boolean" ? finding.baseMove : baseImageMoveRemoves(finding.data);
29349
- }
29350
- if (finding.kind === "vulnerable_dependency" && isMaliciousPackageFinding(finding)) return true;
29351
- if (isPinBlocked(finding)) return false;
29352
- return isCodeRemediationKind(finding.kind) || !!finding.recommendedVersion;
29353
- }
29354
- /**
29355
- * Whether a Fix cannot work: another package's pin caps this finding's fix, and
29356
- * the last fix ended still vulnerable against it (`opentelemetry-api` under
29357
- * `aws-opentelemetry-distro`'s `==1.44.0`). Another would spend a run to meet
29358
- * it again. Blocked with no such fix, a person's Fix still runs (AC-17): they
29359
- * may know a way round. The gate lifts the hold when the pin moves.
29360
- */
29361
- function isPinBlocked(finding) {
29362
- return finding.autoFixHeld?.reason === "blocked_by_dependency" && finding.autoFixHeld.fixFailed === true;
29363
- }
29364
- function baseImageMoveRemoves(data) {
29365
- const baseImage = typeof data === "object" && data !== null ? data.baseImage : null;
29366
- const bases = typeof baseImage === "object" && baseImage !== null ? baseImage.bases : null;
29367
- return Array.isArray(bases) && bases.length > 0 && bases.every((b) => typeof b === "object" && b !== null && typeof b.movesTo === "string" && b.removed === true);
29368
- }
29369
- /**
29370
- * A malicious package (OSV `MAL-*`): its advisory id or one of its aliases
29371
- * says so, or its tier is Act now with no KEV listing, which only a malware
29372
- * advisory earns (`findingTierReason`). The id and aliases come first: a
29373
- * malware report that also aliases a KEV-listed CVE is tiered `kev`. Its fix
29374
- * is removing the package, not a version. The one rule the API's gate, its
29375
- * Fix, the web and the MCP read (PRO-3601).
29376
- */
29377
- function isMaliciousPackageFinding(finding) {
29378
- if (typeof finding.malicious === "boolean") return finding.malicious;
29379
- const mal = (id) => typeof id === "string" && /^MAL-/i.test(id);
29380
- if (mal(finding.advisoryId)) return true;
29381
- const aliases = finding.data && typeof finding.data === "object" ? finding.data.aliases : void 0;
29382
- if (Array.isArray(aliases) && aliases.some(mal)) return true;
29383
- return finding.tier === "act_now" && finding.kevListedAt == null;
29384
- }
29385
- /**
29386
- * The scanner CATEGORIES a sweep reports, in the order the agent reports them
29387
- * (PRO-1725). Outcomes are keyed on the category, not the tool, so replacing a
29388
- * tool in the agents' scanner manifest changes nothing here.
29389
- */
29390
- const MAINTENANCE_SCANNERS = [
29391
- "deps",
29392
- "secrets",
29393
- "sast",
29394
- "iac"
29395
- ];
29396
- new Map(Object.entries({
29397
- deps: [
29398
- "vulnerable_dependency",
29399
- "outdated_dependency",
29400
- "license_violation"
29401
- ],
29402
- secrets: ["secret"],
29403
- sast: ["sast"],
29404
- iac: ["iac_misconfig"]
29405
- }).flatMap(([scanner, kinds]) => kinds.map((kind) => [kind, scanner])));
29406
- const MAINTENANCE_FINDING_SEVERITIES = [
29407
- "critical",
29408
- "high",
29409
- "medium",
29410
- "low",
29411
- "none"
29412
- ];
29413
- const MAINTENANCE_FINDING_STATUSES = [
29414
- "open",
29415
- "remediating",
29416
- "resolved",
29417
- "ignored",
29418
- "superseded"
29419
- ];
29420
- /**
29421
- * Why a human dismissed a finding (required when ignoring). Modelled on
29422
- * Dependabot's dismiss-reason enum + Snyk's ignore reasons:
29423
- * - false_positive: not actually a vulnerability / inaccurate advisory
29424
- * - not_reachable: the vulnerable code path isn't used by this project
29425
- * - accepted_risk: understood and tolerated (usually time-boxed via expiry)
29426
- * - wont_fix: won't address (e.g. no fix available, or out of scope)
29427
- *
29428
- * Canonical copy; the DB schema (findings.ts) self-defines the same
29429
- * values for its CHECK constraint -- keep the two in sync.
29430
- */
29431
- const MAINTENANCE_IGNORE_REASONS = [
29432
- "false_positive",
29433
- "not_reachable",
29434
- "accepted_risk",
29435
- "wont_fix"
29436
- ];
29437
- /**
29438
- * What one lockfile's group list says, read against what its osv-scanner
29439
- * (osv-scalibr) extractor actually writes. Checked per extractor, because the
29440
- * same list means different things in different files:
29441
- *
29442
- * - package-lock.json / npm-shrinkwrap.json: every package entry carries npm's
29443
- * `dev` / `optional` / `devOptional` flags, transitive ones included, so an
29444
- * EMPTY list is a runtime dependency, `dev` alone is dev-only, `optional`
29445
- * alone is shipped, and `dev` + `optional` (devOptional) is left undecided.
29446
- * - pnpm-lock.yaml: `dev` comes from a per-package `dev: true` that lockfile
29447
- * v9 no longer writes, so an empty list says nothing; `dev` still means dev.
29448
- * From a v9 lockfile the sweep walks the `snapshots` graph (PRO-2943): a
29449
- * copy reachable from any workspace's `dependencies` or
29450
- * `optionalDependencies` gets Taiga's own `prod` and reads runtime; one
29451
- * reachable only from `devDependencies` gets `dev`. From an older lockfile
29452
- * only a copy a workspace declares under `dependencies` or
29453
- * `optionalDependencies` gets `prod`, and the rest stays unknown.
29454
- * - poetry.lock: group names with `main` dropped; a non-main, non-optional
29455
- * group is not in the runtime install. Poetry 1.x lockfiles carry no groups
29456
- * at all, so an empty list says nothing.
29457
- * - uv.lock: only direct members of a group are tagged, so an empty list says
29458
- * nothing; `dev` means dev. Where osv-scanner said nothing, the sweep walks
29459
- * the lockfile's package graph (PRO-2994): a package reachable from any
29460
- * workspace member's runtime dependencies gets `prod` and reads runtime,
29461
- * one reachable only from its development groups gets `dev`.
29462
- * - bun.lock, yarn.lock, composer.lock, Cargo.lock, Gemfile.lock and NuGet's
29463
- * packages.lock.json: where osv-scanner names no group, the sweep walks the
29464
- * lockfile's graph (PRO-3395) and writes `prod` for a package reachable from
29465
- * a runtime declaration and `dev` for one reachable only from development
29466
- * ones, where the lockfile or its manifest says which is which (Cargo,
29467
- * Gemfile and NuGet do not). `prod` reads runtime, `dev` alone dev.
29468
- * - The sweep's `prod` reads runtime in package-lock.json and poetry.lock as
29469
- * well, where the graph decides a package osv-scanner said nothing about.
29470
- * - go.mod/go.sum and the rest carry no group information: unknown whatever
29471
- * the list says.
29472
- *
29473
- * Anything this cannot place is `unknown`, never `runtime`: a wrong "runtime"
29474
- * on a build tool is the claim this exists to stop, and a wrong "dev only" on a
29475
- * shipped package is worse.
29476
- */
29477
- function lockfileScope(path, groups) {
29478
- const name = path.slice(path.lastIndexOf("/") + 1);
29479
- const set = new Set(groups.map((g) => g.trim().toLowerCase()).filter((g) => g !== ""));
29480
- if (set.has("taiga:runtime")) return "runtime";
29481
- if (set.has("taiga:dev")) return "dev";
29482
- switch (name) {
29483
- case "package-lock.json":
29484
- case "npm-shrinkwrap.json": {
29485
- if (set.size === 0 || set.has("prod")) return "runtime";
29486
- const dev = set.has("dev");
29487
- const optional = set.has("optional");
29488
- if (dev && optional) return "unknown";
29489
- if (dev) return "dev";
29490
- if (optional && set.size === 1) return "runtime";
29491
- return "unknown";
29492
- }
29493
- case "pnpm-lock.yaml":
29494
- if (set.has("prod")) return "runtime";
29495
- return set.size === 1 && set.has("dev") ? "dev" : "unknown";
29496
- case "uv.lock":
29497
- case "bun.lock":
29498
- case "yarn.lock":
29499
- case "composer.lock":
29500
- case "Cargo.lock":
29501
- case "Gemfile.lock":
29502
- case "packages.lock.json":
29503
- if (set.has("prod")) return "runtime";
29504
- return set.size === 1 && set.has("dev") ? "dev" : "unknown";
29505
- case "pom.xml":
29506
- if (set.has("prod") || set.has("compile") || set.has("runtime")) return "runtime";
29507
- return set.size > 0 && [...set].every((g) => g === "test" || g === "dev") ? "dev" : "unknown";
29508
- case "poetry.lock":
29509
- if (set.has("taiga:prod")) return "runtime";
29510
- return set.size > 0 && !set.has("optional") && !set.has("main") ? "dev" : "unknown";
29511
- default: return "unknown";
29512
- }
29513
- }
29514
- /**
29515
- * The kinds that are a package in a lockfile (PRO-2862): the ones with a
29516
- * dependency scope, a relation and an inventory entry. A code kind reuses the
29517
- * dependency columns for its rule and category and has none of those.
29518
- */
29519
- const DEPENDENCY_FINDING_KINDS = [
29520
- "vulnerable_dependency",
29521
- "outdated_dependency",
29522
- "license_violation"
29523
- ];
29524
- function isDependencyFindingKind(kind) {
29525
- return DEPENDENCY_FINDING_KINDS.includes(kind);
29526
- }
29527
- /**
29528
- * Whether a dependency finding sits only in development dependencies, in at
29529
- * least one runtime dependency set, or in lockfiles that do not say. Decided
29530
- * per lockfile (`lockfileScope`) and combined pessimistically: one runtime
29531
- * lockfile makes the finding runtime, one lockfile that cannot say makes it
29532
- * unknown, and only all-dev reads as dev. Groups the sweep did not record
29533
- * (older images, code kinds) are unknown. Presentation only: the tier and the
29534
- * auto-remediation gate do not read this, and a malicious package runs its
29535
- * install script in any group.
29536
- */
29537
- function dependencyScope(finding) {
29538
- if (!isDependencyFindingKind(finding.kind)) return "unknown";
29539
- return scopeFromGroups(finding.dependencyGroups);
29540
- }
29541
- /** The scope read from per-lockfile groups alone: for an inventory record, which is a package by construction. */
29542
- function scopeFromGroups(dependencyGroups) {
29543
- const entries = Object.entries(dependencyGroups ?? {});
29544
- if (entries.length === 0) return "unknown";
29545
- return combineScopes(entries.map(([path, groups]) => lockfileScope(path, Array.isArray(groups) ? groups : [])));
29546
- }
29547
- function combineScopes(scopes) {
29548
- if (scopes.includes("runtime")) return "runtime";
29549
- if (scopes.includes("unknown") || scopes.length === 0) return "unknown";
29550
- return "dev";
29551
- }
29552
- /**
29553
- * Whether the repository declares the package itself. Per lockfile the sweep
29554
- * says direct or transitive; across lockfiles one direct declaration makes the
29555
- * finding direct (that copy is the repository's to bump), transitive only when
29556
- * every readable lockfile says so, unknown when the sweep could read none of
29557
- * them or did not record it (older images, code kinds). Presentation only; the
29558
- * remediation step already finds every resolved copy and its parent itself.
29559
- */
29560
- function dependencyRelation(finding) {
29561
- if (!isDependencyFindingKind(finding.kind)) return "unknown";
29562
- return relationFromLockfiles(finding.dependencyRelation);
29563
- }
29564
- /** The relation read from per-lockfile answers alone: for an inventory record, which is a package by construction. */
29565
- function relationFromLockfiles(dependencyRelation) {
29566
- const values = Object.values(dependencyRelation ?? {});
29567
- if (values.includes("direct")) return "direct";
29568
- if (values.length > 0 && values.every((v) => v === "transitive")) return "transitive";
29569
- return "unknown";
29570
- }
29571
- new Set(CODE_REMEDIATION_KINDS);
29572
- /** A non-empty string, or null. */
29573
- const locationText = string$2().min(1).nullable().catch(null);
29574
- /**
29575
- * A source line is a positive integer or nothing: the response schema declares
29576
- * `int()`, so a fractional value here would fail serialization for the WHOLE
29577
- * list rather than blank one row; and 0 is "no position" for scanners that
29578
- * report [0, 0] for a check with no concrete line.
29579
- */
29580
- const sourceLine = number$1().refine((n) => Number.isInteger(n) && n > 0).nullable().catch(null);
29581
- object({
29582
- rule_id: locationText,
29583
- rule_url: locationText,
29584
- tool: locationText,
29585
- line: sourceLine,
29586
- end_line: sourceLine,
29587
- resource: locationText,
29588
- in_tree: unknown$1().optional(),
29589
- commit: string$2().regex(/^[0-9a-f]{7,40}$/).nullable().catch(null)
29590
- }).transform((d) => ({
29591
- ruleId: d.rule_id,
29592
- ruleUrl: d.rule_url,
29593
- tool: d.tool,
29594
- line: d.line,
29595
- endLine: d.end_line,
29596
- resource: d.resource,
29597
- historyOnly: d.in_tree === false,
29598
- commit: d.commit
29599
- }));
29600
- /**
29601
- * The sources whose findings no agent scanner's outcome decides (PRO-4070):
29602
- * the API's runtime judge (PRO-3659) and base OS judge (PRO-4074), and the
29603
- * base image reading (PRO-1728) and the reading of what a Dockerfile installs
29604
- * (PRO-4077), whose findings the agent drafts but only a sweep that read them
29605
- * may settle.
29606
- */
29607
- const MAINTENANCE_JUDGED_SOURCES = [
29608
- "runtime",
29609
- "base_os",
29610
- "base_image",
29611
- "dockerfile_install",
29612
- ...["ci_analysis", "code_health"],
29613
- "policy"
29614
- ];
29615
- [...MAINTENANCE_SCANNERS, ...MAINTENANCE_JUDGED_SOURCES];
29616
- new Set(MAINTENANCE_SCANNERS);
29617
- /** The reasons that come and go with a sweep: a finding naming the file holds rather than resolves. */
29618
- const MAINTENANCE_DOCKERFILE_INSTALL_HELD_REASONS = [
29619
- "base_not_read",
29620
- "definition_unreadable",
29621
- "index_unavailable",
29622
- "over_limit"
29623
- ];
29624
- /**
29625
- * The licences a package may carry without a `license_violation` finding
29626
- * (PRO-2862), as SPDX identifiers. osv-scanner evaluates each package's
29627
- * licence expression against this list, so `MIT OR GPL-3.0-only` passes and
29628
- * `Apache-2.0 AND LGPL-3.0-or-later` does not.
29629
- *
29630
- * The default for regulated enterprises (PRO-3310), by classification: on it
29631
- * when Google's licence policy classes it "notice" or "unencumbered" and the
29632
- * Apache Software Foundation's puts it in Category A (where it lists it), and
29633
- * the Blue Oak Council does not rate it Lead -- the permissive family, which
29634
- * no copyleft obligation follows however the software ships. Approval is not
29635
- * compliance: each licence's own conditions still apply (notices, Apache's
29636
- * change notices on modified files). So MPL-2.0 (Google reciprocal, Apache B), OFL-1.1 (Google by
29637
- * exception, Apache B) and WTFPL (Blue Oak Lead) are not; Unicode-3.0, which
29638
- * most Rust builds carry through unicode-ident, is. Anything else raises a
29639
- * finding the product decides on. The starting value of every organization's
29640
- * list, which a tenant admin can replace (PRO-2896, `tenantLicenseAllowlist`);
29641
- * an organization with its own list keeps it. `UNKNOWN` is never a violation.
29642
- */
29643
- const DEFAULT_LICENSE_ALLOWLIST = [
29644
- "MIT",
29645
- "Apache-2.0",
29646
- "BSD-2-Clause",
29647
- "BSD-3-Clause",
29648
- "BSD-2-Clause-Patent",
29649
- "ISC",
29650
- "X11",
29651
- "MIT-CMU",
29652
- "MIT-0",
29653
- "0BSD",
29654
- "Zlib",
29655
- "BSL-1.0",
29656
- "PostgreSQL",
29657
- "NCSA",
29658
- "UPL-1.0",
29659
- "BlueOak-1.0.0",
29660
- "PSF-2.0",
29661
- "Python-2.0",
29662
- "CNRI-Python",
29663
- "Unicode-3.0",
29664
- "Unicode-DFS-2016",
29665
- "Unlicense",
29666
- "CC0-1.0",
29667
- "CC-BY-4.0",
29668
- "CDLA-Permissive-2.0",
29669
- "Artistic-2.0"
29670
- ];
29671
- /**
29672
- * The longest licence string the package list filters by (PRO-2920). The
29673
- * inventory keeps every expression whole whatever its length; this bounds only
29674
- * the query string, far above any expression seen. A longer one is listed in
29675
- * the summary and the SBOM, and cannot be opened as a filter.
29676
- */
29677
- const MAINTENANCE_LICENSE_FILTER_MAX = 4096;
29678
- /** osv-scanner's words for a licence deps.dev could not name. */
29679
- const UNKNOWN_LICENSES = ["UNKNOWN", "non-standard"];
29680
- [...MAINTENANCE_DOCKERFILE_INSTALL_HELD_REASONS];
29681
- const FIX_STAGES = [
29682
- "under_way",
29683
- "awaiting_sweep",
29684
- "did_not_clear"
29685
- ];
29686
- function licensePackageStanding(decisions, pkg) {
29687
- const name = pkg.platformBuildOf ?? pkg.packageName;
29688
- const own = decisions.filter((d) => d.ecosystem === pkg.ecosystem && d.packageName === name).sort((a, b) => a.decidedAt.localeCompare(b.decidedAt) || a.id.localeCompare(b.id));
29689
- const latest = /* @__PURE__ */ new Map();
29690
- const replacements = /* @__PURE__ */ new Map();
29691
- for (const d of own) if (d.action === "replace") replacements.set(d.productRepositoryId, d);
29692
- else latest.set(d.license, d);
29693
- const allowed = [...latest.values()].find((d) => d.action === "allow") ?? null;
29694
- const fixes = [...replacements.values()].flatMap((d) => {
29695
- if (!d.backlogItemId || !d.initiative || d.initiative.state === "canceled") return [];
29696
- const stage = d.initiative.state !== "done" ? "under_way" : d.initiative.sweptSince ? "did_not_clear" : "awaiting_sweep";
29697
- return [{
29698
- backlogItemId: d.backlogItemId,
29699
- stage
29700
- }];
29701
- });
29702
- return {
29703
- allowed,
29704
- fix: FIX_STAGES.flatMap((stage) => fixes.filter((f) => f.stage === stage))[0] ?? null
29705
- };
29706
- }
29707
- /** The longest attestation link taken, in characters (PRO-4387). */
29708
- const ATTESTATION_LINK_MAX_LENGTH = 2e3;
29709
- /**
29710
- * Whether `value` is a link an attestation may carry (PRO-4387): an absolute
29711
- * http or https URL, no longer than {@link ATTESTATION_LINK_MAX_LENGTH}. Any
29712
- * other scheme (`javascript:`, `data:`, `file:`) is refused, because the link
29713
- * is shown to every reader of the control and opened on a click.
29714
- */
29715
- function isAttestationLink(value) {
29716
- if (value.length === 0 || value.length > 2e3) return false;
29717
- if (/[\s<>"]/.test(value) || Array.from(value).some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127)) return false;
29718
- try {
29719
- const url = new URL(value);
29720
- return (url.protocol === "https:" || url.protocol === "http:") && url.hostname.length > 0;
29721
- } catch {
29722
- return false;
29723
- }
29724
- }
29725
- //#endregion
29726
29721
  //#region ../../packages/types/dist/finding-advisory.js
29727
29722
  /**
29728
29723
  * Pull the renderable advisory fields out of a finding's raw OSV `data` object.
@@ -37725,7 +37720,8 @@ const DEFAULT_API_URL = "https://api.eu.tai.ga";
37725
37720
  const envSchema = object({
37726
37721
  TAIGA_API_KEY: string$2().optional(),
37727
37722
  TAIGA_API_URL: string$2().optional(),
37728
- TAIGA_TOOLSETS: string$2().optional()
37723
+ TAIGA_TOOLSETS: string$2().optional(),
37724
+ TAIGA_TELEMETRY: string$2().optional()
37729
37725
  });
37730
37726
  /** Hosts a developer runs the API on; the only ones plain http is accepted for. */
37731
37727
  const LOCAL_HOSTS = /* @__PURE__ */ new Set([
@@ -37747,6 +37743,12 @@ function readConfig(version = SERVER_VERSION) {
37747
37743
  const prerelease = version.includes("-");
37748
37744
  if (!env.TAIGA_API_URL && prerelease) return { problem: `This is a pre-release build (${version}) for one of Taiga's own environments: set TAIGA_API_URL to that environment's API. A released version defaults to ${DEFAULT_API_URL}.` };
37749
37745
  const apiUrl = (env.TAIGA_API_URL || DEFAULT_API_URL).replace(/\/+$/, "");
37746
+ const telemetry = ![
37747
+ "off",
37748
+ "0",
37749
+ "false",
37750
+ "no"
37751
+ ].includes((env.TAIGA_TELEMETRY ?? "").trim().toLowerCase());
37750
37752
  let url;
37751
37753
  try {
37752
37754
  url = new URL(apiUrl);
@@ -37761,12 +37763,14 @@ function readConfig(version = SERVER_VERSION) {
37761
37763
  return { config: {
37762
37764
  apiKey: env.TAIGA_API_KEY,
37763
37765
  apiUrl,
37764
- toolsets: parsed.toolsets
37766
+ toolsets: parsed.toolsets,
37767
+ telemetry
37765
37768
  } };
37766
37769
  }
37767
37770
  return { config: {
37768
37771
  apiKey: env.TAIGA_API_KEY,
37769
- apiUrl
37772
+ apiUrl,
37773
+ telemetry
37770
37774
  } };
37771
37775
  }
37772
37776
  //#endregion
@@ -39177,6 +39181,40 @@ const OUTPUT_SCHEMAS = {
39177
39181
  }).loose()
39178
39182
  };
39179
39183
  //#endregion
39184
+ //#region src/tools/telemetry.ts
39185
+ function toolCallReporter(server, client) {
39186
+ return (tool, result, durationMs) => {
39187
+ const answer = result;
39188
+ const failed = !answer || answer.isError === true;
39189
+ const info = server.server.getClientVersion();
39190
+ const protocolVersion = server.server.getNegotiatedProtocolVersion();
39191
+ const report = {
39192
+ tool,
39193
+ outcome: failed ? "error" : "ok",
39194
+ ...failed ? { errorCode: errorCodeOf(answer) } : {},
39195
+ durationMs: Math.max(0, Math.round(durationMs)),
39196
+ ...info?.name ? { client: {
39197
+ name: info.name,
39198
+ ...info.version ? { version: info.version } : {}
39199
+ } } : {},
39200
+ ...protocolVersion ? { protocolVersion } : {},
39201
+ serverVersion: SERVER_VERSION
39202
+ };
39203
+ client.reportToolCall(report).catch(() => void 0);
39204
+ };
39205
+ }
39206
+ /** An error result's code, as toolError writes it; INTERNAL for a call that threw or answered without one. */
39207
+ function errorCodeOf(answer) {
39208
+ const first = answer?.content?.[0];
39209
+ if (first?.type !== "text") return "INTERNAL";
39210
+ try {
39211
+ const code = JSON.parse(first.text).error;
39212
+ return typeof code === "string" && /^[A-Z_]{1,64}$/.test(code) ? code : "INTERNAL";
39213
+ } catch {
39214
+ return "INTERNAL";
39215
+ }
39216
+ }
39217
+ //#endregion
39180
39218
  //#region src/tools/annotations.ts
39181
39219
  /**
39182
39220
  * Tool annotations shared by the tools. Hints for the client, not a
@@ -62007,7 +62045,7 @@ function registerModelConnectionTools(server, client) {
62007
62045
  * model learns the tool's real shape. Applied here, once, so no tool can be
62008
62046
  * registered without it.
62009
62047
  */
62010
- function withStrictInputs(server, client, registered, toolsets, left) {
62048
+ function withStrictInputs(server, client, registered, toolsets, left, report) {
62011
62049
  const inputs = /* @__PURE__ */ new Map();
62012
62050
  const register = server.registerTool.bind(server);
62013
62051
  server.registerTool = ((name, config, callback) => {
@@ -62025,6 +62063,16 @@ function withStrictInputs(server, client, registered, toolsets, left) {
62025
62063
  if (schema !== void 0 && !(schema instanceof ZodObject)) throw new Error(`Tool ${name}: inputSchema must be a z.object() so unknown arguments can be refused`);
62026
62064
  const handler = callback;
62027
62065
  const withHint = async (args, ctx) => {
62066
+ const started = performance.now();
62067
+ let answer;
62068
+ try {
62069
+ answer = await answerCall(args, ctx);
62070
+ return answer;
62071
+ } finally {
62072
+ report?.(name, answer, performance.now() - started);
62073
+ }
62074
+ };
62075
+ const answerCall = async (args, ctx) => {
62028
62076
  const refused = refusedArguments(args);
62029
62077
  if (refused) return refused;
62030
62078
  const answer = await withIdKind(client, args, await notFoundHints.run(notFoundHint(name, args), () => handler(args, ctx)));
@@ -62257,7 +62305,7 @@ function registerAllTools(server, client, options = {}) {
62257
62305
  const registered = /* @__PURE__ */ new Map();
62258
62306
  const toolsets = new Set(options.toolsets ?? TOOLSETS);
62259
62307
  const left = /* @__PURE__ */ new Map();
62260
- withStrictInputs(server, client, registered, toolsets, left);
62308
+ withStrictInputs(server, client, registered, toolsets, left, options.telemetry ? toolCallReporter(server, client) : void 0);
62261
62309
  registerProductTools(server, client);
62262
62310
  registerDocumentTools(server, client);
62263
62311
  registerDesignTokenTools(server, client, options.wait ?? DEFAULT_WAIT_OPTIONS);
@@ -62402,7 +62450,10 @@ async function main() {
62402
62450
  }
62403
62451
  console.error(`Taiga MCP server started (${introspection.capabilities.length} capabilities, role: ${introspection.role})`);
62404
62452
  const toolsets = activeToolsets(introspection.mcpToolsets, config.toolsets);
62405
- serveStdio(() => createServer(client, { toolsets }), { onerror: (error) => console.error("Taiga MCP server error:", error) });
62453
+ serveStdio(() => createServer(client, {
62454
+ toolsets,
62455
+ telemetry: config.telemetry
62456
+ }), { onerror: (error) => console.error("Taiga MCP server error:", error) });
62406
62457
  }
62407
62458
  main().catch((error) => {
62408
62459
  console.error("Fatal error:", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taiga-ai/mcp-server",
3
- "version": "0.42.0-dev.1245",
3
+ "version": "0.43.0-dev.1247",
4
4
  "description": "Taiga for AI coding assistants: read products, policies, initiatives and runs, and operate the line, over MCP",
5
5
  "mcpName": "ga.tai/mcp-server",
6
6
  "license": "UNLICENSED",