devops-bot-sdk 1.4.90__tar.gz → 1.4.92__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 (38) hide show
  1. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/PKG-INFO +1 -1
  2. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/devops_bot_sdk.egg-info/PKG-INFO +1 -1
  3. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/pyproject.toml +1 -1
  4. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/__init__.py +2 -2
  5. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/client.py +1 -1
  6. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/git_ops.py +40 -12
  7. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/ipc/handlers.py +22 -1
  8. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/README.md +0 -0
  9. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/devops_bot_sdk.egg-info/SOURCES.txt +0 -0
  10. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/devops_bot_sdk.egg-info/dependency_links.txt +0 -0
  11. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/devops_bot_sdk.egg-info/entry_points.txt +0 -0
  12. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/devops_bot_sdk.egg-info/requires.txt +0 -0
  13. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/devops_bot_sdk.egg-info/top_level.txt +0 -0
  14. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/collectors/__init__.py +0 -0
  15. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/collectors/files.py +0 -0
  16. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/collectors/process.py +0 -0
  17. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/collectors/screenshot.py +0 -0
  18. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/config.py +0 -0
  19. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/crucial.py +0 -0
  20. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/exceptions.py +0 -0
  21. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/graphify.py +0 -0
  22. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/hooks/__init__.py +0 -0
  23. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/hooks/crucial_guard.py +0 -0
  24. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/ipc/__init__.py +0 -0
  25. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/ipc/electron_bridge.py +0 -0
  26. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/local_exec.py +0 -0
  27. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/models/__init__.py +0 -0
  28. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/models/envelope.py +0 -0
  29. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/models/requests.py +0 -0
  30. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/models/responses.py +0 -0
  31. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/models/snapshots.py +0 -0
  32. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/py.typed +0 -0
  33. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/run_auto.py +0 -0
  34. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/sse.py +0 -0
  35. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/test.py +0 -0
  36. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/test_pipeline.py +0 -0
  37. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/sdk/updater.py +0 -0
  38. {devops_bot_sdk-1.4.90 → devops_bot_sdk-1.4.92}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devops-bot-sdk
3
- Version: 1.4.90
3
+ Version: 1.4.92
4
4
  Summary: DevOps Bot Desktop SDK — thin client for the AgentOS Electron desktop app
5
5
  Author: noumanaziz2128
6
6
  License-Expression: LicenseRef-Proprietary
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devops-bot-sdk
3
- Version: 1.4.90
3
+ Version: 1.4.92
4
4
  Summary: DevOps Bot Desktop SDK — thin client for the AgentOS Electron desktop app
5
5
  Author: noumanaziz2128
6
6
  License-Expression: LicenseRef-Proprietary
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "devops-bot-sdk"
7
- version = "1.4.90"
7
+ version = "1.4.92"
8
8
  description = "DevOps Bot Desktop SDK — thin client for the AgentOS Electron desktop app"
9
9
  readme = "README.md"
10
10
  license = "LicenseRef-Proprietary"
@@ -1,6 +1,6 @@
1
1
  """AgentOS Desktop SDK — thin HTTPS/SSE client for the Electron app.
2
2
 
3
- Version: 1.4.90
3
+ Version: 1.4.92
4
4
 
5
5
  Public surface:
6
6
  BackendClient.from_config() — create client from ~/.agentos/config.toml
@@ -30,7 +30,7 @@ Rules:
30
30
  - All data egress through submit_webhook only
31
31
  """
32
32
 
33
- __version__ = "1.4.90"
33
+ __version__ = "1.4.92"
34
34
  __author__ = "AgentOS"
35
35
 
36
36
  from sdk.client import BackendClient
@@ -58,7 +58,7 @@ def _notify_status(task_id: str, status: str) -> None:
58
58
  pass
59
59
 
60
60
 
61
- SDK_VERSION = "1.4.90"
61
+ SDK_VERSION = "1.4.92"
62
62
  _POLL_INTERVAL = 3.0
63
63
  _POLL_TIMEOUT = 600.0
64
64
  _ORCHESTRATE_TIMEOUT = 2700.0 # 45 min — covers approval wait + VPS execution time
@@ -72,6 +72,19 @@ async def _is_git_repo(path: str, env: dict) -> bool:
72
72
  return rc == 0 and out == "true"
73
73
 
74
74
 
75
+ # A branch named exactly like a Jira ticket id (e.g. "LDA-6", "OCR-103"). The
76
+ # "name the branch exactly the ticket id" convention produces these, so a
77
+ # leftover checkout from a PREVIOUS ticket's run must be treated as a stale
78
+ # feature branch — never as a base to cut the next ticket's branch from.
79
+ _TICKET_BRANCH_RE = re.compile(r"^[A-Za-z][A-Za-z0-9]{1,9}-\d+$")
80
+
81
+
82
+ def _is_work_branch(name: str) -> bool:
83
+ """True when `name` is one of OUR generated work branches (feature/* or a
84
+ bare ticket id) — i.e. never a legitimate base."""
85
+ return name.startswith("feature/") or bool(_TICKET_BRANCH_RE.match(name))
86
+
87
+
75
88
  async def detect_default_branch(path: str, env: dict) -> str:
