lustro-cli 0.1.0__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.
- lustro_cli/__init__.py +29 -0
- lustro_cli/cli.py +2460 -0
- lustro_cli/client.py +434 -0
- lustro_cli/discovery.py +1033 -0
- lustro_cli/exitcodes.py +25 -0
- lustro_cli/mcp.py +867 -0
- lustro_cli/wire/__init__.py +62 -0
- lustro_cli/wire/_schema.json +97 -0
- lustro_cli/wire/cursor-envelope.schema.json +28 -0
- lustro_cli/wire/error-envelope.schema.json +46 -0
- lustro_cli/wire/golden/cursor-delta.json +91 -0
- lustro_cli/wire/golden/cursor-reset.json +65 -0
- lustro_cli/wire/golden/cursor-unchanged.json +15 -0
- lustro_cli/wire/golden/error-envelope.json +7 -0
- lustro_cli/wire/golden/export-har-websocket.json +148 -0
- lustro_cli/wire/golden/export-har.json +359 -0
- lustro_cli/wire/golden/logs-delta.json +44 -0
- lustro_cli/wire/golden/logs-reset.json +73 -0
- lustro_cli/wire/golden/logs-unchanged.json +9 -0
- lustro_cli/wire/golden/meta.json +12 -0
- lustro_cli/wire/golden/prefs-delta.json +58 -0
- lustro_cli/wire/golden/prefs-files.json +64 -0
- lustro_cli/wire/golden/prefs-reset.json +58 -0
- lustro_cli/wire/golden/prefs-unchanged.json +4 -0
- lustro_cli/wire/golden/rules-list.json +44 -0
- lustro_cli/wire/golden/screen-tree-views.json +596 -0
- lustro_cli/wire/golden/screen-tree.json +689 -0
- lustro_cli/wire/golden/send-result.json +7 -0
- lustro_cli/wire/golden/senders-list.json +6 -0
- lustro_cli/wire/golden/sqlite-databases.json +37 -0
- lustro_cli/wire/golden/sqlite-exec.json +4 -0
- lustro_cli/wire/golden/sqlite-query.json +109 -0
- lustro_cli/wire/golden/sqlite-rows.json +109 -0
- lustro_cli/wire/golden/sqlite-schema.json +98 -0
- lustro_cli/wire/golden/sqlite-tables.json +57 -0
- lustro_cli/wire/golden/stream-delta.json +48 -0
- lustro_cli/wire/golden/stream-reset.json +66 -0
- lustro_cli/wire/golden/stream-unchanged.json +4 -0
- lustro_cli/wire/golden/transaction-image.json +43 -0
- lustro_cli/wire/golden/transaction.json +41 -0
- lustro_cli/wire/golden/websocket.json +37 -0
- lustro_cli/wire/golden/websockets-reset.json +89 -0
- lustro_cli/wire/golden/work-events.json +152 -0
- lustro_cli/wire/golden/work-item.json +118 -0
- lustro_cli/wire/golden/work-items.json +129 -0
- lustro_cli/wire/golden/work-metrics.json +40 -0
- lustro_cli/wire/logs.openapi.json +622 -0
- lustro_cli/wire/meta.schema.json +47 -0
- lustro_cli/wire/network.openapi.json +2458 -0
- lustro_cli/wire/pagination.schema.json +20 -0
- lustro_cli/wire/prefs.openapi.json +699 -0
- lustro_cli/wire/screen.openapi.json +512 -0
- lustro_cli/wire/sqlite.openapi.json +1233 -0
- lustro_cli/wire/stream-envelope.schema.json +33 -0
- lustro_cli/wire/sync.py +80 -0
- lustro_cli/wire/work.openapi.json +1188 -0
- lustro_cli-0.1.0.dist-info/METADATA +585 -0
- lustro_cli-0.1.0.dist-info/RECORD +60 -0
- lustro_cli-0.1.0.dist-info/WHEEL +4 -0
- lustro_cli-0.1.0.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://twinsen81.github.io/Lustro/wire-protocol/v1/stream-envelope.schema.json",
|
|
4
|
+
"title": "Stream envelope",
|
|
5
|
+
"description": "Live-polling envelope for an endpoint whose list only grows at its end, such as a log. A poll gets only the entries after its cursor, so a long list is not sent again each time it grows. The cursor is opaque; clients echo the last cursor on the next poll and treat any unknown status value as \"reset\". This generic envelope permits additional properties so an endpoint may extend it; a tab schema may pin those extensions.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["cursor", "status"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"cursor": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Opaque cursor token. Echo it back on the next poll. It moves forward with the entries the client received; a cursor from another list, or from before the list was cleared, gets a reset."
|
|
12
|
+
},
|
|
13
|
+
"status": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"enum": ["delta", "unchanged", "reset"],
|
|
16
|
+
"description": "delta = items are the entries after the cursor: append them. unchanged = no new entry, items omitted. reset = replace everything the client has with items, which are the last entries of the list."
|
|
17
|
+
},
|
|
18
|
+
"items": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"description": "Present for reset and delta, oldest first. An endpoint can send a delta in pages: poll again with the returned cursor until the status is unchanged. Element shape is endpoint-specific.",
|
|
21
|
+
"items": {}
|
|
22
|
+
},
|
|
23
|
+
"dropped": {
|
|
24
|
+
"type": "integer",
|
|
25
|
+
"minimum": 0,
|
|
26
|
+
"description": "Present for delta: how many entries the list evicted before this client received them. They come before the first item."
|
|
27
|
+
},
|
|
28
|
+
"state": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"description": "Optional endpoint-specific observable state. Tab schemas pin the exact shape."
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
lustro_cli/wire/sync.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""Regenerate the vendored wire-protocol artifacts from the repo source of truth.
|
|
2
|
+
|
|
3
|
+
Run from a source checkout:
|
|
4
|
+
|
|
5
|
+
python -m lustro_cli.wire.sync
|
|
6
|
+
|
|
7
|
+
This copies the canonical schemas, the OpenAPI documents of the Network, Logs,
|
|
8
|
+
Preferences, SQLite, WorkManager, and Screen tabs, and the golden fixtures into ``lustro_cli/wire/`` so
|
|
9
|
+
the next wheel build bundles up-to-date copies. It is a development-time helper and is not needed at runtime.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import shutil
|
|
15
|
+
import sys
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
# lustro_cli/wire/sync.py -> repo root is five levels up
|
|
19
|
+
# (.../lustro-cli/src/lustro_cli/wire/sync.py).
|
|
20
|
+
_HERE = Path(__file__).resolve()
|
|
21
|
+
_WIRE_DIR = _HERE.parent
|
|
22
|
+
_REPO_ROOT = _HERE.parents[4]
|
|
23
|
+
|
|
24
|
+
_SCHEMAS = [
|
|
25
|
+
"error-envelope.schema.json",
|
|
26
|
+
"cursor-envelope.schema.json",
|
|
27
|
+
"stream-envelope.schema.json",
|
|
28
|
+
"pagination.schema.json",
|
|
29
|
+
"meta.schema.json",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def main() -> int:
|
|
34
|
+
wire_v1 = _REPO_ROOT / "wire-protocol" / "v1"
|
|
35
|
+
assets = _REPO_ROOT / "lustro" / "src" / "main" / "assets" / "lustro"
|
|
36
|
+
# Generated from the tab's route declarations and committed outside the assets: the tab serves its own.
|
|
37
|
+
openapi = _REPO_ROOT / "lustro" / "openapi" / "network.openapi.json"
|
|
38
|
+
# Generated from the tab's route declarations and committed outside the assets: the tab serves its own.
|
|
39
|
+
logs_openapi = _REPO_ROOT / "lustro-logs" / "openapi" / "logs.openapi.json"
|
|
40
|
+
# Generated from the tab's route declarations and committed outside the assets: the tab serves its own.
|
|
41
|
+
prefs_openapi = _REPO_ROOT / "lustro-prefs" / "openapi" / "prefs.openapi.json"
|
|
42
|
+
# Generated from the tab's route declarations and committed outside the assets: the tab serves its own.
|
|
43
|
+
sqlite_openapi = _REPO_ROOT / "lustro-sqlite" / "openapi" / "sqlite.openapi.json"
|
|
44
|
+
# Generated from the tab's route declarations and committed outside the assets: the tab serves its own.
|
|
45
|
+
work_openapi = _REPO_ROOT / "lustro-work" / "openapi" / "work.openapi.json"
|
|
46
|
+
# Generated from the tab's route declarations and committed outside the assets: the tab serves its own.
|
|
47
|
+
screen_openapi = _REPO_ROOT / "lustro-screen" / "openapi" / "screen.openapi.json"
|
|
48
|
+
served_schema = assets / "_schema.json"
|
|
49
|
+
golden_src = wire_v1 / "golden"
|
|
50
|
+
|
|
51
|
+
sources = (openapi, logs_openapi, prefs_openapi, sqlite_openapi, work_openapi, screen_openapi, served_schema)
|
|
52
|
+
if not wire_v1.is_dir() or not all(source.is_file() for source in sources):
|
|
53
|
+
print(
|
|
54
|
+
"error: cannot find repo sources (expected {} and {}). "
|
|
55
|
+
"Run from a source checkout.".format(wire_v1, ", ".join(str(source) for source in sources)),
|
|
56
|
+
file=sys.stderr,
|
|
57
|
+
)
|
|
58
|
+
return 1
|
|
59
|
+
|
|
60
|
+
golden_dst = _WIRE_DIR / "golden"
|
|
61
|
+
golden_dst.mkdir(exist_ok=True)
|
|
62
|
+
|
|
63
|
+
for name in _SCHEMAS:
|
|
64
|
+
shutil.copy2(wire_v1 / name, _WIRE_DIR / name)
|
|
65
|
+
shutil.copy2(openapi, _WIRE_DIR / "network.openapi.json")
|
|
66
|
+
shutil.copy2(logs_openapi, _WIRE_DIR / "logs.openapi.json")
|
|
67
|
+
shutil.copy2(prefs_openapi, _WIRE_DIR / "prefs.openapi.json")
|
|
68
|
+
shutil.copy2(sqlite_openapi, _WIRE_DIR / "sqlite.openapi.json")
|
|
69
|
+
shutil.copy2(work_openapi, _WIRE_DIR / "work.openapi.json")
|
|
70
|
+
shutil.copy2(screen_openapi, _WIRE_DIR / "screen.openapi.json")
|
|
71
|
+
shutil.copy2(served_schema, _WIRE_DIR / "_schema.json")
|
|
72
|
+
for fixture in sorted(golden_src.glob("*.json")):
|
|
73
|
+
shutil.copy2(fixture, golden_dst / fixture.name)
|
|
74
|
+
|
|
75
|
+
print("synced wire artifacts into {}".format(_WIRE_DIR))
|
|
76
|
+
return 0
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if __name__ == "__main__": # pragma: no cover
|
|
80
|
+
sys.exit(main())
|