-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Sandboxing for tool execution (#2040)
Co-authored-by: Caren Thomas <carenthomas@Jeffs-MacBook-Pro-2.local> Co-authored-by: Caren Thomas <carenthomas@jeffs-mbp-2.lan> Co-authored-by: Caren Thomas <carenthomas@Jeffs-MBP-2.hsd1.ca.comcast.net> Co-authored-by: Sarah Wooders <sarahwooders@gmail.com>
- Loading branch information
1 parent
476541f
commit ae083fc
Showing
39 changed files
with
2,843 additions
and
862 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
alembic/versions/f81ceea2c08d_create_sandbox_config_and_sandbox_env_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
"""Create sandbox config and sandbox env var tables | ||
Revision ID: f81ceea2c08d | ||
Revises: c85a3d07c028 | ||
Create Date: 2024-11-14 17:51:27.263561 | ||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
import sqlalchemy as sa | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "f81ceea2c08d" | ||
down_revision: Union[str, None] = "f7507eab4bb9" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"sandbox_configs", | ||
sa.Column("id", sa.String(), nullable=False), | ||
sa.Column("type", sa.Enum("E2B", "LOCAL", name="sandboxtype"), nullable=False), | ||
sa.Column("config", sa.JSON(), nullable=False), | ||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=True), | ||
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=True), | ||
sa.Column("is_deleted", sa.Boolean(), server_default=sa.text("FALSE"), nullable=False), | ||
sa.Column("_created_by_id", sa.String(), nullable=True), | ||
sa.Column("_last_updated_by_id", sa.String(), nullable=True), | ||
sa.Column("organization_id", sa.String(), nullable=False), | ||
sa.ForeignKeyConstraint( | ||
["organization_id"], | ||
["organizations.id"], | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
sa.UniqueConstraint("type", "organization_id", name="uix_type_organization"), | ||
) | ||
op.create_table( | ||
"sandbox_environment_variables", | ||
sa.Column("id", sa.String(), nullable=False), | ||
sa.Column("key", sa.String(), nullable=False), | ||
sa.Column("value", sa.String(), nullable=False), | ||
sa.Column("description", sa.String(), nullable=True), | ||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=True), | ||
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=True), | ||
sa.Column("is_deleted", sa.Boolean(), server_default=sa.text("FALSE"), nullable=False), | ||
sa.Column("_created_by_id", sa.String(), nullable=True), | ||
sa.Column("_last_updated_by_id", sa.String(), nullable=True), | ||
sa.Column("organization_id", sa.String(), nullable=False), | ||
sa.Column("sandbox_config_id", sa.String(), nullable=False), | ||
sa.ForeignKeyConstraint( | ||
["organization_id"], | ||
["organizations.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["sandbox_config_id"], | ||
["sandbox_configs.id"], | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
sa.UniqueConstraint("key", "sandbox_config_id", name="uix_key_sandbox_config"), | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table("sandbox_environment_variables") | ||
op.drop_table("sandbox_configs") | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.