Skip to content

Commit 538b6c4

Browse files
committed
naming
1 parent 899bbaa commit 538b6c4

2 files changed

Lines changed: 46 additions & 78 deletions

File tree

flexus_simple_bots/integration_tester/integration_tester_bot.py

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
import asyncio
22
import json
33
import logging
4-
import sys
54
from pathlib import Path
65
from typing import Any, Dict, List, Callable, Awaitable
76

8-
_repo_root = Path(__file__).parents[2]
9-
if str(_repo_root) not in sys.path:
10-
sys.path.insert(0, str(_repo_root))
11-
127
from flexus_client_kit import ckit_bot_exec, ckit_client, ckit_shutdown
138
from flexus_client_kit import ckit_bot_version
14-
from flexus_client_kit import ckit_cloudtool, ckit_integrations_db
9+
from flexus_client_kit import ckit_cloudtool, ckit_integrations_db, ckit_skills
10+
from flexus_client_kit.integrations import fi_resend
1511

16-
logger = logging.getLogger("integration_tester")
12+
logger = logging.getLogger("bot_integration_tester")
1713

1814
INTEGRATION_TESTER_ROOTDIR = Path(__file__).parent
15+
INTEGRATION_TESTER_SKILLS: list[str] = ckit_skills.static_skills_find(INTEGRATION_TESTER_ROOTDIR, shared_skills_allowlist="", integration_skills_allowlist="")
1916

20-
PLAN_BATCHES_TOOL = ckit_cloudtool.CloudTool(
17+
INTEGRATION_TESTER_PLAN_BATCHES_TOOL = ckit_cloudtool.CloudTool(
2118
strict=True,
2219
name="integration_plan_batches",
2320
description="Plan integration tests one by one and return task specs for kanban fan-out.",
@@ -47,12 +44,14 @@
4744
"airtable",
4845
"hubspot",
4946
"twilio",
47+
"resend",
48+
"newsapi",
5049
"skills",
5150
],
52-
builtin_skills=[],
51+
builtin_skills=INTEGRATION_TESTER_SKILLS,
5352
)
5453

55-
TOOLS = [PLAN_BATCHES_TOOL] + [t for rec in INTEGRATION_TESTER_INTEGRATIONS for t in rec.integr_tools]
54+
TOOLS = [INTEGRATION_TESTER_PLAN_BATCHES_TOOL] + [t for rec in INTEGRATION_TESTER_INTEGRATIONS for t in rec.integr_tools]
5655

5756

5857
def _requested_names(raw: str) -> List[str]:
@@ -145,15 +144,14 @@ async def wrapper(toolcall: ckit_cloudtool.FCloudtoolCall, model_produced_args:
145144

146145

147146
BOT_NAME = ckit_bot_version.bot_name_from_file(__file__)
148-
BOT_VERSION = (Path(__file__).parents[1] / "VERSION").read_text().strip()
149-
SETUP_SCHEMA = json.loads((Path(__file__).parent / "setup_schema.json").read_text())
147+
INTEGRATION_TESTER_SETUP_SCHEMA = json.loads((Path(__file__).parent / "setup_schema.json").read_text()) + fi_resend.RESEND_SETUP_SCHEMA
150148

151149

152150
async def integration_tester_main_loop(
153151
fclient: ckit_client.FlexusClient,
154152
rcx: ckit_bot_exec.RobotContext,
155153
) -> None:
156-
setup = ckit_bot_exec.official_setup_mixing_procedure(SETUP_SCHEMA, rcx.persona.persona_setup)
154+
setup = ckit_bot_exec.official_setup_mixing_procedure(INTEGRATION_TESTER_SETUP_SCHEMA, rcx.persona.persona_setup)
157155

158156
integr_objects = await ckit_integrations_db.main_loop_integrations_init(INTEGRATION_TESTER_INTEGRATIONS, rcx, setup)
159157
supported_integrations = sorted({r.integr_name for r in INTEGRATION_TESTER_INTEGRATIONS})
@@ -170,7 +168,7 @@ async def integration_tester_main_loop(
170168
)
171169
)
172170

