-
Notifications
You must be signed in to change notification settings - Fork 3
feat(sdk): compose local agents with Desktop and Workstation #222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cm2435-hcomp
wants to merge
44
commits into
main
Choose a base branch
from
charlie/placement-python-sdk
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
fae5de8
wip(sdk): add agent placement and cancellable local execution
cm2435-hcomp f94841b
docs: explain candidate local agent setup and lifecycle limits
cm2435-hcomp 48b35ee
docs: describe local shared file support and lifetime
cm2435-hcomp e2a3739
docs: describe candidate cloud workstation retention
cm2435-hcomp ac92c76
Interrupt desktop commands when the SDK bridge stops
cm2435-hcomp 0b58d7e
Keep async desktop permission prompts on the caller thread
cm2435-hcomp 0f6250d
build: prepare SDK-owned runtime pin updates
cm2435-hcomp 5fcc24b
style(sdk): format shared client exports
cm2435-hcomp 0e7f94b
Merge branch 'charlie/placement-python-sdk' into charlie/placement-sd…
cm2435-hcomp 486bf46
fix(sdk): release download lock scope and close idle-probe clients
cm2435-hcomp 3f968ec
Merge branch 'charlie/placement-python-sdk' into charlie/placement-sd…
cm2435-hcomp 6f33203
fix(sdk): preserve cancellation retries and safe asynchronous lifecycle
cm2435-hcomp cb86d87
Merge branch 'charlie/placement-python-sdk' into charlie/placement-sd…
cm2435-hcomp f75842f
Clean up owned runtime when client validation fails
cm2435-hcomp 8620ce1
Merge branch 'charlie/placement-python-sdk' into charlie/placement-sd…
cm2435-hcomp 82bf0e7
Notify displaced sessions even when bridge stop times out
cm2435-hcomp 8c31d02
Merge branch 'charlie/placement-python-sdk' into charlie/placement-sd…
cm2435-hcomp d21f77f
refactor(sdk): move local runtime into hai_agents_local and add Clien…
abonneth 0f5f9a4
fix(sdk): keep loopback runtime traffic off environment proxies
abonneth 547d2a3
fix(sdk): require the local runtime to prove its identity
abonneth 1446f8e
fix(sdk): publish the runtime token only after the child proves the port
abonneth 8e9b38f
fix(local): stop a bridge cleanly when its session's channel closes
abonneth f738f10
fix(local): keep cancel_session's signature and close only live sessions
abonneth d02c2de
fix(sdk): keep a started runtime alive while other clients use it
abonneth fb3f3d3
chore(sdk): drop internal markers and em dashes from local runtime docs
abonneth 1d6640b
fix(local): give the runtime time to release environments before SIGKILL
abonneth c2c9a96
ci: block SDK releases whose pinned runtime lacks the shared recipe
abonneth a42b972
test: match the runtime identity error
abonneth 725d4e6
Merge remote-tracking branch 'origin/charlie/placement-python-sdk' in…
abonneth c629770
test: skip desktop stop test until hai-drivers ships DesktopCommandRu…
abonneth bd285d2
fix(local): treat a closed channel on result post as a clean stop
abonneth b677898
fix(local): serialize idle shutdown with startup and cover a full spa…
abonneth 59edf26
Merge remote-tracking branch 'origin/charlie/placement-python-sdk' in…
abonneth 434d07a
fix(local): keep the create error when stopping its bridges fails
abonneth 292d460
fix(local): count queued sessions as active in idle shutdown
abonneth ee14299
Merge remote-tracking branch 'origin/charlie/placement-python-sdk' in…
abonneth 688453b
fix(runtime): stop an owned runtime whose idle probe fails
abonneth 5c66e7c
refactor(runtime): drop unused LocalRuntime.force_kill and health
abonneth 871349e
docs: trim local-agent README to usage
abonneth 59a1d3b
refactor(local): set verify_runtime once where local sessions localize
abonneth 3b15d98
refactor(runtime): keep the runtime pin in pin.json; bump script load…
abonneth e2b0410
refactor(local): share sync/async session bookkeeping and close-failu…
abonneth 9202c2f
style(runtime): one-line docstrings, drop narrating comments
abonneth f4659fd
Merge remote-tracking branch 'origin/main' into charlie/placement-pyt…
abonneth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| """Pin a hai-agent-runtime release: its version plus a fresh sha256 for every platform in the pin file.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import json | ||
| import re | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| # Stdlib only: runs in a bare checkout with no dependencies installed. | ||
| PIN_FILE = Path(__file__).parents[1] / "src" / "hai_agents_local" / "runtime" / "pin.json" | ||
| _VERSION_RE = re.compile(r"[0-9]+\.[0-9]+\.[0-9]+(?:[-+][0-9A-Za-z.-]+)?") | ||
| _SHA256_RE = re.compile(r"[0-9a-f]{64}") | ||
| _PLACEHOLDER_SHA256 = "0" * 64 | ||
|
|
||
|
|
||
| def apply_bump(pin: dict, version: str, shas: dict[str, str]) -> dict: | ||
| """`pin` moved to `version`; raises unless `shas` holds a real digest for exactly the pinned platforms.""" | ||
| if not _VERSION_RE.fullmatch(version): | ||
| raise ValueError("runtime version must be a release version, e.g. 0.1.13") | ||
| for platform, sha in shas.items(): | ||
| if not _SHA256_RE.fullmatch(sha) or sha == _PLACEHOLDER_SHA256: | ||
| raise ValueError(f"{platform}: {sha!r} is not a lowercase 64-char sha256") | ||
| published = set(pin["sha256"]) | ||
| extra = shas.keys() - published | ||
| if extra: | ||
| raise ValueError(f"no manifest entry for platform(s): {sorted(extra)}") | ||
| # A platform left on its old digest would fail verification at the new version's URL. | ||
| missing = published - shas.keys() | ||
| if missing: | ||
| raise ValueError(f"missing sha for published platform(s): {sorted(missing)}") | ||
| return {**pin, "version": version, "sha256": {platform: shas[platform] for platform in pin["sha256"]}} | ||
|
|
||
|
|
||
| def _parse_args(argv: list[str]) -> tuple[str, dict[str, str]]: | ||
| parser = argparse.ArgumentParser(description=__doc__) | ||
| parser.add_argument("--version", required=True) | ||
| parser.add_argument( | ||
| "--sha", | ||
| action="append", | ||
| required=True, | ||
| metavar="PLATFORM=SHA256", | ||
| help="per-platform digest, e.g. darwin-arm64=<hex> (repeatable)", | ||
| ) | ||
| args = parser.parse_args(argv) | ||
| shas: dict[str, str] = {} | ||
| for entry in args.sha: | ||
| platform, _, sha = entry.partition("=") | ||
| if not platform or not sha: | ||
| parser.error(f"--sha must be PLATFORM=SHA256, got {entry!r}") | ||
| if platform in shas: | ||
| parser.error(f"duplicate --sha for {platform}") | ||
| shas[platform] = sha.lower() | ||
| return args.version, shas | ||
|
|
||
|
|
||
| def main(argv: list[str]) -> int: | ||
| version, shas = _parse_args(argv) | ||
| pin = apply_bump(json.loads(PIN_FILE.read_text(encoding="utf-8")), version, shas) | ||
| PIN_FILE.write_text(json.dumps(pin, indent=2) + "\n", encoding="utf-8") | ||
| print(f"bumped runtime to {version} ({', '.join(sorted(shas))})") | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main(sys.argv[1:])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.