76
89
  """Repo default branch — the PR base.
77
90
 
@@ -100,9 +113,10 @@ async def detect_default_branch(path: str, env: dict) -> str:
100
113
  )
101
114
  if rc == 0:
102
115
  return cand
103
- # 4. Last resort: the current branch, but never a feature branch.
116
+ # 4. Last resort: the current branch, but never one of our work branches
117
+ # (feature/* or a bare ticket id like "LDA-6").
104
118
  rc, out, _ = await _run(["git", "rev-parse", "--abbrev-ref", "HEAD"], path, env)
105
- if rc == 0 and out and not out.startswith("feature/"):
119
+ if rc == 0 and out and not _is_work_branch(out):
106
120
  return out
107
121
  return "main"
108
122
 
@@ -167,9 +181,10 @@ async def start_branch(
167
181
  - `base` omitted → the repo's CURRENT checked-out branch (the branch the
168
182
  user is actually working on); the feature branch is cut from local HEAD
169
183
  so the user's working state is preserved. If HEAD is detached or already
170
- one of OUR `feature/*` branches (a stale checkout from a prior re-run in
171
- a shared working tree), fall back to `detect_default_branch` so we never
172
- chain a feature branch onto another feature branch.
184
+ one of OUR work branches `feature/*` or a bare ticket-id branch like
185
+ "LDA-6" (a stale checkout from a prior ticket's run in a shared working
186
+ tree) fall back to `detect_default_branch` so we never chain one
187
+ ticket's branch onto another's.
173
188
 
174
189
  Returns {"branch", "base"} or None when the path isn't a git repo (e.g. a
175
190
  fresh scratch dir) or the checkout failed. The returned `base` is the branch
@@ -210,7 +225,7 @@ async def start_branch(
210
225
  # Default: base = the CURRENT checked-out branch (the user's working branch).
211
226
  rc, cur, _ = await _run(["git", "rev-parse", "--abbrev-ref", "HEAD"], path, env)
212
227
  cur = cur.strip() if rc == 0 else ""
213
- if cur and cur != "HEAD" and not cur.startswith("feature/"):
228
+ if cur and cur != "HEAD" and not _is_work_branch(cur):
214
229
  # Cut from local HEAD — preserve the user's working state, do not pull.
215
230
  rc, _, _ = await _run(["git", "checkout", "-B", branch], path, env)
216
231
  if rc != 0:
@@ -218,7 +233,8 @@ async def start_branch(
218
233
  logger.info("git_ops.branch | %s ← current branch %s", branch, cur)
219
234
  return {"branch": branch, "base": cur}
220
235
 
221
- # HEAD detached or a stale feature/* checkout fall back to repo default.
236
+ # HEAD detached or a stale work-branch checkout (feature/* or a previous
237
+ # ticket's id-named branch) → fall back to the repo default.
222
238
  resolved = await detect_default_branch(path, env)
223
239
  if resolved == branch:
224
240
  resolved = "main"
@@ -300,7 +316,10 @@ async def finish_pr(
300
316
  `gh auth login`). SSH alone covers git transport, not the PR.
301
317
 
302
318
  Every failure path is logged so a missing PR is diagnosable instead of silent.
303
- Returns {"pushed": bool, "pr_url": str | None, "pr_error": str | None}.
319
+ Returns {"pushed": bool, "pr_url": str | None, "pr_error": str | None,
320
+ "committed": bool, "pr_unavailable": bool} — `pr_unavailable` is True when
321
+ the box simply has no way to open a PR (no token AND no `gh`), which callers
322
+ treat as a warning rather than a failed PR attempt.
304
323
  """
305
324
  path = str(Path(project_path).expanduser())
306
325
  env = _git_env(github_token)
