python-codex 0.5.2__py3-none-any.whl → 0.6.0__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.
Files changed (71) hide show
  1. pycodex/__init__.py +18 -8
  2. pycodex/agent.py +89 -74
  3. pycodex/bootstrap.py +27 -239
  4. pycodex/cli.py +19 -14
  5. pycodex/config.py +36 -0
  6. pycodex/context.py +369 -51
  7. pycodex/events.py +13 -186
  8. pycodex/model.py +181 -88
  9. pycodex/multi_agents.py +401 -0
  10. pycodex/portable/__init__.py +8 -6
  11. pycodex/portable/client.py +24 -39
  12. pycodex/portable/protocol.py +28 -0
  13. pycodex/portable/server.py +3 -3
  14. pycodex/prompts/developer_messages.json +13 -0
  15. pycodex/prompts/goals/budget_limit.md +19 -0
  16. pycodex/prompts/goals/continuation.md +56 -0
  17. pycodex/prompts/models.json +1069 -140
  18. pycodex/protocol.py +78 -15
  19. pycodex/runtime.py +370 -226
  20. pycodex/tools/__init__.py +100 -7
  21. pycodex/tools/agent_tool_schemas.py +0 -38
  22. pycodex/tools/apply_patch_tool.py +17 -34
  23. pycodex/tools/base_tool.py +63 -35
  24. pycodex/tools/clock_manager.py +182 -0
  25. pycodex/tools/clock_tool.py +2 -181
  26. pycodex/tools/code_mode_manager.py +165 -246
  27. pycodex/tools/exec_command_tool.py +0 -18
  28. pycodex/tools/exec_runtime.py +381 -0
  29. pycodex/tools/exec_tool.py +78 -31
  30. pycodex/tools/followup_task_tool.py +44 -0
  31. pycodex/tools/goal_manager.py +205 -0
  32. pycodex/tools/goal_tool.py +126 -0
  33. pycodex/tools/interrupt_agent_tool.py +48 -0
  34. pycodex/tools/list_agents_tool.py +66 -0
  35. pycodex/tools/python_tool_schema.py +141 -0
  36. pycodex/tools/request_permissions_tool.py +1 -0
  37. pycodex/tools/request_user_input_tool.py +3 -23
  38. pycodex/tools/runtime_services.py +122 -450
  39. pycodex/tools/send_message_tool.py +42 -0
  40. pycodex/tools/spawn_agent_tool.py +55 -94
  41. pycodex/tools/unified_exec_manager.py +26 -35
  42. pycodex/tools/wait_agent_tool.py +46 -66
  43. pycodex/tools/wait_tool.py +24 -13
  44. pycodex/tools/web_search_tool.py +1 -0
  45. pycodex/utils/codex_config.py +105 -0
  46. pycodex/utils/compactor.py +4 -0
  47. pycodex/utils/compat.py +2 -2
  48. pycodex/utils/doctor.py +5 -4
  49. pycodex/utils/event_helpers.py +143 -13
  50. pycodex/utils/history.py +33 -0
  51. pycodex/utils/session_persist.py +78 -36
  52. {python_codex-0.5.2.dist-info → python_codex-0.6.0.dist-info}/METADATA +117 -27
  53. python_codex-0.6.0.dist-info/RECORD +106 -0
  54. responses_server/__init__.py +2 -0
  55. responses_server/app.py +7 -6
  56. responses_server/config.py +0 -11
  57. responses_server/payload_processors.py +4 -4
  58. responses_server/request_translation.py +480 -0
  59. responses_server/server.py +31 -24
  60. responses_server/stream_events.py +124 -0
  61. responses_server/stream_router.py +33 -830
  62. responses_server/tools/custom_adapter.py +29 -29
  63. responses_server/transport.py +332 -0
  64. pycodex/tools/close_agent_tool.py +0 -60
  65. pycodex/tools/exec_runtime.js +0 -161
  66. pycodex/tools/resume_agent_tool.py +0 -54
  67. pycodex/tools/send_input_tool.py +0 -110
  68. python_codex-0.5.2.dist-info/RECORD +0 -90
  69. {python_codex-0.5.2.dist-info → python_codex-0.6.0.dist-info}/WHEEL +0 -0
  70. {python_codex-0.5.2.dist-info → python_codex-0.6.0.dist-info}/entry_points.txt +0 -0
  71. {python_codex-0.5.2.dist-info → python_codex-0.6.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,110 +0,0 @@
1
- """`send_input` tool for the Python Codex prototype.
2
-
3
- Original Codex mapping:
4
- - Corresponds to the original Codex `send_input` collaboration tool.
5
-
6
- Expected behavior:
7
- - Send a follow-up message to an existing spawned agent.
8
- - Optionally interrupt the agent's current turn before queueing the new input.
9
- - Return the submission id for the queued input.
10
- """
11
-
12
- import typing
13
-
14
- from ..protocol import JSONDict, JSONValue
15
- from .agent_tool_schemas import COLLAB_INPUT_ITEMS_SCHEMA
16
- from .base_tool import BaseTool, ToolContext
17
- from .runtime_services import SubAgentManager
18
-
19
- SEND_INPUT_OUTPUT_SCHEMA = {
20
- "type": "object",
21
- "properties": {
22
- "submission_id": {
23
- "type": "string",
24
- "description": "Identifier for the queued input submission.",
25
- }
26
- },
27
- "required": ["submission_id"],
28
- "additionalProperties": False,
29
- }
30
-
31
-
32
- class SendInputTool(BaseTool):
33
- name = "send_input"
34
- description = (
35
- "Send a message to an existing agent. Use interrupt=true to redirect "
36
- "work immediately. You should reuse the agent by send_input if you "
37
- "believe your assigned task is highly dependent on the context of a "
38
- "previous task."
39
- )
40
- input_schema = {
41
- "type": "object",
42
- "properties": {
43
- "id": {
44
- "type": "string",
45
- "description": "Agent id to message (from spawn_agent).",
46
- },
47
- "message": {
48
- "type": "string",
49
- "description": "Legacy plain-text message to send to the agent. Use either message or items.",
50
- },
51
- "items": COLLAB_INPUT_ITEMS_SCHEMA,
52
- "interrupt": {
53
- "type": "boolean",
54
- "description": "True interrupts the current task and handles this message immediately; false or omitted queues it.",
55
- },
56
- },
57
- "required": ["id"],
58
- "additionalProperties": False,
59
- }
60
- output_schema = SEND_INPUT_OUTPUT_SCHEMA
61
- supports_parallel = False
62
-
63
- def __init__(self, subagent_manager: "SubAgentManager") -> "None":
64
- self._subagent_manager = subagent_manager
65
-
66
- async def run(self, context: "ToolContext", args: "JSONDict") -> "JSONValue":
67
- del context
68
- agent_id = str(args.get("id", "")).strip()
69
- if not agent_id:
70
- return "Error: `id` is required."
71
- items = args.get("items")
72
- if items is not None and not isinstance(items, list):
73
- return "Error: `items` must be a list when provided."
74
- prompt_text = self._compose_prompt(
75
- self._optional_string(args, "message"),
76
- items,
77
- )
78
- if not prompt_text:
79
- return "Error: `message` or `items` is required."
80
- return await self._subagent_manager.send_input(
81
- agent_id,
82
- prompt_text,
83
- interrupt=bool(args.get("interrupt", False)),
84
- )
85
-
86
- def _compose_prompt(
87
- self,
88
- message: "typing.Union[str, None]",
89
- items: "typing.Union[typing.List[typing.Dict[str, object]], None]",
90
- ) -> "str":
91
- parts: "typing.List[str]" = []
92
- if message:
93
- parts.append(message.strip())
94
- for item in items or []:
95
- item_type = str(item.get("type", ""))
96
- if item_type == "text":
97
- text = str(item.get("text", "")).strip()
98
- if text:
99
- parts.append(text)
100
- else:
101
- parts.append(str(item))
102
- return "\n\n".join(part for part in parts if part)
103
-
104
- def _optional_string(
105
- self, args: "JSONDict", key: "str"
106
- ) -> "typing.Union[str, None]":
107
- value = args.get(key)
108
- if value in (None, ""):
109
- return None
110
- return str(value)
@@ -1,90 +0,0 @@
1
- pycodex/__init__.py,sha256=fHEyhylULeRo-5xEnl-UxT5ZpBzbFzRW7vLwdy_7oxU,2660
2
- pycodex/__main__.py,sha256=MHKZ_ae3fSLGTLUUMOx15fWdeOnJSHhq-zslRP5F5Lc,79
3
- pycodex/agent.py,sha256=n37WeYIEZXahhHSv4fXc5wR5PF1SLuTn5LNl5Zwcogo,21863
4
- pycodex/bootstrap.py,sha256=wUNipqvIPzJlcP3PTY0cCyPH_QTeIbSR8xtyw4AEP6Y,12282
5
- pycodex/cli.py,sha256=uCrRARI2IypIU-1aC0Y2DLzhzYGWQta1f7zYWsyaNnU,12797
6
- pycodex/context.py,sha256=8P3fBXbwzTKmoXGDdkzTsAghfOkAZstJnMTqr-cxHyI,27019
7
- pycodex/events.py,sha256=U_yk25C-ZqNbDl59w6gtM70oAgr6wq56HsAR23CSyuU,30588
8
- pycodex/model.py,sha256=KmSO-k_QkOm5qCgkVk9gibvyyiU6-tImZY-PUcX5S6I,54043
9
- pycodex/protocol.py,sha256=uzUz_06iA4m9vAoqZeCGiJ4SocKZDzOfCJUU4Bpt5dI,12033
10
- pycodex/runtime.py,sha256=CoYkscTyW6WGOm78HSkzHDex2y96RXrQ-6c6lHJSzv8,30045
11
- pycodex/portable/__init__.py,sha256=FmspRPmblYuZIVXMpXaxE1uosCaz2hZDpkpOzxDJQic,1084
12
- pycodex/portable/client.py,sha256=DOxzZljVfN1ynmhqrChX7NsT1IFSFVKzEn1J3wvV3XQ,16038
13
- pycodex/portable/server.py,sha256=w4YD71Sxb7MD5q57GPuIgx7AoicTv0R9xzX2kAaibPA,7503
14
- pycodex/prompts/default_base_instructions.md,sha256=D65mcj6bo4CDvVom-D9cbJRJVNquo0NghKt164_fRsg,20923
15
- pycodex/prompts/models.json,sha256=u-bS5xtI7ZHbrG_nbzrt-xmp5RtQT6YL8PHbd_4XZB4,397650
16
- pycodex/prompts/permissions/approval_policy/never.md,sha256=QceTG6wjkaJARjYr0HYV1aPnPcpGcrkRUW-smWRr6MQ,120
17
- pycodex/prompts/permissions/approval_policy/on_failure.md,sha256=dfJjpXkpO6_ANdCKxbVJ8o4vyLxevrJWfKsGHTqtbkc,289
18
- pycodex/prompts/permissions/approval_policy/on_request.md,sha256=hVQalzh0FAdkKzw5u-N4H7-LtC9ijVDlYsh3OKsZKzo,3661
19
- pycodex/prompts/permissions/approval_policy/on_request_rule_request_permission.md,sha256=mOinishp1k-wlPsaEuIOMn5GoVm_dAIsWIuEMmv2r7o,1725
20
- pycodex/prompts/permissions/approval_policy/unless_trusted.md,sha256=XHpi1Lfx1iIXFbbQ_ho_kGstA3JN-RLho291HM30UNw,247
21
- pycodex/prompts/permissions/sandbox_mode/danger_full_access.md,sha256=nZ7YHacBd3cAHKRZc9XClOOOnXJPXPh0WFBueh5C2D0,197
22
- pycodex/prompts/permissions/sandbox_mode/read_only.md,sha256=2rAPEXsBYCcuttI5j3euS-3uv_v97catIsnhxlSQSIM,173
23
- pycodex/prompts/permissions/sandbox_mode/workspace_write.md,sha256=lVN-LwrBbHqlv5yVjcd_mU8tzZW8jfKpTatJKIZu9HI,277
24
- pycodex/tools/__init__.py,sha256=UYwmsX_Ckw_YaYQ6TYhUU6w5pxi2qzZoTrq6BAgNErM,1857
25
- pycodex/tools/agent_tool_schemas.py,sha256=8cL9ml4So0H6IIeK0ZzjAo9bk3VeprDOSYPpIamOqEU,2048
26
- pycodex/tools/apply_patch_tool.py,sha256=n30M-ofZlOkDCC18nX10MPF5FLROiURACFLG1hd4FK8,13906
27
- pycodex/tools/base_tool.py,sha256=paBph9XemCWm2tPBHFUSBcjB9i1BqKeQIJi04OC1-BY,6809
28
- pycodex/tools/clock_tool.py,sha256=D1uON_F_oXSQka1C2VOC7Hgs7Pvfc5C7-37gRugSbdI,7899
29
- pycodex/tools/close_agent_tool.py,sha256=uIbCjsQx9MLkjVYheS8ZVf5VVPbC6Iviwox4pneJpmI,2030
30
- pycodex/tools/code_mode_manager.py,sha256=oEzYkebFdgX993NBC0A4R0mthg4qdhJ-dD0fgeE3III,18948
31
- pycodex/tools/exec_command_tool.py,sha256=Shv9WMUP-ZGk11C7EMqUl1pr_nAH831iKNx3RTCLPYA,4620
32
- pycodex/tools/exec_runtime.js,sha256=DR1uocKailTqNWAcJNFJuQgFFMSUzTpT_uQsRaneg2s,3643
33
- pycodex/tools/exec_tool.py,sha256=tuC21rlhP8CPSYml4XnSDSRV0UPGkQ6aHj0DLIoOOvM,2274
34
- pycodex/tools/grep_files_tool.py,sha256=KCBVNaSTU45ND-iAhh14YawMyjQnMRZnGI1NGKL3zgg,4809
35
- pycodex/tools/list_dir_tool.py,sha256=_U6ouRcVbGHT5mChVyUsiMgDGrFK7EFMFaspPLAHtH8,5337
36
- pycodex/tools/read_file_tool.py,sha256=YK__uhIVldBjAQega5S_ZuZU5jgP_kLOwr-YhjAmRo4,9735
37
- pycodex/tools/request_permissions_tool.py,sha256=nEt3_uw3lmFXyydqcN3PxuKwrEvaRPtfjA_U8nikCtU,3978
38
- pycodex/tools/request_user_input_tool.py,sha256=_7siHF2p3KiNDFwsTqKKIUw2kPCXMzLaR12PkZ1wdIQ,4050
39
- pycodex/tools/resume_agent_tool.py,sha256=bZvXEUNdc1RVD2N5Msjv63Rni62FQk4gj9LAXK1Vsy8,1613
40
- pycodex/tools/runtime_services.py,sha256=mk4J06htubwStgxBJeHLQi64W5uVNkMamhgvqTCMxe4,17496
41
- pycodex/tools/send_input_tool.py,sha256=w63SKM05_e3oXvdaBtL-hk941TvkWKuTUDEqTSyWEMQ,3761
42
- pycodex/tools/shell_command_tool.py,sha256=bJKlTdIs2i28vH5f4GZfpunezr6JNicRzsL_6Vc3HvU,3675
43
- pycodex/tools/shell_tool.py,sha256=I6lYLABSmLddRrNmpk0Li83AV55MI8x0bckWaRkFGI0,3527
44
- pycodex/tools/spawn_agent_tool.py,sha256=Jx5jYpxsH_CQ3BLkXYPZuIINW5deO_zY8tyw8kZpreY,6208
45
- pycodex/tools/unified_exec_manager.py,sha256=KKmWbJc24tXabbQQPac2Go7yezV3eZSPQqIMauWtZOA,14934
46
- pycodex/tools/update_plan_tool.py,sha256=xwrSrerw5qfkbFc9Ltx1OZEmD__CWtryOy3UhL0-Jp4,3198
47
- pycodex/tools/view_image_tool.py,sha256=H7OP-QZEU5Gf-E4YnQbXfu2hDkL5-dJ3Apla2YYjErQ,3754
48
- pycodex/tools/wait_agent_tool.py,sha256=pLsnk9TxSt4v7krC7s7vxi91pLisSNU0lATt9s-P_3E,3134
49
- pycodex/tools/wait_tool.py,sha256=0_OO_DvMsBhG3oDKZePTOjZTBq1lmWntXAzqIqvebdA,3206
50
- pycodex/tools/web_search_tool.py,sha256=3ao1IvJw7MwcP35UKLbqrM-nlm5Z-UUFVdEzkJYOV1o,988
51
- pycodex/tools/write_stdin_tool.py,sha256=jvBDchLLmoDITd7g-ZVeEVXHRhWKkmnjM5laL-53FOM,3609
52
- pycodex/utils/__init__.py,sha256=ih_KyZ2_bajR5YlZ1QMTWOHnuEBda-S3gQ7PwnBtLZQ,453
53
- pycodex/utils/async_bridge.py,sha256=BXsKTUTUvUtPJnItQlulFRdV7opdKKDlsKLdtVTYshs,1732
54
- pycodex/utils/compactor.py,sha256=0tlszw1n54aMEGH6sL1U1dEgFSU5ioYL2NI5uSvHSiM,6119
55
- pycodex/utils/compat.py,sha256=QxcI4AQuUD-gE2494qPGezgm0OIX98qSHdAiof1JrlU,3550
56
- pycodex/utils/crypto.py,sha256=HRCXF26Ft3S8CG2X0YpZwa8GMU9YJ0Loo8Q9PMPMcNw,1249
57
- pycodex/utils/debug.py,sha256=5XMpWpwFSm6woyx6RGXvN2qL0afRtTQbwlOAv-LotTw,913
58
- pycodex/utils/doctor.py,sha256=fI66oQqB5zNL7aEpFbiHnzhELyp9XydwMyAGznw5YSE,10616
59
- pycodex/utils/dotenv.py,sha256=h7ZgvqpEswetqjhtwfiaHyokAHwNKPakizTAHPHz5Ds,1865
60
- pycodex/utils/event_helpers.py,sha256=ar4WoIkpiShoayN_GZlnDijy74CC2Z8_5p76EryduNk,6517
61
- pycodex/utils/get_env.py,sha256=L4S8h84tkgxZKvrxY7ezTgePbXepG-yIigUTKeY6uuE,6094
62
- pycodex/utils/image_utils.py,sha256=OUzUs0Cow4L8Z2np0EBeEUotAqqsCmRmhrV8AxZUXRw,2460
63
- pycodex/utils/model_metadata.py,sha256=uK3iI4yC7Ge7yN4I1_gQYalQ4MYKddz2qMwsmQb-P80,1337
64
- pycodex/utils/random_ids.py,sha256=jLTxZZ0MBbRdQOFDFWGVRjWzIo6FKSQ5ADXbQSLPp1s,379
65
- pycodex/utils/session_persist.py,sha256=ceCJjg_spDzf3E8UMetlPnMPqy3wZmvqY3E0JwaotO8,25298
66
- pycodex/utils/truncation.py,sha256=5D6vAorT8EgXgjd7ASwtraAyIZdlCR-w5jKZqJxDzho,5446
67
- pycodex/utils/_aes_gcm/LICENSE,sha256=KvdHagY3sYIK34GldJaRi34sNnGwMVJIIoDhbC9MRu8,2805
68
- pycodex/utils/_aes_gcm/README.md,sha256=D9XGeewCgU2PVqJCO6WusUs0Mw2FbMnABCqaVktqCnE,3045
69
- pycodex/utils/_aes_gcm/__init__.py,sha256=p0U1CVy6dQBDAfGvSYG0opn6iP2VGF5rqUUM-mNLJxU,70
70
- pycodex/utils/_aes_gcm/aes.py,sha256=12p_5O7gX-e-LQ08nNe2CBdP_H4eX3J84LlXaVr9i8A,9269
71
- pycodex/utils/_aes_gcm/gcm.py,sha256=Z8fYHpnLpqJyTPmjDOZtryqe0xmT_93vscNuJe5ZY-w,2762
72
- pycodex/utils/_aes_gcm/source-sha256.json,sha256=g9uPWXuA0D9Wq9EGnduyiVanTgi8QWRFW-9T69FG-fc,215
73
- responses_server/__init__.py,sha256=sx9C88YWqmehASZy24FUMqT14A36doM_rj0MIZtQ9iQ,377
74
- responses_server/__main__.py,sha256=876xZTqhPeDBD2GKKr8pKX33Af8PhFTosAI8bYQsFgQ,61
75
- responses_server/app.py,sha256=PE-jWn_hmL5os1xsVL81KwU0kDZHOkZoVdSOK-7x3xQ,8400
76
- responses_server/config.py,sha256=sCJYGisPHW9Uup26-R9Zv0o9W_kRVt-ETc2MFCVjG90,2795
77
- responses_server/messages_api.py,sha256=ialAYTMmN0y-uxQB3Y51ukq-kvkSVO84WVLXaqLsKw0,18775
78
- responses_server/payload_processors.py,sha256=dqPwqHD-FhyiIwjzFEMf2wCtQDxkRyerZzbdqnH1aDE,3561
79
- responses_server/server.py,sha256=k4DbsOYkaHHcy38uF9u_QXahJC1cplKsTu-MdC3DCIs,2286
80
- responses_server/session_store.py,sha256=nwGxQL6nUVKnDVeDHz8IzqNQ7dWk8Ybf0URekOHdxTo,1133
81
- responses_server/stream_router.py,sha256=TQX2-8uOGad3TBJnRu9SOtDaHBHjYwE-WERYz6rcuo8,46274
82
- responses_server/trajectory_dump.py,sha256=5_Wy6tslszrqx3j1JeP_boyTbzIicKy8No84PzMnmHk,5111
83
- responses_server/tools/__init__.py,sha256=ivsBSEy0SBUhY-Uea5v1XMLXShkwHdCVl0id-1FwdZg,150
84
- responses_server/tools/custom_adapter.py,sha256=SnIiNUdomff3APtTriURAC9YCeEdhCDjzGMEYusfUdk,8340
85
- responses_server/tools/web_search.py,sha256=pnKH9JyTScRehWpZS3HpXRvjWsQvC0QZqxjEOCT4ndg,8936
86
- python_codex-0.5.2.dist-info/METADATA,sha256=fKnCsLh7iHfZnQlTzJKqyoPMf0LsUyR7N0UZ6D0aZQo,11014
87
- python_codex-0.5.2.dist-info/WHEEL,sha256=KGYbc1zXlYddvwxnNty23BeaKzh7YuoSIvIMO4jEhvw,87
88
- python_codex-0.5.2.dist-info/entry_points.txt,sha256=sNUVakoVuTrzJH505ZgRTQxmtRRPUHV_EH0i6EbYTyM,45
89
- python_codex-0.5.2.dist-info/licenses/LICENSE,sha256=0X8ifk312hYAORM4hlzg8wVSEXYKNmiPgWlB1YIy2Nw,10926
90
- python_codex-0.5.2.dist-info/RECORD,,