optio-opencode 0.1.3__tar.gz → 0.1.4__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.1.3 → optio_opencode-0.1.4}/PKG-INFO +4 -3
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/pyproject.toml +4 -3
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/src/optio_opencode/__init__.py +1 -2
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/src/optio_opencode/prompt.py +7 -32
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/src/optio_opencode/session.py +3 -3
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/src/optio_opencode/types.py +5 -6
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/src/optio_opencode.egg-info/PKG-INFO +4 -3
- optio_opencode-0.1.4/src/optio_opencode.egg-info/requires.txt +8 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_host_local.py +3 -3
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_session_hooks.py +3 -3
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_smart_install.py +8 -8
- optio_opencode-0.1.3/src/optio_opencode.egg-info/requires.txt +0 -7
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/README.md +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/setup.cfg +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/src/optio_opencode/host_actions.py +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/src/optio_opencode/snapshots.py +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/src/optio_opencode.egg-info/SOURCES.txt +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/src/optio_opencode.egg-info/dependency_links.txt +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/src/optio_opencode.egg-info/top_level.txt +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_host_primitives_local.py +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_host_primitives_remote.py +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_host_remote_resume.py +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_host_resume.py +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_prompt.py +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_sanity.py +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_session_blob_hooks.py +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_session_local.py +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_session_remote.py +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_session_resume.py +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_snapshots.py +0 -0
- {optio_opencode-0.1.3 → optio_opencode-0.1.4}/tests/test_types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: optio-opencode
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
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,8 +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.
|
|
24
|
-
Requires-Dist: optio-host<0.
|
|
23
|
+
Requires-Dist: optio-core<0.3,>=0.2
|
|
24
|
+
Requires-Dist: optio-host<0.3,>=0.2
|
|
25
|
+
Requires-Dist: optio-agents<0.2,>=0.1
|
|
25
26
|
Requires-Dist: asyncssh>=2.14
|
|
26
27
|
Provides-Extra: dev
|
|
27
28
|
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "optio-opencode"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.4"
|
|
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,10 +26,11 @@ classifiers = [
|
|
|
26
26
|
"Framework :: AsyncIO",
|
|
27
27
|
]
|
|
28
28
|
dependencies = [
|
|
29
|
-
"optio-core>=0.
|
|
29
|
+
"optio-core>=0.2,<0.3",
|
|
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
|
-
"optio-host>=0.
|
|
32
|
+
"optio-host>=0.2,<0.3",
|
|
33
|
+
"optio-agents>=0.1,<0.2",
|
|
33
34
|
"asyncssh>=2.14",
|
|
34
35
|
]
|
|
35
36
|
|
|
@@ -7,45 +7,20 @@ addressed. The consumer's own task description is then appended verbatim.
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
from optio_agents.protocol.prompt import LOG_CHANNEL_PROMPT
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
_OPENCODE_INTRO = """# Coordination protocol with the host (optio-opencode)
|
|
11
14
|
|
|
12
15
|
You are running inside a coordination harness. Follow these conventions
|
|
13
16
|
throughout the session.
|
|
14
17
|
|
|
15
|
-
## Log channel
|
|
16
|
-
|
|
17
|
-
Append one line per entry to `./optio.log` in this directory. Each line
|
|
18
|
-
must start with one of:
|
|
19
|
-
|
|
20
|
-
- `STATUS:` — progress update for the human. Optional leading percent,
|
|
21
|
-
e.g. `STATUS: 50% counting my fingers`.
|
|
22
|
-
- `DELIVERABLE:` — absolute or workdir-relative path to a file you've
|
|
23
|
-
just produced, e.g. `DELIVERABLE: ./deliverables/summary.md`.
|
|
24
|
-
- `DONE` — you have finished the task. May be followed by an optional
|
|
25
|
-
summary on the same line: `DONE: wrote the report`.
|
|
26
|
-
- `ERROR` — you cannot continue. May be followed by an optional
|
|
27
|
-
message: `ERROR: provider auth failed`.
|
|
28
|
-
|
|
29
|
-
**Every entry must end with a newline character (`\\n`).** The host
|
|
30
|
-
reads `optio.log` with a line-oriented tailer that only emits a line
|
|
31
|
-
once it sees `\\n`; an entry written without a trailing newline (e.g.
|
|
32
|
-
via `printf 'DONE'`) will be buffered indefinitely and never reach the
|
|
33
|
-
host. Use `echo`, `>>` redirection of a heredoc, or any other mechanism
|
|
34
|
-
that guarantees a trailing newline. If unsure, double-check with
|
|
35
|
-
`tail -c 1 ./optio.log` — the result must be a newline.
|
|
36
|
-
|
|
37
|
-
After writing `DONE` or `ERROR`, the session will terminate. Do not
|
|
38
|
-
write further lines.
|
|
39
|
-
|
|
40
|
-
## Deliverables
|
|
41
|
-
|
|
42
|
-
Place files you want to hand back to the host under `./deliverables/`.
|
|
43
|
-
For each file, write a `DELIVERABLE:` log line *after* the file exists
|
|
44
|
-
and its contents are final. The host fetches files by reading these
|
|
45
|
-
log lines.
|
|
46
18
|
"""
|
|
47
19
|
|
|
48
20
|
|
|
21
|
+
BASE_PROMPT_PRE = _OPENCODE_INTRO + LOG_CHANNEL_PROMPT
|
|
22
|
+
|
|
23
|
+
|
|
49
24
|
BASE_PROMPT_POST = """## Task
|
|
50
25
|
|
|
51
26
|
Here comes the description of your actual task to complete. Throughout
|
|
@@ -7,7 +7,7 @@ Section 4 of the design spec. The public entry point is the factory
|
|
|
7
7
|
|
|
8
8
|
Most of the per-session work is generic log/deliverables protocol
|
|
9
9
|
plumbing (parse ``optio.log``, fetch deliverables, watch for cancel) and
|
|
10
|
-
lives in ``
|
|
10
|
+
lives in ``optio_agents.protocol.run_log_protocol_session``. This module
|
|
11
11
|
keeps only the opencode-specific work — write AGENTS.md / opencode.json,
|
|
12
12
|
install/launch the opencode binary, set up tunnel and widget, and the
|
|
13
13
|
resume/snapshot brackets around the protocol session.
|
|
@@ -29,10 +29,10 @@ from typing import AsyncIterator, Callable
|
|
|
29
29
|
from optio_core.context import ProcessContext
|
|
30
30
|
from optio_core.models import BasicAuth, TaskInstance
|
|
31
31
|
|
|
32
|
-
from
|
|
32
|
+
from optio_agents import HookContext
|
|
33
33
|
from optio_host.host import Host, LocalHost, ProcessHandle, RemoteHost
|
|
34
34
|
from optio_host.paths import task_dir
|
|
35
|
-
from
|
|
35
|
+
from optio_agents.protocol.session import _SessionFailed, run_log_protocol_session
|
|
36
36
|
from optio_opencode import host_actions
|
|
37
37
|
from optio_opencode.prompt import compose_agents_md
|
|
38
38
|
from optio_opencode.snapshots import (
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"""Public data types for optio-opencode consumers.
|
|
2
2
|
|
|
3
|
-
The generic ``DeliverableCallback`` / ``HookCallback`` types
|
|
4
|
-
``
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
imports keep working unchanged.
|
|
3
|
+
The generic ``DeliverableCallback`` / ``HookCallback`` types are owned by
|
|
4
|
+
``optio-agents`` (they describe the log/deliverables protocol); ``SSHConfig``
|
|
5
|
+
is owned by ``optio-host``. This module re-exports them so existing
|
|
6
|
+
``from optio_opencode.types import ...`` imports keep working unchanged.
|
|
8
7
|
"""
|
|
9
8
|
|
|
10
9
|
from dataclasses import dataclass, field
|
|
11
10
|
from typing import Any, Callable
|
|
12
11
|
|
|
13
|
-
from
|
|
12
|
+
from optio_agents.protocol.session import DeliverableCallback, HookCallback
|
|
14
13
|
from optio_host.types import SSHConfig
|
|
15
14
|
|
|
16
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: optio-opencode
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
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,8 +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.
|
|
24
|
-
Requires-Dist: optio-host<0.
|
|
23
|
+
Requires-Dist: optio-core<0.3,>=0.2
|
|
24
|
+
Requires-Dist: optio-host<0.3,>=0.2
|
|
25
|
+
Requires-Dist: optio-agents<0.2,>=0.1
|
|
25
26
|
Requires-Dist: asyncssh>=2.14
|
|
26
27
|
Provides-Extra: dev
|
|
27
28
|
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
@@ -24,7 +24,7 @@ async def test_setup_workdir_creates_workdir(local_host):
|
|
|
24
24
|
assert os.path.isdir(local_host.workdir)
|
|
25
25
|
# As of the optio-host split, setup_workdir mkdirs the workdir only.
|
|
26
26
|
# The protocol-specific deliverables/ + optio.log are owned by the
|
|
27
|
-
# protocol session driver in
|
|
27
|
+
# protocol session driver in optio_agents.protocol.session.
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
@pytest.mark.asyncio
|
|
@@ -136,7 +136,7 @@ async def test_tail_file_yields_appended_lines(local_host):
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
async def test_fetch_deliverable_text(local_host):
|
|
139
|
-
from
|
|
139
|
+
from optio_agents.protocol.session import fetch_deliverable_text
|
|
140
140
|
await local_host.setup_workdir()
|
|
141
141
|
os.makedirs(os.path.join(local_host.workdir, "deliverables"), exist_ok=True)
|
|
142
142
|
target = os.path.join(local_host.workdir, "deliverables", "a.txt")
|
|
@@ -146,7 +146,7 @@ async def test_fetch_deliverable_text(local_host):
|
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
async def test_fetch_deliverable_non_utf8_raises(local_host):
|
|
149
|
-
from
|
|
149
|
+
from optio_agents.protocol.session import fetch_deliverable_text
|
|
150
150
|
await local_host.setup_workdir()
|
|
151
151
|
os.makedirs(os.path.join(local_host.workdir, "deliverables"), exist_ok=True)
|
|
152
152
|
target = os.path.join(local_host.workdir, "deliverables", "b.bin")
|
|
@@ -97,7 +97,7 @@ class _RecordingFakeHost:
|
|
|
97
97
|
return b""
|
|
98
98
|
|
|
99
99
|
async def run_command(self, *a, **kw):
|
|
100
|
-
from optio_host.
|
|
100
|
+
from optio_host.host import RunResult
|
|
101
101
|
self.timeline.append(f"run_command:{a[0]}")
|
|
102
102
|
return RunResult(stdout="", stderr="", exit_code=0)
|
|
103
103
|
|
|
@@ -255,8 +255,8 @@ async def test_on_deliverable_receives_hook_ctx_and_can_use_host_primitives(tmp_
|
|
|
255
255
|
)
|
|
256
256
|
# We don't run a full session here; we directly invoke
|
|
257
257
|
# _deliverable_fetch_loop with a constructed HookContext.
|
|
258
|
-
from
|
|
259
|
-
from
|
|
258
|
+
from optio_agents.protocol.session import _deliverable_fetch_loop
|
|
259
|
+
from optio_agents import HookContext
|
|
260
260
|
|
|
261
261
|
queue = asyncio.Queue()
|
|
262
262
|
await queue.put(("/wd/deliverables/x.txt", "x.txt"))
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import pytest
|
|
4
4
|
|
|
5
|
-
from optio_host.
|
|
5
|
+
from optio_host.host import RunResult
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class _FakeHost:
|
|
@@ -170,7 +170,7 @@ class _ExecutingFakeCtx:
|
|
|
170
170
|
|
|
171
171
|
|
|
172
172
|
async def test_install_opencode_from_zip_happy_path(zip_server, tmp_path):
|
|
173
|
-
from
|
|
173
|
+
from optio_agents import HookContext
|
|
174
174
|
from optio_host.host import LocalHost
|
|
175
175
|
from optio_opencode.host_actions import _install_opencode_from_zip
|
|
176
176
|
|
|
@@ -212,7 +212,7 @@ async def test_install_opencode_from_zip_happy_path(zip_server, tmp_path):
|
|
|
212
212
|
|
|
213
213
|
async def test_install_opencode_from_zip_cleans_up_tempdir(zip_server, tmp_path):
|
|
214
214
|
"""The temp dir created on the host should be removed after install."""
|
|
215
|
-
from
|
|
215
|
+
from optio_agents import HookContext
|
|
216
216
|
from optio_host.host import LocalHost
|
|
217
217
|
from optio_opencode.host_actions import _install_opencode_from_zip
|
|
218
218
|
|
|
@@ -264,7 +264,7 @@ async def test_install_opencode_from_zip_cleans_up_tempdir(zip_server, tmp_path)
|
|
|
264
264
|
|
|
265
265
|
async def test_ensure_opencode_installed_returns_existing_path_when_ok(monkeypatch):
|
|
266
266
|
"""When smart-install says 'ok', resolve the on-PATH path and return it."""
|
|
267
|
-
from
|
|
267
|
+
from optio_agents import HookContext
|
|
268
268
|
from optio_opencode import host_actions
|
|
269
269
|
|
|
270
270
|
async def stub_check(host, *, install_dir=None):
|
|
@@ -295,7 +295,7 @@ async def test_ensure_opencode_installed_returns_existing_path_when_ok(monkeypat
|
|
|
295
295
|
|
|
296
296
|
|
|
297
297
|
async def test_ensure_opencode_installed_raises_when_install_disabled(monkeypatch):
|
|
298
|
-
from
|
|
298
|
+
from optio_agents import HookContext
|
|
299
299
|
from optio_opencode import host_actions
|
|
300
300
|
|
|
301
301
|
async def stub_check(host, *, install_dir=None):
|
|
@@ -324,7 +324,7 @@ async def test_ensure_opencode_installed_installs_when_download_required(
|
|
|
324
324
|
monkeypatch, zip_server, tmp_path,
|
|
325
325
|
):
|
|
326
326
|
"""End-to-end with a real LocalHost + fake zip server: install path."""
|
|
327
|
-
from
|
|
327
|
+
from optio_agents import HookContext
|
|
328
328
|
from optio_host.host import LocalHost
|
|
329
329
|
from optio_opencode import host_actions
|
|
330
330
|
|
|
@@ -394,7 +394,7 @@ async def test_ensure_opencode_installed_respects_custom_install_dir(
|
|
|
394
394
|
):
|
|
395
395
|
"""End-to-end: an explicit ``install_dir`` flows through to the
|
|
396
396
|
install target and to the post-ok ``command -v`` PATH augmentation."""
|
|
397
|
-
from
|
|
397
|
+
from optio_agents import HookContext
|
|
398
398
|
from optio_host.host import LocalHost
|
|
399
399
|
from optio_opencode import host_actions
|
|
400
400
|
|
|
@@ -439,7 +439,7 @@ async def test_ensure_opencode_installed_default_install_dir_is_home_local_bin(
|
|
|
439
439
|
):
|
|
440
440
|
"""When ``install_dir`` is omitted, the default is
|
|
441
441
|
``<host_home>/.local/bin``."""
|
|
442
|
-
from
|
|
442
|
+
from optio_agents import HookContext
|
|
443
443
|
from optio_opencode import host_actions
|
|
444
444
|
|
|
445
445
|
fake_home = tmp_path / "home"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optio_opencode-0.1.3 → optio_opencode-0.1.4}/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
|