173-
@rcx.on_tool_call(PLAN_BATCHES_TOOL.name)
171+
@rcx.on_tool_call(INTEGRATION_TESTER_PLAN_BATCHES_TOOL.name)
174172
async def toolcall_plan_batches(toolcall, model_produced_args):
175173
args = model_produced_args or {}
176174
req = _requested_names(str(args.get("requested", "all")))
@@ -226,29 +224,18 @@ async def toolcall_plan_batches(toolcall, model_produced_args):
226224
def main():
227225
from flexus_simple_bots.integration_tester import integration_tester_install
228226
scenario_fn = ckit_bot_exec.parse_bot_args()
227+
bot_version = ckit_bot_version.read_version_file(__file__)
229228
fclient = ckit_client.FlexusClient(
230-
ckit_client.bot_service_name(BOT_NAME, BOT_VERSION),
229+
ckit_client.bot_service_name(BOT_NAME, bot_version),
231230
endpoint="/v1/jailed-bot",
232231
)
233232

234-
from dotenv import load_dotenv
235-
load_dotenv()
236-
237-
async def _install_compat(client: ckit_client.FlexusClient) -> int:
238-
await integration_tester_install.install(
239-
client,
240-
bot_name=BOT_NAME,
241-
bot_version=BOT_VERSION,
242-
tools=TOOLS,
243-
)
244-
return 0
245-
246233
asyncio.run(ckit_bot_exec.run_bots_in_this_group(
247234
fclient,
248235
bot_main_loop=integration_tester_main_loop,
249236
inprocess_tools=TOOLS,
250237
scenario_fn=scenario_fn,
251-
install_func=_install_compat,
238+
install_func=integration_tester_install.install,
252239
))
253240

254241

flexus_simple_bots/integration_tester/integration_tester_install.py

Lines changed: 31 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,34 @@
11
import asyncio
2-
import json
32
import logging
4-
from typing import List
53

64
from flexus_client_kit import ckit_client, ckit_bot_install, ckit_cloudtool, ckit_integrations_db, ckit_skills
75
from flexus_simple_bots import prompts_common
86
from flexus_simple_bots.integration_tester import integration_tester_bot
97
from flexus_simple_bots.integration_tester import integration_tester_prompts
108

11-
logger = logging.getLogger("integration_tester")
12-
13-
INTEGRATION_TESTER_SKILLS = ckit_skills.static_skills_find(integration_tester_bot.INTEGRATION_TESTER_ROOTDIR, shared_skills_allowlist="", integration_skills_allowlist="")
14-
15-
16-
def _build_experts(tools):
17-
builtin_skills = ckit_skills.read_name_description(integration_tester_bot.INTEGRATION_TESTER_ROOTDIR, INTEGRATION_TESTER_SKILLS)
18-
tool_names = {t.name for rec in integration_tester_bot.INTEGRATION_TESTER_INTEGRATIONS for t in rec.integr_tools}
19-
tool_names.add(integration_tester_bot.PLAN_BATCHES_TOOL.name)
20-
allow_tools = ",".join(tool_names | ckit_cloudtool.KANBAN_ADVANCED | {"flexus_hand_over_task"})
21-
22-
return [
23-
("default", ckit_bot_install.FMarketplaceExpertInput(
24-
fexp_system_prompt=integration_tester_prompts.DEFAULT_PROMPT,
25-
fexp_python_kernel="",
26-
fexp_allow_tools=allow_tools,
27-
fexp_nature="NATURE_INTERACTIVE",
28-
fexp_builtin_skills=builtin_skills,
29-
fexp_description="Test API key integrations",
30-
)),
31-
("autonomous", ckit_bot_install.FMarketplaceExpertInput(
32-
fexp_system_prompt=integration_tester_prompts.AUTONOMOUS_PROMPT,
33-
fexp_python_kernel="",
34-
fexp_allow_tools=allow_tools,
35-
fexp_nature="NATURE_AUTONOMOUS",
36-
fexp_inactivity_timeout=600,
37-
fexp_builtin_skills=builtin_skills,
38-
fexp_description="Autonomous integration testing",
39-
)),
40-
]
41-
9+
logger = logging.getLogger("bot_integration_tester")
10+
11+
TOOL_NAMESET = {t.name for t in integration_tester_bot.TOOLS}
12+
13+
EXPERTS = [
14+
("default", ckit_bot_install.FMarketplaceExpertInput(
15+
fexp_system_prompt=integration_tester_prompts.DEFAULT_PROMPT,
16+
fexp_python_kernel="",
17+
fexp_allow_tools=",".join(TOOL_NAMESET | ckit_cloudtool.KANBAN_ADVANCED | {"flexus_hand_over_task"}),
18+
fexp_nature="NATURE_INTERACTIVE",
19+
fexp_builtin_skills=ckit_skills.read_name_description(integration_tester_bot.INTEGRATION_TESTER_ROOTDIR, integration_tester_bot.INTEGRATION_TESTER_SKILLS),
20+
fexp_description="Test API key integrations",
21+
)),
22+
("autonomous", ckit_bot_install.FMarketplaceExpertInput(
23+
fexp_system_prompt=integration_tester_prompts.AUTONOMOUS_PROMPT,
24+
fexp_python_kernel="",
25+
fexp_allow_tools=",".join(TOOL_NAMESET | ckit_cloudtool.KANBAN_ADVANCED | {"flexus_hand_over_task"}),
26+
fexp_nature="NATURE_AUTONOMOUS",
27+
fexp_inactivity_timeout=600,
28+
fexp_builtin_skills=ckit_skills.read_name_description(integration_tester_bot.INTEGRATION_TESTER_ROOTDIR, integration_tester_bot.INTEGRATION_TESTER_SKILLS),
29+
fexp_description="Autonomous integration testing",
30+
)),
31+
]
4232

