optio-codex 0.4.5__tar.gz → 0.4.7__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.
Files changed (65) hide show
  1. {optio_codex-0.4.5 → optio_codex-0.4.7}/PKG-INFO +4 -4
  2. {optio_codex-0.4.5 → optio_codex-0.4.7}/pyproject.toml +4 -4
  3. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/session.py +19 -5
  4. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/types.py +14 -1
  5. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex.egg-info/PKG-INFO +4 -4
  6. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex.egg-info/requires.txt +3 -3
  7. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_config_hooks.py +8 -3
  8. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_session_conversation.py +11 -0
  9. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_session_local.py +8 -0
  10. {optio_codex-0.4.5 → optio_codex-0.4.7}/README.md +0 -0
  11. {optio_codex-0.4.5 → optio_codex-0.4.7}/setup.cfg +0 -0
  12. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/__init__.py +0 -0
  13. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/account.py +0 -0
  14. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/conversation.py +0 -0
  15. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/conversation_listener.py +0 -0
  16. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/cred_watcher.py +0 -0
  17. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/fs_allowlist.py +0 -0
  18. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/host_actions.py +0 -0
  19. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/info.py +0 -0
  20. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/models.py +0 -0
  21. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/prompt.py +0 -0
  22. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/rollout.py +0 -0
  23. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/seed_manifest.py +0 -0
  24. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/snapshots.py +0 -0
  25. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/todos.py +0 -0
  26. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex/verify.py +0 -0
  27. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex.egg-info/SOURCES.txt +0 -0
  28. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex.egg-info/dependency_links.txt +0 -0
  29. {optio_codex-0.4.5 → optio_codex-0.4.7}/src/optio_codex.egg-info/top_level.txt +0 -0
  30. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_account.py +0 -0
  31. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_agent_info.py +0 -0
  32. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_auto_start_prompt.py +0 -0
  33. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_await_codex_gone.py +0 -0
  34. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_claustrum.py +0 -0
  35. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_codex_cache.py +0 -0
  36. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_config.py +0 -0
  37. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_conversation.py +0 -0
  38. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_conversation_controls.py +0 -0
  39. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_conversation_listener.py +0 -0
  40. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_cred_watcher.py +0 -0
  41. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_file_download.py +0 -0
  42. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_file_upload.py +0 -0
  43. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_fs_allowlist.py +0 -0
  44. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_host_actions.py +0 -0
  45. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_import.py +0 -0
  46. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_input_wiring.py +0 -0
  47. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_kill_ttyd_by_socket.py +0 -0
  48. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_models.py +0 -0
  49. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_prompt.py +0 -0
  50. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_real_codex_conversation.py +0 -0
  51. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_real_codex_seed_resume.py +0 -0
  52. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_real_codex_session.py +0 -0
  53. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_rollout.py +0 -0
  54. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_sandbox_enforce.py +0 -0
  55. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_seed_manifest.py +0 -0
  56. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_session_lease.py +0 -0
  57. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_session_remote.py +0 -0
  58. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_session_resume.py +0 -0
  59. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_session_sandbox.py +0 -0
  60. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_session_seed.py +0 -0
  61. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_snapshots.py +0 -0
  62. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_teardown_session_tree.py +0 -0
  63. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_todos.py +0 -0
  64. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_verify.py +0 -0
  65. {optio_codex-0.4.5 → optio_codex-0.4.7}/tests/test_workdir_trust.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: optio-codex
3
- Version: 0.4.5
3
+ Version: 0.4.7
4
4
  Summary: Run OpenAI Codex as an optio task; local subprocess; ttyd-served TUI iframe.
5
5
  Author-email: Kristof Csillag <kristof.csillag@deai-labs.com>
6
6
  License-Expression: Apache-2.0
@@ -20,9 +20,9 @@ Classifier: Topic :: Software Development :: Code Generators
20
20
  Classifier: Framework :: AsyncIO