@@ -353,18 +372,27 @@ async def finish_pr(
353
372
  pr_error = f"gh pr create failed: {gh_err[:200]}"
354
373
  logger.warning("git_ops.gh_pr_failed branch=%s error=%s", branch, gh_err[:300])
355
374
 
375
+ pr_unavailable = False
356
376
  if not pr_url and pr_error is None:
357
377
  # Pushed, but no PR and no specific error captured above.
358
378
  if github_token and owner_repo:
359
379
  pr_error = "no PR created — REST API returned no URL"
360
380
  elif not github_token and not shutil.which("gh"):
361
- pr_error = ("no PR created no token and `gh` not installed; SSH "
362
- "transport can't open a PR. Install gh + `gh auth login`, "
363
- "or provide a GitHub token.")
381
+ # This box CANNOT open a PR at all (no token, no gh) SSH covers
382
+ # git transport only. Not a failed attempt: on SSH-only setups the
383
+ # PR is opened externally (platform/human), so flag it as
384
+ # `pr_unavailable` so the caller treats it as a warning, not a
385
+ # compliance failure.
386
+ pr_unavailable = True
387
+ pr_error = ("PR not opened from this machine — no GitHub token and "
388
+ "`gh` not installed (SSH covers push only). The PR must "
389
+ "be opened externally, or install gh + `gh auth login` / "
390
+ "provide a token.")
364
391
  elif not shutil.which("gh"):
365
392
  pr_error = "no PR created — missing GitHub token or unrecognized origin remote"
366
393
  else:
367
394
  pr_error = "no PR created"
368
395
  logger.warning("git_ops.no_pr branch=%s reason=%s", branch, pr_error)
369
396
 
370
- return {"pushed": pushed, "pr_url": pr_url, "pr_error": pr_error, "committed": committed}
397
+ return {"pushed": pushed, "pr_url": pr_url, "pr_error": pr_error,
398
+ "committed": committed, "pr_unavailable": pr_unavailable}
@@ -2078,8 +2078,19 @@ async def _code_one_repo(
2078
2078
  issues.append("in scope but produced 0 committed changes")
2079
2079
  elif not pr.get("pushed"):
2080
2080
  issues.append("branch was not pushed")
2081
- elif not pr.get("pr_url"):
2081
+ elif not pr.get("pr_url") and not pr.get("pr_unavailable"):
2082
2082
  issues.append(f"no PR opened ({(pr or {}).get('pr_error') or 'unknown'})")
2083
+ elif pr.get("pr_unavailable"):
2084
+ # Committed + pushed, but this box has NO way to open a PR (no
2085
+ # token, no gh — SSH transport only). The PR is opened
2086
+ # externally on such setups, so this is a WARNING, not a
2087
+ # compliance failure: the ticket still completes (Done).
2088
+ await send(Envelope(
2089
+ type="step_update", thread_id=thread_id,
2090
+ data={"status": "running",
2091
+ "current_step": f"[{name}] Pushed OK — PR to be opened "
2092
+ "externally (no token/gh on this machine)"},
2093
+ ).model_dump())
2083
2094
  else:
2084
2095
  # Plain working folder (documentation / analyst deliverables, non-git):
2085
2096
  # no branch/PR to verify, but it must still have PRODUCED something.
@@ -2878,6 +2889,7 @@ import re as _re # noqa: E402
2878
2889
  _BASE_NOISE = {
2879
2890
  "the", "a", "an", "this", "that", "new", "feature", "features",
2880
2891
  "your", "same", "current", "default", "its", "please", "create",
2892
+ "origin", "latest", "upstream", "branch",
2881
2893
  }
2882
2894
  _BASE_DIRECTIVE_RES = [
2883
2895
  # "branch from/off <base>" — most explicit, tried first. Greedy so a full
@@ -2885,6 +2897,15 @@ _BASE_DIRECTIVE_RES = [
2885
2897
  _re.compile(r"branch(?:es|ed|ing)?\s+(?:from|off(?:\s+of)?)\s+(?:the\s+)?[\"'`]?([A-Za-z0-9._\-/]+)[\"'`]?(?:\s+branch)?\b", _re.I),
2886
2898
  # "base branch: <base>" / "base is <base>"
2887
2899
  _re.compile(r"base(?:\s+branch)?\s*(?:[:=]|\bis\b|\bshould\s+be\b)\s*[\"'`]?([A-Za-z0-9._\-/]+)[\"'`]?\b", _re.I),
2900
+ # Literal git-workflow steps: "git checkout <base>" (NOT -b/-B — that's the
2901
+ # NEW branch) and "git pull origin <base>". This is how the standard
2902
+ # Human Instructions template names the base ("git checkout main && git
2903
+ # pull origin main").
2904
+ _re.compile(r"git\s+checkout\s+(?!-)[\"'`]?([A-Za-z0-9._\-/]+)[\"'`]?", _re.I),
2905
+ _re.compile(r"git\s+pull\s+(?:origin\s+)?[\"'`]?([A-Za-z0-9._\-/]+)[\"'`]?", _re.I),
2906
+ # "open a PR into <base>" / "merge to <base>" / "PR Requirements (target: <base>"
2907
+ _re.compile(r"(?:PR|pull\s+request|merge[sd]?)\s+(?:in)?to\s+(?:the\s+)?[\"'`]?([A-Za-z0-9._\-/]+)[\"'`]?", _re.I),
2908
+ _re.compile(r"target\s*:\s*[\"'`]?([A-Za-z][A-Za-z0-9._\-/]*)[\"'`]?", _re.I),
2888
2909
  # "from the <base> branch"
2889
2910
  _re.compile(r"from\s+(?:the\s+)?[\"'`]?([A-Za-z0-9._\-/]+)[\"'`]?\s+branch\b", _re.I),
2890
2911
  # loose "<base> branch" (e.g. "main branch") — last, most permissive.