4333
INTEGRATION_TESTER_DESC = """
4434
**Job description**
@@ -77,19 +67,9 @@ def _ensure_marketplace_images() -> None:
7767
pic_small_path.write_bytes(fallback_small_path.read_bytes())
7868

7969

80-
async def install(
81-
client: ckit_client.FlexusClient,
82-
bot_name: str,
83-
bot_version: str,
84-
tools: List[ckit_cloudtool.CloudTool],
85-
):
86-
setup_schema_path = integration_tester_bot.INTEGRATION_TESTER_ROOTDIR / "setup_schema.json"
87-
integration_tester_setup_default = json.loads(setup_schema_path.read_text())
88-
70+
async def install(client: ckit_client.FlexusClient):
8971
_ensure_marketplace_images()
9072

91-
experts = _build_experts(tools)
92-
9373
await ckit_bot_install.marketplace_upsert_dev_bot(
9474
client,
9575
ws_id=client.ws_id,
@@ -109,7 +89,7 @@ async def install(
10989
},
11090
prompts_common.SCHED_TODO_5M | {"sched_when": "EVERY:1m", "sched_fexp_name": "autonomous"},
11191
],
112-
marketable_setup_default=integration_tester_setup_default,
92+
marketable_setup_default=integration_tester_bot.INTEGRATION_TESTER_SETUP_SCHEMA,
11393
marketable_featured_actions=[
11494
{"feat_question": "Test all integrations", "feat_expert": "default"},
11595
{"feat_question": "Test gmail", "feat_expert": "default"},
@@ -120,11 +100,13 @@ async def install(
120100
{"feat_question": "Test airtable", "feat_expert": "default"},
121101
{"feat_question": "Test hubspot", "feat_expert": "default"},
122102
{"feat_question": "Test twilio", "feat_expert": "default"},
103+
{"feat_question": "Test resend", "feat_expert": "default"},
104+
{"feat_question": "Test newsapi", "feat_expert": "default"},
123105
],
124106
marketable_intro_message="Hi! I'm Integration Tester. I create deterministic kanban batch tasks and resolve them autonomously.",
125107
marketable_preferred_model_expensive="gpt-5.4-mini",
126108
marketable_preferred_model_cheap="gpt-5.4-mini",
127-
marketable_experts=[(name, exp.filter_tools(tools)) for name, exp in experts],
109+
marketable_experts=[(name, exp.filter_tools(integration_tester_bot.TOOLS)) for name, exp in EXPERTS],
128110
add_integrations_into_expert_system_prompt=integration_tester_bot.INTEGRATION_TESTER_INTEGRATIONS,
129111
marketable_tags=["testing", "integrations", "qa"],
130112
marketable_forms=ckit_bot_install.load_form_bundles(__file__),
@@ -140,6 +122,8 @@ async def install(
140122
"slack",
141123
"telegram",
142124
"twilio_manual",
125+
"resend",
126+
"newsapi",
143127
],
144128
marketable_auth_scopes={
145129
"gmail": ckit_integrations_db.GOOGLE_OAUTH_BASE_SCOPES + [
@@ -171,8 +155,5 @@ async def install(
171155

172156

173157
if __name__ == "__main__":
174-
from dotenv import load_dotenv
175-
load_dotenv()
176-
177158
client = ckit_client.FlexusClient("integration_tester_install")
178-
asyncio.run(install(client, bot_name="integration_tester", bot_version="dev", tools=integration_tester_bot.TOOLS))
159+
asyncio.run(install(client))

0 commit comments

Comments
 (0)