optio-codex 0.4.2__tar.gz → 0.4.3__tar.gz
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.
- {optio_codex-0.4.2 → optio_codex-0.4.3}/PKG-INFO +1 -1
- {optio_codex-0.4.2 → optio_codex-0.4.3}/pyproject.toml +1 -1
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/session.py +17 -1
- optio_codex-0.4.3/src/optio_codex/todos.py +35 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex.egg-info/PKG-INFO +1 -1
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex.egg-info/SOURCES.txt +2 -0
- optio_codex-0.4.3/tests/test_todos.py +51 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/README.md +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/setup.cfg +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/__init__.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/account.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/conversation.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/conversation_listener.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/cred_watcher.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/fs_allowlist.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/host_actions.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/info.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/models.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/prompt.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/rollout.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/seed_manifest.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/snapshots.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/types.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex/verify.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex.egg-info/dependency_links.txt +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex.egg-info/requires.txt +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/src/optio_codex.egg-info/top_level.txt +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_account.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_agent_info.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_await_codex_gone.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_claustrum.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_codex_cache.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_config.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_config_hooks.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_conversation.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_conversation_controls.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_conversation_listener.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_cred_watcher.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_file_download.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_file_upload.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_fs_allowlist.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_host_actions.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_import.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_input_wiring.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_kill_ttyd_by_socket.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_models.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_prompt.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_real_codex_conversation.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_real_codex_seed_resume.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_real_codex_session.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_rollout.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_sandbox_enforce.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_seed_manifest.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_session_conversation.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_session_lease.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_session_local.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_session_remote.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_session_resume.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_session_sandbox.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_session_seed.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_snapshots.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_teardown_session_tree.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_verify.py +0 -0
- {optio_codex-0.4.2 → optio_codex-0.4.3}/tests/test_workdir_trust.py +0 -0
|
@@ -20,6 +20,7 @@ from optio_agents.fs_grants import fs_isolation_dirs
|
|
|
20
20
|
from optio_agents.input_listener import serialized, start_input_listener
|
|
21
21
|
from optio_agents.protocol.session import _SessionFailed, run_log_protocol_session
|
|
22
22
|
from optio_agents.account import EMPTY, accounts_to_metadata
|
|
23
|
+
from optio_agents.todos import TodoTracker
|
|
23
24
|
from optio_agents.uploads import materialize, upload_url_token
|
|
24
25
|
from optio_host.host import Host, LocalHost, ProcessHandle, proc_wait
|
|
25
26
|
from optio_host.paths import task_dir
|
|
@@ -29,6 +30,7 @@ from optio_codex import models as codex_models
|
|
|
29
30
|
from optio_codex.account import resolve_capture_account
|
|
30
31
|
from optio_codex.info import AGENT_INFO
|
|
31
32
|
from optio_codex.conversation import CodexConversation
|
|
33
|
+
from optio_codex.todos import extract_codex_todo
|
|
32
34
|
from optio_codex.conversation_listener import ConversationListener
|
|
33
35
|
from optio_codex.fs_allowlist import (
|
|
34
36
|
SandboxSettings,
|
|
@@ -175,6 +177,7 @@ async def run_codex_session(ctx: ProcessContext, config: CodexTaskConfig) -> Non
|
|
|
175
177
|
# only) is started after publish and torn down first in the finally block.
|
|
176
178
|
conversation: CodexConversation | None = None
|
|
177
179
|
conv_listener: ConversationListener | None = None
|
|
180
|
+
todo_tracker: TodoTracker | None = None
|
|
178
181
|
|
|
179
182
|
await host.connect()
|
|
180
183
|
|
|
@@ -436,7 +439,7 @@ async def run_codex_session(ctx: ProcessContext, config: CodexTaskConfig) -> Non
|
|
|
436
439
|
await asyncio.sleep(1.0)
|
|
437
440
|
|
|
438
441
|
async def _conversation_body(host: Host, hook_ctx: HookContext) -> None:
|
|
439
|
-
nonlocal launched_handle, conversation, conv_listener
|
|
442
|
+
nonlocal launched_handle, conversation, conv_listener, todo_tracker
|
|
440
443
|
|
|
441
444
|
# Launch `codex app-server` directly (no tmux/ttyd). The sandbox MODE
|
|
442
445
|
# and approval policy travel in thread/start params (the app-server has
|
|
@@ -574,6 +577,10 @@ async def run_codex_session(ctx: ProcessContext, config: CodexTaskConfig) -> Non
|
|
|
574
577
|
"uploadUrl": upload_url,
|
|
575
578
|
})
|
|
576
579
|
ctx.report_progress(None, "Conversation UI is live")
|
|
580
|
+
todo_tracker = TodoTracker(extract_codex_todo, ctx)
|
|
581
|
+
loaded = await todo_tracker.restore(host) if resuming else False
|
|
582
|
+
if not loaded:
|
|
583
|
+
todo_tracker.arm(conversation)
|
|
577
584
|
|
|
578
585
|
# Resume history backfill: the resumed thread already carried its
|
|
579
586
|
# prior conversation inline in the thread/resume response
|
|
@@ -597,6 +604,13 @@ async def run_codex_session(ctx: ProcessContext, config: CodexTaskConfig) -> Non
|
|
|
597
604
|
"codex conversation resume: replayed %d prior events",
|
|
598
605
|
replayed,
|
|
599
606
|
)
|
|
607
|
+
if loaded:
|
|
608
|
+
todo_tracker.arm(conversation)
|
|
609
|
+
else:
|
|
610
|
+
todo_tracker = TodoTracker(extract_codex_todo, ctx)
|
|
611
|
+
if resuming:
|
|
612
|
+
await todo_tracker.restore(host)
|
|
613
|
+
todo_tracker.arm(conversation)
|
|
600
614
|
|
|
601
615
|
# Kickoff prompt as the first turn (headless: no positional prompt
|
|
602
616
|
# path). Suppressed on resume — re-kicking would duplicate the task.
|
|
@@ -833,6 +847,8 @@ async def run_codex_session(ctx: ProcessContext, config: CodexTaskConfig) -> Non
|
|
|
833
847
|
# launch). An interrupt before launch leaves it None — skip capture
|
|
834
848
|
# so any prior good snapshot survives and hasSavedState is untouched.
|
|
835
849
|
if config.supports_resume and launched_handle is not None:
|
|
850
|
+
if todo_tracker is not None:
|
|
851
|
+
await todo_tracker.save(host)
|
|
836
852
|
try:
|
|
837
853
|
await _capture_snapshot(
|
|
838
854
|
ctx, host,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Codex app-server events -> TodoUpdate."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
|
|
7
|
+
from optio_agents.todos import TodoUpdate, todo_update_from_payload
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _from_item(item: object) -> TodoUpdate | None:
|
|
11
|
+
if not isinstance(item, dict):
|
|
12
|
+
return None
|
|
13
|
+
name = item.get("name") or item.get("type") or ""
|
|
14
|
+
if name != "update_plan":
|
|
15
|
+
return None
|
|
16
|
+
args = item.get("arguments")
|
|
17
|
+
if isinstance(args, str):
|
|
18
|
+
try:
|
|
19
|
+
args = json.loads(args)
|
|
20
|
+
except ValueError:
|
|
21
|
+
return None
|
|
22
|
+
if not isinstance(args, dict) or "plan" not in args:
|
|
23
|
+
return None
|
|
24
|
+
return todo_update_from_payload({"plan": args.get("plan")})
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def extract_codex_todo(event: dict) -> TodoUpdate | None:
|
|
28
|
+
"""``update_plan`` on an ``item/completed`` notification, or the item itself."""
|
|
29
|
+
if not isinstance(event, dict):
|
|
30
|
+
return None
|
|
31
|
+
if event.get("method") == "item/completed":
|
|
32
|
+
params = event.get("params")
|
|
33
|
+
item = params.get("item") if isinstance(params, dict) else None
|
|
34
|
+
return _from_item(item)
|
|
35
|
+
return _from_item(event)
|
|
@@ -14,6 +14,7 @@ src/optio_codex/rollout.py
|
|
|
14
14
|
src/optio_codex/seed_manifest.py
|
|
15
15
|
src/optio_codex/session.py
|
|
16
16
|
src/optio_codex/snapshots.py
|
|
17
|
+
src/optio_codex/todos.py
|
|
17
18
|
src/optio_codex/types.py
|
|
18
19
|
src/optio_codex/verify.py
|
|
19
20
|
src/optio_codex.egg-info/PKG-INFO
|
|
@@ -56,5 +57,6 @@ tests/test_session_sandbox.py
|
|
|
56
57
|
tests/test_session_seed.py
|
|
57
58
|
tests/test_snapshots.py
|
|
58
59
|
tests/test_teardown_session_tree.py
|
|
60
|
+
tests/test_todos.py
|
|
59
61
|
tests/test_verify.py
|
|
60
62
|
tests/test_workdir_trust.py
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from optio_codex.todos import extract_codex_todo
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_item_completed_update_plan():
|
|
5
|
+
update = extract_codex_todo({
|
|
6
|
+
"method": "item/completed",
|
|
7
|
+
"params": {"item": {
|
|
8
|
+
"type": "update_plan",
|
|
9
|
+
"arguments": {"plan": [{"step": "Write", "status": "in_progress"}]},
|
|
10
|
+
}},
|
|
11
|
+
})
|
|
12
|
+
assert update is not None and update.merge is False
|
|
13
|
+
assert update.items[0].text == "Write"
|
|
14
|
+
assert update.items[0].status == "in_progress"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_arguments_json_string():
|
|
18
|
+
update = extract_codex_todo({
|
|
19
|
+
"method": "item/completed",
|
|
20
|
+
"params": {"item": {
|
|
21
|
+
"type": "update_plan",
|
|
22
|
+
"arguments": '{"plan":[{"step":"Write","status":"pending"}]}',
|
|
23
|
+
}},
|
|
24
|
+
})
|
|
25
|
+
assert update is not None
|
|
26
|
+
assert update.items[0].text == "Write"
|
|
27
|
+
assert update.items[0].status == "pending"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_function_call_shape():
|
|
31
|
+
update = extract_codex_todo({
|
|
32
|
+
"type": "function_call",
|
|
33
|
+
"name": "update_plan",
|
|
34
|
+
"arguments": {"plan": [{"step": "Write", "status": "completed"}]},
|
|
35
|
+
})
|
|
36
|
+
assert update is not None
|
|
37
|
+
assert update.items[0].status == "completed"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_command_execution_is_ignored():
|
|
41
|
+
assert extract_codex_todo({
|
|
42
|
+
"method": "item/completed",
|
|
43
|
+
"params": {"item": {"type": "commandExecution", "command": "ls"}},
|
|
44
|
+
}) is None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_broken_arguments_are_ignored():
|
|
48
|
+
assert extract_codex_todo({
|
|
49
|
+
"method": "item/completed",
|
|
50
|
+
"params": {"item": {"type": "update_plan", "arguments": "{"}},
|
|
51
|
+
}) is None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|