21
21
  Requires-Python: >=3.11
22
22
  Description-Content-Type: text/markdown
23
- Requires-Dist: optio-core<0.6,>=0.5
24
- Requires-Dist: optio-host<0.4,>=0.3
25
- Requires-Dist: optio-agents<0.7,>=0.6
23
+ Requires-Dist: optio-core<0.7,>=0.6
24
+ Requires-Dist: optio-host<0.5,>=0.4
25
+ Requires-Dist: optio-agents<0.8,>=0.7
26
26
  Requires-Dist: asyncssh>=2.14
27
27
  Requires-Dist: aiohttp>=3.9
28
28
  Provides-Extra: dev
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "optio-codex"
7
- version = "0.4.5"
7
+ version = "0.4.7"
8
8
  description = "Run OpenAI Codex as an optio task; local subprocess; ttyd-served TUI iframe."
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -26,9 +26,9 @@ classifiers = [
26
26
  "Framework :: AsyncIO",
27
27
  ]
28
28
  dependencies = [
29
- "optio-core>=0.5,<0.6",
30
- "optio-host>=0.3,<0.4",
31
- "optio-agents>=0.6,<0.7",
29
+ "optio-core>=0.6,<0.7",
30
+ "optio-host>=0.4,<0.5",
31
+ "optio-agents>=0.7,<0.8",
32
32
  "asyncssh>=2.14",
33
33
  "aiohttp>=3.9",
34
34
  ]
@@ -309,6 +309,8 @@ async def run_codex_session(ctx: ProcessContext, config: CodexTaskConfig) -> Non
309
309
  supports_resume=config.supports_resume,
310
310
  file_download=config.file_download,
311
311
  fs_isolation_dirs=fs_isolation_dirs(config, host.workdir),
312
+ # Every resume sends the System: resume notice.
313
+ check_resume_log_every_message=False,
312
314
  ),
313
315
  )
314
316
  else:
@@ -364,8 +366,8 @@ async def run_codex_session(ctx: ProcessContext, config: CodexTaskConfig) -> Non
364
366
  # PUSH resume awareness (Gap 1): a System: notice positional appended
365
367
  # after `resume <id>` + flags so the resumed TUI session gets a "you
366
368
  # have been resumed" turn (mutually exclusive with the fresh-launch
367
- # kickoff above). Parity with claudecode/opencode/grok; resume.log
368
- # stays the pull-based backstop.
369
+ # kickoff above). Parity with claudecode/opencode/grok. AGENTS.md
370
+ # tells codex to wait for this notice, not to poll resume.log.
369
371
  *host_actions.build_resume_notice_args(resuming=resuming),
370
372
  ]
