arkitekt-next 0.12.0__py3-none-any.whl → 0.12.2__py3-none-any.whl

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.

Potentially problematic release.


This version of arkitekt-next might be problematic. Click here for more details.

arkitekt_next/__blok__.py CHANGED
@@ -21,7 +21,6 @@ from arkitekt_next.bloks.namegen import PreformedNamesBlok
21
21
  from arkitekt_next.bloks.ollama import OllamaBlok
22
22
  from arkitekt_next.bloks.self_signed import SelfSignedBlok
23
23
  from arkitekt_next.bloks.kraph import KraphBlok
24
- from arkitekt_next.bloks.local_sign import LocalSignBlok
25
24
  from arkitekt_next.bloks.elektro import ElektroBlok
26
25
  from blok.blok import Blok
27
26
 
@@ -51,6 +50,5 @@ def get_bloks() -> list[Blok]:
51
50
  SecretBlok(),
52
51
  PreformedNamesBlok(),
53
52
  OrkestratorBlok(),
54
- LocalSignBlok(),
55
53
  ElektroBlok(),
56
54
  ]
@@ -2,7 +2,18 @@ from typing import Dict, Any
2
2
  import secrets
3
3
 
4
4
 
5
+ from arkitekt_next.bloks.services.admin import AdminService
6
+ from arkitekt_next.bloks.services.channel import ChannelService
7
+ from arkitekt_next.bloks.services.config import ConfigService
8
+ from arkitekt_next.bloks.services.db import DBService
9
+ from arkitekt_next.bloks.services.gateway import GatewayService
10
+ from arkitekt_next.bloks.services.lok import LokService
11
+ from arkitekt_next.bloks.services.mount import MountService
12
+ from arkitekt_next.bloks.services.redis import RedisService
13
+ from arkitekt_next.bloks.services.s3 import S3Service
14
+ from arkitekt_next.bloks.services.secret import SecretService
5
15
  from blok import blok, InitContext, ExecutionContext, Option
16
+ from blok.bloks.services.dns import DnsService
6
17
  from blok.tree import Repo, YamlFile
7
18
  from arkitekt_next.bloks.base import BaseArkitektService
8
19
 
@@ -13,7 +24,7 @@ class AlpakaBlok(BaseArkitektService):
13
24
  self.dev = False
14
25
  self.host = "alpaka"
15
26
  self.command = "bash run-debug.sh"
