This PR adjusts the billing logic to not write any records to
`billing_events` if:
- The user is staff, as we don't want to bill staff members
- Billing is disabled (we currently enable billing based on the presence
of the Stripe API key)
Release Notes:
- N/A
This PR makes the `StripeBilling` object long-lived so that we can make
better use of the cached data on it.
We now hold it on the `AppState` and spawn a background task to
initialize the cache on startup.
Release Notes:
- N/A
Co-authored-by: Richard <richard@zed.dev>
This PR adds usage-based billing for LLM interactions in the Assistant.
Release Notes:
- N/A
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Richard <richard@zed.dev>
Co-authored-by: Richard Feldman <oss@rtfeldman.com>
This PR fixes some issues with our previous approach to synching LLM
usage over to Stripe.
We now have a separate LLM access price in Stripe that is a marker price
to allow us to create the initial subscription with that as its
subscription item
We then dynamically set the LLM usage price during the reconciliation
sync based on the usage for the current month.
Release Notes:
- N/A
---------
Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Richard <richard@zed.dev>
This PR makes the `has_llm_subscription` and
`max_monthly_spend_in_cents` fields in the `LlmTokenClaims` required.
This change will be safe to deploy in ~45 minutes.
Release Notes:
- N/A
This PR adds a new `billing_preferences` table.
Right now there is a single preference: the maximum monthly spend for
LLM usage.
Release Notes:
- N/A
---------
Co-authored-by: Richard <richard@zed.dev>
Reworks the way tasks are stored, accessed and synchronized in the
`project`.
Now both collab and ssh remote projects use the same TaskStorage kind to
get the task context from the remote host, and worktree task templates
are synchronized along with other worktree settings.
Release Notes:
- Adds ssh support to tasks, improves collab-remote projects' tasks sync
This PR renames the `MONTHLY_SPENDING_LIMIT` constant to
`FREE_TIER_MONTHLY_SPENDING_LIMIT` to clarify it.
This will help distinguish it from the user's specified limit on their
paid monthly spending.
Release Notes:
- N/A
This PR adds a new `Cents` type that can be used to represent a monetary
value in cents.
This cuts down on the primitive obsession we were using when dealing
with money in the billing code.
Release Notes:
- N/A
We have a lot of data in Clickhouse. This column was used when migrating
the events dataset between analytics databases and has no purpose today.
Naive maths: 257,170,993 editor event rows * 1 byte per boolean =
257,170,993 bytes, or ~0.24 GB
I'll drop the column after deploying a new collab.
Going forward, I'd like to remove more data that we never touch, to try
to keep things more focused. We should discuss some TTL at some point.
Release Notes:
- N/A
After https://github.com/rust-lang/rust-analyzer/pull/18167 and certain
people who type and complete rapidly, it turned out that we have not
waited for `completionItem/resolve` to finish before applying the
completion results.
Release Notes:
- Fixed completion items applied improperly on fast typing
This PR makes the `github_user_login` field required in the
`LlmTokenClaims`.
We previously added this in
https://github.com/zed-industries/zed/pull/16316 and made it optional
for backwards-compatibility.
It's been more than long enough for all of the previous LLM tokens to
have expired, so we can now make the field required.
Release Notes:
- N/A
This PR reworks our existing billing code in preparation for charging
based on LLM usage.
We aren't yet exercising the new billing-related code outside of
development.
There are some noteworthy changes for our existing LLM usage tracking:
- A new `monthly_usages` table has been added for tracking usage
per-user, per-model, per-month
- The per-month usage measures have been removed, in favor of the
`monthly_usages` table
- All of the per-month metrics in the Clickhouse rows have been changed
from a rolling 30-day window to a calendar month
Release Notes:
- N/A
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Richard <richard@zed.dev>
Co-authored-by: Max <max@zed.dev>
This PR drops the `cache_creation_input_tokens_this_month ` and
`cache_read_input_tokens_this_month ` columns from the `usages` table in
the LLM database.
We mistakenly added these in #18834, but these aren't necessary due to
the structure of the `usages` table. We weren't actually using these
columns anywhere.
Release Notes:
- N/A
This PR extends the LLM usage tracking to support tracking usage for
cache writes and reads for Anthropic models.
Release Notes:
- N/A
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Antonio <antonio@zed.dev>
This PR reverts the changes to the Clickhouse event rows that were
included in https://github.com/zed-industries/zed/pull/18414.
The changes don't seem to be correct, as they make the row structs
differ from the underlying table schema.
Release Notes:
- N/A
REplace isahc with ureq everywhere gpui is used.
This should allow us to make http requests without libssl; and avoid a
long-tail of panics caused by ishac.
Release Notes:
- (potentially breaking change) updated our http client
---------
Co-authored-by: Mikayla <mikayla@zed.dev>
This PR does not change how things work for settings, but lays the
ground work for the future functionality.
After this change, Zed is prepared to sync more than just
`settings.json` files from local worktree and user config.
* ssh tasks
Part of this work is to streamline the task sync mechanism.
Instead of having an extra set of requests to fetch the task contents
from the server (as remote-via-collab does now and does not cover all
sync cases), we want to reuse the existing mechanism for synchronizing
user and local settings.
* editorconfig
Part of the task is to sync .editorconfig file changes to everyone which
involves sending and storing those configs.
Both ssh (and remove-over-collab) .zed/tasks.json and .editorconfig
files behave similar to .zed/settings.json local files: they belong to a
certain path in a certain worktree; may update over time, changing Zed's
functionality; can be merged hierarchically.
Settings sync follows the same "config file changed -> send to watchers
-> parse and merge locally and on watchers" path that's needed for both
new kinds of files, ergo the messaging layer is extended to send more
types of settings for future watch & parse and merge impls to follow.
Release Notes:
- N/A
I noticed a few places where we were storing `&'static str`s in
`static`s instead of `const`s.
This PR updates them to use `const`.
Release Notes:
- N/A
This restructures the code in `remote` so that it's easier to replace
the current SSH connection with a new one in case of
disconnects/reconnects.
Right now, it successfully reconnects, BUT we're still missing the big
piece on the server-side: keeping the server process alive and
reconnecting to the same process that keeps the project-state.
Release Notes:
- N/A
---------
Co-authored-by: Bennet <bennet@zed.dev>
If specifying a formatter in the settings like this:
"languages": {
"foo": {
"formatter": {
"external": {
"command": "/path/to/foo-formatter"
}
}
}
}
Zed will show an error like this:
Invalid user settings file
data did not match any variant of untagged enum SingleOrVec
This is because the arguments are not optional. The error is hard to
understand, so let's make the arguments actually optional, which makes
the above settings snippet valid.
Release Notes:
- Make external formatter arguments optional
Todo:
* [x] Tooltips for hunk buttons
* [x] Buttons to go to next and previous hunk
* [x] Ellipsis button that opens a context menu with `Revert all`
/cc @iamnbutler @danilo-leal for design 👀
Release Notes:
- Changed the behavior of the git gutter so that diff hunk are expanded
immediately when clicking the gutter, and hunk controls are displayed
above the hunk.
---------
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This PR updates the collab seed script to seed the GitHub users from a
set of static data.
This removes the need to hit the GitHub API to retrieve these users.
Release Notes:
- N/A
This PR fixes the GitHub user retrieval in the database seed script.
The users returned from the [list
users](https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#list-users)
endpoint don't have a `created_at` timestamp, so we need to fetch them
individually.
I want to rework this further at a later date, this is just a bandaid to
get things working again.
Release Notes:
- N/A
Release Notes:
- (Potentially breaking change) Zed will now use the node installed on
your $PATH (if it is more recent than v18) instead of downloading its
own. You can disable the new behavior with `{"node":
{"disable_path_lookup": true}}` in your settings. We do not yet use
system/project-local node_modules.
---------
Co-authored-by: Mikayla <mikayla@zed.dev>
This pushes the new LanguageServerName type to more places.
As both languages and language servers were identified by Arc<str>, it
was
sometimes hard to tell which was intended.
Release Notes:
- N/A
This PR removes the `replica_id` field from the `MultiBuffer` struct.
We were only ever referencing this field to pass when constructing a
`MultiBuffer`, and never used it outside of that.
Release Notes:
- N/A