portacode 1.4.12.dev1__py3-none-any.whl → 1.4.15.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 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.12.dev1'
32
- __version_tuple__ = version_tuple = (1, 4, 12, 'dev1')
31
+ __version__ = version = '1.4.15.dev3'
32
+ __version_tuple__ = version_tuple = (1, 4, 15, 'dev3')
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -326,9 +326,12 @@ Configures a Proxmox node for Portacode infrastructure usage (API token validati
326
326
 
327
327
  **Payload Fields:**
328
328
 
329
- * `token_identifier` (string, required): API token identifier in the form `user@realm!tokenid`.
330
- * `token_value` (string, required): Secret value associated with the token.
331
- * `verify_ssl` (boolean, optional): When true, the handler verifies SSL certificates; defaults to `false`.
329
+ * `token_identifier` (string, optional when reconfiguring): API token identifier in the form `user@realm!tokenid`. Required on first configuration or when replacing the stored token.
330
+ * `token_value` (string, optional when reconfiguring): Secret value associated with the token. Required when `token_identifier` is supplied.
331
+ * `verify_ssl` (boolean, optional): When true, the handler verifies SSL certificates; defaults to `false`. When omitted, the last configured value is preserved.
332
+ * `cloudflare_api_token` (string, optional): Cloudflare API token the host can reuse later to provision tunnels.
333
+
334
+ The setup command also installs `cloudflared` on the node so Cloudflare tunnels can be created afterward.
332
335
 
333
336
  **Responses:**
334
337
 
@@ -361,6 +364,9 @@ Creates a Portacode-managed LXC container, starts it, and bootstraps the Portaco
361
364
  * `username` (string, optional): OS user to provision (defaults to `svcuser`).
362
365
  * `password` (string, optional): Password for the user (used only during provisioning).
363
366
  * `ssh_key` (string, optional): SSH public key to add to the user.
367
+ * `device_id` (string, optional): ID of the Device record that already exists on the dashboard.
368
+ * `device_public_key` (string, optional): PEM-encoded Portacode public key. When supplied together with `device_private_key` the handler injects the keypair, records the device metadata, and runs `portacode service install` automatically.
369
+ * `device_private_key` (string, optional): PEM-encoded private key that pairs with `device_public_key`. Both key fields must be present for the automatic service-install mode.
364
370
 
365
371
  **Responses:**
366
372
 
@@ -406,6 +412,51 @@ Deletes a managed container from Proxmox (stopping it first if necessary) and re
406
412
  * Emits a [`proxmox_container_action`](#proxmox_container_action-event) event with `action="remove"` and the refreshed infra snapshot after deletion.
407
413
  * Emits an [`error`](#error) event on failure.
408
414
 
415
+ ### `create_cloudflare_tunnel`
416
+
417
+ Creates or updates a Cloudflare tunnel in front of a managed container. The container must be running and a Cloudflare API token must already be configured via `setup_proxmox_infra`.
418
+
419
+ **Payload Fields:**
420
+
421
+ * `ctid` (string, required): Identifier of the container.
422
+ * `container_port` (integer, required): Port inside the container to expose through Cloudflare.
423
+ * `cloudflare_url` (string, optional): Hostname (e.g., `app.example.com`) that the tunnel should serve. Leave blank to let Cloudflare create a quick tunnel (`*.cfargotunnel.com`) automatically.
424
+ * `protocol` (string, optional): One of `http`, `https`, or `tcp` (defaults to `http`).
425
+
426
+ **Responses:**
427
+
428
+ * Emits a [`cloudflare_tunnel_created`](#cloudflare_tunnel_created-event) event with the tunnel metadata, the refreshed infra snapshot, and the optional `device_id` so dashboards can refresh the CT list.
429
+ * Emits an [`error`](#error) event on failure.
430
+
431
+ ### `update_cloudflare_tunnel`
432
+
433
+ Refreshes the tunnel configuration for an existing tunnel (different port, URL, or protocol).
434
+
435
+ **Payload Fields:**
436
+
437
+ * `ctid` (string, required): Identifier of the container.
438
+ * `container_port` (integer, optional): New container port.
439
+ * `cloudflare_url` (string, optional): New hostname (leave blank to keep the current hostname or let Cloudflare assign a quick tunnel).
440
+ * `protocol` (string, optional): New protocol (`http`, `https`, or `tcp`).
441
+
442
+ **Responses:**
443
+
444
+ * Emits a [`cloudflare_tunnel_updated`](#cloudflare_tunnel_updated-event) event with the refreshed tunnel metadata, the refreshed infra snapshot, and the optional `device_id`.
445
+ * Emits an [`error`](#error) event on failure.
446
+
447
+ ### `remove_cloudflare_tunnel`
448
+
449
+ Stops and removes any tunnel metadata associated with a container.
450
+
451
+ **Payload Fields:**
452
+
453
+ * `ctid` (string, required): Identifier of the container.
454
+
455
+ **Responses:**
456
+
457
+ * Emits a [`cloudflare_tunnel_removed`](#cloudflare_tunnel_removed-event) event with the refreshed infra snapshot and optional `device_id`.
458
+ * Emits an [`error`](#error) event on failure.
459
+
409
460
  ### `proxmox_container_created`
410
461
 
411
462
  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.
@@ -418,6 +469,8 @@ Emitted after a successful `create_proxmox_container` action. Contains the new c
418
469
  * `public_key` (string): Portacode public auth key created inside the new container.
419
470
  * `container` (object): Metadata such as `vmid`, `hostname`, `template`, `storage`, `disk_gib`, `ram_mib`, and `cpus`.
420
471
  * `setup_steps` (array[object]): Detailed bootstrap step results (name, stdout/stderr, elapsed time, and status).
472
+ * `device_id` (string, optional): Mirrors the `device_id` supplied with `create_proxmox_container`, if any.
473
+ * `service_installed` (boolean): True when the handler already ran `portacode service install` (with a provided keypair); otherwise it remains False and the dashboard can call `start_portacode_service`.
421
474
 
422
475
  ### `proxmox_container_progress`
423
476
 
@@ -450,6 +503,7 @@ Runs `sudo portacode service install` inside the container after the dashboard h
450
503
  * Emits additional [`proxmox_container_progress`](#proxmox_container_progress-event) events to report the authentication and service-install steps.
451
504
  * On success, emits a [`proxmox_service_started`](#proxmox_service_started-event).
452
505
  * On failure, emits a generic [`error`](#error) event.
506
+ * When `create_proxmox_container` already provided a dashboard-generated keypair, the handler may have installed the service already, so this call is optional unless you need to re-run the install.
453
507
 
454
508
  ### `proxmox_service_started`
455
509
 
@@ -1120,6 +1174,8 @@ Provides system information in response to a `system_info` action. Handled by [`
1120
1174
  * `message` (string|null): Informational text about the network setup attempt.
1121
1175
  * `bridge` (string): The bridge interface configured (typically `vmbr1`).
1122
1176
  * `health` (string|null): `"healthy"` when the connectivity verification succeeded.
1177
+ * `cloudflare` (object): Optional Cloudflare metadata collected for future tunnels:
1178
+ * `configured` (boolean): True when a Cloudflare API token is stored.
1123
1179
  * `node_status` (object|null): Status response returned by the Proxmox API when validating the token.
1124
1180
  * `managed_containers` (object): Cached summary of the Portacode-managed containers:
1125
1181
  * `updated_at` (string): ISO timestamp when this snapshot was last refreshed.
@@ -1137,6 +1193,11 @@ Provides system information in response to a `system_info` action. Handled by [`
1137
1193
  * `cpu_share` (number): vCPU-equivalent share requested at creation.
1138
1194
  * `status` (string): Lowercase lifecycle status (e.g., `running`, `stopped`, `deleted`).
1139
1195
  * `created_at` (string|null): ISO timestamp recorded when the CT was provisioned.
1196
+ * `tunnel` (object|null): Tunnel metadata that includes:
1197
+ * `url` (string): Public hostname assigned for this tunnel.
1198
+ * `container_port` (integer): Container port exposed via the tunnel.
1199
+ * `protocol` (string): Protocol advertised when the tunnel was configured.
1200
+ * `status` (string): `running`, `stopped`, or `unknown`.
1140
1201
  * `portacode_version` (string): Installed CLI version returned by `portacode.__version__`.
1141
1202
 
1142
1203
  ### `proxmox_infra_configured`
@@ -1202,6 +1263,48 @@ Emitted after `start_proxmox_container`, `stop_proxmox_container`, or `remove_pr
1202
1263
  * `details` (object, optional): Exit status information (e.g., `exitstatus`, `stop_exitstatus`, `delete_exitstatus`).
1203
1264
  * `infra` (object): Same snapshot described under [`system_info`](#system_info-event) `proxmox.infra`, including the updated `managed_containers` summary.
1204
1265
 
1266
+ ### `cloudflare_tunnel_created`
1267
+
1268
+ Submitted after a successful `create_cloudflare_tunnel` action.
1269
+
1270
+ **Event Fields:**
1271
+
1272
+ * `event` (string): `cloudflare_tunnel_created`.
1273
+ * `ctid` (string): Container ID associated with the tunnel.
1274
+ * `success` (boolean): True when the tunnel is running.
1275
+ * `device_id` (string, optional): Mirrors the `device_id` supplied with the command, letting dashboards refresh that device immediately.
1276
+ * `message` (string): Summary text; when a hostname was assigned (including Quick Tunnel), the host is appended (e.g., `Created ... -> example.com`).
1277
+ * `tunnel` (object): Tunnel metadata matching the manager view. When using Cloudflare Quick Tunnel (no hostname supplied), `tunnel.url` holds the autogenerated `*.cfargotunnel.com` hostname.
1278
+ * `infra` (object): Snapshot produced by `get_infra_snapshot`, including the refreshed `managed_containers` list.
1279
+
1280
+ ### `cloudflare_tunnel_updated`
1281
+
1282
+ Sent when `update_cloudflare_tunnel` completes.
1283
+
1284
+ **Event Fields:**
1285
+
1286
+ * `event` (string): `cloudflare_tunnel_updated`.
1287
+ * `ctid` (string): Container ID associated with the tunnel.
1288
+ * `success` (boolean): True on success.
1289
+ * `device_id` (string, optional): Mirrors the command's `device_id`.
1290
+ * `message` (string): Summary text; includes the new hostname when one was assigned or changed.
1291
+ * `tunnel` (object): Updated tunnel metadata.
1292
+ * `infra` (object): Snapshot produced by `get_infra_snapshot` so dashboards can refresh the managed container list.
1293
+
1294
+ ### `cloudflare_tunnel_removed`
1295
+
1296
+ Sent after a tunnel has been removed from a container record.
1297
+
1298
+ **Event Fields:**
1299
+
1300
+ * `event` (string): `cloudflare_tunnel_removed`.
1301
+ * `ctid` (string): Container ID that no longer has a tunnel.
1302
+ * `success` (boolean): True on success.
1303
+ * `device_id` (string, optional): Mirrors the command's `device_id`.
1304
+ * `message` (string): Summary text.
1305
+ * `tunnel` (null): Always `null` to explicitly clear the stored tunnel metadata.
1306
+ * `infra` (object): The refreshed snapshot so dashboards see the updated container list.
1307
+
1205
1308
  ### <a name="clock_sync_response"></a>`clock_sync_response`
1206
1309
 
1207
1310
  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.
@@ -43,12 +43,15 @@ from .project_state_handlers import (
43
43
  )
44
44
  from .proxmox_infra import (
45
45
  ConfigureProxmoxInfraHandler,
46
+ CreateCloudflareTunnelHandler,
46
47
  CreateProxmoxContainerHandler,
47
48
  RevertProxmoxInfraHandler,
48
49
  StartPortacodeServiceHandler,
49
50
  StartProxmoxContainerHandler,
50
51
  StopProxmoxContainerHandler,
52
+ RemoveCloudflareTunnelHandler,
51
53
  RemoveProxmoxContainerHandler,
54
+ UpdateCloudflareTunnelHandler,
52
55
  )
53
56
 
54
57
  __all__ = [
@@ -62,6 +65,7 @@ __all__ = [
62
65
  "TerminalListHandler",
63
66
  "SystemInfoHandler",
64
67
  "ConfigureProxmoxInfraHandler",
68
+ "CreateCloudflareTunnelHandler",
65
69
  "CreateProxmoxContainerHandler",
66
70
  # File operation handlers (optional - register as needed)
67
71
  "FileReadHandler",
@@ -91,7 +95,9 @@ __all__ = [
91
95
  "StartPortacodeServiceHandler",
92
96
  "StartProxmoxContainerHandler",
93
97
  "StopProxmoxContainerHandler",
98
+ "RemoveCloudflareTunnelHandler",
94
99
  "RemoveProxmoxContainerHandler",
100
+ "UpdateCloudflareTunnelHandler",
95
101
  "UpdatePortacodeHandler",
96
102
  "RevertProxmoxInfraHandler",
97
103
  ]