portacode 1.4.11.dev5__py3-none-any.whl → 1.4.12.dev3__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.
- portacode/_version.py +2 -2
- portacode/connection/handlers/WEBSOCKET_PROTOCOL.md +142 -15
- portacode/connection/handlers/__init__.py +8 -0
- portacode/connection/handlers/proxmox_infra.py +743 -116
- portacode/connection/terminal.py +9 -0
- {portacode-1.4.11.dev5.dist-info → portacode-1.4.12.dev3.dist-info}/METADATA +1 -1
- {portacode-1.4.11.dev5.dist-info → portacode-1.4.12.dev3.dist-info}/RECORD +11 -11
- {portacode-1.4.11.dev5.dist-info → portacode-1.4.12.dev3.dist-info}/WHEEL +0 -0
- {portacode-1.4.11.dev5.dist-info → portacode-1.4.12.dev3.dist-info}/entry_points.txt +0 -0
- {portacode-1.4.11.dev5.dist-info → portacode-1.4.12.dev3.dist-info}/licenses/LICENSE +0 -0
- {portacode-1.4.11.dev5.dist-info → portacode-1.4.12.dev3.dist-info}/top_level.txt +0 -0
portacode/_version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '1.4.
|
|
32
|
-
__version_tuple__ = version_tuple = (1, 4,
|
|
31
|
+
__version__ = version = '1.4.12.dev3'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 4, 12, 'dev3')
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -367,6 +367,45 @@ Creates a Portacode-managed LXC container, starts it, and bootstraps the Portaco
|
|
|
367
367
|
* On success, the device will emit a [`proxmox_container_created`](#proxmox_container_created-event) event that includes the Portacode auth key produced inside the container.
|
|
368
368
|
* On failure, the device will emit an [`error`](#error) event.
|
|
369
369
|
|
|
370
|
+
### `start_proxmox_container`
|
|
371
|
+
|
|
372
|
+
Starts a previously provisioned, Portacode-managed LXC container. Handled by [`StartProxmoxContainerHandler`](./proxmox_infra.py).
|
|
373
|
+
|
|
374
|
+
**Payload Fields:**
|
|
375
|
+
|
|
376
|
+
* `ctid` (string, required): Identifier of the container to start.
|
|
377
|
+
|
|
378
|
+
**Responses:**
|
|
379
|
+
|
|
380
|
+
* Emits a [`proxmox_container_action`](#proxmox_container_action-event) event with `action="start"` and the refreshed infra snapshot.
|
|
381
|
+
* Emits an [`error`](#error) event when the request cannot be fulfilled (e.g., missing infra config, CT not tagged as managed, or API failure).
|
|
382
|
+
|
|
383
|
+
### `stop_proxmox_container`
|
|
384
|
+
|
|
385
|
+
Stops a running Portacode-managed container. Handled by [`StopProxmoxContainerHandler`](./proxmox_infra.py).
|
|
386
|
+
|
|
387
|
+
**Payload Fields:**
|
|
388
|
+
|
|
389
|
+
* `ctid` (string, required): Identifier of the container to stop.
|
|
390
|
+
|
|
391
|
+
**Responses:**
|
|
392
|
+
|
|
393
|
+
* Emits a [`proxmox_container_action`](#proxmox_container_action-event) event with `action="stop"` and the refreshed infra snapshot.
|
|
394
|
+
* Emits an [`error`](#error) event on failure.
|
|
395
|
+
|
|
396
|
+
### `remove_proxmox_container`
|
|
397
|
+
|
|
398
|
+
Deletes a managed container from Proxmox (stopping it first if necessary) and removes the stored metadata file. Handled by [`RemoveProxmoxContainerHandler`](./proxmox_infra.py).
|
|
399
|
+
|
|
400
|
+
**Payload Fields:**
|
|
401
|
+
|
|
402
|
+
* `ctid` (string, required): Identifier of the container to delete.
|
|
403
|
+
|
|
404
|
+
**Responses:**
|
|
405
|
+
|
|
406
|
+
* Emits a [`proxmox_container_action`](#proxmox_container_action-event) event with `action="remove"` and the refreshed infra snapshot after deletion.
|
|
407
|
+
* Emits an [`error`](#error) event on failure.
|
|
408
|
+
|
|
370
409
|
### `proxmox_container_created`
|
|
371
410
|
|
|
372
411
|
Emitted after a successful `create_proxmox_container` action. Contains the new container ID, the Portacode public key produced inside the container, and the bootstrap logs.
|
|
@@ -380,6 +419,48 @@ Emitted after a successful `create_proxmox_container` action. Contains the new c
|
|
|
380
419
|
* `container` (object): Metadata such as `vmid`, `hostname`, `template`, `storage`, `disk_gib`, `ram_mib`, and `cpus`.
|
|
381
420
|
* `setup_steps` (array[object]): Detailed bootstrap step results (name, stdout/stderr, elapsed time, and status).
|
|
382
421
|
|
|
422
|
+
### `proxmox_container_progress`
|
|
423
|
+
|
|
424
|
+
Sent intermittently while `create_proxmox_container` is executing so callers can display a progress indicator. Each notification describes the currently running step (validation, provisioning, or each bootstrap command) and whether it succeeded or failed.
|
|
425
|
+
|
|
426
|
+
**Event Fields:**
|
|
427
|
+
|
|
428
|
+
* `step_index` (integer): 1-based index of the current step inside the entire provisioning sequence.
|
|
429
|
+
* `total_steps` (integer): Total number of steps that must run before provisioning completes.
|
|
430
|
+
* `step_name` (string): Internal step identifier (e.g., `create_container`, `apt_update`, `portacode_connect`).
|
|
431
|
+
* `step_label` (string): Human-friendly label suitable for UI (e.g., `Create container`, `Apt update`).
|
|
432
|
+
* `status` (string): One of `in_progress`, `completed`, or `failed`.
|
|
433
|
+
* `phase` (string): Either `lifecycle` (environment/container lifecycle) or `bootstrap` (per-command bootstrap work).
|
|
434
|
+
* `message` (string): Short description of what is happening or why a failure occurred.
|
|
435
|
+
* `details` (object, optional): Contains `attempt` (if retries were needed) and `error_summary` when a step fails.
|
|
436
|
+
* `request_id` (string, optional): Mirrors the request ID from the incoming `create_proxmox_container` payload when available.
|
|
437
|
+
|
|
438
|
+
### `start_portacode_service`
|
|
439
|
+
|
|
440
|
+
Runs `sudo portacode service install` inside the container after the dashboard has created the corresponding Device record with the supplied public key.
|
|
441
|
+
|
|
442
|
+
**Payload Fields:**
|
|
443
|
+
|
|
444
|
+
* `ctid` (string, required): Container ID target.
|
|
445
|
+
* `step_index` (integer, required): Next step index to render inside `proxmox_container_progress`.
|
|
446
|
+
* `total_steps` (integer, required): The overall total number of steps (including lifecycle, bootstrap, and service installation).
|
|
447
|
+
|
|
448
|
+
**Responses:**
|
|
449
|
+
|
|
450
|
+
* Emits additional [`proxmox_container_progress`](#proxmox_container_progress-event) events to report the authentication and service-install steps.
|
|
451
|
+
* On success, emits a [`proxmox_service_started`](#proxmox_service_started-event).
|
|
452
|
+
* On failure, emits a generic [`error`](#error) event.
|
|
453
|
+
|
|
454
|
+
### `proxmox_service_started`
|
|
455
|
+
|
|
456
|
+
Indicates that `portacode service install` finished successfully inside a managed container.
|
|
457
|
+
|
|
458
|
+
**Event Fields:**
|
|
459
|
+
|
|
460
|
+
* `success` (boolean): True when the install succeeded.
|
|
461
|
+
* `message` (string): Success summary (e.g., `Portacode service install completed`).
|
|
462
|
+
* `ctid` (string): Container ID.
|
|
463
|
+
|
|
383
464
|
### `clock_sync_request`
|
|
384
465
|
|
|
385
466
|
Internal event that devices send to the gateway to request the authoritative server timestamp (used for adjusting `portacode.utils.ntp_clock`). The gateway responds immediately with [`clock_sync_response`](#clock_sync_response).
|
|
@@ -1025,21 +1106,37 @@ Provides system information in response to a `system_info` action. Handled by [`
|
|
|
1025
1106
|
* `proxmox` (object): Detection hints for Proxmox VE nodes:
|
|
1026
1107
|
* `is_proxmox_node` (boolean): True when Proxmox artifacts (e.g., `/etc/proxmox-release`) exist.
|
|
1027
1108
|
* `version` (string|null): Raw contents of `/etc/proxmox-release` when readable.
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1109
|
+
* `infra` (object): Portacode infrastructure configuration snapshot:
|
|
1110
|
+
* `configured` (boolean): True when `setup_proxmox_infra` stored an API token.
|
|
1111
|
+
* `host` (string|null): Hostname used for the API client (usually `localhost`).
|
|
1112
|
+
* `node` (string|null): Proxmox node name that was targeted.
|
|
1113
|
+
* `user` (string|null): API token owner (e.g., `root@pam`).
|
|
1114
|
+
* `token_name` (string|null): API token identifier.
|
|
1115
|
+
* `default_storage` (string|null): Storage pool chosen for future containers.
|
|
1116
|
+
* `templates` (array[string]): Cached list of available LXC templates.
|
|
1117
|
+
* `last_verified` (string|null): ISO timestamp when the token was last validated.
|
|
1118
|
+
* `network` (object):
|
|
1119
|
+
* `applied` (boolean): True when the bridge/NAT services were successfully configured.
|
|
1120
|
+
* `message` (string|null): Informational text about the network setup attempt.
|
|
1121
|
+
* `bridge` (string): The bridge interface configured (typically `vmbr1`).
|
|
1122
|
+
* `health` (string|null): `"healthy"` when the connectivity verification succeeded.
|
|
1123
|
+
* `node_status` (object|null): Status response returned by the Proxmox API when validating the token.
|
|
1124
|
+
* `managed_containers` (object): Cached summary of the Portacode-managed containers:
|
|
1125
|
+
* `updated_at` (string): ISO timestamp when this snapshot was last refreshed.
|
|
1126
|
+
* `count` (integer): Number of managed containers.
|
|
1127
|
+
* `total_ram_mib` (integer): RAM footprint summed across all containers.
|
|
1128
|
+
* `total_disk_gib` (integer): Disk footprint summed across all containers.
|
|
1129
|
+
* `total_cpu_share` (number): CPU shares requested across all containers.
|
|
1130
|
+
* `containers` (array[object]): Container summaries with the following fields:
|
|
1131
|
+
* `vmid` (string|null): Numeric CT ID.
|
|
1132
|
+
* `hostname` (string|null): Hostname configured in the CT.
|
|
1133
|
+
* `template` (string|null): Template identifier used.
|
|
1134
|
+
* `storage` (string|null): Storage pool backing the rootfs.
|
|
1135
|
+
* `disk_gib` (integer): Rootfs size in GiB.
|
|
1136
|
+
* `ram_mib` (integer): Memory size in MiB.
|
|
1137
|
+
* `cpu_share` (number): vCPU-equivalent share requested at creation.
|
|
1138
|
+
* `status` (string): Lowercase lifecycle status (e.g., `running`, `stopped`, `deleted`).
|
|
1139
|
+
* `created_at` (string|null): ISO timestamp recorded when the CT was provisioned.
|
|
1043
1140
|
* `portacode_version` (string): Installed CLI version returned by `portacode.__version__`.
|
|
1044
1141
|
|
|
1045
1142
|
### `proxmox_infra_configured`
|
|
@@ -1075,6 +1172,36 @@ Emitted after a successful `create_proxmox_container` action to report the newly
|
|
|
1075
1172
|
* `container` (object): Metadata such as `vmid`, `hostname`, `template`, `storage`, `disk_gib`, `ram_mib`, and `cpus`.
|
|
1076
1173
|
* `setup_steps` (array[object]): Detailed bootstrap step reports including stdout/stderr, elapsed time, and pass/fail status.
|
|
1077
1174
|
|
|
1175
|
+
### `proxmox_container_progress`
|
|
1176
|
+
|
|
1177
|
+
Sent continuously while `create_proxmox_container` runs so dashboards can show a progress bar tied to each lifecycle and bootstrap step.
|
|
1178
|
+
|
|
1179
|
+
**Event Fields:**
|
|
1180
|
+
|
|
1181
|
+
* `step_index` (integer): 1-based position of the step inside the entire provisioning workflow.
|
|
1182
|
+
* `total_steps` (integer): Total number of lifecycle and bootstrap steps for the current operation.
|
|
1183
|
+
* `step_name` (string): Internal identifier (e.g., `validate_environment`, `install_deps`, `portacode_connect`).
|
|
1184
|
+
* `step_label` (string): Friendly label suitable for the UI.
|
|
1185
|
+
* `status` (string): One of `in_progress`, `completed`, or `failed`.
|
|
1186
|
+
* `phase` (string): Either `lifecycle` (node validation/container lifecycle) or `bootstrap` (commands run inside the CT).
|
|
1187
|
+
* `message` (string): Short human-readable description of the action or failure.
|
|
1188
|
+
* `details` (object, optional): Contains `attempt` (when retries are used) and `error_summary` on failure.
|
|
1189
|
+
* `request_id` (string, optional): Mirrors the `create_proxmox_container` request when provided.
|
|
1190
|
+
|
|
1191
|
+
### `proxmox_container_action`
|
|
1192
|
+
|
|
1193
|
+
Emitted after `start_proxmox_container`, `stop_proxmox_container`, or `remove_proxmox_container` commands complete. Each event includes the refreshed infra snapshot so dashboards can immediately display the latest managed container totals even though the `proxmox.infra.managed_containers` cache updates only every ~30 seconds.
|
|
1194
|
+
|
|
1195
|
+
**Event Fields:**
|
|
1196
|
+
|
|
1197
|
+
* `action` (string): The action that ran (`start`, `stop`, or `remove`).
|
|
1198
|
+
* `success` (boolean): True when the requested action succeeded.
|
|
1199
|
+
* `ctid` (string): Target CT ID.
|
|
1200
|
+
* `message` (string): Human-friendly summary (e.g., `Stopped container 103`).
|
|
1201
|
+
* `status` (string): The container’s new status (e.g., `running`, `stopped`, `deleted`).
|
|
1202
|
+
* `details` (object, optional): Exit status information (e.g., `exitstatus`, `stop_exitstatus`, `delete_exitstatus`).
|
|
1203
|
+
* `infra` (object): Same snapshot described under [`system_info`](#system_info-event) `proxmox.infra`, including the updated `managed_containers` summary.
|
|
1204
|
+
|
|
1078
1205
|
### <a name="clock_sync_response"></a>`clock_sync_response`
|
|
1079
1206
|
|
|
1080
1207
|
Reply sent by the gateway immediately after receiving a `clock_sync_request`. Devices use this event plus the measured round-trip time to keep their local `ntp_clock` offset accurate.
|
|
@@ -45,6 +45,10 @@ from .proxmox_infra import (
|
|
|
45
45
|
ConfigureProxmoxInfraHandler,
|
|
46
46
|
CreateProxmoxContainerHandler,
|
|
47
47
|
RevertProxmoxInfraHandler,
|
|
48
|
+
StartPortacodeServiceHandler,
|
|
49
|
+
StartProxmoxContainerHandler,
|
|
50
|
+
StopProxmoxContainerHandler,
|
|
51
|
+
RemoveProxmoxContainerHandler,
|
|
48
52
|
)
|
|
49
53
|
|
|
50
54
|
__all__ = [
|
|
@@ -84,6 +88,10 @@ __all__ = [
|
|
|
84
88
|
"ProjectStateGitUnstageHandler",
|
|
85
89
|
"ProjectStateGitRevertHandler",
|
|
86
90
|
"ProjectStateGitCommitHandler",
|
|
91
|
+
"StartPortacodeServiceHandler",
|
|
92
|
+
"StartProxmoxContainerHandler",
|
|
93
|
+
"StopProxmoxContainerHandler",
|
|
94
|
+
"RemoveProxmoxContainerHandler",
|
|
87
95
|
"UpdatePortacodeHandler",
|
|
88
96
|
"RevertProxmoxInfraHandler",
|
|
89
97
|
]
|