371
373
  launch_env = {
@@ -573,6 +575,8 @@ async def run_codex_session(ctx: ProcessContext, config: CodexTaskConfig) -> Non
573
575
  "protocol": "codex",
574
576
  "toolVerbosity": config.tool_verbosity,
575
577
  "thinkingVerbosity": config.thinking_verbosity,
578
+ # The welcome card atop the transcript (None: no card).
579
+ "welcome": config.welcome_widget_data,
576
580
  "showSessionControls": config.show_session_controls,
577
581
  "nativeSpinner": config.native_spinner,
578
582
  "controls": filter_controls(
@@ -623,7 +627,8 @@ async def run_codex_session(ctx: ProcessContext, config: CodexTaskConfig) -> Non
623
627
  # Kickoff prompt as the first turn (headless: no positional prompt
624
628
  # path). Suppressed on resume — re-kicking would duplicate the task.
625
629
  # On resume, PUSH a System: resume notice instead so the resumed thread
626
- # notices promptly (parity; resume.log stays the pull-based backstop).
630
+ # notices promptly (parity; AGENTS.md says to wait for it, not to
631
+ # poll resume.log).
627
632
  if config.auto_start and not resuming:
628
633
  await conversation.send(host_actions.AUTO_START_PROMPT)
629
634
  elif resuming:
@@ -918,6 +923,8 @@ async def _maybe_refresh_on_resume(
918
923
  supports_resume=new_config.supports_resume,
919
924
  file_download=new_config.file_download,
920
925
  fs_isolation_dirs=fs_isolation_dirs(new_config, host.workdir),
926
+ # Every resume sends the System: resume notice.
927
+ check_resume_log_every_message=False,
921
928
  )
922
929
  try:
923
930
  existing = await hook_ctx.read_text_from_host("AGENTS.md", silent=True)
@@ -1005,13 +1012,20 @@ async def _capture_snapshot(
1005
1012
  ``session_blob_decrypt`` unwraps it on the restore read.
1006
1013
  """
1007
1014
  exclude = effective_workdir_exclude(workdir_exclude)
1015
+
1016
+ # The capture-cap decision's one-line note (at most one per capture) has
1017
+ # no process-log handle at the host layer, so it is forwarded here
1018
+ # through ctx.report_progress, same as every other milestone line.
1019
+ def _on_note(note: str, level: str) -> None:
1020
+ ctx.report_progress(None, note, level=level)
1021
+
1008
1022
  async with ctx.store_blob("workdir") as wwriter:
1009
1023
  if session_blob_encrypt is None:
1010
- async for chunk in host.archive_workdir(exclude):
1024
+ async for chunk in host.archive_workdir(exclude, on_note=_on_note):
1011
1025
  await wwriter.write(chunk)
1012
1026
  else:
1013
1027
  buf = bytearray()
1014
- async for chunk in host.archive_workdir(exclude):
1028
+ async for chunk in host.archive_workdir(exclude, on_note=_on_note):
1015
1029
  buf.extend(chunk)
1016
1030
  await wwriter.write(session_blob_encrypt(bytes(buf)))
1017
1031
  workdir_blob_id = wwriter.file_id
@@ -36,8 +36,12 @@ from optio_agents import (
36
36
  from optio_agents.config_types import (
37
37
  BlobCryptoConfigMixin,
38
38
  ClaustrumConfigMixin,
39
+ ResumeConfigMixin,
39
40
  SessionControlsConfigMixin,
41
+ WelcomeConfigMixin,
40
42
  )
43
+ from optio_agents.custom_controls import CustomControlsConfigMixin
44
+ from optio_agents.mcp import McpConfigMixin
41
45
  from optio_agents.protocol.session import (
42
46
  CallerMessageCallback,
43
47
  DeliverableCallback,
@@ -97,7 +101,11 @@ def _identity_resume_refresh(config: "CodexTaskConfig") -> "CodexTaskConfig":
97
101
 
98
102
 
99
103
  @dataclass(frozen=True, kw_only=True)
100
- class CodexTaskConfig(ClaustrumConfigMixin, BlobCryptoConfigMixin, SessionControlsConfigMixin):
104
+ class CodexTaskConfig(
105
+ ClaustrumConfigMixin, BlobCryptoConfigMixin, SessionControlsConfigMixin, McpConfigMixin,
106
+ CustomControlsConfigMixin, ResumeConfigMixin,
107
+ WelcomeConfigMixin,
108
+ ):
101
109
  """Configuration for one optio-codex task instance.
102
110
 
103
111
  Inherits the claustrum filesystem-isolation triad (``fs_isolation`` /
@@ -305,6 +313,11 @@ class CodexTaskConfig(ClaustrumConfigMixin, BlobCryptoConfigMixin, SessionContro
305
313
  self._validate_claustrum()
306
314
  self._validate_blob_crypto()
307
315
  self._validate_session_controls()
316
+ self._validate_welcome()
317
+ # This engine cannot hand MCP servers to its agent yet: refuse mcp_servers.
318
+ self._validate_mcp(supported=False, agent=self.agent_type)
319
+ # Nor can it apply custom session controls: refuse a non-empty custom_controls.
320
+ self._validate_custom_controls(supported=False, agent=self.agent_type)
308
321
  if self.mode not in _VALID_MODES:
309
322
  raise ValueError(
310
323
  f"CodexTaskConfig.mode={self.mode!r} is not one of "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: optio-codex
3
- Version: 0.4.5
3
+ Version: 0.4.7
4
4
  Summary: Run OpenAI Codex as an optio task; local subprocess; ttyd-served TUI iframe.
5
5
  Author-email: Kristof Csillag <kristof.csillag@deai-labs.com>
6
6
  License-Expression: Apache-2.0
@@ -20,9 +20,9 @@ Classifier: Topic :: Software Development :: Code Generators
20
20
  Classifier: Framework :: AsyncIO
21
21
  Requires-Python: >=3.11
22
22
  Description-Content-Type: text/markdown
23
- Requires-Dist: optio-core<0.6,>=0.5
24
- Requires-Dist: optio-host<0.4,>=0.3
25
- Requires-Dist: optio-agents<0.7,>=0.6
23
+ Requires-Dist: optio-core<0.7,>=0.6
24
+ Requires-Dist: optio-host<0.5,>=0.4
25
+ Requires-Dist: optio-agents<0.8,>=0.7
26
26
  Requires-Dist: asyncssh>=2.14
27
27
  Requires-Dist: aiohttp>=3.9
28
28
  Provides-Extra: dev
@@ -1,6 +1,6 @@
1
- optio-core<0.6,>=0.5
2
- optio-host<0.4,>=0.3
3
- optio-agents<0.7,>=0.6
1
+ optio-core<0.7,>=0.6
2
+ optio-host<0.5,>=0.4
3
+ optio-agents<0.8,>=0.7
4
4
  asyncssh>=2.14
5
5
  aiohttp>=3.9
6
6
 
@@ -15,7 +15,7 @@ from unittest.mock import AsyncMock, MagicMock
15
15
 
16
16
  import pytest
17
17
 
18
- from optio_agents import get_protocol
18
+ from optio_agents import RESUME_NOTICE, SYSTEM_MESSAGE_PREFIX, get_protocol
19
19
  from optio_agents.fs_grants import fs_isolation_dirs
20
20
  from optio_codex.prompt import compose_agents_md
21
21
  from optio_codex.types import CodexTaskConfig
@@ -142,7 +142,7 @@ async def test_capture_snapshot_writes_through_session_blob_encrypt(monkeypatch)
142
142
 
143
143
  workdir_tar = b"codex-workdir-tar-with-home-dot-codex"
144
144
 
145
- async def _fake_archive(_excl):
145
+ async def _fake_archive(_excl, *, on_note=None):
146
146
  # Emit in two chunks to prove the encrypt path buffers whole.
147
147
  yield workdir_tar[:10]
148
148
  yield workdir_tar[10:]
@@ -179,7 +179,7 @@ async def test_capture_snapshot_plaintext_streams_unwrapped(monkeypatch):
179
179
  fake_ctx.mark_has_saved_state = AsyncMock()
180
180
  fake_ctx.process_id = "pid-x"
181
181
 
182
- async def _fake_archive(_excl):
182
+ async def _fake_archive(_excl, *, on_note=None):
183
183
  yield b"plain-workdir"
184
184
 
185
185
  fake_host = MagicMock()
@@ -271,6 +271,7 @@ async def test_maybe_refresh_identity_unchanged_is_noop():
271
271
  supports_resume=cfg.supports_resume,
272
272
  file_download=cfg.file_download,
273
273
  fs_isolation_dirs=fs_isolation_dirs(cfg, workdir),
274
+ check_resume_log_every_message=False, # as the fresh start writes it
274
275
  )
275
276
  host, hook, written = _resume_fakes(existing, workdir=workdir)
276
277
 
@@ -301,6 +302,10 @@ async def test_maybe_refresh_mutating_hook_rewrites_agents_md():
301
302
  refreshed = await _maybe_refresh_on_resume(host, hook, cfg, protocol)
302
303
  assert refreshed == ["AGENTS.md"]
303
304
  assert "UPDATED INSTRUCTIONS" in written["AGENTS.md"]
305
+ # Every resume sends the System: resume notice, so the refreshed file
306
+ # says to wait for it rather than read resume.log before each message.
307
+ assert "At the start of every new incoming user message" not in written["AGENTS.md"]
308
+ assert f"`{SYSTEM_MESSAGE_PREFIX}{RESUME_NOTICE}` message on your input channel" in written["AGENTS.md"]
304
309
 
305
310
 
306
311
  async def test_maybe_refresh_none_hook_is_noop():
@@ -20,6 +20,7 @@ import pytest
20
20
 
21
21
  from optio_core.lifecycle import Optio
22
22
 
23
+ from optio_agents import WelcomeCard
23
24
  from optio_codex import CodexTaskConfig, create_codex_task
24
25
 
25
26
 
@@ -261,6 +262,11 @@ async def test_conversation_ui_publishes_widget(shim_install_dir, task_root, mon
261
262
  config=_conversation_config(
262
263
  shim_install_dir, conversation_ui=True,
263
264
  show_session_controls=True, tool_verbosity="verbose",
265
+ # A language-map title (published unresolved) and a minimum height.
266
+ welcome=WelcomeCard(
267
+ title={"en": "Hello", "hu": "Szia"}, description="Try **this**.",
268
+ icon="img/w.png", min_height=200,
269
+ ),
264
270
  ),
265
271
  )
266
272
  assert task.ui_widget == "conversation"
@@ -287,6 +293,11 @@ async def test_conversation_ui_publishes_widget(shim_install_dir, task_root, mon
287
293
  assert wd.get("toolVerbosity") == "verbose"
288
294
  assert wd.get("showSessionControls") is True
289
295
  assert wd.get("nativeSpinner") is False
296
+ # The welcome card, its icon rooted at the web app.
297
+ assert wd.get("welcome") == {
298
+ "title": {"en": "Hello", "hu": "Szia"}, "description": "Try **this**.",
299
+ "icon": "/img/w.png", "minHeight": 200,
300
+ }
290
301
  # The model picker is now the generic id="model" SessionControl.
291
302
  controls = wd.get("controls", [])
292
303
  model_ctrl = next((c for c in controls if c.get("id") == "model"), None)
@@ -9,11 +9,15 @@ import shutil
9
9
 
10
10
  import pytest
11
11
 
12
+ from optio_agents import RESUME_NOTICE, SYSTEM_MESSAGE_PREFIX
12
13
  from optio_codex import (
13
14
  CodexTaskConfig,
14
15
  create_codex_task,
15
16
  )
16
17
 
18
+ _POLL_RULE = "At the start of every new incoming user message"
19
+ _NOTICE_RULE = f"`{SYSTEM_MESSAGE_PREFIX}{RESUME_NOTICE}` message on your input channel"
20
+
17
21
 
18
22
  @pytest.mark.asyncio
19
23
  async def test_local_happy_path_done_in_optio_log(
@@ -61,6 +65,10 @@ async def test_local_happy_path_done_in_optio_log(
61
65
  assert observed["per_task_codex"] is True
62
66
  assert observed["resume_log"].count("\n") == 1 # exactly one launch line
63
67
  assert "## Resumes" in observed["agents_md"]
68
+ # Every resume sends the System: resume notice (both modes), so the
69
+ # agent waits for it instead of reading resume.log before each message.
70
+ assert _POLL_RULE not in observed["agents_md"]
71
+ assert _NOTICE_RULE in observed["agents_md"]
64
72
  assert captures.widget_upstream
65
73
  assert captures.widget_data
66
74
 
File without changes
File without changes