optio-opencode 0.2.2__py3-none-any.whl → 0.2.3__py3-none-any.whl

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/prompt.py CHANGED
@@ -8,7 +8,7 @@ addressed. The consumer's own task description is then appended verbatim.
8
8
 
9
9
 
10
10
  from optio_agents.prompt import downloadables_block
11
- from optio_agents.protocol import build_log_channel_prompt
11
+ from optio_agents.protocol import ProtocolFeatures, build_log_channel_prompt
12
12
 
13
13
 
14
14
  _OPENCODE_INTRO = """# Coordination protocol with the host (optio-opencode)
@@ -163,7 +163,7 @@ def compose_agents_md(
163
163
  )
164
164
  if host_protocol:
165
165
  if documentation is None:
166
- documentation = build_log_channel_prompt("suppress")
166
+ documentation = build_log_channel_prompt(ProtocolFeatures(browser="suppress"))
167
167
  base_prompt_pre = _OPENCODE_INTRO + documentation
168
168
  else:
169
169
  # Conversation mode without the optio.log channel: no keyword docs,
optio_opencode/session.py CHANGED
@@ -97,7 +97,11 @@ async def run_opencode_session(ctx: ProcessContext, config: OpencodeTaskConfig)
97
97
  """Execute function body for one optio-opencode task instance."""
98
98
  # --- per-task filesystem layout ---------------------------------------
99
99
  host: Host = _build_host(config, ctx.process_id)
100
- protocol = get_protocol(browser="suppress")
100
+ protocol = get_protocol(
101
+ browser="suppress",
102
+ client_messages=config.use_client_messages,
103
+ caller_messages=config.on_caller_message is not None,
104
+ )
101
105
 
102
106
  instructions = config.consumer_instructions
103
107
  omit_task_framing = False
@@ -502,6 +506,7 @@ async def run_opencode_session(ctx: ProcessContext, config: OpencodeTaskConfig)
502
506
  body=_opencode_body,
503
507
  prepare=_prepare,
504
508
  on_deliverable=config.on_deliverable,
509
+ on_caller_message=config.on_caller_message,
505
510
  after_execute=config.after_execute,
506
511
  protocol=protocol,
507
512
  agent_sender=_agent_sender,
optio_opencode/types.py CHANGED
@@ -9,7 +9,11 @@ is owned by ``optio-host``. This module re-exports them so existing
9
9
  from dataclasses import dataclass, field
10
10
  from typing import Any, Awaitable, Callable, Literal
11
11
 
12
- from optio_agents.protocol.session import DeliverableCallback, HookCallback
12
+ from optio_agents.protocol.session import (
13
+ CallerMessageCallback,
14
+ DeliverableCallback,
15
+ HookCallback,
16
+ )
13
17
  from optio_host.types import SSHConfig
14
18
 
15
19
 
@@ -28,6 +32,7 @@ _VALID_TOOL_VERBOSITY = {"silent", "description-only", "verbose"}
28
32
 
29
33
 
30
34
  __all__ = [
35
+ "CallerMessageCallback",
31
36
  "DeliverableCallback",
32
37
  "HookCallback",
33
38
  "SSHConfig",
@@ -52,6 +57,14 @@ class OpencodeTaskConfig:
52
57
  opencode_config: dict[str, Any] = field(default_factory=dict)
53
58
  ssh: SSHConfig | None = None
54
59
  on_deliverable: DeliverableCallback | None = None
60
+ # Enable the CLIENT_MESSAGE keyword: agent-pushed messages routed to the
61
+ # originating browser session's frontend (stored as sessionEvents,
62
+ # surfaced via optio-ui's onClientMessage). Off by default.
63
+ use_client_messages: bool = False
64
+ # Enable the CALLER_MESSAGE keyword: agent-pushed messages routed to this
65
+ # callback in the embedding application. A non-None return value is sent
66
+ # back to the agent as feedback. Off (None) by default.
67
+ on_caller_message: CallerMessageCallback | None = None
55
68
  install_if_missing: bool = True
56
69
  # Override for the optio-owned opencode binary **cache** directory (where
57
70
  # the opencode binary is installed/cached on the worker). ``None``
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: optio-opencode
3
- Version: 0.2.2
3
+ Version: 0.2.3
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,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.3,>=0.2
23
+ Requires-Dist: optio-core<0.4,>=0.3
24
24
  Requires-Dist: optio-host<0.3,>=0.2
25
- Requires-Dist: optio-agents<0.3,>=0.2
25
+ Requires-Dist: optio-agents<0.4,>=0.3
26
26
  Requires-Dist: asyncssh>=2.14
27
27
  Requires-Dist: aiohttp>=3.9
28
28
  Provides-Extra: dev
@@ -81,6 +81,18 @@ task = create_opencode_task(config)
81
81
 
82
82
  Set `ssh=None` for local subprocess mode.
83
83
 
84
+ ## Messages
85
+
86
+ - `use_client_messages` (bool, default `False`) — enable the `CLIENT_MESSAGE:`
87
+ log keyword: the agent can push `{keyword, data}` messages to the browser
88
+ session that launched the task (surfaced via optio-ui's `onClientMessage`).
89
+ - `on_caller_message` (async callback, default `None`) — enable the
90
+ `CALLER_MESSAGE:` log keyword: the agent can push `{keyword, data}` messages
91
+ to your application. Signature `(hook_ctx, keyword, data) -> str | None`;
92
+ a non-None return is sent back to the agent as feedback. Keywords that are
93
+ not enabled are absent from both the parser and the agent-facing protocol
94
+ documentation.
95
+
84
96
  ## License
85
97
 
86
98
  Apache-2.0.
@@ -2,13 +2,13 @@ optio_opencode/__init__.py,sha256=Y3spOLFCKHXrhnLMvnlilknW_XWE48nI7ic_MOgKMVU,15
2
2
  optio_opencode/conversation.py,sha256=biM5vVQOpElagcUWDyNRg2IXyDLKkBRHwpDCbCWIFDQ,15344
3
3
  optio_opencode/cred_watcher.py,sha256=dRx5Ktf9qz4VqWN1VegIHGz09BnHwVbUStE3pUZeTyo,4936
4
4
  optio_opencode/host_actions.py,sha256=pQZaGsR2lXRtIg7zAEowL2CvWW3rSsY0S4sO5d1YbSk,22154
5
- optio_opencode/prompt.py,sha256=KnPCwAzkv4VcAtoqRXaktrKDBce3JzhvCLFfTJS6CXY,7410
5
+ optio_opencode/prompt.py,sha256=TLR0fpCQnZJCcSSg6AAfQOK3tcTvVZVDmJRg329wM8Y,7454
6
6
  optio_opencode/seed_manifest.py,sha256=Md9-Vgidt4HTe1IGnKJnszBXcVIMwCN201L29qlljB0,2682
7
- optio_opencode/session.py,sha256=1TK-j_J-zoVYDsKe8JEfA6NHDmQDE2U12DnEwSUmncg,47631
7
+ optio_opencode/session.py,sha256=PNY3q9V_D-hHYV4arJnxJ7CPy22H0zoIUV9ZstHSp_0,47816
8
8
  optio_opencode/snapshots.py,sha256=wKX4OpCMYe-M9-LNZYVBxlaDtw9s15eZhR3c2mxreXw,3285
9
- optio_opencode/types.py,sha256=u3B3DgijwZJfodxWx3f8PEzAPug6ivA-4UFpOT2hW7U,9104
9
+ optio_opencode/types.py,sha256=EehxpPkHlLkGLOn7IUADsd8aJDcPo1u6s1RMSFW_sdc,9697
10
10
  optio_opencode/verify.py,sha256=44cOC3EnkjxBU5MGnL1Gs3VUkdIyO813gEF7Xn_vsac,6276
11
- optio_opencode-0.2.2.dist-info/METADATA,sha256=jPyh5nVQ2SPwt_tNuhSGpFPrlYTLJIX9RvlOeM7qg6E,3510
12
- optio_opencode-0.2.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
13
- optio_opencode-0.2.2.dist-info/top_level.txt,sha256=1jAPllx4JDiN8gzJtbS206_8fTFSwitP9dv1WkxyiYM,15
14
- optio_opencode-0.2.2.dist-info/RECORD,,
11
+ optio_opencode-0.2.3.dist-info/METADATA,sha256=CrBgnYhOATFyy3gwsQtw3Tjp-CMQ6720yAUa1bJmkjM,4154
12
+ optio_opencode-0.2.3.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
13
+ optio_opencode-0.2.3.dist-info/top_level.txt,sha256=1jAPllx4JDiN8gzJtbS206_8fTFSwitP9dv1WkxyiYM,15
14
+ optio_opencode-0.2.3.dist-info/RECORD,,