elan-cli 0.1.6__tar.gz → 0.1.7__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.
- {elan_cli-0.1.6 → elan_cli-0.1.7}/CHANGELOG.md +9 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/PKG-INFO +2 -2
- {elan_cli-0.1.6 → elan_cli-0.1.7}/pyproject.toml +2 -2
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/adk.py +51 -2
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/invoke.py +39 -3
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/main.py +19 -3
- {elan_cli-0.1.6 → elan_cli-0.1.7}/.gitignore +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/LICENSE +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/README.md +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/__init__.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/auth.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/child.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/client.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/config.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/deploy.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/destroy.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/doctor.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/env.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/files.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/logs.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/manifests.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/project.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/projects.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/prompt.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/rollback.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/scaffold.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/scan.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/secret.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/stream.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/tenant.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/validate.py +0 -0
- {elan_cli-0.1.6 → elan_cli-0.1.7}/src/elan_cli/wallet.py +0 -0
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
Versions follow the tag that published them — `cli/v*`. A version with no date
|
|
4
4
|
has not been published yet.
|
|
5
5
|
|
|
6
|
+
## 0.1.7 — 2026-11-18
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
- `elan invoke --security-context FILE` (or `-` for stdin): credentials the
|
|
10
|
+
agent may act with for the run (ADR-0249). Read from a file, never argv, and
|
|
11
|
+
never printed — only the credential names are.
|
|
12
|
+
- `elan adk web|run … --security-context FILE`: the same, for a local run.
|
|
13
|
+
Validated before ADK starts and handed to it by path.
|
|
14
|
+
|
|
6
15
|
## 0.1.6 — 2026-11-15
|
|
7
16
|
|
|
8
17
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: elan-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: The command line a developer deploys an agent with
|
|
5
5
|
Project-URL: Homepage, https://openelan.ai
|
|
6
6
|
Project-URL: Documentation, https://openelan.ai/app/docs
|
|
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
16
16
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
17
|
Requires-Python: >=3.12
|
|
18
18
|
Requires-Dist: certifi>=2024.2.2
|
|
19
|
-
Requires-Dist: elan-agentkit-contracts>=0.
|
|
19
|
+
Requires-Dist: elan-agentkit-contracts>=0.2.0
|
|
20
20
|
Requires-Dist: elan-sdk
|
|
21
21
|
Requires-Dist: httpx>=0.27
|
|
22
22
|
Requires-Dist: keyring>=25.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "elan-cli"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.7"
|
|
4
4
|
description = "The command line a developer deploys an agent with"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -29,7 +29,7 @@ dependencies = [
|
|
|
29
29
|
# so `uv tool install elan-cli` no longer pulls a token verifier, a
|
|
30
30
|
# database layer and a Pub/Sub broker onto a developer's laptop to read one
|
|
31
31
|
# YAML file.
|
|
32
|
-
"elan-agentkit-contracts>=0.
|
|
32
|
+
"elan-agentkit-contracts>=0.2.0",
|
|
33
33
|
# THE SHARED CLIENT CODE, ONE WAY (ADR-0104). `text_of` and the certifi
|
|
34
34
|
# context live there now; this re-exports them. The dependency runs
|
|
35
35
|
# elan-cli -> elan-sdk and never back: the SDK must not import `elan_cli`,
|
|
@@ -136,8 +136,48 @@ def argv_for(args: list[str], root: Path, slugs: list[str]) -> list[str]:
|
|
|
136
136
|
return list(args)
|
|
137
137
|
|
|
138
138
|
|
|
139
|
+
#: The one flag `elan adk` takes for itself; everything else is ADK's.
|
|
140
|
+
SECURITY_CONTEXT_FLAG = "--security-context"
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def take_security_context(args: list[str]) -> tuple[str | None, list[str]]:
|
|
144
|
+
"""Split `--security-context FILE` (or `=FILE`) out of ADK's arguments.
|
|
145
|
+
|
|
146
|
+
OURS AND NOT ADK'S, so it is removed before ADK sees the command line —
|
|
147
|
+
ADK would refuse an option it does not know, naming a flag the developer
|
|
148
|
+
typed correctly.
|
|
149
|
+
"""
|
|
150
|
+
rest: list[str] = []
|
|
151
|
+
path: str | None = None
|
|
152
|
+
items = iter(args)
|
|
153
|
+
for item in items:
|
|
154
|
+
if item == SECURITY_CONTEXT_FLAG:
|
|
155
|
+
path = next(items, None)
|
|
156
|
+
if path is None:
|
|
157
|
+
raise ValueError(f"{SECURITY_CONTEXT_FLAG} needs a file")
|
|
158
|
+
elif item.startswith(SECURITY_CONTEXT_FLAG + "="):
|
|
159
|
+
path = item.split("=", 1)[1]
|
|
160
|
+
else:
|
|
161
|
+
rest.append(item)
|
|
162
|
+
return path, rest
|
|
163
|
+
|
|
164
|
+
|
|
139
165
|
def run(args: list[str], start: Path | None = None,
|
|
140
166
|
python: str | None = None) -> int:
|
|
167
|
+
# THE CREDENTIALS A LOCAL RUN ACTS WITH (ADR-0249), validated here so a bad
|
|
168
|
+
# file is refused naming the field before ADK starts — then handed to the
|
|
169
|
+
# child by PATH, never by value, so they are in no process listing.
|
|
170
|
+
try:
|
|
171
|
+
context_file, args = take_security_context(args)
|
|
172
|
+
if context_file is not None:
|
|
173
|
+
from elan_cli.invoke import load_security_context # noqa: PLC0415
|
|
174
|
+
|
|
175
|
+
load_security_context(context_file)
|
|
176
|
+
context_file = str(Path(context_file).resolve())
|
|
177
|
+
except (OSError, ValueError) as exc:
|
|
178
|
+
print(f"error: {SECURITY_CONTEXT_FLAG}: {exc}")
|
|
179
|
+
return 2
|
|
180
|
+
|
|
141
181
|
if not args:
|
|
142
182
|
print("error: `elan adk` passes its arguments to ADK's own CLI.\n\n"
|
|
143
183
|
" elan adk web the dev UI, every target in this repo\n"
|
|
@@ -183,10 +223,12 @@ def run(args: list[str], start: Path | None = None,
|
|
|
183
223
|
print(flush=True)
|
|
184
224
|
# SUPERVISED RATHER THAN `subprocess.run`, because `adk web` is the one
|
|
185
225
|
# child here with a graceful shutdown worth protecting — see `child.py`.
|
|
186
|
-
|
|
226
|
+
if context_file is not None:
|
|
227
|
+
print(f"credentials from {context_file} (local only)")
|
|
228
|
+
return supervise(argv, cwd=project.root, env=_environment(context_file))
|
|
187
229
|
|
|
188
230
|
|
|
189
|
-
def _environment() -> dict[str, str]:
|
|
231
|
+
def _environment(context_file: str | None = None) -> dict[str, str]:
|
|
190
232
|
"""ADK's own environment, plus the one thing it must not inherit.
|
|
191
233
|
|
|
192
234
|
`TARGET_SLUG` NAMES WHICH AGENT A POD RUNS, and a developer who has it set
|
|
@@ -194,6 +236,13 @@ def _environment() -> dict[str, str]:
|
|
|
194
236
|
one target for every shim, because `Settings` reads it. The shim passes
|
|
195
237
|
its slug explicitly; removing this makes sure nothing overrides it.
|
|
196
238
|
"""
|
|
239
|
+
from elan_agentkit_contracts.security_context import LOCAL_CONTEXT_ENV # noqa: PLC0415
|
|
240
|
+
|
|
197
241
|
env = dict(os.environ)
|
|
198
242
|
env.pop("TARGET_SLUG", None)
|
|
243
|
+
# AN INHERITED ONE IS DROPPED TOO, so a run started without the flag acts
|
|
244
|
+
# with no credentials rather than with whatever a previous shell exported.
|
|
245
|
+
env.pop(LOCAL_CONTEXT_ENV, None)
|
|
246
|
+
if context_file:
|
|
247
|
+
env[LOCAL_CONTEXT_ENV] = context_file
|
|
199
248
|
return env
|
|
@@ -23,9 +23,11 @@ minutes reads as a failure.
|
|
|
23
23
|
|
|
24
24
|
from __future__ import annotations
|
|
25
25
|
|
|
26
|
+
import json
|
|
26
27
|
import sys
|
|
27
28
|
import time
|
|
28
29
|
import uuid
|
|
30
|
+
from typing import Any
|
|
29
31
|
|
|
30
32
|
from elan_cli.client import Api, ApiError
|
|
31
33
|
from elan_cli.stream import (
|
|
@@ -58,9 +60,36 @@ ANSWERED_BY = {
|
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
|
|
63
|
+
def load_security_context(path: str, *, stdin=None) -> dict[str, Any]:
|
|
64
|
+
"""A security context from a JSON file, or `-` for stdin (ADR-0249).
|
|
65
|
+
|
|
66
|
+
A FILE AND NEVER AN ARGUMENT, because argv lands in shell history, in `ps`
|
|
67
|
+
for every user on the machine, and in CI logs — and these are another
|
|
68
|
+
service's credentials for somebody. Validated here so a refusal names the
|
|
69
|
+
field before anything is sent; the value is returned revealed only because
|
|
70
|
+
the request body is the one place it has to be.
|
|
71
|
+
"""
|
|
72
|
+
from elan_agentkit_contracts.security_context import ( # noqa: PLC0415
|
|
73
|
+
parse_security_context,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
if path == "-":
|
|
77
|
+
raw = (stdin or sys.stdin).read()
|
|
78
|
+
else:
|
|
79
|
+
with open(path, encoding="utf-8") as handle:
|
|
80
|
+
raw = handle.read()
|
|
81
|
+
try:
|
|
82
|
+
data = json.loads(raw)
|
|
83
|
+
except json.JSONDecodeError as exc:
|
|
84
|
+
# NOT `exc.doc`, which is the file — and the file is credentials.
|
|
85
|
+
raise ValueError(f"{path}: not JSON (line {exc.lineno}, column {exc.colno})") from None
|
|
86
|
+
return parse_security_context(data).to_wire()
|
|
87
|
+
|
|
88
|
+
|
|
61
89
|
def run(api: Api, target: str, text: str, *, session: str = "",
|
|
62
90
|
project: str = "", timeout: float = DEFAULT_TIMEOUT,
|
|
63
|
-
now=time.monotonic, open_socket=None
|
|
91
|
+
now=time.monotonic, open_socket=None,
|
|
92
|
+
security_context: dict[str, Any] | None = None) -> int:
|
|
64
93
|
"""Send one message and print what comes back. Returns the exit code.
|
|
65
94
|
|
|
66
95
|
THE CLOCK IS INJECTED so a timeout can be reached without waiting for one.
|
|
@@ -85,9 +114,12 @@ def run(api: Api, target: str, text: str, *, session: str = "",
|
|
|
85
114
|
with watching(api.config.api, api.token(), session_id,
|
|
86
115
|
open_socket=open_socket) as socket:
|
|
87
116
|
try:
|
|
88
|
-
|
|
117
|
+
body: dict[str, Any] = {
|
|
89
118
|
"target_slug": target, "text": text,
|
|
90
|
-
"session_id": session_id, "project": project}
|
|
119
|
+
"session_id": session_id, "project": project}
|
|
120
|
+
if security_context is not None:
|
|
121
|
+
body["security_context"] = security_context
|
|
122
|
+
started = api.request("POST", "/v1/invocations", json=body)
|
|
91
123
|
except ApiError as exc:
|
|
92
124
|
print(f"{exc}", file=sys.stderr)
|
|
93
125
|
return 1
|
|
@@ -95,6 +127,10 @@ def run(api: Api, target: str, text: str, *, session: str = "",
|
|
|
95
127
|
invocation = started.get("invocation_id", "")
|
|
96
128
|
print(f"invocation {invocation}")
|
|
97
129
|
print(f"session {session_id}")
|
|
130
|
+
if security_context:
|
|
131
|
+
# NAMES ONLY. The values were sent and are never printed.
|
|
132
|
+
names = ", ".join(c["name"] for c in security_context["credentials"])
|
|
133
|
+
print(f"credentials {names or '(none)'}")
|
|
98
134
|
print()
|
|
99
135
|
try:
|
|
100
136
|
return _follow(socket, invocation, target, session_id,
|
|
@@ -144,8 +144,11 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
144
144
|
# documents.
|
|
145
145
|
passthrough = sub.add_parser(
|
|
146
146
|
"adk", help="run ADK's own tools against this repo (web, run, eval)")
|
|
147
|
-
passthrough.add_argument(
|
|
148
|
-
|
|
147
|
+
passthrough.add_argument(
|
|
148
|
+
"args", nargs=argparse.REMAINDER,
|
|
149
|
+
help="Passed to ADK unchanged, except --security-context FILE: the "
|
|
150
|
+
"credentials a local run acts with, as JSON (ADR-0249), e.g. "
|
|
151
|
+
"`elan adk web --security-context ctx.json`.")
|
|
149
152
|
|
|
150
153
|
# `env` TAKES NOTHING, for the same reason `init` lost its flag: the
|
|
151
154
|
# runtime resolves from the index by name.
|
|
@@ -194,6 +197,10 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
194
197
|
help="seconds to wait for a reply (default 300; a "
|
|
195
198
|
"sleeping agent has to be scheduled and started "
|
|
196
199
|
"before it reads its queue)")
|
|
200
|
+
send.add_argument("--security-context", metavar="FILE", default=None,
|
|
201
|
+
help="credentials the agent may act with for this run, "
|
|
202
|
+
"as JSON — a file, or - for stdin. Never on the "
|
|
203
|
+
"command line, which shell history and ps can read")
|
|
197
204
|
|
|
198
205
|
log = sub.add_parser("logs", help="a build's output, or a workload's")
|
|
199
206
|
# OPTIONAL, BECAUSE `--workload` REPLACES IT. argparse cannot express "one of
|
|
@@ -575,10 +582,19 @@ def _dispatch(args, parser) -> int:
|
|
|
575
582
|
# FROM elan.yaml, WHICH IS THE ONLY PLACE THAT KNOWS. `invoke` is
|
|
576
583
|
# run inside a project, and the deploy file names it — so this is
|
|
577
584
|
# read rather than asked for, the same way `deploy` reads it.
|
|
585
|
+
security_context = None
|
|
586
|
+
if args.security_context:
|
|
587
|
+
try:
|
|
588
|
+
security_context = invoke_cmd.load_security_context(
|
|
589
|
+
args.security_context)
|
|
590
|
+
except (OSError, ValueError) as exc:
|
|
591
|
+
print(f"--security-context: {exc}", file=sys.stderr)
|
|
592
|
+
return 2
|
|
578
593
|
return invoke_cmd.run(api, args.target, args.text,
|
|
579
594
|
session=args.session,
|
|
580
595
|
project=_project_here(),
|
|
581
|
-
timeout=args.timeout
|
|
596
|
+
timeout=args.timeout,
|
|
597
|
+
security_context=security_context)
|
|
582
598
|
finally:
|
|
583
599
|
api.close()
|
|
584
600
|
|
|
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
|
|
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
|