Skip to content

Commit bf9356c

Browse files
authored
chore: release 0.11.7 2 (#2790)
2 parents bd0a430 + 22c1768 commit bf9356c

File tree

191 files changed

+21124
-3910
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+21124
-3910
lines changed

.pre-commit-config.yaml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,15 @@ repos:
1111

1212
- repo: local
1313
hooks:
14-
- id: autoflake
15-
name: autoflake
16-
entry: bash -c '[ -d "apps/core" ] && cd apps/core; uv run autoflake --remove-all-unused-imports --remove-unused-variables --in-place --recursive --ignore-init-module-imports .'
14+
- id: trufflehog
15+
name: TruffleHog
16+
entry: bash -c 'trufflehog git file://. --since-commit HEAD --results=verified,unknown --fail --no-update'
1717
language: system
18-
types: [python]
19-
- id: isort
20-
name: isort
21-
entry: bash -c '[ -d "apps/core" ] && cd apps/core; uv run isort --profile black .'
22-
language: system
23-
types: [python]
24-
exclude: ^docs/
25-
- id: black
26-
name: black
27-
entry: bash -c '[ -d "apps/core" ] && cd apps/core; uv run black --line-length 140 --target-version py310 --target-version py311 .'
28-
language: system
29-
types: [python]
30-
exclude: ^docs/
18+
stages: ["pre-commit", "pre-push"]
19+
20+
- repo: https://github.com/astral-sh/ruff-pre-commit
21+
rev: v0.12.11
22+
hooks:
23+
- id: ruff-check
24+
args: [ --fix ]
25+
- id: ruff-format
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
"""Add vector_db_provider to archives table
2+
3+
Revision ID: 068588268b02
4+
Revises: d5103ee17ed5
5+
Create Date: 2025-08-27 13:16:29.428231
6+
7+
"""
8+
9+
from typing import Sequence, Union
10+
11+
import sqlalchemy as sa
12+
13+
from alembic import op
14+
from letta.settings import settings
15+
16+
# revision identifiers, used by Alembic.
17+
revision: str = "068588268b02"
18+
down_revision: Union[str, None] = "887a4367b560"
19+
branch_labels: Union[str, Sequence[str], None] = None
20+
depends_on: Union[str, Sequence[str], None] = None
21+
22+
23+
def upgrade() -> None:
24+
# ### commands auto generated by Alembic - please adjust! ###
25+
if settings.letta_pg_uri_no_default:
26+
# PostgreSQL - use enum type
27+
vectordbprovider = sa.Enum("NATIVE", "TPUF", name="vectordbprovider")
28+
vectordbprovider.create(op.get_bind(), checkfirst=True)
29+
30+
# Add column as nullable first
31+
op.add_column("archives", sa.Column("vector_db_provider", vectordbprovider, nullable=True))
32+
33+
# Backfill existing rows with NATIVE
34+
op.execute("UPDATE archives SET vector_db_provider = 'NATIVE' WHERE vector_db_provider IS NULL")
35+
36+
# Make column non-nullable
37+
op.alter_column("archives", "vector_db_provider", nullable=False)
38+
else:
39+
# SQLite - use string type
40+
# Add column as nullable first
41+
op.add_column("archives", sa.Column("vector_db_provider", sa.String(), nullable=True))
42+
43+
# Backfill existing rows with NATIVE
44+
op.execute("UPDATE archives SET vector_db_provider = 'NATIVE' WHERE vector_db_provider IS NULL")
45+
46+
# For SQLite, we need to recreate the table to make column non-nullable
47+
# This is a limitation of SQLite ALTER TABLE
48+
# For simplicity, we'll leave it nullable in SQLite
49+
# ### end Alembic commands ###
50+
51+
52+
def downgrade() -> None:
53+
# ### commands auto generated by Alembic - please adjust! ###
54+
op.drop_column("archives", "vector_db_provider")
55+
56+
if settings.letta_pg_uri_no_default:
57+
# Drop enum type for PostgreSQL
58+
vectordbprovider = sa.Enum("NATIVE", "TPUF", name="vectordbprovider")
59+
vectordbprovider.drop(op.get_bind(), checkfirst=True)
60+
# ### end Alembic commands ###

alembic/versions/220856bbf43b_add_read_only_column.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def upgrade() -> None:
2828
# add default value of `False`
2929
op.add_column("block", sa.Column("read_only", sa.Boolean(), nullable=True))
3030
op.execute(
31-
f"""
31+
"""
3232
UPDATE block
3333
SET read_only = False
3434
"""
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
"""Add tags to passages and create passage_tags junction table
2+
3+
Revision ID: 54c76f7cabca
4+
Revises: c41c87205254
5+
Create Date: 2025-08-28 15:13:01.549590
6+
7+
"""
8+
9+
from typing import Sequence, Union
10+
11+
import sqlalchemy as sa
12+
13+
from alembic import op
14+
from letta.settings import settings
15+
16+
# revision identifiers, used by Alembic.
17+
revision: str = "54c76f7cabca"
18+
down_revision: Union[str, None] = "c41c87205254"
19+
branch_labels: Union[str, Sequence[str], None] = None
20+
depends_on: Union[str, Sequence[str], None] = None
21+
22+
23+
def upgrade() -> None:
24+
# ### commands auto generated by Alembic - please adjust! ###
25+
26+
# Database-specific timestamp defaults
27+
if not settings.letta_pg_uri_no_default:
28+
# SQLite uses CURRENT_TIMESTAMP
29+
timestamp_default = sa.text("(CURRENT_TIMESTAMP)")
30+
else:
31+
# PostgreSQL uses now()
32+
timestamp_default = sa.text("now()")
33+
34+
op.create_table(
35+
"passage_tags",
36+
sa.Column("id", sa.String(), nullable=False),
37+
sa.Column("tag", sa.String(), nullable=False),
38+
sa.Column("passage_id", sa.String(), nullable=False),
39+
sa.Column("archive_id", sa.String(), nullable=False),
40+
sa.Column("created_at", sa.DateTime(timezone=True), server_default=timestamp_default, nullable=True),
41+
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=timestamp_default, nullable=True),
42+
sa.Column("is_deleted", sa.Boolean(), server_default=sa.text("FALSE"), nullable=False),
43+
sa.Column("_created_by_id", sa.String(), nullable=True),
44+
sa.Column("_last_updated_by_id", sa.String(), nullable=True),
45+
sa.Column("organization_id", sa.String(), nullable=False),
46+
sa.ForeignKeyConstraint(["archive_id"], ["archives.id"], ondelete="CASCADE"),
47+
sa.ForeignKeyConstraint(
48+
["organization_id"],
49+
["organizations.id"],
50+
),
51+
sa.ForeignKeyConstraint(["passage_id"], ["archival_passages.id"], ondelete="CASCADE"),
52+
sa.PrimaryKeyConstraint("id"),
53+
sa.UniqueConstraint("passage_id", "tag", name="uq_passage_tag"),
54+
)
55+
op.create_index("ix_passage_tags_archive_id", "passage_tags", ["archive_id"], unique=False)
56+
op.create_index("ix_passage_tags_archive_tag", "passage_tags", ["archive_id", "tag"], unique=False)
57+
op.create_index("ix_passage_tags_org_archive", "passage_tags", ["organization_id", "archive_id"], unique=False)
58+
op.create_index("ix_passage_tags_tag", "passage_tags", ["tag"], unique=False)
59+
op.add_column("archival_passages", sa.Column("tags", sa.JSON(), nullable=True))
60+
op.add_column("source_passages", sa.Column("tags", sa.JSON(), nullable=True))
61+
# ### end Alembic commands ###
62+
63+
64+
def downgrade() -> None:
65+
# ### commands auto generated by Alembic - please adjust! ###
66+
op.drop_column("source_passages", "tags")
67+
op.drop_column("archival_passages", "tags")
68+
op.drop_index("ix_passage_tags_tag", table_name="passage_tags")
69+
op.drop_index("ix_passage_tags_org_archive", table_name="passage_tags")
70+
op.drop_index("ix_passage_tags_archive_tag", table_name="passage_tags")
71+
op.drop_index("ix_passage_tags_archive_id", table_name="passage_tags")
72+
op.drop_table("passage_tags")
73+
# ### end Alembic commands ###
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""convert_stop_reason_from_enum_to_string
2+
3+
Revision ID: 887a4367b560
4+
Revises: d5103ee17ed5
5+
Create Date: 2025-08-27 16:34:45.605580
6+
7+
"""
8+
9+
from typing import Sequence, Union
10+
11+
from alembic import op
12+
from letta.settings import settings
13+
14+
# revision identifiers, used by Alembic.
15+
revision: str = "887a4367b560"
16+
down_revision: Union[str, None] = "d5103ee17ed5"
17+
branch_labels: Union[str, Sequence[str], None] = None
18+
depends_on: Union[str, Sequence[str], None] = None
19+
20+
21+
def upgrade() -> None:
22+
# Skip this migration for SQLite it doesn't enforce column types strictly,
23+
# so the existing enum values will continue to work as strings.
24+
if not settings.letta_pg_uri_no_default:
25+
return
26+
27+
op.execute(
28+
"""
29+
ALTER TABLE steps
30+
ALTER COLUMN stop_reason TYPE VARCHAR
31+
USING stop_reason::VARCHAR
32+
"""
33+
)
34+
35+
36+
def downgrade() -> None:
37+
# This is a one-way migration as we can't easily recreate the enum type
38+
# If needed, you would need to create the enum type and cast back
39+
pass

alembic/versions/88f9432739a9_add_jobtype_to_job_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def upgrade() -> None:
2929
op.add_column("jobs", sa.Column("job_type", sa.String(), nullable=True))
3030

3131
# Set existing rows to have the default value of JobType.JOB
32-
op.execute(f"UPDATE jobs SET job_type = 'job' WHERE job_type IS NULL")
32+
op.execute("UPDATE jobs SET job_type = 'job' WHERE job_type IS NULL")
3333

3434
# Make the column non-nullable after setting default values
3535
op.alter_column("jobs", "job_type", existing_type=sa.String(), nullable=False)

alembic/versions/bdddd421ec41_add_privileged_tools_to_organization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def upgrade() -> None:
3030

3131
# fill in column with `False`
3232
op.execute(
33-
f"""
33+
"""
3434
UPDATE organizations
3535
SET privileged_tools = False
3636
"""
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""add default requires approval field on tools
2+
3+
Revision ID: c41c87205254
4+
Revises: 068588268b02
5+
Create Date: 2025-08-28 13:17:51.636159
6+
7+
"""
8+
9+
from typing import Sequence, Union
10+
11+
import sqlalchemy as sa
12+
13+
from alembic import op
14+
15+
# revision identifiers, used by Alembic.
16+
revision: str = "c41c87205254"
17+
down_revision: Union[str, None] = "068588268b02"
18+
branch_labels: Union[str, Sequence[str], None] = None
19+
depends_on: Union[str, Sequence[str], None] = None
20+
21+
22+
def upgrade() -> None:
23+
# ### commands auto generated by Alembic - please adjust! ###
24+
op.add_column("tools", sa.Column("default_requires_approval", sa.Boolean(), nullable=True))
25+
# ### end Alembic commands ###
26+
27+
28+
def downgrade() -> None:
29+
# ### commands auto generated by Alembic - please adjust! ###
30+
op.drop_column("tools", "default_requires_approval")
31+
# ### end Alembic commands ###
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"""add template fields to blocks agents groups
2+
3+
Revision ID: d5103ee17ed5
4+
Revises: ffb17eb241fc
5+
Create Date: 2025-08-26 15:45:32.949892
6+
7+
"""
8+
9+
from typing import Sequence, Union
10+
11+
import sqlalchemy as sa
12+
13+
from alembic import op
14+
15+
# revision identifiers, used by Alembic.
16+
revision: str = "d5103ee17ed5"
17+
down_revision: Union[str, None] = "ffb17eb241fc"
18+
branch_labels: Union[str, Sequence[str], None] = None
19+
depends_on: Union[str, Sequence[str], None] = None
20+
21+
22+
def upgrade() -> None:
23+
# ### commands auto generated by Alembic - please adjust! ###
24+
op.add_column("agents", sa.Column("entity_id", sa.String(), nullable=True))
25+
op.add_column("agents", sa.Column("deployment_id", sa.String(), nullable=True))
26+
op.add_column("block", sa.Column("entity_id", sa.String(), nullable=True))
27+
op.add_column("block", sa.Column("base_template_id", sa.String(), nullable=True))
28+
op.add_column("block", sa.Column("template_id", sa.String(), nullable=True))
29+
op.add_column("block", sa.Column("deployment_id", sa.String(), nullable=True))
30+
op.add_column("groups", sa.Column("base_template_id", sa.String(), nullable=True))
31+
op.add_column("groups", sa.Column("template_id", sa.String(), nullable=True))
32+
op.add_column("groups", sa.Column("deployment_id", sa.String(), nullable=True))
33+
# ### end Alembic commands ###
34+
35+
36+
def downgrade() -> None:
37+
# ### commands auto generated by Alembic - please adjust! ###
38+
op.drop_column("groups", "deployment_id")
39+
op.drop_column("groups", "template_id")
40+
op.drop_column("groups", "base_template_id")
41+
op.drop_column("block", "deployment_id")
42+
op.drop_column("block", "template_id")
43+
op.drop_column("block", "base_template_id")
44+
op.drop_column("block", "entity_id")
45+
op.drop_column("agents", "deployment_id")
46+
op.drop_column("agents", "entity_id")
47+
# ### end Alembic commands ###
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""Add vector db namespace fields to archive and agent state
2+
3+
Revision ID: ddb69be34a72
4+
Revises: f3bf00ef6118
5+
Create Date: 2025-09-02 12:59:54.837863
6+
7+
"""
8+
9+
from typing import Sequence, Union
10+
11+
import sqlalchemy as sa
12+
13+
from alembic import op
14+
15+
# revision identifiers, used by Alembic.
16+
revision: str = "ddb69be34a72"
17+
down_revision: Union[str, None] = "f3bf00ef6118"
18+
branch_labels: Union[str, Sequence[str], None] = None
19+
depends_on: Union[str, Sequence[str], None] = None
20+
21+
22+
def upgrade() -> None:
23+
# ### commands auto generated by Alembic - please adjust! ###
24+
op.add_column("agents", sa.Column("_vector_db_namespace", sa.String(), nullable=True))
25+
op.add_column("archives", sa.Column("_vector_db_namespace", sa.String(), nullable=True))
26+
# ### end Alembic commands ###
27+
28+
29+
def downgrade() -> None:
30+
# ### commands auto generated by Alembic - please adjust! ###
31+
op.drop_column("archives", "_vector_db_namespace")
32+
op.drop_column("agents", "_vector_db_namespace")
33+
# ### end Alembic commands ###

0 commit comments

Comments
 (0)