@aerovato/operator-helper 1.4.0 → 1.6.0

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.
package/README.md CHANGED
@@ -30,6 +30,9 @@ operator-helper install opencode
30
30
  # Pi
31
31
  operator-helper install pi
32
32
 
33
+ # DeepSeek Harness
34
+ operator-helper install deepseek
35
+
33
36
  # Code Puppy
34
37
  operator-helper install code-puppy
35
38
  ```
@@ -48,6 +51,7 @@ The direct user-facing Helper operation is adapter installation:
48
51
  operator-helper install opencode
49
52
  operator-helper install opencode-v2
50
53
  operator-helper install pi
54
+ operator-helper install deepseek
51
55
  operator-helper install code-puppy
52
56
  ```
53
57
 
@@ -43,33 +43,31 @@ except ImportError:
43
43
  CustomCommandResult = None
44
44
 
45
45
  _RENDER_TIMEOUT_SECONDS = 30
46
- _COMMAND_TIMEOUT_SECONDS = 60
47
46
  _render_tasks: dict[str, asyncio.Task[str]] = {}
48
47
  _update_launched = False
49
48
 
50
49
  _COMMANDS = {
51
50
  "operator:user-init": (
52
51
  "Initialize Operator User Instructions",
53
- ("user init", "user guide"),
54
- "Follow the instructions in the guide output above.",
52
+ "user init",
53
+ "Follow the User Setup guide in its output, including when initialization reports failures.",
55
54
  ),
56
55
  "operator:project-init": (
57
56
  "Initialize Operator Project",
58
- ("project init", "project guide"),
59
- "Follow the instructions in the guide output above.",
57
+ "project init",
58
+ "Follow the Project Setup guide in its output, including when initialization reports failures.",
60
59
  ),
61
60
  "operator:index": (
62
61
  "Build or refresh the Operator Project Index",
63
- ("index status", "index guide"),
64
- "Follow the instructions in the guide output above.",
62
+ "index init",
63
+ "Follow the Project Index Setup guide in its output, including when inspection reports failures.",
65
64
  ),
66
65
  "operator:repair": (
67
66
  "Repair Operator",
68
- ("memory check",),
69
- "If the output says `No issues detected.`, no action is needed and you may stop. "
70
- "Otherwise, repair only the reported Operator memory issues; do not initialize "
71
- "uninitialized partitions. Rerun `operator-helper memory check` until it succeeds, "
72
- "then read the applicable Operator memory before continuing.",
67
+ "memory check",
68
+ "If no issues are detected, stop. Otherwise, repair only the reported load "
69
+ "failures without initializing absent partitions. Rerun `operator-helper memory "
70
+ "check` to confirm the repair, then read the applicable Operator memory documents.",
73
71
  ),
74
72
  }
75
73
 
@@ -145,8 +143,6 @@ async def _get_preamble(conversation_key: str) -> str:
145
143
 
146
144
 
147
145
  async def _render_preamble(conversation_key: str) -> str:
148
- environment = os.environ.copy()
149
- environment["OPERATOR_HELPER_SKIP_UPDATE"] = "1"
150
146
  process: asyncio.subprocess.Process | None = None
151
147
  try:
152
148
  process = await asyncio.create_subprocess_exec(
@@ -154,7 +150,6 @@ async def _render_preamble(conversation_key: str) -> str:
154
150
  "preamble",
155
151
  stdout=asyncio.subprocess.PIPE,
156
152
  stderr=asyncio.subprocess.PIPE,
157
- env=environment,
158
153
  )
159
154
  stdout, stderr = await asyncio.wait_for(
160
155
  process.communicate(), timeout=_RENDER_TIMEOUT_SECONDS
@@ -284,62 +279,23 @@ def _custom_command(_command: str, name: str) -> CustomCommandResult | None:
284
279
  if definition is None:
285
280
  return None
286
281
 
287
- version = _run_helper(("version",))
288
- if version[0] != 0:
289
- diagnostic = (
290
- "Operator Helper is unavailable. Help the user repair the missing "
291
- "operator-helper command (npm: @aerovato/operator-helper). Validate the "
292
- f"repair by rerunning `operator-helper version`. Once it succeeds, ask the "
293
- f"user to rerun `/{name}`."
294
- )
295
- content = "\n\n".join(
296
- (
297
- _command_output("operator-helper version 2>&1", version[1]),
298
- _tag("operator-diagnostic", diagnostic),
299
- )
300
- )
301
- return CustomCommandResult(content)
302
-
303
- _, operations, instructions = definition
304
- outputs = []
305
- for operation in operations:
306
- arguments = tuple(operation.split())
307
- result = _run_helper(arguments)
308
- outputs.append(_command_output(f"operator-helper {operation} 2>&1", result[1]))
309
- outputs.append(_tag("operator-instructions", instructions))
310
- return CustomCommandResult("\n\n".join(outputs))
311
-
312
-
313
- def _run_helper(arguments: tuple[str, ...]) -> tuple[int, str]:
314
- try:
315
- result = subprocess.run(
316
- ("operator-helper", *arguments),
317
- stdout=subprocess.PIPE,
318
- stderr=subprocess.STDOUT,
319
- text=True,
320
- timeout=_COMMAND_TIMEOUT_SECONDS,
321
- check=False,
322
- )
323
- return result.returncode, _remove_process_newline(result.stdout)
324
- except (OSError, subprocess.TimeoutExpired) as error:
325
- return 1, str(error)
326
-
327
-
328
- def _command_output(command: str, output: str) -> str:
329
- return (
330
- "<operator-command>\n"
331
- f"<command>{command}</command>\n"
332
- "<output>\n"
333
- f"{output}\n"
334
- "</output>\n"
335
- "</operator-command>"
282
+ description, operation, instructions = definition
283
+ return CustomCommandResult(
284
+ f"# {description}\n\n"
285
+ "1. Run `operator-helper version`. If an update is available, run "
286
+ "`operator-helper upgrade` before continuing.\n"
287
+ f"2. Run `operator-helper {operation}`. {instructions}\n\n"
288
+ "## Recovery\n\n"
289
+ "- If Helper cannot start, repair its installation and retry the failed command.\n"
290
+ "- If the version check or upgrade fails, diagnose the error and retry.\n"
291
+ f"- If `operator-helper {operation}` reports a failure, use its output to "
292
+ "resolve it and rerun it as needed.\n"
293
+ "- If you cannot resolve a problem, report the blocker.\n\n"
294
+ "Use Helper output as working context. Do not reproduce it wholesale or "
295
+ "reimplement Helper logic."
336
296
  )
337
297
 
338
298
 
339
- def _tag(name: str, content: str) -> str:
340
- return f"<{name}>\n{content}\n</{name}>"
341
-
342
-
343
299
  def _custom_command_help() -> list[tuple[str, str]]:
344
300
  return [(name, definition[0]) for name, definition in _COMMANDS.items()]
345
301