FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
claw-code/src/execution_registry.py at main · STELIORD/claw-code · GitHub
STELIORD
claw-code
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
claw-code
/
src
/
execution_registry.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
51 lines (37 loc) · 1.37 KB
Breadcrumbs
claw-code
/
src
/
execution_registry.py
Copy path
File metadata and controls
51 lines (37 loc) · 1.37 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from
__future__
import
annotations
from
dataclasses
import
dataclass
from
.
commands
import
PORTED_COMMANDS
,
execute_command
from
.
tools
import
PORTED_TOOLS
,
execute_tool
@
dataclass
(
frozen
=
True
)
class
MirroredCommand
:
name
:
str
source_hint
:
str
def
execute
(
self
,
prompt
:
str
)
->
str
:
return
execute_command
(
self
.
name
,
prompt
).
message
@
dataclass
(
frozen
=
True
)
class
MirroredTool
:
name
:
str
source_hint
:
str
def
execute
(
self
,
payload
:
str
)
->
str
:
return
execute_tool
(
self
.
name
,
payload
).
message
@
dataclass
(
frozen
=
True
)
class
ExecutionRegistry
:
commands
:
tuple
[
MirroredCommand
, ...]
tools
:
tuple
[
MirroredTool
, ...]
def
command
(
self
,
name
:
str
)
->
MirroredCommand
|
None
:
lowered
=
name
.
lower
()
for
command
in
self
.
commands
:
if
command
.
name
.
lower
()
==
lowered
:
return
command
return
None
def
tool
(
self
,
name
:
str
)
->
MirroredTool
|
None
:
lowered
=
name
.
lower
()
for
tool
in
self
.
tools
:
if
tool
.
name
.
lower
()
==
lowered
:
return
tool
return
None
def
build_execution_registry
()
->
ExecutionRegistry
:
return
ExecutionRegistry
(
commands
=
tuple
(
MirroredCommand
(
module
.
name
,
module
.
source_hint
)
for
module
in
PORTED_COMMANDS
),
tools
=
tuple
(
MirroredTool
(
module
.
name
,
module
.
source_hint
)
for
module
in
PORTED_TOOLS
),
)
Back
|
FazBrowse Home
|
New Git URL