optio-opencode 0.6.1__tar.gz → 0.6.2__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_opencode-0.6.1 → optio_opencode-0.6.2}/PKG-INFO +1 -1
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/pyproject.toml +1 -1
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/session.py +13 -1
- optio_opencode-0.6.2/src/optio_opencode/todos.py +27 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode.egg-info/PKG-INFO +1 -1
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode.egg-info/SOURCES.txt +2 -0
- optio_opencode-0.6.2/tests/test_todos.py +38 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/README.md +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/setup.cfg +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/__init__.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/account.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/conversation.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/cred_watcher.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/fs_allowlist.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/host_actions.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/info.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/model_probe.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/prompt.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/providers/__init__.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/providers/anthropic.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/providers/deepseek.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/providers/openai.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/providers/xai.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/seed_manifest.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/snapshots.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/types.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode/verify.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode.egg-info/dependency_links.txt +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode.egg-info/requires.txt +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode.egg-info/top_level.txt +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_account.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_account_xai_apikey.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_agent_info.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_agent_sender_opencode.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_claustrum.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_config_harmonization.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_conversation_config.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_conversation_driver.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_conversation_session.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_conversation_ui_model.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_conversation_ui_session.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_conversation_upload.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_cred_watcher.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_file_download.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_file_upload.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_host_actions.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_host_local.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_host_primitives_local.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_host_primitives_remote.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_host_remote_resume.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_host_resume.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_model_probe.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_model_probe_wiring.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_prompt.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_provider_deepseek.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_purge_seed.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_sanity.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_seed_config.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_session_blob_hooks.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_session_hooks.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_session_local.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_session_remote.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_session_resume.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_session_seed.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_session_seed_saveback.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_smart_install.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_snapshots.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_types.py +0 -0
- {optio_opencode-0.6.1 → optio_opencode-0.6.2}/tests/test_verify_seed.py +0 -0
|
@@ -36,6 +36,7 @@ from optio_agents.fs_grants import fs_isolation_dirs
|
|
|
36
36
|
from optio_host.host import Host, LocalHost, ProcessHandle
|
|
37
37
|
from optio_host.paths import task_dir
|
|
38
38
|
from optio_agents.protocol.session import _SessionFailed, run_log_protocol_session
|
|
39
|
+
from optio_agents.todos import TodoTracker
|
|
39
40
|
from optio_agents.uploads import materialize, upload_url_token
|
|
40
41
|
from optio_agents import seeds as _seeds
|
|
41
42
|
from optio_agents.account import accounts_to_metadata
|
|
@@ -44,6 +45,7 @@ from optio_opencode.account import resolve_capture_accounts
|
|
|
44
45
|
from optio_opencode import model_probe
|
|
45
46
|
from optio_opencode.info import AGENT_INFO
|
|
46
47
|
from optio_opencode.conversation import OpencodeConversation
|
|
48
|
+
from optio_opencode.todos import extract_opencode_todo
|
|
47
49
|
from optio_opencode.prompt import DEFAULT_CONVERSATION_INSTRUCTIONS, compose_agents_md
|
|
48
50
|
from optio_opencode.seed_manifest import (
|
|
49
51
|
OPENCODE_CRED_MANIFEST,
|
|
@@ -210,6 +212,7 @@ async def run_opencode_session(ctx: ProcessContext, config: OpencodeTaskConfig)
|
|
|
210
212
|
cancelled = False
|
|
211
213
|
launched_handle: ProcessHandle | None = None
|
|
212
214
|
conversation: OpencodeConversation | None = None
|
|
215
|
+
todo_tracker: TodoTracker | None = None
|
|
213
216
|
reader_task: "asyncio.Task | None" = None
|
|
214
217
|
opencode_exec: str = "opencode"
|
|
215
218
|
session_id: str | None = None
|
|
@@ -320,7 +323,7 @@ async def run_opencode_session(ctx: ProcessContext, config: OpencodeTaskConfig)
|
|
|
320
323
|
terminate the subprocess and capture the snapshot.
|
|
321
324
|
"""
|
|
322
325
|
nonlocal launched_handle, opencode_exec, session_id, preserved_session_id
|
|
323
|
-
nonlocal worker_port, conversation, reader_task
|
|
326
|
+
nonlocal worker_port, conversation, reader_task, todo_tracker
|
|
324
327
|
nonlocal cred_baseline, cred_watch_task, resolved_seed_id, lease_holder
|
|
325
328
|
|
|
326
329
|
if callable(config.seed_id):
|
|
@@ -641,6 +644,13 @@ async def run_opencode_session(ctx: ProcessContext, config: OpencodeTaskConfig)
|
|
|
641
644
|
reader_task = asyncio.create_task(conversation.run_reader())
|
|
642
645
|
ctx.publish_result(conversation)
|
|
643
646
|
ctx.report_progress(None, f"{AGENT_INFO.name} conversation is live")
|
|
647
|
+
# OpenCode does not replay history through on_event. Arm immediately
|
|
648
|
+
# so the next tool part moves the bar. Restore first, after the
|
|
649
|
+
# launch line above, which passes percent None.
|
|
650
|
+
todo_tracker = TodoTracker(extract_opencode_todo, ctx)
|
|
651
|
+
if resuming:
|
|
652
|
+
await todo_tracker.restore(host)
|
|
653
|
+
todo_tracker.arm(conversation)
|
|
644
654
|
|
|
645
655
|
proc = launched_handle.pid_like
|
|
646
656
|
wait_task = asyncio.create_task(proc.wait()) # type: ignore[union-attr]
|
|
@@ -835,6 +845,8 @@ async def run_opencode_session(ctx: ProcessContext, config: OpencodeTaskConfig)
|
|
|
835
845
|
_LOG.exception("opencode seed capture failed; callback not fired")
|
|
836
846
|
|
|
837
847
|
if config.supports_resume and session_id is not None:
|
|
848
|
+
if todo_tracker is not None:
|
|
849
|
+
await todo_tracker.save(host)
|
|
838
850
|
try:
|
|
839
851
|
await _capture_snapshot(
|
|
840
852
|
ctx, host,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""OpenCode ``message.part.updated`` tool parts -> TodoUpdate."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from optio_agents.todos import (
|
|
6
|
+
TODO_TOOL_NAMES,
|
|
7
|
+
TodoUpdate,
|
|
8
|
+
normalize_tool_name,
|
|
9
|
+
todo_update_from_payload,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def extract_opencode_todo(event: dict) -> TodoUpdate | None:
|
|
14
|
+
if not isinstance(event, dict) or event.get("type") != "message.part.updated":
|
|
15
|
+
return None
|
|
16
|
+
props = event.get("properties")
|
|
17
|
+
part = props.get("part") if isinstance(props, dict) else None
|
|
18
|
+
if not isinstance(part, dict) or part.get("type") != "tool":
|
|
19
|
+
return None
|
|
20
|
+
name = part.get("tool") or ""
|
|
21
|
+
if not isinstance(name, str) or normalize_tool_name(name) not in TODO_TOOL_NAMES:
|
|
22
|
+
return None
|
|
23
|
+
state = part.get("state")
|
|
24
|
+
raw = state.get("input") if isinstance(state, dict) else None
|
|
25
|
+
if not isinstance(raw, dict) or not raw:
|
|
26
|
+
return None
|
|
27
|
+
return todo_update_from_payload(raw)
|
|
@@ -12,6 +12,7 @@ src/optio_opencode/prompt.py
|
|
|
12
12
|
src/optio_opencode/seed_manifest.py
|
|
13
13
|
src/optio_opencode/session.py
|
|
14
14
|
src/optio_opencode/snapshots.py
|
|
15
|
+
src/optio_opencode/todos.py
|
|
15
16
|
src/optio_opencode/types.py
|
|
16
17
|
src/optio_opencode/verify.py
|
|
17
18
|
src/optio_opencode.egg-info/PKG-INFO
|
|
@@ -61,5 +62,6 @@ tests/test_session_seed.py
|
|
|
61
62
|
tests/test_session_seed_saveback.py
|
|
62
63
|
tests/test_smart_install.py
|
|
63
64
|
tests/test_snapshots.py
|
|
65
|
+
tests/test_todos.py
|
|
64
66
|
tests/test_types.py
|
|
65
67
|
tests/test_verify_seed.py
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from optio_opencode.todos import extract_opencode_todo
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_tool_part_becomes_an_update():
|
|
5
|
+
update = extract_opencode_todo({
|
|
6
|
+
"id": "p1",
|
|
7
|
+
"type": "message.part.updated",
|
|
8
|
+
"properties": {"part": {
|
|
9
|
+
"type": "tool",
|
|
10
|
+
"tool": "todowrite",
|
|
11
|
+
"state": {"input": {"todos": [{
|
|
12
|
+
"content": "Write", "status": "pending",
|
|
13
|
+
}]}},
|
|
14
|
+
}},
|
|
15
|
+
})
|
|
16
|
+
assert update is not None
|
|
17
|
+
assert update.items[0].text == "Write"
|
|
18
|
+
assert update.items[0].status == "pending"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_empty_input_is_ignored():
|
|
22
|
+
assert extract_opencode_todo({
|
|
23
|
+
"type": "message.part.updated",
|
|
24
|
+
"properties": {"part": {
|
|
25
|
+
"type": "tool", "tool": "todowrite", "state": {"input": {}},
|
|
26
|
+
}},
|
|
27
|
+
}) is None
|
|
28
|
+
assert extract_opencode_todo({
|
|
29
|
+
"type": "message.part.updated",
|
|
30
|
+
"properties": {"part": {"type": "tool", "tool": "todowrite", "state": {}}},
|
|
31
|
+
}) is None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_text_part_is_ignored():
|
|
35
|
+
assert extract_opencode_todo({
|
|
36
|
+
"type": "message.part.updated",
|
|
37
|
+
"properties": {"part": {"type": "text", "text": "hi"}},
|
|
38
|
+
}) 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
|
{optio_opencode-0.6.1 → optio_opencode-0.6.2}/src/optio_opencode.egg-info/dependency_links.txt
RENAMED
|
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
|