16
- self.repo = "https://github.com/jhnnsrs/alpaka-server"
27
+ self.repo = "https://github.com/arkitektio/alpaka-server"
17
28
  self.scopes = {
18
29
  "alpaka_pull": "Pull new Models",
19
30
  "alpaka_chat": "Add repositories to the database",
@@ -22,11 +33,59 @@ class AlpakaBlok(BaseArkitektService):
22
33
  self.build_repo = False
23
34
  self.buckets = ["media"]
24
35
  self.secret_key = secrets.token_hex(16)
25
- self.image = "jhnnsrs/alpaka:next"
36
+ self.image = "jhnnsrs/alpaka:nightly"
26
37
 
27
38
  def get_additional_config(self):
28
39
  return {"ensured_repos": self.ensured_repos}
29
40
 
41
+ def preflight(
42
+ self,
43
+ init: InitContext,
44
+ lok: LokService,
45
+ db: DBService,
46
+ redis: RedisService,
47
+ s3: S3Service,
48
+ config: ConfigService,
49
+ channel: ChannelService,
50
+ mount: MountService,
51
+ admin: AdminService,
52
+ secret: SecretService,
53
+ gateway: GatewayService | None = None,
54
+ dns: DnsService = None,
55
+ mount_repo: bool = False,
56
+ host: str = "",
57
+ image: str = "",
58
+ secret_key: str = "",
59
+ build_repo: bool = False,
60
+ command: str = "",
61
+ repo: str = "",
62
+ disable: bool = False,
63
+ dev: bool = False,
64
+ ):
65
+ return super().preflight(
66
+ init,
67
+ lok,
68
+ db,
69
+ redis,
70
+ s3,
71
+ config,
72
+ channel,
73
+ mount,
74
+ admin,
75
+ secret,
76
+ gateway,
77
+ dns,
78
+ mount_repo,
79
+ host,
80
+ image,
81
+ secret_key,
82
+ build_repo,
83
+ command,
84
+ repo,
85
+ disable,
86
+ dev,
87
+ )
88
+
30
89
  def get_builder(self):
31
90
  return "arkitekt.generic"
32
91
 
@@ -3,6 +3,7 @@ from typing import Any, Dict, Optional
3
3
  from pydantic import BaseModel
4
4
 
5
5
  from arkitekt_next.bloks.kraph import KraphBlok
6
+ from arkitekt_next.bloks.lok import LokBlok
6
7
  from arkitekt_next.bloks.tailscale import TailscaleBlok
7
8
  from blok import InitContext, Panel, Renderer, blok
8
9
 
@@ -26,21 +27,17 @@ class AdminCredentials(BaseModel):
26
27
  @blok(
27
28
  "live.arkitekt",
28
29
  dependencies=[
30
+ LokBlok.as_dependency(True, True),
29
31
  MikroBlok.as_dependency(True, True),
30
32
  KabinetBlok.as_dependency(True, True),
31
33
  RekuestBlok.as_dependency(True, True),
32
34
  FlussBlok.as_dependency(True, True),
33
35
  InternalDockerBlok.as_dependency(True, True),
34
- LocalLiveKitBlok.as_dependency(True, True),
35
- OrkestratorBlok.as_dependency(True, False),
36
- KraphBlok.as_dependency(True, False),
37
- TailscaleBlok.as_dependency(True, False),
38
- OllamaBlok.as_dependency(True, False),
39
- ElektroBlok.as_dependency(True, False),
36
+ KraphBlok.as_dependency(True, True),
37
+ ElektroBlok.as_dependency(True, True),
40
38
  ],
41
39
  )
42
40
  class ArkitektBlok:
43
-
44
41
  def entry(self, renderer: Renderer):
45
42
  renderer.render(
46
43
  Panel(
@@ -63,12 +63,10 @@ class BaseArkitektService:
63
63
  redis: RedisService,
64
64
  s3: S3Service,
65
65
  config: ConfigService,
66
- channel: ChannelService,
67
66
  mount: MountService,
68
67
  admin: AdminService,
69
68
  secret: SecretService,
70
- gateway: Optional[GatewayService] = None,
71
- dns: DnsService = None,
69
+ gateway: GatewayService,
72
70
  mount_repo: bool = False,
73
71
  host: str = "",
74
72
  image: str = "",
@@ -100,12 +98,7 @@ class BaseArkitektService:
100
98
 
101
99
  django_secret = secret.retrieve_secret()
102
100
 
103
- dns_result = dns.get_dns_result()
104
-
105
101
  csrf_trusted_origins = []
106
- for hostname in dns_result.hostnames:
107
- csrf_trusted_origins.append(f"http://{hostname}")
108
- csrf_trusted_origins.append(f"https://{hostname}")
109
102
 
110
103
  configuration = YamlFile(
111
104
  **{
@@ -67,20 +67,13 @@ class CaddyBlok:
67
67
  def preflight(
68
68
  self,
69
69
  init: InitContext,
70
- dns: DnsService,
71
70
  name: NameService,
72
- certer: CerterService,
73
71
  ):
74
72
  for key, value in init.kwargs.items():
75
73
  setattr(self, key, value)
76
74
 
77
- self.public_ips = dns.get_dns_result().ip_addresses
78
- self.public_hosts = dns.get_dns_result().hostnames
79
75
  self.gateway_network = name.retrieve_name().replace("-", "_")
80
76
 
81
- self.cert_mount = certer.retrieve_certs_mount()
82
- self.depends_on = certer.retrieve_depends_on()
83
-
84
77
  def build(
85
78
  self,
86
79
  context: ExecutionContext,
@@ -95,7 +88,6 @@ class CaddyBlok:
95
88
  if port.tls:
96
89
  caddyfile += f"""
97
90
  :{port.port} {{
98
- tls /certs/caddy.crt /certs/caddy.key
99
91
  reverse_proxy {port.host}:{port.to}
100
92
  }}
101
93
  """
@@ -112,7 +104,6 @@ class CaddyBlok:
112
104
  """
113
105
  caddyfile += (
114
106
  """
115
- tls /certs/caddy.crt /certs/caddy.key
116
107
  """
117
108
  if protocol == "https" and self.cert_mount
118
109
  else ""
@@ -173,8 +164,6 @@ class CaddyBlok:
173
164
  ]
174
165
 
175
166
  volumes = ["./configs/Caddyfile:/etc/caddy/Caddyfile"]
176
- if self.cert_mount:
177
- volumes.append(f"{self.cert_mount}:/certs")
178
167
 
179
168
  caddy_container = {
180
169
  "image": "caddy:latest",
@@ -184,7 +173,6 @@ class CaddyBlok:
184
173
  ]
185
174
  + exposed_ports_strings,
186
175
  "volumes": volumes,
187
- "depends_on": caddy_depends_on,
188
176
  "networks": [self.gateway_network, "default"],
189
177
  }
190
178
 
@@ -35,7 +35,7 @@ class UserParamType(click.ParamType):
35
35
  return value
36
36
  try:
37
37
  name, password = value.split(":")
38
- return {"name": name, "password": password}
38
+ return {"username": name, "password": password}
39
39
  except ValueError:
40
40
  self.fail(
41
41
  f"User '{value}' is not in the correct format. It should be 'name:password'.",
@@ -176,8 +176,6 @@ class LokBlok:
176
176
  admin: AdminService,
177
177
  secrets: SecretBlok,
178
178
  s3: S3Service,
179
- dns: DnsService,
180
- livekit: Optional[LivekitService] = None,
181
179
  ):
182
180
  for key, value in init.kwargs.items():
183
181
  setattr(self, key, value)
@@ -193,9 +191,6 @@ class LokBlok:
193
191
  self.redis_access = redis.register()
194
192
  self.admin_access = admin.retrieve()
195
193
  self.s3_access = s3.create_buckets(self.buckets)
196
- if livekit:
197
- self.local_access = livekit.retrieve_access()
198
- self.dns_result = dns.get_dns_result()
199
194
  self.initialized = True
200
195
 
201
196
  def build(self, context: ExecutionContext):
@@ -206,7 +201,7 @@ class LokBlok:
206
201
 
207
202
  if self.postgress_access.dependency:
208
203
  depends_on.append(self.postgress_access.dependency)
209
-
204
+
210
205
  if self.s3_access.dependency:
211
206
  depends_on.append(self.s3_access.dependency)
212
207
 
@@ -219,7 +214,6 @@ class LokBlok:
219
214
  "volumes": [
220
215
  "/var/run/docker.sock:/var/run/docker.sock",
221
216
  "./configs/lok.yaml:/workspace/config.yaml",
222
- "./certs:/certs",
223
217
  ],
224
218
  }
225
219
 
@@ -237,10 +231,6 @@ class LokBlok:
237
231
 
238
232
  trusted_origins = []
239
233
 
240
- for i in self.dns_result.hostnames:
241
- trusted_origins.append(f"http://{i}")
242
- trusted_origins.append(f"https://{i}")
243
-
244
234
  configuration = YamlFile(
245
235
  **{
246
236
  "db": asdict(self.postgress_access),
@@ -262,14 +252,8 @@ class LokBlok:
262
252
  ],
263
253
  "groups": [group for group in self.groups],
264
254
  "deployment": {"name": self.deployment_name},
265
- "livekit": (
266
- asdict(self.local_access)
267
- if self.local_access
268
- else {"api_key": "dev", "api_secret": "secret", "api_url": None}
269
- ),
270
255
  "s3": asdict(self.s3_access),
271
256
  "token_expire_seconds": self.token_expiry_seconds,
272
- "apps": [],
273
257
  "force_script_name": "lok",
274
258
  "csrf_trusted_origins": trusted_origins,
275
259
  }
@@ -8,11 +8,11 @@ from arkitekt_next.constants import DEFAULT_ARKITEKT_URL
8
8
  import sys
9
9
 
10
10
 
11
- async def run_app(app):
12
- rekuest = app.services.get("rekuest")
11
+ async def run_app(app: App):
12
+ rekuest = app.rekuest
13
13
 
14
14
  async with app:
15
- await rekuest.run()
15
+ await rekuest.arun()
16
16
 
17
17
 
18
18
  @click.command("prod")
@@ -16,6 +16,7 @@ from koil import unkoil
16
16
  from koil.composition import KoiledModel
17
17
  from arkitekt_next.base_models import Manifest
18
18
  from fakts_next import Fakts
19
+ from herre_next import Herre
19
20
 
20
21
 
21
22
  if TYPE_CHECKING:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arkitekt-next
3
- Version: 0.12.0
3
+ Version: 0.12.2
4
4
  Summary: client for the arkitekt_next platform
5
5
  Author-email: jhnnsrs <jhnnsrs@gmail.com>
6
6
  License-Expression: MIT
@@ -13,19 +13,19 @@ Requires-Dist: herre-next>=1.3
13
13
  Requires-Dist: kabinet>=0.5
14
14
  Requires-Dist: koil>=2.0.4
15
15
  Requires-Dist: rath>=3.4
16
- Requires-Dist: rekuest-next>=0.8
16
+ Requires-Dist: rekuest-next>=0.8.1
17
17
  Requires-Dist: rich-click>=1.8.8
18
18
  Requires-Dist: semver>=3.0.4
19
19
  Requires-Dist: watchfiles>=1.0.5
20
20
  Provides-Extra: all
21
21
  Requires-Dist: fluss-next>=0.2.0; extra == 'all'
22
22
  Requires-Dist: kabinet>=0.2.0; extra == 'all'
23
- Requires-Dist: mikro-next>=0.3.1; extra == 'all'
23
+ Requires-Dist: mikro-next>=0.4; extra == 'all'
24
24
  Requires-Dist: reaktion-next>=0.2.0; extra == 'all'
25
25
  Requires-Dist: rekuest-next>=0.7; extra == 'all'
26
26
  Requires-Dist: rich-click>=1.6.1; extra == 'all'
27
27
  Requires-Dist: semver>=3.0.1; extra == 'all'
28
- Requires-Dist: turms>=0.8.2; extra == 'all'
28
+ Requires-Dist: turms>=0.9; extra == 'all'
29
29
  Requires-Dist: unlok-next>=0.2.0; extra == 'all'
30
30
  Requires-Dist: watchfiles>=0.18.1; extra == 'all'
31
31
  Provides-Extra: alpaka
@@ -33,7 +33,7 @@ Requires-Dist: alpaka>=0.2.0; extra == 'alpaka'
33
33
  Provides-Extra: blok
34
34
  Requires-Dist: blok>=0.1.0; extra == 'blok'
35
35
  Provides-Extra: cli
36
- Requires-Dist: turms>=0.8.2; extra == 'cli'
36
+ Requires-Dist: turms>=0.9.0; extra == 'cli'
37
37
  Provides-Extra: elektro
38
38
  Requires-Dist: elektro>=0.5.0; extra == 'elektro'
39
39
  Provides-Extra: extended
@@ -48,7 +48,7 @@ Requires-Dist: kraph>=0.2.0; extra == 'kraph'
48
48
  Provides-Extra: lovekit
49
49
  Requires-Dist: lovekit>=0.2.0; extra == 'lovekit'
50
50
  Provides-Extra: mikro
51
- Requires-Dist: mikro-next>=0.3.1; extra == 'mikro'
51
+ Requires-Dist: mikro-next>=0.4.0; extra == 'mikro'
52
52
  Provides-Extra: reaktion
53
53
  Requires-Dist: reaktion-next>=0.2.0; extra == 'reaktion'
54
54
  Provides-Extra: unlok
@@ -1,10 +1,10 @@
1
- arkitekt_next/__blok__.py,sha256=68Zx7ydA5CBnvm1ADdZZV31Oqp3ZV65-0jG7YZ_xKBc,1983
1
+ arkitekt_next/__blok__.py,sha256=1u-ggUla503bHMWsnHLOucmUMF4JuHNQRKuG1Vc343Q,1901
2
2
  arkitekt_next/__init__.py,sha256=HOKaWJpoMBgHx9Xo8WaO6vY-RhF_bQ6aUQh3p5r20B4,3108
3
3
  arkitekt_next/base_models.py,sha256=GlxtMcV4YbeY8wkbK943HsIFzB8caEsDOfzJ2EDLJ9s,4247
4
4
  arkitekt_next/builders.py,sha256=7FsGNpLa9mGhSW9UTAXt1ZJLdlIvbsPy7qQxYD0LEmU,7627
5
5
  arkitekt_next/constants.py,sha256=N_tP85BDHPiOG663wwaEyMWYiUGtL2T_h4wBVPgsSUU,87
6
6
  arkitekt_next/init_registry.py,sha256=RHAHBI1dJNpFrNZRiDxMHBj_p4GLq2Oj0GnY9Vs31os,3230
7
- arkitekt_next/protocols.py,sha256=rLm9xeO3JT6b8Vrm8jOMZt_dxmbjvN_uubNrM3BwLwc,2032
7
+ arkitekt_next/protocols.py,sha256=A5xHlehqaoGNVmA8VFEMNUl8r0CeOJ1OUnlZ2OT_WhE,2061
8
8
  arkitekt_next/service_registry.py,sha256=gA7c2JKWqZPme5VatVJWFlX0e8HPcxb2BkzZrBMGPUk,7307
9
9
  arkitekt_next/tqdm.py,sha256=KLGeviRa8iEx89OENMXOuoz8hRDKxDktwG3L8oPlR7I,3415
10
10
  arkitekt_next/utils.py,sha256=7kWfUU4jacD8sKgV2-GsZV547EXYpzDNx_7LnIrb0oU,2454
@@ -19,20 +19,19 @@ arkitekt_next/apps/service/herre_qt.py,sha256=42APOZl0SnX0FWl6K-TC9CcZUO-BSXMXyH
19
19
  arkitekt_next/apps/service/local_fakts.py,sha256=Wy37fjsEP2yjKZPtMlLilNlkO0olFX_7P5IIr6g3jkE,2900
20
20
  arkitekt_next/bloks/__init__.py,sha256=_4EeR63d6avQUWLG4mK2n_FvogTPQ_Jx6f2_RvNbWeA,29
21
21
  arkitekt_next/bloks/admin.py,sha256=LzlcGWtpoS3NR3llRjzj1EuwH5o_hroBje3ZSm7ZXOI,1293
22
- arkitekt_next/bloks/alpaka.py,sha256=d7m_qRJZUBdKmIQlWv51bhdvXtSXnRXwgAp1viLYVeM,1393
23
- arkitekt_next/bloks/arkitekt.py,sha256=DYMj0aRaCIN256jgZMJSOK4oLVRXNIwDKkzz_F3bTDA,1697
24
- arkitekt_next/bloks/base.py,sha256=0PBKYVb9-sWz4q90fu8uOlhGUQWRM8JtL4k2tSCW4cw,6567
22
+ arkitekt_next/bloks/alpaka.py,sha256=Ojw1iOQL6JtEEwCTGshYO5e6iYn5dwx8LiG4ArdDCa4,3151
23
+ arkitekt_next/bloks/arkitekt.py,sha256=BiqKLcptePUIDKtZ-IOf0mQnYPtZCquYbs0qKj8pUFk,1580
24
+ arkitekt_next/bloks/base.py,sha256=n3cfEF-7OFJFUDMA5UDEfH118Mg-9aKBxFEFtm8Vb5E,6271
25
25
  arkitekt_next/bloks/channel.py,sha256=PsFlb1qjL9ULtbVt8g1dsuaa9bd60zJCT059LztUkGA,739
26
26
  arkitekt_next/bloks/config.py,sha256=YMQChT4SCdc_vvvbkAj_qGyA--6JVEHds7MalqUp3lw,1269
27
27
  arkitekt_next/bloks/elektro.py,sha256=7UlSZ6EjwCV3SEN7Wn0En2pDZwZcLF_wa5nQvZmKvGI,1288
28
28
  arkitekt_next/bloks/fluss.py,sha256=8nf5Z2k-tA3CNRQeIqh7-aaFe5my_NN2lAhbyYbwKEs,1074
29
- arkitekt_next/bloks/gateway.py,sha256=WBnqw-tfqYWNRJtyvTKxKbicR-Foe_jreMYNPQOARjk,6706
29
+ arkitekt_next/bloks/gateway.py,sha256=H_8ZzEaeTOgVUjL8_qOa0hm6b8kqhXma6p2lxRDPfiY,6207
30
30
  arkitekt_next/bloks/internal_docker.py,sha256=4onnegXts8zOaXEgg4kw8zaqlACRNwvdknJeFHipGtQ,2829
31
31
  arkitekt_next/bloks/kabinet.py,sha256=NKP6tpr8XcVvvFifX-lxgBPkP0P810kJ4URv25jf2z8,1489
32
32
  arkitekt_next/bloks/kraph.py,sha256=vbDkLNC5X644pwM_rpUpTNl4uwGpswFm0iNsyMPWY6c,1292
33
33
  arkitekt_next/bloks/livekit.py,sha256=Wf4JM236ZwuWC5qHnZkGDPq_FZftKLi1nDWbkwRoVso,2611
34
- arkitekt_next/bloks/local_sign.py,sha256=UwqfPV3Z38CI2T8N1uJAX-CRlrRxzkdGfKDukPVHMJ4,8030
35
- arkitekt_next/bloks/lok.py,sha256=REa2HF6_FOqVyZ2KEdGTWfdgxXvGI5xvqqPJtyrzIJY,12136
34
+ arkitekt_next/bloks/lok.py,sha256=LL5yoFwIXO4INGKHEha5k2VmkWyHgQIHmy1roDxEae0,11500
36
35
  arkitekt_next/bloks/mikro.py,sha256=bnI9lWd6FXyOViog0Xko3_yhKOt7AAdB_PA4N0XkXAU,1291
37
36
  arkitekt_next/bloks/minio.py,sha256=gVFVoq5Po7yWO-CeTxQQecK4b3bBr_vdnEodF991WR4,5595
38
37
  arkitekt_next/bloks/mount.py,sha256=IEod6LDuV5NNKvvRJ3Xgo8l2caVZnNmJYDgGGBUB3Cg,1088
@@ -109,7 +108,7 @@ arkitekt_next/cli/commands/manifest/version.py,sha256=3JdcXqiFeCvIaEpsMfeSKWU_uQ
109
108
  arkitekt_next/cli/commands/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
110
109
  arkitekt_next/cli/commands/run/dev.py,sha256=eF7LMHxqqwelW82BscKDqJJuUhnuupyMBf53LsC2yms,10461
111
110
  arkitekt_next/cli/commands/run/main.py,sha256=0bNO3DqwbZ4ddMsDWbCGmlPD6Cs3Jlg4yh2-zilsEbY,552
112
- arkitekt_next/cli/commands/run/prod.py,sha256=EqDMa_eYNaffHZOBHGQEGNJVKdq8NHCgfoqK8yH63B4,1637
111
+ arkitekt_next/cli/commands/run/prod.py,sha256=N2x1ZowCUpvgUOAlKP148vraRTVc2XRq4SyyzOnVgjQ,1627
113
112
  arkitekt_next/cli/commands/run/utils.py,sha256=NnvB9_EphzbQU13MkoGq3sxbt49-ykOOjquTnSjk6k0,617
114
113
  arkitekt_next/cli/dockerfiles/vanilla.dockerfile,sha256=0ujdG22rZ6v2n5TMHNA4HR5f1PP9KJvAQORz-DGHBpo,184
115
114
  arkitekt_next/cli/schemas/fluss.schema.graphql,sha256=MqrSpOxtWO9kWFCoUn9ySBPhIH3XozFiqrQl2zjEbiQ,35803
@@ -144,8 +143,8 @@ arkitekt_next/qt/assets/light/green pulse.gif,sha256=cUd2F3Qlvjb7SnsU-LjGgeLTa8K
144
143
  arkitekt_next/qt/assets/light/orange pulse.gif,sha256=0gDvrRed0mzZZPHB4tP6vptx7myUCAa_hEVGdjRhNy8,94769
145
144
  arkitekt_next/qt/assets/light/pink pulse.gif,sha256=rxd6ZTHSIG9JZuuHhi3jiSB_JYFBZpy7OWUeZETlhQ4,107513
146
145
  arkitekt_next/qt/assets/light/red pulse.gif,sha256=U7WLbZvSl5e-Ob5RmawtlC0Rh9VVHxkjDbGjj7NYVUo,108749
147
- arkitekt_next-0.12.0.dist-info/METADATA,sha256=boj9ueLrCGDKqnpRCf72m6uOFQgTuLxIbm7ph654OR0,5780
148
- arkitekt_next-0.12.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
149
- arkitekt_next-0.12.0.dist-info/entry_points.txt,sha256=IY-mUEDBU6QncqnYw-Ufw5bvNNXjqSlLf1uexZZCJhc,61
150
- arkitekt_next-0.12.0.dist-info/licenses/LICENSE,sha256=YZ2oRjC248t-GpoEyw7J13vwKYNG6zhYMaEAix6EzF0,1089
151
- arkitekt_next-0.12.0.dist-info/RECORD,,
146
+ arkitekt_next-0.12.2.dist-info/METADATA,sha256=leA2aYQ9y-YiSz64LTDt4KvMjum64Kas3gU35xktQ2k,5778
147
+ arkitekt_next-0.12.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
148
+ arkitekt_next-0.12.2.dist-info/entry_points.txt,sha256=IY-mUEDBU6QncqnYw-Ufw5bvNNXjqSlLf1uexZZCJhc,61
149
+ arkitekt_next-0.12.2.dist-info/licenses/LICENSE,sha256=YZ2oRjC248t-GpoEyw7J13vwKYNG6zhYMaEAix6EzF0,1089
150
+ arkitekt_next-0.12.2.dist-info/RECORD,,
@@ -1,261 +0,0 @@
1
- import click
2
-
3
- from pydantic import BaseModel
4
- from cryptography.hazmat.primitives import serialization as crypto_serialization
5
- from cryptography.hazmat.primitives.asymmetric import rsa
6
- from cryptography.hazmat.backends import default_backend as crypto_default_backend
7
- from typing import Dict, Optional
8
- from arkitekt_next.bloks.secret import SecretBlok
9
- from arkitekt_next.bloks.services.admin import AdminService
10
- from arkitekt_next.bloks.services.db import DBService
11
- from arkitekt_next.bloks.services.gateway import GatewayService
12
- from arkitekt_next.bloks.services.livekit import LivekitService
13
- from arkitekt_next.bloks.services.lok import LokCredentials, LokService
14
- import yaml
15
- import secrets
16
- from dataclasses import asdict
17
-
18
- from arkitekt_next.bloks.services.redis import RedisService
19
- from blok import blok, InitContext, ExecutionContext, Option
20
- from blok.bloks.services.dns import DnsService
21
- from blok.tree import YamlFile, Repo
22
- from blok import blok, InitContext
23
-
24
-
25
- DEFAULT_ARKITEKT_URL = "http://localhost:8000"
26
-
27
-
28
- # Define a custom user type that will parse and validate the user input
29
- class UserParamType(click.ParamType):
30
- name = "user"
31
-
32
- def convert(self, value, param, ctx):
33
- if isinstance(value, dict):
34
- return value
35
- try:
36
- name, password = value.split(":")
37
- return {"name": name, "password": password}
38
- except ValueError:
39
- self.fail(
40
- f"User '{value}' is not in the correct format. It should be 'name:password'.",
41
- param,
42
- ctx,
43
- )
44
-
45
-
46
- USER = UserParamType()
47
-
48
-
49
- # Define a custom user type that will parse and validate the user input
50
- class GroupParamType(click.ParamType):
51
- name = "group"
52
-
53
- def convert(self, value, param, ctx):
54
- if isinstance(value, dict):
55
- return value
56
- try:
57
- name, description = value.split(":")
58
- return {"name": name, "description": description}
59
- except ValueError:
60
- self.fail(
61
- f"User '{value}' is not in the correct format. It should be 'name:password'.",
62
- param,
63
- ctx,
64
- )
65
-
66
-
67
- GROUP = GroupParamType()
68
-
69
-
70
- class RedeemTokenParamType(click.ParamType):
71
- name = "redeem_token"
72
-
73
- def convert(self, value, param, ctx):
74
- if isinstance(value, dict):
75
- assert "user" in value, f"scope is required {value}"
76
- assert "token" in value, f"description is required {value}"
77
- return value
78
-
79
- try:
80
- user, token = value.split(":")
81
- return {"user": user, "token": token}
82
- except ValueError:
83
- self.fail(
84
- f"RedeemToken '{value}' is not in the correct format. It should be 'username:token'.",
85
- param,
86
- ctx,
87
- )
88
-
89
-
90
- TOKEN = RedeemTokenParamType()
91
-
92
-
93
- class ScopeParamType(click.ParamType):
94
- name = "scope"
95
-
96
- def convert(self, value, param, ctx):
97
- if isinstance(value, dict):
98
- assert "scope" in value, f"scope is required {value}"
99
- assert "description" in value, f"description is required {value}"
100
- return value
101
-
102
- try:
103
- name, description = value.split(":")
104
- return {"scope": name, "description": description}
105
- except ValueError:
106
- self.fail(
107
- f"Scopes '{value}' is not in the correct format. It should be 'scope:description'.",
108
- param,
109
- ctx,
110
- )
111
-
112
-
113
- SCOPE = ScopeParamType()
114
-
115
-
116
- @blok(LokService, description="A local sign service")
117
- class LocalSignBlok:
118
- db_name: str
119
-
120
- def __init__(self) -> None:
121
- self.db_name = "lok_db"
122
- self.mount_repo = False
123
- self.build_repo = False
124
- self.private_key = None
125
- self.public_key = None
126
- self.host = "lok"
127
- self.dev = False
128
- self.with_repo = False
129
- self.users = []
130
- self.tokens = []
131
- self.groups = []
132
- self.scopes = {}
133
- self.key = None
134
- self.deployment_name = "default"
135
- self.token_expiry_seconds = 700000
136
- self.preformed_redeem_tokens = [secrets.token_hex(16) for i in range(80)]
137
- self.registered_tokens = {}
138
- self.local_access = None
139
-
140
- def retrieve_credentials(self) -> LokCredentials:
141
- return LokCredentials(
142
- public_key=self.public_key, key_type="RS256", issuer="lok"
143
- )
144
-
145
- def retrieve_labels(self, service_name: str, builder_name: str) -> list[str]:
146
- return [
147
- f"fakts.service={service_name}",
148
- f"fakts.builder={builder_name}",
149
- ]
150
-
151
- def retrieve_token(self, user: str = "admin") -> str:
152
- pass
153
- return "fake-token"
154
-
155
- def register_scopes(self, scopes_dict: Dict[str, str]) -> LokCredentials:
156
- self.scopes = self.scopes | scopes_dict
157
-
158
- def preflight(
159
- self,
160
- init: InitContext
161
- ):
162
- for key, value in init.kwargs.items():
163
- setattr(self, key, value)
164
-
165
- assert self.public_key, "Public key is required"
166
- assert self.private_key, "Private key is required"
167
-
168
-
169
- def build(self, context: ExecutionContext):
170
- context.file_tree.set_nested("secrets", "public_key.pem", self.public_key)
171
- context.file_tree.set_nested("secrets", "private_key.pem", self.private_key)
172
-
173
- def get_options(self):
174
- key = rsa.generate_private_key(
175
- public_exponent=65537, key_size=2048, backend=crypto_default_backend()
176
- )
177
-
178
- private_key = key.private_bytes(
179
- crypto_serialization.Encoding.PEM,
180
- crypto_serialization.PrivateFormat.PKCS8,
181
- crypto_serialization.NoEncryption(),
182
- ).decode()
183
-
184
- public_key = (
185
- key.public_key()
186
- .public_bytes(
187
- crypto_serialization.Encoding.OpenSSH,
188
- crypto_serialization.PublicFormat.OpenSSH,
189
- )
190
- .decode()
191
- )
192
-
193
- with_dev = Option(
194
- subcommand="dev",
195
- help="Run the service in development mode",
196
- type=bool,
197
- default=self.dev,
198
- show_default=True,
199
- )
200
-
201
- with_fakts_url = Option(
202
- subcommand="db_name",
203
- help="The name of the database",
204
- default="db_name",
205
- show_default=True,
206
- )
207
- with_users = Option(
208
- subcommand="users",
209
- help="Users that should be greated by default. Format is name:password",
210
- default=["admin:admin"],
211
- multiple=True,
212
- type=USER,
213
- show_default=True,
214
- )
215
- with_groups = Option(
216
- subcommand="groups",
217
- help="Groups that should be greated by default. Format is name:description",
218
- default=["admin:admin_group"],
219
- multiple=True,
220
- type=GROUP,
221
- show_default=True,
222
- )
223
- with_public_key = Option(
224
- subcommand="public_key",
225
- help="The public key for the JWT creation",
226
- default=public_key,
227
- required=True,
228
- callback=validate_public_key,
229
- )
230
- with_private_key = Option(
231
- subcommand="private_key",
232
- help="The corresponding private key for the JWT creation",
233
- default=private_key,
234
- callback=validate_private_key,
235
- required=True,
236
- )
237
-
238
- return [
239
- with_dev,
240
- with_fakts_url,
241
- with_users,
242
- with_groups,
243
- with_private_key,
244
- with_public_key,
245
- ]
246
-
247
-
248
- def validate_public_key(ctx, param, value):
249
- if not value.startswith("ssh-rsa"):
250
- raise click.BadParameter(
251
- f"Public key must be in ssh-rsa format. Started with {value}"
252
- )
253
- return value
254
-
255
-
256
- def validate_private_key(ctx, param, value):
257
- if not value.startswith("-----BEGIN PRIVATE KEY-----"):
258
- raise click.BadParameter(
259
- f"Private key must be in PEM format. Started with {value}"
260
- )
261
- return value