You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance container port metadata with protocol, label, and browsable flag (#24)
* feat: sub-container port state — protocol, label and browsable flag (spec C.7/C.3)
Adapt the SDK to GladysAssistant/Gladys#2786, which adds a `browsable`
field (default true) to the manifest sub-container ports and returns the
full port shape from `GET /container`: a port that serves no web UI (a
WebSocket endpoint waiting for devices, the OCPP case) is shown as a
plain badge instead of an "Open" link.
- ContainerPort typings resynced with the core state: `protocol`, `label`
and `browsable` added, `host_port` corrected to `number | null` (no
host port is allocated before the first start); new exported
ContainerPortProtocol union
- getContainers JSDoc + README document the full port entry and what
browsable: false means for the integration
- tests: the getContainers fixture carries the real port shape, plus a
non-browsable port with an unassigned host port; compile-time checks on
the new fields
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WxpcyV2TFQvTJkYdTa9YET
* test(types): assert host_port nullability with a direct assignment
The optional chaining on `containers[0]?.ports[0]?.host_port` contributes
`undefined` on its own, so the widened `number | null | undefined`
annotation type-checked even when `host_port` was `number` — the check
did not actually prove the field is nullable. Assign `null` straight to
`ContainerPort['host_port']` instead, which fails to compile without the
null in the type.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WxpcyV2TFQvTJkYdTa9YET
---------
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,7 +124,7 @@ All methods return Promises; host API errors are thrown as `GladysApiError { sta
124
124
|`getConfig()` / `setConfig(partialConfig)`| Configuration values; `getConfig` also refreshes `gladys.config`|
125
125
|`getStatus()`| Gladys version + integration service status |
126
126
|`setConnectionStatus(connected, message?)`| Application-level connection status shown in the Configuration screen (`message` is an optional multi-language object, e.g. `{ en: 'Token expired' }`). Distinct from the container state machine: a cloud integration can be RUNNING and still disconnected from its third-party service |
127
-
|`getContainers()`| Sub-containers declared in the manifest: Docker status, desired state, assigned host ports, granted/available hardware classes |
127
+
|`getContainers()`| Sub-containers declared in the manifest: Docker status, desired state, published ports (`{ container_port, protocol, host_port, label, browsable }`, `host_port: null` while none is assigned yet), granted/available hardware classes|
128
128
|`startContainer(name, { env }?)`| Creates (if needed) and starts a declared sub-container — typically after generating its config files in `/data`; `env` carries runtime-computed values (secrets never go through the public manifest) |
129
129
|`stopContainer(name)`| Stops a sub-container; the supervisor will not restart it |
130
130
|`restartContainer(name)`| Restarts a sub-container, e.g. after rewriting its config through `/data`|
0 commit comments