optio-opencode 0.6.3__tar.gz → 0.6.5__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.3 → optio_opencode-0.6.5}/PKG-INFO +4 -4
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/pyproject.toml +4 -4
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/session.py +14 -1
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/types.py +24 -5
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode.egg-info/PKG-INFO +4 -4
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode.egg-info/SOURCES.txt +1 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode.egg-info/requires.txt +3 -3
- optio_opencode-0.6.5/tests/test_auto_start_prompt.py +14 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_conversation_ui_model.py +75 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_session_local.py +30 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/README.md +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/setup.cfg +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/__init__.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/account.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/conversation.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/cred_watcher.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/fs_allowlist.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/host_actions.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/info.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/model_probe.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/prompt.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/providers/__init__.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/providers/anthropic.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/providers/deepseek.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/providers/openai.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/providers/xai.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/seed_manifest.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/snapshots.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/todos.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode/verify.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode.egg-info/dependency_links.txt +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/src/optio_opencode.egg-info/top_level.txt +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_account.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_account_xai_apikey.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_agent_info.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_agent_sender_opencode.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_claustrum.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_config_harmonization.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_conversation_config.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_conversation_driver.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_conversation_session.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_conversation_ui_session.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_conversation_upload.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_cred_watcher.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_file_download.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_file_upload.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_host_actions.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_host_local.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_host_primitives_local.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_host_primitives_remote.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_host_remote_resume.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_host_resume.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_model_probe.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_model_probe_wiring.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_prompt.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_provider_deepseek.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_purge_seed.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_sanity.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_seed_config.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_session_blob_hooks.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_session_hooks.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_session_remote.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_session_resume.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_session_seed.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_session_seed_saveback.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_smart_install.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_snapshots.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_todos.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_types.py +0 -0
- {optio_opencode-0.6.3 → optio_opencode-0.6.5}/tests/test_verify_seed.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: optio-opencode
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.5
|
|
4
4
|
Summary: Run opencode web as an optio task; local subprocess or remote via SSH.
|
|
5
5
|
Author-email: Kristof Csillag <kristof.csillag@deai-labs.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -20,10 +20,10 @@ 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.
|
|
23
|
+
Requires-Dist: optio-core<0.7,>=0.6
|
|
24
24
|
Requires-Dist: optio-host<0.4,>=0.3
|
|
25
|
-
Requires-Dist: optio-agents<0.
|
|
26
|
-
Requires-Dist: optio-claudecode<0.
|
|
25
|
+
Requires-Dist: optio-agents<0.8,>=0.7
|
|
26
|
+
Requires-Dist: optio-claudecode<0.8,>=0.7
|
|
27
27
|
Requires-Dist: optio-codex<0.5,>=0.4
|
|
28
28
|
Requires-Dist: optio-grok<0.5,>=0.4
|
|
29
29
|
Requires-Dist: asyncssh>=2.14
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "optio-opencode"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.5"
|
|
8
8
|
description = "Run opencode web as an optio task; local subprocess or remote via SSH."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|
|
@@ -26,15 +26,15 @@ classifiers = [
|
|
|
26
26
|
"Framework :: AsyncIO",
|
|
27
27
|
]
|
|
28
28
|
dependencies = [
|
|
29
|
-
"optio-core>=0.
|
|
29
|
+
"optio-core>=0.6,<0.7",
|
|
30
30
|
# 0.1.1 introduces the bind_addr kwarg on Host.establish_tunnel —
|
|
31
31
|
# required for OPTIO_WIDGET_TUNNEL_BIND to work.
|
|
32
32
|
"optio-host>=0.3,<0.4",
|
|
33
|
-
"optio-agents>=0.
|
|
33
|
+
"optio-agents>=0.7,<0.8",
|
|
34
34
|
# The account meta-analyzer's per-provider handlers reuse the extracted
|
|
35
35
|
# vendor map helpers (account_from_oauth_token / account_from_openai /
|
|
36
36
|
# account_from_xai) rather than reimplement each vendor's fetch+map.
|
|
37
|
-
"optio-claudecode>=0.
|
|
37
|
+
"optio-claudecode>=0.7,<0.8",
|
|
38
38
|
"optio-codex>=0.4,<0.5",
|
|
39
39
|
"optio-grok>=0.4,<0.5",
|
|
40
40
|
"asyncssh>=2.14",
|
|
@@ -68,7 +68,9 @@ READY_TIMEOUT_S = 30.0
|
|
|
68
68
|
|
|
69
69
|
# Fresh-launch kickoff prompt POSTed to the pre-created opencode session so the
|
|
70
70
|
# agent starts the task unattended. Suppressed on resume.
|
|
71
|
-
|
|
71
|
+
# A harness message (System: prefix), like the resume notice: the agent is
|
|
72
|
+
# not handed a turn that reads as the human typing.
|
|
73
|
+
AUTO_START_PROMPT = f"{SYSTEM_MESSAGE_PREFIX}Read AGENTS.md and execute the task it describes"
|
|
72
74
|
|
|
73
75
|
|
|
74
76
|
def _build_host(config: OpencodeTaskConfig, process_id: str) -> Host:
|
|
@@ -173,7 +175,14 @@ def conversation_widget_data(config: "OpencodeTaskConfig", *, session_id: str, d
|
|
|
173
175
|
"directory": directory,
|
|
174
176
|
"toolVerbosity": config.tool_verbosity,
|
|
175
177
|
"thinkingVerbosity": config.thinking_verbosity,
|
|
178
|
+
# The welcome card atop the transcript (None: no card).
|
|
179
|
+
"welcome": config.welcome_widget_data,
|
|
176
180
|
"showSessionControls": config.show_session_controls,
|
|
181
|
+
# The session_controls allowlist (None: every control). opencode's
|
|
182
|
+
# control snapshots are built client-side (OpencodeView, from the live
|
|
183
|
+
# provider catalog) and its model/effort changes are UI-local (no
|
|
184
|
+
# /control endpoint), so the view narrows its snapshots with this.
|
|
185
|
+
"sessionControls": config.session_controls,
|
|
177
186
|
"nativeSpinner": config.native_spinner,
|
|
178
187
|
"defaultModel": config.model,
|
|
179
188
|
# Initial effort ("thought level") the widget seeds its effort slider
|
|
@@ -353,6 +362,8 @@ async def run_opencode_session(ctx: ProcessContext, config: OpencodeTaskConfig)
|
|
|
353
362
|
omit_task_framing=omit_task_framing,
|
|
354
363
|
fs_isolation_dirs=fs_isolation_dirs(config, host.workdir),
|
|
355
364
|
file_download=config.file_download,
|
|
365
|
+
# Every resume sends the System: resume notice.
|
|
366
|
+
check_resume_log_every_message=False,
|
|
356
367
|
),
|
|
357
368
|
)
|
|
358
369
|
if resolved_seed_id is not None:
|
|
@@ -1085,6 +1096,8 @@ async def _maybe_refresh_on_resume(
|
|
|
1085
1096
|
omit_task_framing=omit_task_framing,
|
|
1086
1097
|
fs_isolation_dirs=fs_isolation_dirs(new_config, host.workdir),
|
|
1087
1098
|
file_download=new_config.file_download,
|
|
1099
|
+
# Every resume sends the System: resume notice.
|
|
1100
|
+
check_resume_log_every_message=False,
|
|
1088
1101
|
)
|
|
1089
1102
|
try:
|
|
1090
1103
|
existing = await hook_ctx.read_text_from_host("AGENTS.md", silent=True)
|
|
@@ -18,7 +18,15 @@ from optio_agents import (
|
|
|
18
18
|
TOOL_VERBOSITIES,
|
|
19
19
|
ToolVerbosity,
|
|
20
20
|
)
|
|
21
|
-
from optio_agents.config_types import
|
|
21
|
+
from optio_agents.config_types import (
|
|
22
|
+
BlobCryptoConfigMixin,
|
|
23
|
+
ClaustrumConfigMixin,
|
|
24
|
+
ResumeConfigMixin,
|
|
25
|
+
SessionControlsConfigMixin,
|
|
26
|
+
WelcomeConfigMixin,
|
|
27
|
+
)
|
|
28
|
+
from optio_agents.custom_controls import CustomControlsConfigMixin
|
|
29
|
+
from optio_agents.mcp import McpConfigMixin
|
|
22
30
|
from optio_agents.protocol.session import (
|
|
23
31
|
CallerMessageCallback,
|
|
24
32
|
DeliverableCallback,
|
|
@@ -73,7 +81,11 @@ def _identity_resume_refresh(config: "OpencodeTaskConfig") -> "OpencodeTaskConfi
|
|
|
73
81
|
|
|
74
82
|
|
|
75
83
|
@dataclass(frozen=True, kw_only=True)
|
|
76
|
-
class OpencodeTaskConfig(
|
|
84
|
+
class OpencodeTaskConfig(
|
|
85
|
+
ClaustrumConfigMixin, BlobCryptoConfigMixin, SessionControlsConfigMixin, McpConfigMixin,
|
|
86
|
+
CustomControlsConfigMixin, ResumeConfigMixin,
|
|
87
|
+
WelcomeConfigMixin,
|
|
88
|
+
):
|
|
77
89
|
"""Configuration for one optio-opencode task instance.
|
|
78
90
|
|
|
79
91
|
Inherits the claustrum filesystem-isolation triad (``fs_isolation`` /
|
|
@@ -186,9 +198,10 @@ class OpencodeTaskConfig(ClaustrumConfigMixin, BlobCryptoConfigMixin):
|
|
|
186
198
|
# effort control only appears for a variant-capable model (re-derived on
|
|
187
199
|
# model change). None leaves opencode's per-model default in place.
|
|
188
200
|
reasoning_effort: "OpencodeReasoningEffort | None" = None
|
|
189
|
-
#
|
|
190
|
-
#
|
|
191
|
-
|
|
201
|
+
# show_session_controls / session_controls come from
|
|
202
|
+
# SessionControlsConfigMixin. opencode's controls: "model" (default
|
|
203
|
+
# config.model) and "reasoning_effort" (variant-capable models only).
|
|
204
|
+
# The bar requires conversation_ui=True.
|
|
192
205
|
# Replace the generic working-spinner with opencode's on-brand native
|
|
193
206
|
# spinner in the conversation widget. Requires mode='conversation' and
|
|
194
207
|
# conversation_ui=True.
|
|
@@ -237,6 +250,12 @@ class OpencodeTaskConfig(ClaustrumConfigMixin, BlobCryptoConfigMixin):
|
|
|
237
250
|
# fails fast before the opencode-specific checks below.
|
|
238
251
|
self._validate_claustrum()
|
|
239
252
|
self._validate_blob_crypto()
|
|
253
|
+
self._validate_session_controls()
|
|
254
|
+
self._validate_welcome()
|
|
255
|
+
# This engine cannot hand MCP servers to its agent yet: refuse mcp_servers.
|
|
256
|
+
self._validate_mcp(supported=False, agent=self.agent_type)
|
|
257
|
+
# Nor can it apply custom session controls: refuse a non-empty custom_controls.
|
|
258
|
+
self._validate_custom_controls(supported=False, agent=self.agent_type)
|
|
240
259
|
if self.mode not in ("iframe", "conversation"):
|
|
241
260
|
raise ValueError(
|
|
242
261
|
f"OpencodeTaskConfig.mode={self.mode!r} is not one of "
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: optio-opencode
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.5
|
|
4
4
|
Summary: Run opencode web as an optio task; local subprocess or remote via SSH.
|
|
5
5
|
Author-email: Kristof Csillag <kristof.csillag@deai-labs.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -20,10 +20,10 @@ 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.
|
|
23
|
+
Requires-Dist: optio-core<0.7,>=0.6
|
|
24
24
|
Requires-Dist: optio-host<0.4,>=0.3
|
|
25
|
-
Requires-Dist: optio-agents<0.
|
|
26
|
-
Requires-Dist: optio-claudecode<0.
|
|
25
|
+
Requires-Dist: optio-agents<0.8,>=0.7
|
|
26
|
+
Requires-Dist: optio-claudecode<0.8,>=0.7
|
|
27
27
|
Requires-Dist: optio-codex<0.5,>=0.4
|
|
28
28
|
Requires-Dist: optio-grok<0.5,>=0.4
|
|
29
29
|
Requires-Dist: asyncssh>=2.14
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""The auto-start kickoff is a harness message, not a human one."""
|
|
2
|
+
|
|
3
|
+
from optio_agents.context import SYSTEM_MESSAGE_PREFIX
|
|
4
|
+
from optio_opencode.session import AUTO_START_PROMPT
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_auto_start_prompt_is_a_system_message():
|
|
8
|
+
# The kickoff comes from the harness: it carries the System: prefix every
|
|
9
|
+
# harness message has, so the agent (told that the human may not be
|
|
10
|
+
# present) is not given a turn that reads as the human typing, and the
|
|
11
|
+
# conversation widget renders it as a System row, not a user bubble.
|
|
12
|
+
assert AUTO_START_PROMPT == (
|
|
13
|
+
f"{SYSTEM_MESSAGE_PREFIX}Read AGENTS.md and execute the task it describes"
|
|
14
|
+
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
|
|
3
|
+
from optio_agents import WelcomeCard
|
|
3
4
|
from optio_opencode.session import conversation_widget_data
|
|
4
5
|
from optio_opencode.types import OpencodeTaskConfig
|
|
5
6
|
|
|
@@ -73,7 +74,9 @@ def test_widget_data_carries_model_fields():
|
|
|
73
74
|
"directory": "/wd",
|
|
74
75
|
"toolVerbosity": "verbose",
|
|
75
76
|
"thinkingVerbosity": "hidden",
|
|
77
|
+
"welcome": None,
|
|
76
78
|
"showSessionControls": True,
|
|
79
|
+
"sessionControls": None,
|
|
77
80
|
"nativeSpinner": False,
|
|
78
81
|
"defaultModel": "opencode/big-pickle",
|
|
79
82
|
"defaultEffort": "high",
|
|
@@ -95,6 +98,25 @@ def test_widget_data_defaults():
|
|
|
95
98
|
# No effort configured ⇒ the widget seeds nothing (opencode's per-model
|
|
96
99
|
# default stands).
|
|
97
100
|
assert wd["defaultEffort"] is None
|
|
101
|
+
assert wd["welcome"] is None
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def test_widget_data_carries_the_welcome_card():
|
|
105
|
+
cfg = OpencodeTaskConfig(
|
|
106
|
+
consumer_instructions="task", fs_isolation=False,
|
|
107
|
+
mode="conversation",
|
|
108
|
+
conversation_ui=True,
|
|
109
|
+
# A language-map title (published unresolved) and a minimum height.
|
|
110
|
+
welcome=WelcomeCard(
|
|
111
|
+
title={"en": "Hello", "hu": "Szia"}, description="Try **this**.",
|
|
112
|
+
icon="img/w.png", min_height=200,
|
|
113
|
+
),
|
|
114
|
+
)
|
|
115
|
+
wd = conversation_widget_data(cfg, session_id="s1", directory="/wd")
|
|
116
|
+
assert wd["welcome"] == {
|
|
117
|
+
"title": {"en": "Hello", "hu": "Szia"}, "description": "Try **this**.",
|
|
118
|
+
"icon": "/img/w.png", "minHeight": 200,
|
|
119
|
+
}
|
|
98
120
|
|
|
99
121
|
|
|
100
122
|
def test_reasoning_effort_accepted():
|
|
@@ -122,3 +144,56 @@ def test_reasoning_effort_rejects_bad_value():
|
|
|
122
144
|
conversation_ui=True,
|
|
123
145
|
reasoning_effort="turbo",
|
|
124
146
|
)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
# --- the session_controls allowlist (SessionControlsConfigMixin) -------------
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def _ui_cfg(**kw):
|
|
153
|
+
base = dict(
|
|
154
|
+
consumer_instructions="task", fs_isolation=False,
|
|
155
|
+
mode="conversation", conversation_ui=True,
|
|
156
|
+
)
|
|
157
|
+
base.update(kw)
|
|
158
|
+
return OpencodeTaskConfig(**base)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def test_the_controls_settings_come_from_the_shared_mixin():
|
|
162
|
+
from optio_agents.config_types import SessionControlsConfigMixin
|
|
163
|
+
assert issubclass(OpencodeTaskConfig, SessionControlsConfigMixin)
|
|
164
|
+
cfg = _ui_cfg(show_session_controls=True, session_controls=["model"])
|
|
165
|
+
assert cfg.settable_controls == ["model"]
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def test_session_controls_defaults_to_offering_everything():
|
|
169
|
+
cfg = _ui_cfg(show_session_controls=True)
|
|
170
|
+
assert cfg.session_controls is None
|
|
171
|
+
assert cfg.settable_controls is None
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def test_nothing_is_settable_while_the_bar_is_off():
|
|
175
|
+
assert _ui_cfg().settable_controls == []
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def test_session_controls_needs_show_session_controls():
|
|
179
|
+
with pytest.raises(ValueError, match="OpencodeTaskConfig: session_controls"):
|
|
180
|
+
_ui_cfg(session_controls=["model"])
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def test_session_controls_must_be_a_list_of_ids():
|
|
184
|
+
with pytest.raises(ValueError, match="OpencodeTaskConfig: session_controls"):
|
|
185
|
+
_ui_cfg(show_session_controls=True, session_controls="model")
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def test_widget_data_carries_the_session_controls_allowlist():
|
|
189
|
+
# opencode builds its control snapshots client-side (OpencodeView, from the
|
|
190
|
+
# live provider catalog), so the allowlist rides widgetData for the view to
|
|
191
|
+
# narrow them with.
|
|
192
|
+
cfg = _ui_cfg(show_session_controls=True, session_controls=["reasoning_effort"])
|
|
193
|
+
wd = conversation_widget_data(cfg, session_id="s1", directory="/wd")
|
|
194
|
+
assert wd["sessionControls"] == ["reasoning_effort"]
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def test_widget_data_session_controls_defaults_to_all():
|
|
198
|
+
wd = conversation_widget_data(_ui_cfg(), session_id="s1", directory="/wd")
|
|
199
|
+
assert wd["sessionControls"] is None
|
|
@@ -9,6 +9,7 @@ import pytest
|
|
|
9
9
|
import pytest_asyncio
|
|
10
10
|
from bson import ObjectId
|
|
11
11
|
|
|
12
|
+
from optio_agents import RESUME_NOTICE, SYSTEM_MESSAGE_PREFIX
|
|
12
13
|
from optio_core.context import ProcessContext
|
|
13
14
|
from optio_core.models import BasicAuth
|
|
14
15
|
from optio_opencode.session import run_opencode_session
|
|
@@ -17,6 +18,9 @@ from optio_opencode.types import OpencodeTaskConfig
|
|
|
17
18
|
|
|
18
19
|
FAKE_OPENCODE = os.path.join(os.path.dirname(__file__), "fake_opencode.py")
|
|
19
20
|
|
|
21
|
+
_POLL_RULE = "At the start of every new incoming user message"
|
|
22
|
+
_NOTICE_RULE = f"`{SYSTEM_MESSAGE_PREFIX}{RESUME_NOTICE}` message on your input channel"
|
|
23
|
+
|
|
20
24
|
# Each test here spawns a real fake-opencode server subprocess and polls it for
|
|
21
25
|
# streamed events; the timing is fragile under *any* concurrent machine load
|
|
22
26
|
# (other xdist workers, docker builds). Marked `serial` so the harness runs
|
|
@@ -194,6 +198,26 @@ async def test_happy_path(ctx_and_captures, _supply_scenario):
|
|
|
194
198
|
assert text == "hello 42 blue"
|
|
195
199
|
|
|
196
200
|
|
|
201
|
+
async def test_fresh_agents_md_waits_for_the_resume_notice(ctx_and_captures, _supply_scenario):
|
|
202
|
+
"""Every resume is announced with the System: resume notice (both
|
|
203
|
+
modes), so the planted AGENTS.md tells opencode to wait for it rather
|
|
204
|
+
than read resume.log before each message."""
|
|
205
|
+
import dataclasses
|
|
206
|
+
ctx, cap, _ = ctx_and_captures
|
|
207
|
+
_supply_scenario["name"] = "happy"
|
|
208
|
+
observed: dict[str, str] = {}
|
|
209
|
+
|
|
210
|
+
async def capture(hook_ctx):
|
|
211
|
+
observed["agents_md"] = await hook_ctx.read_text_from_host("AGENTS.md", silent=True)
|
|
212
|
+
|
|
213
|
+
cfg = dataclasses.replace(_config("happy"), before_execute=capture)
|
|
214
|
+
await run_opencode_session(ctx, cfg)
|
|
215
|
+
|
|
216
|
+
assert "## Resumes" in observed["agents_md"]
|
|
217
|
+
assert _POLL_RULE not in observed["agents_md"]
|
|
218
|
+
assert _NOTICE_RULE in observed["agents_md"]
|
|
219
|
+
|
|
220
|
+
|
|
197
221
|
async def test_status_percent_is_reported(ctx_and_captures, _supply_scenario):
|
|
198
222
|
ctx, cap, _ = ctx_and_captures
|
|
199
223
|
_supply_scenario["name"] = "status_percent"
|
|
@@ -518,6 +542,7 @@ async def test_maybe_refresh_on_resume_unchanged_content_skips_write(tmp_workdir
|
|
|
518
542
|
config.consumer_instructions,
|
|
519
543
|
workdir_exclude=config.workdir_exclude,
|
|
520
544
|
supports_resume=config.supports_resume,
|
|
545
|
+
check_resume_log_every_message=False, # as the fresh start writes it
|
|
521
546
|
)
|
|
522
547
|
await host.write_text("AGENTS.md", expected)
|
|
523
548
|
mtime_before = os.path.getmtime(os.path.join(host.workdir, "AGENTS.md"))
|
|
@@ -562,6 +587,7 @@ async def test_maybe_refresh_on_resume_conversation_defaults_match_fresh(tmp_wor
|
|
|
562
587
|
supports_resume=config.supports_resume,
|
|
563
588
|
host_protocol=config.host_protocol,
|
|
564
589
|
omit_task_framing=True,
|
|
590
|
+
check_resume_log_every_message=False,
|
|
565
591
|
)
|
|
566
592
|
await host.write_text("AGENTS.md", expected)
|
|
567
593
|
|
|
@@ -619,6 +645,10 @@ async def test_maybe_refresh_on_resume_changed_content_writes(tmp_workdir):
|
|
|
619
645
|
content = f.read()
|
|
620
646
|
assert "new task" in content
|
|
621
647
|
assert "old task" not in content
|
|
648
|
+
# Every resume sends the System: resume notice, so the refreshed file
|
|
649
|
+
# says to wait for it rather than read resume.log before each message.
|
|
650
|
+
assert _POLL_RULE not in content
|
|
651
|
+
assert _NOTICE_RULE in content
|
|
622
652
|
|
|
623
653
|
|
|
624
654
|
async def test_maybe_refresh_on_resume_hook_raises_keeps_existing(tmp_workdir):
|
|
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.3 → optio_opencode-0.6.5}/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
|