@miosa/cli 1.3.4 → 2.1.0
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.
- package/README.md +20 -835
- package/bin/miosa.js +75 -0
- package/lib/archive.js +88 -0
- package/lib/checksums.js +29 -0
- package/lib/platforms.js +31 -0
- package/lib/resolve.js +47 -0
- package/package.json +26 -41
- package/scripts/postinstall.js +68 -0
- package/CHANGELOG.md +0 -110
- package/dist/action-authority.d.ts +0 -106
- package/dist/action-authority.d.ts.map +0 -1
- package/dist/action-authority.js +0 -116
- package/dist/action-authority.js.map +0 -1
- package/dist/app-advisor.d.ts +0 -80
- package/dist/app-advisor.d.ts.map +0 -1
- package/dist/app-advisor.js +0 -486
- package/dist/app-advisor.js.map +0 -1
- package/dist/app-contract.d.ts +0 -92
- package/dist/app-contract.d.ts.map +0 -1
- package/dist/app-contract.js +0 -218
- package/dist/app-contract.js.map +0 -1
- package/dist/app-document.d.ts +0 -23
- package/dist/app-document.d.ts.map +0 -1
- package/dist/app-document.js +0 -180
- package/dist/app-document.js.map +0 -1
- package/dist/app-manifest.d.ts +0 -140
- package/dist/app-manifest.d.ts.map +0 -1
- package/dist/app-manifest.js +0 -377
- package/dist/app-manifest.js.map +0 -1
- package/dist/app-operation.d.ts +0 -23
- package/dist/app-operation.d.ts.map +0 -1
- package/dist/app-operation.js +0 -49
- package/dist/app-operation.js.map +0 -1
- package/dist/app-release.d.ts +0 -132
- package/dist/app-release.d.ts.map +0 -1
- package/dist/app-release.js +0 -294
- package/dist/app-release.js.map +0 -1
- package/dist/bin/miosa.d.ts +0 -3
- package/dist/bin/miosa.d.ts.map +0 -1
- package/dist/bin/miosa.js +0 -288
- package/dist/bin/miosa.js.map +0 -1
- package/dist/cli-env.d.ts +0 -12
- package/dist/cli-env.d.ts.map +0 -1
- package/dist/cli-env.js +0 -34
- package/dist/cli-env.js.map +0 -1
- package/dist/client.d.ts +0 -155
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -865
- package/dist/client.js.map +0 -1
- package/dist/commands/actions.d.ts +0 -3
- package/dist/commands/actions.d.ts.map +0 -1
- package/dist/commands/actions.js +0 -222
- package/dist/commands/actions.js.map +0 -1
- package/dist/commands/agent-runtime-profiles.d.ts +0 -3
- package/dist/commands/agent-runtime-profiles.d.ts.map +0 -1
- package/dist/commands/agent-runtime-profiles.js +0 -198
- package/dist/commands/agent-runtime-profiles.js.map +0 -1
- package/dist/commands/agent.d.ts +0 -18
- package/dist/commands/agent.d.ts.map +0 -1
- package/dist/commands/agent.js +0 -737
- package/dist/commands/agent.js.map +0 -1
- package/dist/commands/alerts.d.ts +0 -3
- package/dist/commands/alerts.d.ts.map +0 -1
- package/dist/commands/alerts.js +0 -41
- package/dist/commands/alerts.js.map +0 -1
- package/dist/commands/api-keys.d.ts +0 -3
- package/dist/commands/api-keys.d.ts.map +0 -1
- package/dist/commands/api-keys.js +0 -160
- package/dist/commands/api-keys.js.map +0 -1
- package/dist/commands/api-resource.d.ts +0 -20
- package/dist/commands/api-resource.d.ts.map +0 -1
- package/dist/commands/api-resource.js +0 -120
- package/dist/commands/api-resource.js.map +0 -1
- package/dist/commands/app.d.ts +0 -38
- package/dist/commands/app.d.ts.map +0 -1
- package/dist/commands/app.js +0 -1182
- package/dist/commands/app.js.map +0 -1
- package/dist/commands/apps.d.ts +0 -3
- package/dist/commands/apps.d.ts.map +0 -1
- package/dist/commands/apps.js +0 -218
- package/dist/commands/apps.js.map +0 -1
- package/dist/commands/audit.d.ts +0 -3
- package/dist/commands/audit.d.ts.map +0 -1
- package/dist/commands/audit.js +0 -25
- package/dist/commands/audit.js.map +0 -1
- package/dist/commands/auth.d.ts +0 -3
- package/dist/commands/auth.d.ts.map +0 -1
- package/dist/commands/auth.js +0 -282
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/backups.d.ts +0 -3
- package/dist/commands/backups.d.ts.map +0 -1
- package/dist/commands/backups.js +0 -23
- package/dist/commands/backups.js.map +0 -1
- package/dist/commands/billing.d.ts +0 -3
- package/dist/commands/billing.d.ts.map +0 -1
- package/dist/commands/billing.js +0 -208
- package/dist/commands/billing.js.map +0 -1
- package/dist/commands/builds.d.ts +0 -3
- package/dist/commands/builds.d.ts.map +0 -1
- package/dist/commands/builds.js +0 -198
- package/dist/commands/builds.js.map +0 -1
- package/dist/commands/capabilities.d.ts +0 -3
- package/dist/commands/capabilities.d.ts.map +0 -1
- package/dist/commands/capabilities.js +0 -1002
- package/dist/commands/capabilities.js.map +0 -1
- package/dist/commands/checkpoints.d.ts +0 -3
- package/dist/commands/checkpoints.d.ts.map +0 -1
- package/dist/commands/checkpoints.js +0 -193
- package/dist/commands/checkpoints.js.map +0 -1
- package/dist/commands/cleanup.d.ts +0 -3
- package/dist/commands/cleanup.d.ts.map +0 -1
- package/dist/commands/cleanup.js +0 -65
- package/dist/commands/cleanup.js.map +0 -1
- package/dist/commands/cloud.d.ts +0 -3
- package/dist/commands/cloud.d.ts.map +0 -1
- package/dist/commands/cloud.js +0 -192
- package/dist/commands/cloud.js.map +0 -1
- package/dist/commands/command-overview.d.ts +0 -13
- package/dist/commands/command-overview.d.ts.map +0 -1
- package/dist/commands/command-overview.js +0 -50
- package/dist/commands/command-overview.js.map +0 -1
- package/dist/commands/completion.d.ts +0 -3
- package/dist/commands/completion.d.ts.map +0 -1
- package/dist/commands/completion.js +0 -183
- package/dist/commands/completion.js.map +0 -1
- package/dist/commands/computers.d.ts +0 -3
- package/dist/commands/computers.d.ts.map +0 -1
- package/dist/commands/computers.js +0 -706
- package/dist/commands/computers.js.map +0 -1
- package/dist/commands/config.d.ts +0 -3
- package/dist/commands/config.d.ts.map +0 -1
- package/dist/commands/config.js +0 -114
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/connect.d.ts +0 -6
- package/dist/commands/connect.d.ts.map +0 -1
- package/dist/commands/connect.js +0 -127
- package/dist/commands/connect.js.map +0 -1
- package/dist/commands/connectors.d.ts +0 -3
- package/dist/commands/connectors.d.ts.map +0 -1
- package/dist/commands/connectors.js +0 -172
- package/dist/commands/connectors.js.map +0 -1
- package/dist/commands/containers.d.ts +0 -3
- package/dist/commands/containers.d.ts.map +0 -1
- package/dist/commands/containers.js +0 -20
- package/dist/commands/containers.js.map +0 -1
- package/dist/commands/context.d.ts +0 -3
- package/dist/commands/context.d.ts.map +0 -1
- package/dist/commands/context.js +0 -233
- package/dist/commands/context.js.map +0 -1
- package/dist/commands/cp.d.ts +0 -3
- package/dist/commands/cp.d.ts.map +0 -1
- package/dist/commands/cp.js +0 -319
- package/dist/commands/cp.js.map +0 -1
- package/dist/commands/cron.d.ts +0 -3
- package/dist/commands/cron.d.ts.map +0 -1
- package/dist/commands/cron.js +0 -65
- package/dist/commands/cron.js.map +0 -1
- package/dist/commands/dashboard.d.ts +0 -13
- package/dist/commands/dashboard.d.ts.map +0 -1
- package/dist/commands/dashboard.js +0 -54
- package/dist/commands/dashboard.js.map +0 -1
- package/dist/commands/databases.d.ts +0 -3
- package/dist/commands/databases.d.ts.map +0 -1
- package/dist/commands/databases.js +0 -714
- package/dist/commands/databases.js.map +0 -1
- package/dist/commands/db.d.ts +0 -3
- package/dist/commands/db.d.ts.map +0 -1
- package/dist/commands/db.js +0 -385
- package/dist/commands/db.js.map +0 -1
- package/dist/commands/deploy.d.ts +0 -3
- package/dist/commands/deploy.d.ts.map +0 -1
- package/dist/commands/deploy.js +0 -1234
- package/dist/commands/deploy.js.map +0 -1
- package/dist/commands/desktop.d.ts +0 -3
- package/dist/commands/desktop.d.ts.map +0 -1
- package/dist/commands/desktop.js +0 -277
- package/dist/commands/desktop.js.map +0 -1
- package/dist/commands/dev.d.ts +0 -3
- package/dist/commands/dev.d.ts.map +0 -1
- package/dist/commands/dev.js +0 -245
- package/dist/commands/dev.js.map +0 -1
- package/dist/commands/devices.d.ts +0 -3
- package/dist/commands/devices.d.ts.map +0 -1
- package/dist/commands/devices.js +0 -279
- package/dist/commands/devices.js.map +0 -1
- package/dist/commands/docker-deploy.d.ts +0 -3
- package/dist/commands/docker-deploy.d.ts.map +0 -1
- package/dist/commands/docker-deploy.js +0 -659
- package/dist/commands/docker-deploy.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -69
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -596
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/domains.d.ts +0 -3
- package/dist/commands/domains.d.ts.map +0 -1
- package/dist/commands/domains.js +0 -307
- package/dist/commands/domains.js.map +0 -1
- package/dist/commands/enterprise-util.d.ts +0 -39
- package/dist/commands/enterprise-util.d.ts.map +0 -1
- package/dist/commands/enterprise-util.js +0 -217
- package/dist/commands/enterprise-util.js.map +0 -1
- package/dist/commands/env-input.d.ts +0 -26
- package/dist/commands/env-input.d.ts.map +0 -1
- package/dist/commands/env-input.js +0 -68
- package/dist/commands/env-input.js.map +0 -1
- package/dist/commands/env.d.ts +0 -3
- package/dist/commands/env.d.ts.map +0 -1
- package/dist/commands/env.js +0 -189
- package/dist/commands/env.js.map +0 -1
- package/dist/commands/exec.d.ts +0 -3
- package/dist/commands/exec.d.ts.map +0 -1
- package/dist/commands/exec.js +0 -110
- package/dist/commands/exec.js.map +0 -1
- package/dist/commands/forge.d.ts +0 -3
- package/dist/commands/forge.d.ts.map +0 -1
- package/dist/commands/forge.js +0 -254
- package/dist/commands/forge.js.map +0 -1
- package/dist/commands/functions.d.ts +0 -3
- package/dist/commands/functions.d.ts.map +0 -1
- package/dist/commands/functions.js +0 -47
- package/dist/commands/functions.js.map +0 -1
- package/dist/commands/gha-runners.d.ts +0 -3
- package/dist/commands/gha-runners.d.ts.map +0 -1
- package/dist/commands/gha-runners.js +0 -33
- package/dist/commands/gha-runners.js.map +0 -1
- package/dist/commands/groups.d.ts +0 -3
- package/dist/commands/groups.d.ts.map +0 -1
- package/dist/commands/groups.js +0 -38
- package/dist/commands/groups.js.map +0 -1
- package/dist/commands/host.d.ts +0 -3
- package/dist/commands/host.d.ts.map +0 -1
- package/dist/commands/host.js +0 -74
- package/dist/commands/host.js.map +0 -1
- package/dist/commands/hosts.d.ts +0 -7
- package/dist/commands/hosts.d.ts.map +0 -1
- package/dist/commands/hosts.js +0 -91
- package/dist/commands/hosts.js.map +0 -1
- package/dist/commands/link.d.ts +0 -8
- package/dist/commands/link.d.ts.map +0 -1
- package/dist/commands/link.js +0 -124
- package/dist/commands/link.js.map +0 -1
- package/dist/commands/login.d.ts +0 -10
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -263
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -3
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js +0 -43
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/logs.d.ts +0 -3
- package/dist/commands/logs.d.ts.map +0 -1
- package/dist/commands/logs.js +0 -401
- package/dist/commands/logs.js.map +0 -1
- package/dist/commands/ls.d.ts +0 -3
- package/dist/commands/ls.d.ts.map +0 -1
- package/dist/commands/ls.js +0 -121
- package/dist/commands/ls.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -46
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -3413
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/menu.d.ts +0 -29
- package/dist/commands/menu.d.ts.map +0 -1
- package/dist/commands/menu.js +0 -147
- package/dist/commands/menu.js.map +0 -1
- package/dist/commands/meshes.d.ts +0 -3
- package/dist/commands/meshes.d.ts.map +0 -1
- package/dist/commands/meshes.js +0 -27
- package/dist/commands/meshes.js.map +0 -1
- package/dist/commands/network-policy.d.ts +0 -3
- package/dist/commands/network-policy.d.ts.map +0 -1
- package/dist/commands/network-policy.js +0 -155
- package/dist/commands/network-policy.js.map +0 -1
- package/dist/commands/new.d.ts +0 -3
- package/dist/commands/new.d.ts.map +0 -1
- package/dist/commands/new.js +0 -296
- package/dist/commands/new.js.map +0 -1
- package/dist/commands/opencomputers.d.ts +0 -10
- package/dist/commands/opencomputers.d.ts.map +0 -1
- package/dist/commands/opencomputers.js +0 -25
- package/dist/commands/opencomputers.js.map +0 -1
- package/dist/commands/operating-contract.d.ts +0 -3
- package/dist/commands/operating-contract.d.ts.map +0 -1
- package/dist/commands/operating-contract.js +0 -651
- package/dist/commands/operating-contract.js.map +0 -1
- package/dist/commands/project.d.ts +0 -4
- package/dist/commands/project.d.ts.map +0 -1
- package/dist/commands/project.js +0 -25
- package/dist/commands/project.js.map +0 -1
- package/dist/commands/pull.d.ts +0 -14
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js +0 -156
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/regions.d.ts +0 -3
- package/dist/commands/regions.d.ts.map +0 -1
- package/dist/commands/regions.js +0 -103
- package/dist/commands/regions.js.map +0 -1
- package/dist/commands/releases.d.ts +0 -3
- package/dist/commands/releases.d.ts.map +0 -1
- package/dist/commands/releases.js +0 -365
- package/dist/commands/releases.js.map +0 -1
- package/dist/commands/rm.d.ts +0 -3
- package/dist/commands/rm.d.ts.map +0 -1
- package/dist/commands/rm.js +0 -42
- package/dist/commands/rm.js.map +0 -1
- package/dist/commands/rollback.d.ts +0 -3
- package/dist/commands/rollback.d.ts.map +0 -1
- package/dist/commands/rollback.js +0 -62
- package/dist/commands/rollback.js.map +0 -1
- package/dist/commands/run-groups.d.ts +0 -3
- package/dist/commands/run-groups.d.ts.map +0 -1
- package/dist/commands/run-groups.js +0 -364
- package/dist/commands/run-groups.js.map +0 -1
- package/dist/commands/run.d.ts +0 -3
- package/dist/commands/run.d.ts.map +0 -1
- package/dist/commands/run.js +0 -130
- package/dist/commands/run.js.map +0 -1
- package/dist/commands/runs.d.ts +0 -3
- package/dist/commands/runs.d.ts.map +0 -1
- package/dist/commands/runs.js +0 -365
- package/dist/commands/runs.js.map +0 -1
- package/dist/commands/runtime-env.d.ts +0 -3
- package/dist/commands/runtime-env.d.ts.map +0 -1
- package/dist/commands/runtime-env.js +0 -114
- package/dist/commands/runtime-env.js.map +0 -1
- package/dist/commands/sandbox-delete-guard.d.ts +0 -4
- package/dist/commands/sandbox-delete-guard.d.ts.map +0 -1
- package/dist/commands/sandbox-delete-guard.js +0 -32
- package/dist/commands/sandbox-delete-guard.js.map +0 -1
- package/dist/commands/sandbox-dev.d.ts +0 -20
- package/dist/commands/sandbox-dev.d.ts.map +0 -1
- package/dist/commands/sandbox-dev.js +0 -583
- package/dist/commands/sandbox-dev.js.map +0 -1
- package/dist/commands/sandbox.d.ts +0 -36
- package/dist/commands/sandbox.d.ts.map +0 -1
- package/dist/commands/sandbox.js +0 -3796
- package/dist/commands/sandbox.js.map +0 -1
- package/dist/commands/scale.d.ts +0 -3
- package/dist/commands/scale.d.ts.map +0 -1
- package/dist/commands/scale.js +0 -61
- package/dist/commands/scale.js.map +0 -1
- package/dist/commands/schedules.d.ts +0 -3
- package/dist/commands/schedules.d.ts.map +0 -1
- package/dist/commands/schedules.js +0 -37
- package/dist/commands/schedules.js.map +0 -1
- package/dist/commands/secrets.d.ts +0 -3
- package/dist/commands/secrets.d.ts.map +0 -1
- package/dist/commands/secrets.js +0 -200
- package/dist/commands/secrets.js.map +0 -1
- package/dist/commands/services.d.ts +0 -3
- package/dist/commands/services.d.ts.map +0 -1
- package/dist/commands/services.js +0 -70
- package/dist/commands/services.js.map +0 -1
- package/dist/commands/shell.d.ts +0 -16
- package/dist/commands/shell.d.ts.map +0 -1
- package/dist/commands/shell.js +0 -555
- package/dist/commands/shell.js.map +0 -1
- package/dist/commands/snapshot.d.ts +0 -10
- package/dist/commands/snapshot.d.ts.map +0 -1
- package/dist/commands/snapshot.js +0 -181
- package/dist/commands/snapshot.js.map +0 -1
- package/dist/commands/ssh.d.ts +0 -3
- package/dist/commands/ssh.d.ts.map +0 -1
- package/dist/commands/ssh.js +0 -93
- package/dist/commands/ssh.js.map +0 -1
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -302
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/storage.d.ts +0 -3
- package/dist/commands/storage.d.ts.map +0 -1
- package/dist/commands/storage.js +0 -456
- package/dist/commands/storage.js.map +0 -1
- package/dist/commands/teams.d.ts +0 -3
- package/dist/commands/teams.d.ts.map +0 -1
- package/dist/commands/teams.js +0 -169
- package/dist/commands/teams.js.map +0 -1
- package/dist/commands/templates.d.ts +0 -3
- package/dist/commands/templates.d.ts.map +0 -1
- package/dist/commands/templates.js +0 -690
- package/dist/commands/templates.js.map +0 -1
- package/dist/commands/tenant.d.ts +0 -3
- package/dist/commands/tenant.d.ts.map +0 -1
- package/dist/commands/tenant.js +0 -95
- package/dist/commands/tenant.js.map +0 -1
- package/dist/commands/tunnel.d.ts +0 -3
- package/dist/commands/tunnel.d.ts.map +0 -1
- package/dist/commands/tunnel.js +0 -418
- package/dist/commands/tunnel.js.map +0 -1
- package/dist/commands/up.d.ts +0 -14
- package/dist/commands/up.d.ts.map +0 -1
- package/dist/commands/up.js +0 -720
- package/dist/commands/up.js.map +0 -1
- package/dist/commands/update.d.ts +0 -3
- package/dist/commands/update.d.ts.map +0 -1
- package/dist/commands/update.js +0 -166
- package/dist/commands/update.js.map +0 -1
- package/dist/commands/util.d.ts +0 -25
- package/dist/commands/util.d.ts.map +0 -1
- package/dist/commands/util.js +0 -199
- package/dist/commands/util.js.map +0 -1
- package/dist/commands/volumes.d.ts +0 -3
- package/dist/commands/volumes.d.ts.map +0 -1
- package/dist/commands/volumes.js +0 -196
- package/dist/commands/volumes.js.map +0 -1
- package/dist/commands/watch.d.ts +0 -6
- package/dist/commands/watch.d.ts.map +0 -1
- package/dist/commands/watch.js +0 -414
- package/dist/commands/watch.js.map +0 -1
- package/dist/commands/webhooks.d.ts +0 -3
- package/dist/commands/webhooks.d.ts.map +0 -1
- package/dist/commands/webhooks.js +0 -23
- package/dist/commands/webhooks.js.map +0 -1
- package/dist/commands/whoami.d.ts +0 -3
- package/dist/commands/whoami.d.ts.map +0 -1
- package/dist/commands/whoami.js +0 -156
- package/dist/commands/whoami.js.map +0 -1
- package/dist/commands/workspaces.d.ts +0 -3
- package/dist/commands/workspaces.d.ts.map +0 -1
- package/dist/commands/workspaces.js +0 -147
- package/dist/commands/workspaces.js.map +0 -1
- package/dist/config.d.ts +0 -54
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -275
- package/dist/config.js.map +0 -1
- package/dist/errors.d.ts +0 -30
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -92
- package/dist/errors.js.map +0 -1
- package/dist/framework-detector.d.ts +0 -22
- package/dist/framework-detector.d.ts.map +0 -1
- package/dist/framework-detector.js +0 -373
- package/dist/framework-detector.js.map +0 -1
- package/dist/generated/action-capabilities.d.ts +0 -826
- package/dist/generated/action-capabilities.d.ts.map +0 -1
- package/dist/generated/action-capabilities.js +0 -1035
- package/dist/generated/action-capabilities.js.map +0 -1
- package/dist/net-diagnosis.d.ts +0 -87
- package/dist/net-diagnosis.d.ts.map +0 -1
- package/dist/net-diagnosis.js +0 -408
- package/dist/net-diagnosis.js.map +0 -1
- package/dist/pty/raw-mode.d.ts +0 -7
- package/dist/pty/raw-mode.d.ts.map +0 -1
- package/dist/pty/raw-mode.js +0 -22
- package/dist/pty/raw-mode.js.map +0 -1
- package/dist/pty/ws-pty-client.d.ts +0 -13
- package/dist/pty/ws-pty-client.d.ts.map +0 -1
- package/dist/pty/ws-pty-client.js +0 -73
- package/dist/pty/ws-pty-client.js.map +0 -1
- package/dist/tui/dashboard.d.ts +0 -35
- package/dist/tui/dashboard.d.ts.map +0 -1
- package/dist/tui/dashboard.js +0 -191
- package/dist/tui/dashboard.js.map +0 -1
- package/dist/tui/logs.d.ts +0 -26
- package/dist/tui/logs.d.ts.map +0 -1
- package/dist/tui/logs.js +0 -276
- package/dist/tui/logs.js.map +0 -1
- package/dist/types.d.ts +0 -362
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -16
- package/dist/types.js.map +0 -1
- package/dist/ui/picker.d.ts +0 -41
- package/dist/ui/picker.d.ts.map +0 -1
- package/dist/ui/picker.js +0 -77
- package/dist/ui/picker.js.map +0 -1
- package/dist/ui/progress.d.ts +0 -10
- package/dist/ui/progress.d.ts.map +0 -1
- package/dist/ui/progress.js +0 -36
- package/dist/ui/progress.js.map +0 -1
- package/dist/ui/render.d.ts +0 -91
- package/dist/ui/render.d.ts.map +0 -1
- package/dist/ui/render.js +0 -138
- package/dist/ui/render.js.map +0 -1
- package/dist/ui/spinner.d.ts +0 -4
- package/dist/ui/spinner.d.ts.map +0 -1
- package/dist/ui/spinner.js +0 -7
- package/dist/ui/spinner.js.map +0 -1
- package/dist/ui/table.d.ts +0 -8
- package/dist/ui/table.d.ts.map +0 -1
- package/dist/ui/table.js +0 -46
- package/dist/ui/table.js.map +0 -1
- package/dist/update-check.d.ts +0 -13
- package/dist/update-check.d.ts.map +0 -1
- package/dist/update-check.js +0 -94
- package/dist/update-check.js.map +0 -1
- package/dist/version.d.ts +0 -3
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -5
- package/dist/version.js.map +0 -1
package/dist/commands/volumes.js
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import { loadConfig } from "../config.js";
|
|
3
|
-
import { MiosaClient } from "../client.js";
|
|
4
|
-
import { renderTable } from "../ui/table.js";
|
|
5
|
-
import { spin } from "../ui/spinner.js";
|
|
6
|
-
import { handleError } from "./util.js";
|
|
7
|
-
function unwrapVolumes(raw) {
|
|
8
|
-
if (Array.isArray(raw))
|
|
9
|
-
return raw;
|
|
10
|
-
return raw.data ?? raw.volumes ?? [];
|
|
11
|
-
}
|
|
12
|
-
function unwrapVolume(raw) {
|
|
13
|
-
if ("data" in raw && raw.data)
|
|
14
|
-
return raw.data;
|
|
15
|
-
if ("volume" in raw && raw.volume)
|
|
16
|
-
return raw.volume;
|
|
17
|
-
return raw;
|
|
18
|
-
}
|
|
19
|
-
function fmtState(volume) {
|
|
20
|
-
const state = volume.state ?? "available";
|
|
21
|
-
if (state === "available" || state === "attached")
|
|
22
|
-
return chalk.green(state);
|
|
23
|
-
if (state === "creating" || state === "detaching")
|
|
24
|
-
return chalk.yellow(state);
|
|
25
|
-
if (state === "error" || state === "failed")
|
|
26
|
-
return chalk.red(state);
|
|
27
|
-
return state;
|
|
28
|
-
}
|
|
29
|
-
export function register(program) {
|
|
30
|
-
const volumes = program
|
|
31
|
-
.command("volumes")
|
|
32
|
-
.description("Manage persistent storage volumes");
|
|
33
|
-
volumes
|
|
34
|
-
.command("list")
|
|
35
|
-
.description("List volumes")
|
|
36
|
-
.option("--json", "Output raw JSON")
|
|
37
|
-
.action(async (opts) => {
|
|
38
|
-
try {
|
|
39
|
-
const config = loadConfig();
|
|
40
|
-
const client = new MiosaClient(config);
|
|
41
|
-
const spinner = spin("Fetching volumes...");
|
|
42
|
-
const rows = unwrapVolumes(await client.apiGet("/api/v1/volumes"));
|
|
43
|
-
spinner.stop();
|
|
44
|
-
if (opts.json) {
|
|
45
|
-
console.log(JSON.stringify(rows, null, 2));
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
renderTable(rows, [
|
|
49
|
-
{ header: "ID", key: (v) => v.id.slice(0, 12), width: 14 },
|
|
50
|
-
{ header: "NAME", key: "name", width: 24 },
|
|
51
|
-
{
|
|
52
|
-
header: "SIZE",
|
|
53
|
-
key: (v) => (v.size_gb === undefined ? chalk.dim("unknown") : `${v.size_gb}GB`),
|
|
54
|
-
width: 10,
|
|
55
|
-
},
|
|
56
|
-
{ header: "REGION", key: (v) => v.region ?? chalk.dim("default"), width: 14 },
|
|
57
|
-
{ header: "STATE", key: fmtState, width: 12 },
|
|
58
|
-
{
|
|
59
|
-
header: "ATTACHED",
|
|
60
|
-
key: (v) => v.attached_to ?? chalk.dim("none"),
|
|
61
|
-
width: 18,
|
|
62
|
-
},
|
|
63
|
-
]);
|
|
64
|
-
}
|
|
65
|
-
catch (err) {
|
|
66
|
-
handleError(err);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
volumes
|
|
70
|
-
.command("create <name>")
|
|
71
|
-
.description("Create a persistent volume")
|
|
72
|
-
.option("--size <gb>", "Volume size in GB", "10")
|
|
73
|
-
.option("--region <region>", "Region ID")
|
|
74
|
-
.option("--json", "Output raw JSON")
|
|
75
|
-
.action(async (name, opts) => {
|
|
76
|
-
try {
|
|
77
|
-
const config = loadConfig();
|
|
78
|
-
const client = new MiosaClient(config);
|
|
79
|
-
const spinner = spin(`Creating volume ${name}...`);
|
|
80
|
-
const volume = unwrapVolume(await client.apiPost("/api/v1/volumes", {
|
|
81
|
-
name,
|
|
82
|
-
size_gb: Number.parseInt(opts.size, 10),
|
|
83
|
-
region: opts.region,
|
|
84
|
-
}));
|
|
85
|
-
spinner.succeed(`Created volume ${volume.name}`);
|
|
86
|
-
if (opts.json)
|
|
87
|
-
console.log(JSON.stringify(volume, null, 2));
|
|
88
|
-
}
|
|
89
|
-
catch (err) {
|
|
90
|
-
handleError(err);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
volumes
|
|
94
|
-
.command("show <id>")
|
|
95
|
-
.description("Show volume details")
|
|
96
|
-
.option("--json", "Output raw JSON")
|
|
97
|
-
.action(async (id, opts) => {
|
|
98
|
-
try {
|
|
99
|
-
const config = loadConfig();
|
|
100
|
-
const client = new MiosaClient(config);
|
|
101
|
-
const volume = unwrapVolume(await client.apiGet(`/api/v1/volumes/${encodeURIComponent(id)}`));
|
|
102
|
-
if (opts.json) {
|
|
103
|
-
console.log(JSON.stringify(volume, null, 2));
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
console.log();
|
|
107
|
-
console.log(` ${chalk.bold("ID")} ${volume.id}`);
|
|
108
|
-
console.log(` ${chalk.bold("Name")} ${volume.name}`);
|
|
109
|
-
console.log(` ${chalk.bold("Size")} ${volume.size_gb ?? "unknown"}GB`);
|
|
110
|
-
console.log(` ${chalk.bold("Region")} ${volume.region ?? "default"}`);
|
|
111
|
-
console.log(` ${chalk.bold("State")} ${volume.state ?? "available"}`);
|
|
112
|
-
console.log(` ${chalk.bold("Attached")} ${volume.attached_to ?? "none"}`);
|
|
113
|
-
console.log();
|
|
114
|
-
}
|
|
115
|
-
catch (err) {
|
|
116
|
-
handleError(err);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
volumes
|
|
120
|
-
.command("attach <id>")
|
|
121
|
-
.description("Attach a volume to a machine")
|
|
122
|
-
.requiredOption("--machine <machine>", "Machine or host ID")
|
|
123
|
-
.option("--mount <path>", "Mount path", "/mnt/data")
|
|
124
|
-
.option("--json", "Output raw JSON")
|
|
125
|
-
.action(async (id, opts) => {
|
|
126
|
-
try {
|
|
127
|
-
const config = loadConfig();
|
|
128
|
-
const client = new MiosaClient(config);
|
|
129
|
-
const spinner = spin("Attaching volume...");
|
|
130
|
-
const attachment = await client.apiPost(`/api/v1/computers/${encodeURIComponent(opts.machine)}/volumes`, { volume_id: id, mount_path: opts.mount });
|
|
131
|
-
spinner.succeed(`Attached volume ${id}`);
|
|
132
|
-
if (opts.json) {
|
|
133
|
-
console.log(JSON.stringify(attachment, null, 2));
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
console.log(` ${chalk.bold("Attachment")} ${attachment.id}`);
|
|
137
|
-
}
|
|
138
|
-
catch (err) {
|
|
139
|
-
handleError(err);
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
volumes
|
|
143
|
-
.command("detach <attachment-id>")
|
|
144
|
-
.description("Detach a volume attachment")
|
|
145
|
-
.requiredOption("--machine <machine>", "Machine or host ID")
|
|
146
|
-
.option("--json", "Output raw JSON")
|
|
147
|
-
.action(async (attachmentId, opts) => {
|
|
148
|
-
try {
|
|
149
|
-
const config = loadConfig();
|
|
150
|
-
const client = new MiosaClient(config);
|
|
151
|
-
const spinner = spin("Detaching volume...");
|
|
152
|
-
const result = await client.apiDelete(`/api/v1/computers/${encodeURIComponent(opts.machine)}/volumes/${encodeURIComponent(attachmentId)}`);
|
|
153
|
-
spinner.succeed("Volume detached");
|
|
154
|
-
if (opts.json)
|
|
155
|
-
console.log(JSON.stringify(result ?? { ok: true }, null, 2));
|
|
156
|
-
}
|
|
157
|
-
catch (err) {
|
|
158
|
-
handleError(err);
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
volumes
|
|
162
|
-
.command("destroy <id>")
|
|
163
|
-
.description("Destroy a persistent volume")
|
|
164
|
-
.option("-f, --force", "Skip confirmation prompt")
|
|
165
|
-
.option("--json", "Output raw JSON")
|
|
166
|
-
.action(async (id, opts) => {
|
|
167
|
-
try {
|
|
168
|
-
if (!opts.force) {
|
|
169
|
-
const { default: inquirer } = await import("inquirer");
|
|
170
|
-
const { ok } = await inquirer.prompt([
|
|
171
|
-
{
|
|
172
|
-
type: "confirm",
|
|
173
|
-
name: "ok",
|
|
174
|
-
message: chalk.red(`Destroy volume ${id}? This is irreversible.`),
|
|
175
|
-
default: false,
|
|
176
|
-
},
|
|
177
|
-
]);
|
|
178
|
-
if (!ok) {
|
|
179
|
-
console.log(chalk.dim(" Cancelled."));
|
|
180
|
-
process.exit(0);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
const config = loadConfig();
|
|
184
|
-
const client = new MiosaClient(config);
|
|
185
|
-
const spinner = spin("Destroying volume...");
|
|
186
|
-
const result = await client.apiDelete(`/api/v1/volumes/${encodeURIComponent(id)}`);
|
|
187
|
-
spinner.succeed("Volume destroyed");
|
|
188
|
-
if (opts.json)
|
|
189
|
-
console.log(JSON.stringify(result ?? { ok: true }, null, 2));
|
|
190
|
-
}
|
|
191
|
-
catch (err) {
|
|
192
|
-
handleError(err);
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
//# sourceMappingURL=volumes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"volumes.js","sourceRoot":"","sources":["../../src/commands/volumes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MA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mB,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAC5C,CAAC;YACF,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;YACpC,IAAI,IAAI,CAAC,IAAI;gBAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9E,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/commands/watch.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Command } from "commander";
|
|
2
|
-
import { MiosaClient } from "../client.js";
|
|
3
|
-
import type { ComputerId } from "../types.js";
|
|
4
|
-
export declare function resolveComputerId(client: MiosaClient, idOrName: string): Promise<ComputerId>;
|
|
5
|
-
export declare function register(program: Command): void;
|
|
6
|
-
//# sourceMappingURL=watch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,EAAE,WAAW,EAAY,MAAM,cAAc,CAAC;AAIrD,OAAO,KAAK,EAQV,UAAU,EACX,MAAM,aAAa,CAAC;AAwSrB,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,UAAU,CAAC,CAwBrB;AAkGD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4G/C"}
|
package/dist/commands/watch.js
DELETED
|
@@ -1,414 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import { mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { loadConfig } from "../config.js";
|
|
5
|
-
import { MiosaClient, parseSse } from "../client.js";
|
|
6
|
-
import { NetworkError, UserError } from "../errors.js";
|
|
7
|
-
import { handleError } from "./util.js";
|
|
8
|
-
import { spin } from "../ui/spinner.js";
|
|
9
|
-
import { toComputerId } from "../types.js";
|
|
10
|
-
// ── Constants ─────────────────────────────────────────────────────────────────
|
|
11
|
-
const RECONNECT_DELAY_MS = 2_000;
|
|
12
|
-
const MAX_RECONNECT_ATTEMPTS = 10;
|
|
13
|
-
const DIVIDER = chalk.dim("─".repeat(42));
|
|
14
|
-
// ── SSE → ComputerEvent parser ────────────────────────────────────────────────
|
|
15
|
-
function parseComputerEvent(eventType, raw) {
|
|
16
|
-
let parsed;
|
|
17
|
-
try {
|
|
18
|
-
parsed = JSON.parse(raw);
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
return { type: "unknown", raw };
|
|
22
|
-
}
|
|
23
|
-
const d = parsed;
|
|
24
|
-
const type = eventType || (typeof d["type"] === "string" ? d["type"] : "unknown");
|
|
25
|
-
switch (type) {
|
|
26
|
-
case "desktop_action": {
|
|
27
|
-
return {
|
|
28
|
-
type: "desktop_action",
|
|
29
|
-
kind: (d["kind"] ??
|
|
30
|
-
d["action"] ??
|
|
31
|
-
"click"),
|
|
32
|
-
x: typeof d["x"] === "number" ? d["x"] : undefined,
|
|
33
|
-
y: typeof d["y"] === "number" ? d["y"] : undefined,
|
|
34
|
-
button: d["button"] ?? undefined,
|
|
35
|
-
text: typeof d["text"] === "string" ? d["text"] : undefined,
|
|
36
|
-
key: typeof d["key"] === "string" ? d["key"] : undefined,
|
|
37
|
-
dx: typeof d["dx"] === "number" ? d["dx"] : undefined,
|
|
38
|
-
dy: typeof d["dy"] === "number" ? d["dy"] : undefined,
|
|
39
|
-
timestamp: typeof d["timestamp"] === "string"
|
|
40
|
-
? d["timestamp"]
|
|
41
|
-
: new Date().toISOString(),
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
case "exec": {
|
|
45
|
-
const hasExitCode = typeof d["exit_code"] === "number";
|
|
46
|
-
return {
|
|
47
|
-
type: "exec",
|
|
48
|
-
command: typeof d["command"] === "string" ? d["command"] : raw,
|
|
49
|
-
exit_code: hasExitCode ? d["exit_code"] : undefined,
|
|
50
|
-
duration_ms: typeof d["duration_ms"] === "number" ? d["duration_ms"] : undefined,
|
|
51
|
-
phase: hasExitCode ? "done" : "start",
|
|
52
|
-
timestamp: typeof d["timestamp"] === "string"
|
|
53
|
-
? d["timestamp"]
|
|
54
|
-
: new Date().toISOString(),
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
case "file": {
|
|
58
|
-
return {
|
|
59
|
-
type: "file",
|
|
60
|
-
operation: (d["operation"] ?? "write"),
|
|
61
|
-
path: typeof d["path"] === "string" ? d["path"] : "",
|
|
62
|
-
size: typeof d["size"] === "number" ? d["size"] : undefined,
|
|
63
|
-
timestamp: typeof d["timestamp"] === "string"
|
|
64
|
-
? d["timestamp"]
|
|
65
|
-
: new Date().toISOString(),
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
case "screenshot": {
|
|
69
|
-
return {
|
|
70
|
-
type: "screenshot",
|
|
71
|
-
width: typeof d["width"] === "number" ? d["width"] : 0,
|
|
72
|
-
height: typeof d["height"] === "number" ? d["height"] : 0,
|
|
73
|
-
size: typeof d["size"] === "number" ? d["size"] : 0,
|
|
74
|
-
data: typeof d["data"] === "string" ? d["data"] : undefined,
|
|
75
|
-
timestamp: typeof d["timestamp"] === "string"
|
|
76
|
-
? d["timestamp"]
|
|
77
|
-
: new Date().toISOString(),
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
case "error": {
|
|
81
|
-
return {
|
|
82
|
-
type: "error",
|
|
83
|
-
message: typeof d["message"] === "string" ? d["message"] : "Unknown error",
|
|
84
|
-
code: typeof d["code"] === "string" ? d["code"] : undefined,
|
|
85
|
-
timestamp: typeof d["timestamp"] === "string"
|
|
86
|
-
? d["timestamp"]
|
|
87
|
-
: new Date().toISOString(),
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
case "heartbeat":
|
|
91
|
-
case "ping":
|
|
92
|
-
return {
|
|
93
|
-
type: "heartbeat",
|
|
94
|
-
timestamp: typeof d["timestamp"] === "string"
|
|
95
|
-
? d["timestamp"]
|
|
96
|
-
: new Date().toISOString(),
|
|
97
|
-
};
|
|
98
|
-
default:
|
|
99
|
-
return { type: "unknown", raw };
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
// ── Filter helpers ────────────────────────────────────────────────────────────
|
|
103
|
-
const VALID_FILTER_CATEGORIES = new Set([
|
|
104
|
-
"desktop",
|
|
105
|
-
"exec",
|
|
106
|
-
"file",
|
|
107
|
-
"screenshot",
|
|
108
|
-
"error",
|
|
109
|
-
]);
|
|
110
|
-
function parseFilter(raw) {
|
|
111
|
-
const categories = raw.split(",").map((s) => s.trim().toLowerCase());
|
|
112
|
-
const invalid = categories.filter((c) => !VALID_FILTER_CATEGORIES.has(c));
|
|
113
|
-
if (invalid.length > 0) {
|
|
114
|
-
throw new UserError(`Unknown filter categories: ${invalid.join(", ")}`, `Valid categories: ${[...VALID_FILTER_CATEGORIES].join(", ")}`);
|
|
115
|
-
}
|
|
116
|
-
return new Set(categories);
|
|
117
|
-
}
|
|
118
|
-
function eventMatchesFilter(event, filter) {
|
|
119
|
-
if (filter === null)
|
|
120
|
-
return true;
|
|
121
|
-
switch (event.type) {
|
|
122
|
-
case "desktop_action":
|
|
123
|
-
return filter.has("desktop");
|
|
124
|
-
case "exec":
|
|
125
|
-
return filter.has("exec");
|
|
126
|
-
case "file":
|
|
127
|
-
return filter.has("file");
|
|
128
|
-
case "screenshot":
|
|
129
|
-
return filter.has("screenshot");
|
|
130
|
-
case "error":
|
|
131
|
-
return filter.has("error");
|
|
132
|
-
case "heartbeat":
|
|
133
|
-
case "unknown":
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
// ── Formatting helpers ────────────────────────────────────────────────────────
|
|
138
|
-
function formatTimestamp(isoOrNow) {
|
|
139
|
-
try {
|
|
140
|
-
return new Date(isoOrNow).toLocaleTimeString();
|
|
141
|
-
}
|
|
142
|
-
catch {
|
|
143
|
-
return new Date().toLocaleTimeString();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
function formatBytes(bytes) {
|
|
147
|
-
if (bytes < 1024)
|
|
148
|
-
return `${bytes}B`;
|
|
149
|
-
if (bytes < 1024 * 1024)
|
|
150
|
-
return `${(bytes / 1024).toFixed(1)}KB`;
|
|
151
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
|
|
152
|
-
}
|
|
153
|
-
function formatDuration(ms) {
|
|
154
|
-
if (ms < 1000)
|
|
155
|
-
return `${ms}ms`;
|
|
156
|
-
return `${(ms / 1000).toFixed(1)}s`;
|
|
157
|
-
}
|
|
158
|
-
function formatDesktopAction(e) {
|
|
159
|
-
switch (e.kind) {
|
|
160
|
-
case "click":
|
|
161
|
-
case "double_click":
|
|
162
|
-
case "right_click": {
|
|
163
|
-
const label = e.kind === "double_click"
|
|
164
|
-
? "double_click"
|
|
165
|
-
: e.kind === "right_click"
|
|
166
|
-
? "right_click"
|
|
167
|
-
: "click";
|
|
168
|
-
const coords = e.x !== undefined && e.y !== undefined ? `(${e.x}, ${e.y})` : "";
|
|
169
|
-
const btn = e.button ? ` ${e.button}` : "";
|
|
170
|
-
return `${chalk.blue(label.padEnd(12))} ${coords}${btn}`;
|
|
171
|
-
}
|
|
172
|
-
case "type":
|
|
173
|
-
return `${chalk.blue("type".padEnd(12))} ${chalk.italic(JSON.stringify(e.text ?? ""))}`;
|
|
174
|
-
case "key":
|
|
175
|
-
return `${chalk.blue("key".padEnd(12))} ${e.key ?? ""}`;
|
|
176
|
-
case "scroll": {
|
|
177
|
-
const coords = e.x !== undefined && e.y !== undefined ? `(${e.x}, ${e.y})` : "";
|
|
178
|
-
return `${chalk.blue("scroll".padEnd(12))} ${coords} dx=${e.dx ?? 0} dy=${e.dy ?? 0}`;
|
|
179
|
-
}
|
|
180
|
-
case "move": {
|
|
181
|
-
const coords = e.x !== undefined && e.y !== undefined ? `(${e.x}, ${e.y})` : "";
|
|
182
|
-
return `${chalk.blue("move".padEnd(12))} ${coords}`;
|
|
183
|
-
}
|
|
184
|
-
case "drag": {
|
|
185
|
-
const coords = e.x !== undefined && e.y !== undefined ? `(${e.x}, ${e.y})` : "";
|
|
186
|
-
return `${chalk.blue("drag".padEnd(12))} ${coords}`;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
function formatExecEvent(e) {
|
|
191
|
-
if (e.phase === "start") {
|
|
192
|
-
return `${chalk.green("exec".padEnd(12))} ${e.command}`;
|
|
193
|
-
}
|
|
194
|
-
const duration = e.duration_ms !== undefined
|
|
195
|
-
? chalk.dim(` (${formatDuration(e.duration_ms)})`)
|
|
196
|
-
: "";
|
|
197
|
-
const exitLabel = e.exit_code === 0
|
|
198
|
-
? chalk.green(`exit=${e.exit_code}`)
|
|
199
|
-
: chalk.red(`exit=${e.exit_code ?? "?"}`);
|
|
200
|
-
return `${chalk.green("exec:done".padEnd(12))} ${exitLabel}${duration}`;
|
|
201
|
-
}
|
|
202
|
-
function formatFileEvent(e) {
|
|
203
|
-
const size = e.size !== undefined ? chalk.dim(` ${formatBytes(e.size)}`) : "";
|
|
204
|
-
return `${chalk.yellow(e.operation.padEnd(12))} ${e.path}${size}`;
|
|
205
|
-
}
|
|
206
|
-
function formatScreenshotEvent(e) {
|
|
207
|
-
return chalk.dim(`${"screenshot".padEnd(12)} ${e.width}x${e.height}, ${formatBytes(e.size)}`);
|
|
208
|
-
}
|
|
209
|
-
function formatErrorEvent(e) {
|
|
210
|
-
const code = e.code ? chalk.dim(` [${e.code}]`) : "";
|
|
211
|
-
return `${chalk.red("error".padEnd(12))} ${e.message}${code}`;
|
|
212
|
-
}
|
|
213
|
-
function renderLine(ts, body) {
|
|
214
|
-
console.log(`${chalk.dim(ts)} ${body}`);
|
|
215
|
-
}
|
|
216
|
-
// ── Screenshot saving ─────────────────────────────────────────────────────────
|
|
217
|
-
function saveScreenshot(dir, event, index) {
|
|
218
|
-
if (!event.data)
|
|
219
|
-
return;
|
|
220
|
-
try {
|
|
221
|
-
const filename = `screenshot-${String(index).padStart(4, "0")}-${Date.now()}.png`;
|
|
222
|
-
const filepath = join(dir, filename);
|
|
223
|
-
const buf = Buffer.from(event.data, "base64");
|
|
224
|
-
writeFileSync(filepath, buf);
|
|
225
|
-
console.log(chalk.dim(` Saved ${filepath}`));
|
|
226
|
-
}
|
|
227
|
-
catch (err) {
|
|
228
|
-
console.error(chalk.red(` Failed to save screenshot: ${err instanceof Error ? err.message : String(err)}`));
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
// ── Resolve computer by ID or name ────────────────────────────────────────────
|
|
232
|
-
function dataOf(payload) {
|
|
233
|
-
if (payload !== null &&
|
|
234
|
-
typeof payload === "object" &&
|
|
235
|
-
payload.data !== undefined) {
|
|
236
|
-
return payload.data;
|
|
237
|
-
}
|
|
238
|
-
return payload;
|
|
239
|
-
}
|
|
240
|
-
function listOf(payload) {
|
|
241
|
-
const value = dataOf(payload);
|
|
242
|
-
return Array.isArray(value) ? value : [];
|
|
243
|
-
}
|
|
244
|
-
export async function resolveComputerId(client, idOrName) {
|
|
245
|
-
// Try direct lookup first; if that 404s, fall back to list search.
|
|
246
|
-
try {
|
|
247
|
-
const payload = await client.apiGet(`/api/v1/computers/${encodeURIComponent(idOrName)}`);
|
|
248
|
-
const computer = dataOf(payload);
|
|
249
|
-
if (!computer?.id)
|
|
250
|
-
throw new Error("Computer response did not include an id");
|
|
251
|
-
return toComputerId(computer.id);
|
|
252
|
-
}
|
|
253
|
-
catch {
|
|
254
|
-
// Fallback: list and match by name
|
|
255
|
-
const payload = await client.apiGet("/api/v1/computers");
|
|
256
|
-
const computers = listOf(payload);
|
|
257
|
-
const match = computers.find((c) => c.id === idOrName || c.name === idOrName);
|
|
258
|
-
if (!match) {
|
|
259
|
-
throw new UserError(`Computer not found: ${idOrName}`, "Run `miosa computers list` to see available computers.");
|
|
260
|
-
}
|
|
261
|
-
return toComputerId(match.id);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
async function runEventLoop(client, computerId, opts) {
|
|
265
|
-
let screenshotIndex = 0;
|
|
266
|
-
const res = await client.watchComputerEvents(computerId);
|
|
267
|
-
for await (const sseEvent of parseSse(res.body)) {
|
|
268
|
-
// Re-parse raw SSE events into typed ComputerEvents
|
|
269
|
-
let event;
|
|
270
|
-
if (sseEvent.type === "unknown") {
|
|
271
|
-
event = parseComputerEvent("", sseEvent.raw);
|
|
272
|
-
}
|
|
273
|
-
else if (sseEvent.type === "heartbeat" ||
|
|
274
|
-
sseEvent.type === "done" ||
|
|
275
|
-
sseEvent.type === "exit") {
|
|
276
|
-
// heartbeat: silently skip; done/exit: end of stream
|
|
277
|
-
if (sseEvent.type === "done" || sseEvent.type === "exit")
|
|
278
|
-
return;
|
|
279
|
-
continue;
|
|
280
|
-
}
|
|
281
|
-
else if (sseEvent.type === "error") {
|
|
282
|
-
event = {
|
|
283
|
-
type: "error",
|
|
284
|
-
message: sseEvent.message,
|
|
285
|
-
timestamp: new Date().toISOString(),
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
// stdout/stderr/thought/tool_call/tool_result fall through as unknown
|
|
290
|
-
event = { type: "unknown", raw: JSON.stringify(sseEvent) };
|
|
291
|
-
}
|
|
292
|
-
// Apply filter
|
|
293
|
-
if (!eventMatchesFilter(event, opts.filter))
|
|
294
|
-
continue;
|
|
295
|
-
if (opts.json) {
|
|
296
|
-
console.log(JSON.stringify(event));
|
|
297
|
-
continue;
|
|
298
|
-
}
|
|
299
|
-
// Human-readable rendering
|
|
300
|
-
switch (event.type) {
|
|
301
|
-
case "desktop_action": {
|
|
302
|
-
const ts = formatTimestamp(event.timestamp);
|
|
303
|
-
renderLine(ts, formatDesktopAction(event));
|
|
304
|
-
break;
|
|
305
|
-
}
|
|
306
|
-
case "exec": {
|
|
307
|
-
const ts = formatTimestamp(event.timestamp);
|
|
308
|
-
renderLine(ts, formatExecEvent(event));
|
|
309
|
-
break;
|
|
310
|
-
}
|
|
311
|
-
case "file": {
|
|
312
|
-
const ts = formatTimestamp(event.timestamp);
|
|
313
|
-
renderLine(ts, formatFileEvent(event));
|
|
314
|
-
break;
|
|
315
|
-
}
|
|
316
|
-
case "screenshot": {
|
|
317
|
-
const ts = formatTimestamp(event.timestamp);
|
|
318
|
-
renderLine(ts, formatScreenshotEvent(event));
|
|
319
|
-
if (opts.screenshotsDir !== null) {
|
|
320
|
-
saveScreenshot(opts.screenshotsDir, event, ++screenshotIndex);
|
|
321
|
-
}
|
|
322
|
-
break;
|
|
323
|
-
}
|
|
324
|
-
case "error": {
|
|
325
|
-
const ts = formatTimestamp(event.timestamp);
|
|
326
|
-
renderLine(ts, formatErrorEvent(event));
|
|
327
|
-
break;
|
|
328
|
-
}
|
|
329
|
-
case "heartbeat":
|
|
330
|
-
case "unknown":
|
|
331
|
-
if (process.env["MIOSA_DEBUG"]) {
|
|
332
|
-
console.log(chalk.dim(`[debug] ${event.type === "unknown" ? event.raw : "heartbeat"}`));
|
|
333
|
-
}
|
|
334
|
-
break;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
// ── Command registration ──────────────────────────────────────────────────────
|
|
339
|
-
export function register(program) {
|
|
340
|
-
program
|
|
341
|
-
.command("watch <computer-id>")
|
|
342
|
-
.description("Stream real-time events from a Computer — agent actions, execs, file ops, screenshots")
|
|
343
|
-
.option("--json", "Output one JSON object per line (machine-readable)")
|
|
344
|
-
.option("--filter <categories>", "Comma-separated event categories to show: desktop, exec, file, screenshot, error")
|
|
345
|
-
.option("--screenshots <dir>", "Save incoming screenshots to a local directory as PNG files")
|
|
346
|
-
.action(async (computerArg, opts) => {
|
|
347
|
-
try {
|
|
348
|
-
const config = loadConfig();
|
|
349
|
-
const client = new MiosaClient(config);
|
|
350
|
-
// Parse --filter
|
|
351
|
-
let filter = null;
|
|
352
|
-
if (opts.filter) {
|
|
353
|
-
filter = parseFilter(opts.filter);
|
|
354
|
-
}
|
|
355
|
-
// Prepare screenshots directory
|
|
356
|
-
let screenshotsDir = null;
|
|
357
|
-
if (opts.screenshots) {
|
|
358
|
-
screenshotsDir = opts.screenshots;
|
|
359
|
-
mkdirSync(screenshotsDir, { recursive: true });
|
|
360
|
-
}
|
|
361
|
-
// Resolve computer
|
|
362
|
-
const spinner = spin(`Connecting to ${computerArg}...`);
|
|
363
|
-
const computerId = await resolveComputerId(client, computerArg);
|
|
364
|
-
spinner.succeed(`Watching ${computerArg} ${chalk.dim("(connected via SSE)")}`);
|
|
365
|
-
if (!opts.json) {
|
|
366
|
-
console.log(DIVIDER);
|
|
367
|
-
}
|
|
368
|
-
// Graceful Ctrl+C
|
|
369
|
-
let stopping = false;
|
|
370
|
-
process.on("SIGINT", () => {
|
|
371
|
-
stopping = true;
|
|
372
|
-
if (!opts.json) {
|
|
373
|
-
console.log(chalk.dim("\n\nStopped."));
|
|
374
|
-
}
|
|
375
|
-
process.exit(0);
|
|
376
|
-
});
|
|
377
|
-
// Reconnection loop
|
|
378
|
-
let attempts = 0;
|
|
379
|
-
while (!stopping) {
|
|
380
|
-
try {
|
|
381
|
-
await runEventLoop(client, computerId, {
|
|
382
|
-
json: opts.json ?? false,
|
|
383
|
-
filter,
|
|
384
|
-
screenshotsDir,
|
|
385
|
-
});
|
|
386
|
-
// Clean end-of-stream — exit normally
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
catch (err) {
|
|
390
|
-
if (stopping)
|
|
391
|
-
break;
|
|
392
|
-
// Don't reconnect on auth/user errors
|
|
393
|
-
if (err instanceof UserError ||
|
|
394
|
-
(err instanceof Error && err.constructor.name === "AuthError")) {
|
|
395
|
-
throw err;
|
|
396
|
-
}
|
|
397
|
-
attempts++;
|
|
398
|
-
if (attempts > MAX_RECONNECT_ATTEMPTS) {
|
|
399
|
-
throw new NetworkError(`Lost connection to ${computerArg} after ${MAX_RECONNECT_ATTEMPTS} reconnect attempts.`, "Check that the computer is running: miosa computers list");
|
|
400
|
-
}
|
|
401
|
-
if (!opts.json) {
|
|
402
|
-
console.log(chalk.dim(`\nConnection lost — reconnecting in ${RECONNECT_DELAY_MS / 1000}s ` +
|
|
403
|
-
`(attempt ${attempts}/${MAX_RECONNECT_ATTEMPTS})...`));
|
|
404
|
-
}
|
|
405
|
-
await new Promise((resolve) => setTimeout(resolve, RECONNECT_DELAY_MS));
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
catch (err) {
|
|
410
|
-
handleError(err);
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
//# sourceMappingURL=watch.js.map
|