@miosa/cli 1.3.4 → 2.0.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 +26 -0
- package/lib/checksums.js +29 -0
- package/lib/platforms.js +31 -0
- package/lib/resolve.js +47 -0
- package/package.json +25 -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/agent.js
DELETED
|
@@ -1,737 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* miosa agent - first-class computer control session management.
|
|
3
|
-
*
|
|
4
|
-
* Routes map to: /api/v1/computers/:computer_id/control/sessions[/:session_id/...]
|
|
5
|
-
*
|
|
6
|
-
* Subcommands:
|
|
7
|
-
* start POST /computers/:id/control/sessions
|
|
8
|
-
* ls GET /computers/:id/control/sessions (all computers when no --computer)
|
|
9
|
-
* get GET /computers/:id/control/sessions/:session_id
|
|
10
|
-
* task POST /computers/:id/control/sessions/:session_id/task
|
|
11
|
-
* pause POST /computers/:id/control/sessions/:session_id/pause
|
|
12
|
-
* resume POST /computers/:id/control/sessions/:session_id/resume
|
|
13
|
-
* stop DELETE /computers/:id/control/sessions/:session_id
|
|
14
|
-
* history GET /computers/:id/control/sessions/:session_id/events
|
|
15
|
-
*/
|
|
16
|
-
import fs from "node:fs";
|
|
17
|
-
import chalk from "chalk";
|
|
18
|
-
import { MiosaClient } from "../client.js";
|
|
19
|
-
import { loadConfig } from "../config.js";
|
|
20
|
-
import { UserError } from "../errors.js";
|
|
21
|
-
import { renderTable } from "../ui/table.js";
|
|
22
|
-
import { spin } from "../ui/spinner.js";
|
|
23
|
-
import { handleError, isJsonMode, parseEnvPairs } from "./util.js";
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
// Helpers
|
|
26
|
-
// ---------------------------------------------------------------------------
|
|
27
|
-
function apiV1(path) {
|
|
28
|
-
return `/api/v1${path}`;
|
|
29
|
-
}
|
|
30
|
-
function enc(value) {
|
|
31
|
-
return encodeURIComponent(value);
|
|
32
|
-
}
|
|
33
|
-
function collectOption(value, previous) {
|
|
34
|
-
previous.push(value);
|
|
35
|
-
return previous;
|
|
36
|
-
}
|
|
37
|
-
function readJsonValue(value, file, label) {
|
|
38
|
-
if (value && file) {
|
|
39
|
-
throw new UserError(`Use either --${label} or --${label}-file, not both.`);
|
|
40
|
-
}
|
|
41
|
-
if (file) {
|
|
42
|
-
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
43
|
-
}
|
|
44
|
-
if (value) {
|
|
45
|
-
return JSON.parse(value);
|
|
46
|
-
}
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
/** Extract a list from the standard {data: [...]} envelope or bare array. */
|
|
50
|
-
function listOf(payload, extraKeys = []) {
|
|
51
|
-
if (Array.isArray(payload))
|
|
52
|
-
return payload;
|
|
53
|
-
if (isRecord(payload)) {
|
|
54
|
-
if (Array.isArray(payload["data"]))
|
|
55
|
-
return payload["data"];
|
|
56
|
-
for (const key of extraKeys) {
|
|
57
|
-
if (Array.isArray(payload[key]))
|
|
58
|
-
return payload[key];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return [];
|
|
62
|
-
}
|
|
63
|
-
/** Extract a single object from {data: {...}} envelope or the payload itself. */
|
|
64
|
-
function dataOf(payload) {
|
|
65
|
-
if (isRecord(payload) && isRecord(payload["data"])) {
|
|
66
|
-
return payload["data"];
|
|
67
|
-
}
|
|
68
|
-
return payload;
|
|
69
|
-
}
|
|
70
|
-
function isRecord(value) {
|
|
71
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Resolve a computer by name or ID.
|
|
75
|
-
* Calls GET /api/v1/computers and filters the list.
|
|
76
|
-
*/
|
|
77
|
-
async function resolveComputer(c, nameOrId) {
|
|
78
|
-
const payload = await c.apiGet(apiV1("/computers"));
|
|
79
|
-
const items = listOf(payload, ["computers"]);
|
|
80
|
-
const match = items.find((item) => item.id === nameOrId || item.name === nameOrId);
|
|
81
|
-
if (!match) {
|
|
82
|
-
throw new UserError(`Computer not found: ${nameOrId}`, "Run `miosa computers list` to see available computers.");
|
|
83
|
-
}
|
|
84
|
-
return match;
|
|
85
|
-
}
|
|
86
|
-
/** Relative time string, e.g. "3 minutes ago" */
|
|
87
|
-
function timeAgo(iso) {
|
|
88
|
-
if (!iso)
|
|
89
|
-
return chalk.dim("—");
|
|
90
|
-
const ms = Date.now() - new Date(iso).getTime();
|
|
91
|
-
if (ms < 0)
|
|
92
|
-
return "just now";
|
|
93
|
-
if (ms < 60_000)
|
|
94
|
-
return `${Math.floor(ms / 1_000)}s ago`;
|
|
95
|
-
if (ms < 3_600_000)
|
|
96
|
-
return `${Math.floor(ms / 60_000)} minutes ago`;
|
|
97
|
-
if (ms < 86_400_000)
|
|
98
|
-
return `${Math.floor(ms / 3_600_000)} hours ago`;
|
|
99
|
-
return `${Math.floor(ms / 86_400_000)} days ago`;
|
|
100
|
-
}
|
|
101
|
-
/** "3m 42s" from two ISO timestamps */
|
|
102
|
-
function duration(start, end) {
|
|
103
|
-
if (!start)
|
|
104
|
-
return chalk.dim("—");
|
|
105
|
-
const endMs = end ? new Date(end).getTime() : Date.now();
|
|
106
|
-
const ms = endMs - new Date(start).getTime();
|
|
107
|
-
if (ms < 0)
|
|
108
|
-
return chalk.dim("—");
|
|
109
|
-
const totalSec = Math.floor(ms / 1_000);
|
|
110
|
-
const mins = Math.floor(totalSec / 60);
|
|
111
|
-
const secs = totalSec % 60;
|
|
112
|
-
return mins > 0 ? `${mins}m ${secs}s` : `${secs}s`;
|
|
113
|
-
}
|
|
114
|
-
/** Truncate a string to max characters, appending "…" if cut. */
|
|
115
|
-
function truncate(s, max) {
|
|
116
|
-
return s.length <= max ? s : s.slice(0, max - 1) + "…";
|
|
117
|
-
}
|
|
118
|
-
function str(value) {
|
|
119
|
-
if (typeof value === "string")
|
|
120
|
-
return value;
|
|
121
|
-
if (value == null)
|
|
122
|
-
return "";
|
|
123
|
-
return String(value);
|
|
124
|
-
}
|
|
125
|
-
function unwrapData(payload) {
|
|
126
|
-
if (isRecord(payload) && isRecord(payload["data"])) {
|
|
127
|
-
return payload["data"];
|
|
128
|
-
}
|
|
129
|
-
return isRecord(payload) ? payload : {};
|
|
130
|
-
}
|
|
131
|
-
function colorStatus(status) {
|
|
132
|
-
switch (status.toLowerCase()) {
|
|
133
|
-
case "running":
|
|
134
|
-
return chalk.green(status);
|
|
135
|
-
case "paused":
|
|
136
|
-
return chalk.yellow(status);
|
|
137
|
-
case "completed":
|
|
138
|
-
case "done":
|
|
139
|
-
case "succeeded":
|
|
140
|
-
return chalk.dim(status);
|
|
141
|
-
case "failed":
|
|
142
|
-
case "canceled":
|
|
143
|
-
case "cancelled":
|
|
144
|
-
return chalk.red(status);
|
|
145
|
-
default:
|
|
146
|
-
return chalk.dim(status);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function isTerminalStatus(status) {
|
|
150
|
-
return (typeof status === "string" &&
|
|
151
|
-
["succeeded", "failed", "canceled", "cancelled"].includes(status.toLowerCase()));
|
|
152
|
-
}
|
|
153
|
-
function sleep(ms) {
|
|
154
|
-
if (ms <= 0)
|
|
155
|
-
return Promise.resolve();
|
|
156
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
157
|
-
}
|
|
158
|
-
async function waitForRun(c, id, timeoutSec) {
|
|
159
|
-
const deadline = Date.now() + timeoutSec * 1000;
|
|
160
|
-
while (true) {
|
|
161
|
-
const run = unwrapData(await c.apiGet(apiV1(`/runs/${enc(id)}`)));
|
|
162
|
-
if (isTerminalStatus(run["status"]))
|
|
163
|
-
return run;
|
|
164
|
-
if (Date.now() >= deadline) {
|
|
165
|
-
throw new Error(`Timed out waiting for run ${id}`);
|
|
166
|
-
}
|
|
167
|
-
await sleep(Math.min(2000, Math.max(0, deadline - Date.now())));
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function colorEventType(type) {
|
|
171
|
-
switch (type.toLowerCase()) {
|
|
172
|
-
case "thought":
|
|
173
|
-
return chalk.magenta(type.padEnd(8));
|
|
174
|
-
case "exec":
|
|
175
|
-
return chalk.blue(type.padEnd(8));
|
|
176
|
-
case "click":
|
|
177
|
-
return chalk.cyan(type.padEnd(8));
|
|
178
|
-
case "type":
|
|
179
|
-
return chalk.cyan(type.padEnd(8));
|
|
180
|
-
case "done":
|
|
181
|
-
return chalk.green(type.padEnd(8));
|
|
182
|
-
case "error":
|
|
183
|
-
return chalk.red(type.padEnd(8));
|
|
184
|
-
default:
|
|
185
|
-
return chalk.dim(type.padEnd(8));
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function formatEventTimestamp(event, baseTime) {
|
|
189
|
-
const raw = event.timestamp ?? event.inserted_at;
|
|
190
|
-
if (!raw)
|
|
191
|
-
return chalk.dim("--:--:--");
|
|
192
|
-
const d = new Date(raw);
|
|
193
|
-
// Offset from session start for context
|
|
194
|
-
const diffMs = d.getTime() - baseTime.getTime();
|
|
195
|
-
const absTime = d.toLocaleTimeString("en-US", { hour12: false });
|
|
196
|
-
if (diffMs < 0)
|
|
197
|
-
return chalk.dim(absTime);
|
|
198
|
-
return chalk.dim(absTime);
|
|
199
|
-
}
|
|
200
|
-
async function startAgentSession(computerNameOrId, goal, opts) {
|
|
201
|
-
const config = loadConfig();
|
|
202
|
-
const c = new MiosaClient(config);
|
|
203
|
-
const spinner = isJsonMode(opts)
|
|
204
|
-
? null
|
|
205
|
-
: spin(`Resolving computer ${computerNameOrId}...`);
|
|
206
|
-
const computer = await resolveComputer(c, computerNameOrId);
|
|
207
|
-
spinner?.succeed(`Starting agent on ${computer.name}`);
|
|
208
|
-
const body = { goal };
|
|
209
|
-
if (opts.model)
|
|
210
|
-
body["model_id"] = opts.model;
|
|
211
|
-
if (opts.maxTurns != null)
|
|
212
|
-
body["max_turns"] = parseInt(opts.maxTurns, 10);
|
|
213
|
-
const payload = await c.apiPost(apiV1(`/computers/${enc(computer.id)}/control/sessions`), body);
|
|
214
|
-
const session = dataOf(payload);
|
|
215
|
-
if (isJsonMode(opts)) {
|
|
216
|
-
console.log(JSON.stringify(session, null, 2));
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
console.log(chalk.green(`Agent session started: ${session.id}`));
|
|
220
|
-
console.log(chalk.dim(`Watch: miosa agent get ${session.id} --computer ${computer.name}`));
|
|
221
|
-
console.log(chalk.dim(`Resume: miosa agent resume ${session.id} --computer ${computer.name}`));
|
|
222
|
-
}
|
|
223
|
-
async function resumeAgentSession(computerNameOrId, sessionId, instruction, opts) {
|
|
224
|
-
const config = loadConfig();
|
|
225
|
-
const c = new MiosaClient(config);
|
|
226
|
-
const computer = await resolveComputer(c, computerNameOrId);
|
|
227
|
-
const payload = await c.apiPost(apiV1(`/computers/${enc(computer.id)}/control/sessions/${enc(sessionId)}/resume`), {});
|
|
228
|
-
if (instruction) {
|
|
229
|
-
await c.apiPost(apiV1(`/computers/${enc(computer.id)}/control/sessions/${enc(sessionId)}/task`), { instruction });
|
|
230
|
-
}
|
|
231
|
-
if (isJsonMode(opts)) {
|
|
232
|
-
console.log(JSON.stringify(payload, null, 2));
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
console.log(chalk.green(`Session ${sessionId} resumed.`));
|
|
236
|
-
if (instruction)
|
|
237
|
-
console.log(chalk.dim(`Task submitted to ${sessionId}.`));
|
|
238
|
-
}
|
|
239
|
-
async function runInstructionTarget(instruction, opts) {
|
|
240
|
-
const targets = [opts.sandbox, opts.computer, opts.host].filter(Boolean);
|
|
241
|
-
if (targets.length !== 1) {
|
|
242
|
-
throw new UserError("Choose exactly one target.", "Use one of: --sandbox <id>, --computer <name-or-id>, or --host <id>.");
|
|
243
|
-
}
|
|
244
|
-
const config = loadConfig();
|
|
245
|
-
const c = new MiosaClient(config);
|
|
246
|
-
if (opts.host) {
|
|
247
|
-
await runOpenComputerHostPrompt(c, opts.host, instruction, opts);
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
const targetKind = opts.sandbox ? "sandbox" : "computer";
|
|
251
|
-
const targetId = targetKind === "computer"
|
|
252
|
-
? (await resolveComputer(c, opts.computer)).id
|
|
253
|
-
: opts.sandbox;
|
|
254
|
-
const body = {
|
|
255
|
-
target_kind: targetKind,
|
|
256
|
-
target_id: targetId,
|
|
257
|
-
instruction,
|
|
258
|
-
runner: opts.runner ?? "claude-code",
|
|
259
|
-
};
|
|
260
|
-
if (opts.model)
|
|
261
|
-
body["model"] = opts.model;
|
|
262
|
-
if (opts.cwd)
|
|
263
|
-
body["cwd"] = opts.cwd;
|
|
264
|
-
if (opts.env && opts.env.length > 0)
|
|
265
|
-
body["env"] = parseEnvPairs(opts.env);
|
|
266
|
-
if (opts.timeout)
|
|
267
|
-
body["timeout"] = Number.parseInt(opts.timeout, 10);
|
|
268
|
-
if (opts.agentProfile)
|
|
269
|
-
body["agent_runtime_profile_id"] = opts.agentProfile;
|
|
270
|
-
if (opts.skipAgentProfile)
|
|
271
|
-
body["skip_agent_runtime_profile"] = true;
|
|
272
|
-
if (opts.externalWorkspace)
|
|
273
|
-
body["external_workspace_id"] = opts.externalWorkspace;
|
|
274
|
-
if (opts.externalUser)
|
|
275
|
-
body["external_user_id"] = opts.externalUser;
|
|
276
|
-
if (opts.externalProject)
|
|
277
|
-
body["external_project_id"] = opts.externalProject;
|
|
278
|
-
const executionPacket = readJsonValue(opts.executionPacket, opts.executionPacketFile, "execution-packet");
|
|
279
|
-
const expectedOutputs = readJsonValue(opts.expectedOutputs, opts.expectedOutputsFile, "expected-outputs");
|
|
280
|
-
const approvalPolicy = readJsonValue(opts.approvalPolicy, opts.approvalPolicyFile, "approval-policy");
|
|
281
|
-
if (executionPacket !== undefined)
|
|
282
|
-
body["execution_packet"] = executionPacket;
|
|
283
|
-
if (expectedOutputs !== undefined)
|
|
284
|
-
body["expected_outputs"] = expectedOutputs;
|
|
285
|
-
if (approvalPolicy !== undefined)
|
|
286
|
-
body["approval_policy"] = approvalPolicy;
|
|
287
|
-
if (opts.capability?.length)
|
|
288
|
-
body["capability_requirements"] = opts.capability;
|
|
289
|
-
let run = unwrapData(await c.apiPost(apiV1("/runs"), body));
|
|
290
|
-
const runId = str(run["id"]);
|
|
291
|
-
if (opts.wait) {
|
|
292
|
-
if (!runId)
|
|
293
|
-
throw new Error("Run response did not include an id.");
|
|
294
|
-
run = await waitForRun(c, runId, Number.parseInt(opts.waitTimeout ?? opts.timeout ?? "900", 10));
|
|
295
|
-
}
|
|
296
|
-
if (isJsonMode(opts)) {
|
|
297
|
-
console.log(JSON.stringify(run, null, 2));
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
console.log(chalk.green(`Run ${str(run["status"] || "created")}: ${str(run["id"])}`));
|
|
301
|
-
console.log(chalk.dim(`Target: ${targetKind} ${targetId}`));
|
|
302
|
-
const output = str(run["output"]).trim();
|
|
303
|
-
const stderr = str(run["stderr"]).trim();
|
|
304
|
-
if (output) {
|
|
305
|
-
console.log();
|
|
306
|
-
console.log(output);
|
|
307
|
-
}
|
|
308
|
-
if (stderr) {
|
|
309
|
-
console.error();
|
|
310
|
-
console.error(chalk.red(stderr));
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
async function runOpenComputerHostPrompt(c, hostId, instruction, opts) {
|
|
314
|
-
const body = { task: instruction };
|
|
315
|
-
if (opts.model)
|
|
316
|
-
body["model"] = opts.model;
|
|
317
|
-
if (opts.agentProfile)
|
|
318
|
-
body["agent_runtime_profile_id"] = opts.agentProfile;
|
|
319
|
-
if (opts.skipAgentProfile)
|
|
320
|
-
body["skip_agent_runtime_profile"] = true;
|
|
321
|
-
if (opts.externalWorkspace)
|
|
322
|
-
body["external_workspace_id"] = opts.externalWorkspace;
|
|
323
|
-
if (opts.externalUser)
|
|
324
|
-
body["external_user_id"] = opts.externalUser;
|
|
325
|
-
if (opts.externalProject)
|
|
326
|
-
body["external_project_id"] = opts.externalProject;
|
|
327
|
-
const executionPacket = readJsonValue(opts.executionPacket, opts.executionPacketFile, "execution-packet");
|
|
328
|
-
const expectedOutputs = readJsonValue(opts.expectedOutputs, opts.expectedOutputsFile, "expected-outputs");
|
|
329
|
-
const approvalPolicy = readJsonValue(opts.approvalPolicy, opts.approvalPolicyFile, "approval-policy");
|
|
330
|
-
if (executionPacket !== undefined)
|
|
331
|
-
body["execution_packet"] = executionPacket;
|
|
332
|
-
if (expectedOutputs !== undefined)
|
|
333
|
-
body["expected_outputs"] = expectedOutputs;
|
|
334
|
-
if (approvalPolicy !== undefined)
|
|
335
|
-
body["approval_policy"] = approvalPolicy;
|
|
336
|
-
if (opts.capability?.length)
|
|
337
|
-
body["capability_requirements"] = opts.capability;
|
|
338
|
-
if (opts.timeout) {
|
|
339
|
-
body["budget"] = { timeout_ms: Number.parseInt(opts.timeout, 10) * 1000 };
|
|
340
|
-
}
|
|
341
|
-
const session = unwrapData(await c.apiPost(apiV1(`/opencomputers/hosts/${enc(hostId)}/agent/dispatch`), body));
|
|
342
|
-
if (isJsonMode(opts)) {
|
|
343
|
-
console.log(JSON.stringify(session, null, 2));
|
|
344
|
-
return;
|
|
345
|
-
}
|
|
346
|
-
console.log(chalk.green(`OpenComputers agent session started: ${str(session["id"] || session["session_id"])}`));
|
|
347
|
-
console.log(chalk.dim(`Host: ${hostId}`));
|
|
348
|
-
if (session["sse_url"]) {
|
|
349
|
-
console.log(chalk.dim(`Events: ${str(session["sse_url"])}`));
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
// ---------------------------------------------------------------------------
|
|
353
|
-
// Subcommand builders
|
|
354
|
-
// ---------------------------------------------------------------------------
|
|
355
|
-
function buildStart(agent) {
|
|
356
|
-
agent
|
|
357
|
-
.command("start")
|
|
358
|
-
.description("Start an agent session on a computer")
|
|
359
|
-
.requiredOption("--computer <name-or-id>", "Computer name or ID")
|
|
360
|
-
.requiredOption("--goal <goal>", "Goal for the agent to accomplish")
|
|
361
|
-
.option("--model <model-id>", "Model ID override")
|
|
362
|
-
.option("--max-turns <n>", "Maximum agent turns (default: server default)")
|
|
363
|
-
.option("--json", "Output as JSON")
|
|
364
|
-
.action(async (opts) => {
|
|
365
|
-
try {
|
|
366
|
-
await startAgentSession(opts.computer, opts.goal, opts);
|
|
367
|
-
}
|
|
368
|
-
catch (err) {
|
|
369
|
-
handleError(err);
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
function buildRun(agent) {
|
|
374
|
-
agent
|
|
375
|
-
.command("run <instruction...>")
|
|
376
|
-
.description("Dispatch one instruction to a Sandbox, Computer, or OpenComputers host")
|
|
377
|
-
.option("--sandbox <id>", "Sandbox ID target")
|
|
378
|
-
.option("--computer <name-or-id>", "Computer name or ID target")
|
|
379
|
-
.option("--host <id>", "OpenComputers host ID target")
|
|
380
|
-
.option("--runner <name>", "Runner for Sandbox/Computer targets: claude-code (default), codex, claude (alias), hermes, osa, pi, custom")
|
|
381
|
-
.option("--model <name>", "Provider/model override")
|
|
382
|
-
.option("--cwd <path>", "Working directory for Sandbox/Computer targets")
|
|
383
|
-
.option("--env <KEY=VALUE>", "Environment variable for Sandbox/Computer targets. Repeatable.", collectOption, [])
|
|
384
|
-
.option("--timeout <sec>", "Timeout in seconds")
|
|
385
|
-
.option("--agent-profile <id>", "Agent runtime profile ID")
|
|
386
|
-
.option("--skip-agent-profile", "Do not apply default agent runtime profile")
|
|
387
|
-
.option("--external-workspace <id>", "White-label workspace/customer ID for billing attribution")
|
|
388
|
-
.option("--external-user <id>", "White-label user ID for billing attribution")
|
|
389
|
-
.option("--external-project <id>", "White-label project ID for billing attribution")
|
|
390
|
-
.option("--execution-packet <json>", "Execution packet JSON for product context, plan, and acceptance criteria")
|
|
391
|
-
.option("--execution-packet-file <file>", "Read execution packet JSON from a file")
|
|
392
|
-
.option("--expected-outputs <json>", "Expected outputs JSON declaring files/previews/messages")
|
|
393
|
-
.option("--expected-outputs-file <file>", "Read expected outputs JSON from a file")
|
|
394
|
-
.option("--approval-policy <json>", "Approval policy JSON for publish/writeback/destructive actions")
|
|
395
|
-
.option("--approval-policy-file <file>", "Read approval policy JSON from a file")
|
|
396
|
-
.option("--capability <name>", "Required runtime capability. Repeatable.", collectOption, [])
|
|
397
|
-
.option("--wait", "Wait for Sandbox/Computer run completion")
|
|
398
|
-
.option("--wait-timeout <sec>", "Maximum seconds to wait for --wait")
|
|
399
|
-
.option("--json", "Output as JSON")
|
|
400
|
-
.action(async (instruction, opts, command) => {
|
|
401
|
-
try {
|
|
402
|
-
const resolvedOpts = command.optsWithGlobals();
|
|
403
|
-
const mergedOpts = { ...opts };
|
|
404
|
-
for (const [key, value] of Object.entries(resolvedOpts)) {
|
|
405
|
-
if (mergedOpts[key] == null) {
|
|
406
|
-
mergedOpts[key] = value;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
const runInstruction = instruction.join(" ").trim();
|
|
410
|
-
if (!runInstruction) {
|
|
411
|
-
throw new UserError("No agent instruction provided.");
|
|
412
|
-
}
|
|
413
|
-
await runInstructionTarget(runInstruction, mergedOpts);
|
|
414
|
-
}
|
|
415
|
-
catch (err) {
|
|
416
|
-
handleError(err);
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
function buildLs(agent) {
|
|
421
|
-
agent
|
|
422
|
-
.command("ls")
|
|
423
|
-
.description("List active agent sessions (all computers or one with --computer)")
|
|
424
|
-
.option("--computer <name-or-id>", "Filter to a specific computer")
|
|
425
|
-
.option("--json", "Output as JSON")
|
|
426
|
-
.action(async (opts) => {
|
|
427
|
-
try {
|
|
428
|
-
const config = loadConfig();
|
|
429
|
-
const c = new MiosaClient(config);
|
|
430
|
-
let sessions;
|
|
431
|
-
if (opts.computer) {
|
|
432
|
-
const spinner = spin(`Fetching sessions for ${opts.computer}…`);
|
|
433
|
-
const computer = await resolveComputer(c, opts.computer);
|
|
434
|
-
spinner.text = `Loading sessions on ${computer.name}…`;
|
|
435
|
-
const payload = await c.apiGet(apiV1(`/computers/${enc(computer.id)}/control/sessions`));
|
|
436
|
-
sessions = listOf(payload, ["sessions"]).map((s) => ({
|
|
437
|
-
...s,
|
|
438
|
-
computer_name: computer.name,
|
|
439
|
-
}));
|
|
440
|
-
spinner.stop();
|
|
441
|
-
}
|
|
442
|
-
else {
|
|
443
|
-
const spinner = spin("Fetching all computers…");
|
|
444
|
-
const computersPayload = await c.apiGet(apiV1("/computers"));
|
|
445
|
-
const computers = listOf(computersPayload, [
|
|
446
|
-
"computers",
|
|
447
|
-
]);
|
|
448
|
-
spinner.text = `Fetching sessions across ${computers.length} computer(s)…`;
|
|
449
|
-
const settled = await Promise.allSettled(computers.map(async (computer) => {
|
|
450
|
-
const payload = await c.apiGet(apiV1(`/computers/${enc(computer.id)}/control/sessions`));
|
|
451
|
-
return listOf(payload, ["sessions"]).map((s) => ({
|
|
452
|
-
...s,
|
|
453
|
-
computer_name: computer.name,
|
|
454
|
-
}));
|
|
455
|
-
}));
|
|
456
|
-
sessions = settled.flatMap((result) => result.status === "fulfilled" ? result.value : []);
|
|
457
|
-
spinner.stop();
|
|
458
|
-
}
|
|
459
|
-
if (isJsonMode(opts)) {
|
|
460
|
-
console.log(JSON.stringify(sessions, null, 2));
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
if (sessions.length === 0) {
|
|
464
|
-
console.log(chalk.dim("No agent sessions found."));
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
renderTable(sessions, [
|
|
468
|
-
{
|
|
469
|
-
header: "ID",
|
|
470
|
-
key: (s) => s.id,
|
|
471
|
-
width: 22,
|
|
472
|
-
},
|
|
473
|
-
{
|
|
474
|
-
header: "COMPUTER",
|
|
475
|
-
key: (s) => s.computer_name ?? s.computer_id,
|
|
476
|
-
width: 16,
|
|
477
|
-
},
|
|
478
|
-
{
|
|
479
|
-
header: "STATUS",
|
|
480
|
-
key: (s) => s.status,
|
|
481
|
-
width: 10,
|
|
482
|
-
color: (val) => colorStatus(val.trim()),
|
|
483
|
-
},
|
|
484
|
-
{
|
|
485
|
-
header: "STARTED",
|
|
486
|
-
key: (s) => timeAgo(s.started_at ?? s.inserted_at),
|
|
487
|
-
width: 18,
|
|
488
|
-
},
|
|
489
|
-
{
|
|
490
|
-
header: "GOAL",
|
|
491
|
-
key: (s) => truncate(s.goal, 42),
|
|
492
|
-
},
|
|
493
|
-
]);
|
|
494
|
-
}
|
|
495
|
-
catch (err) {
|
|
496
|
-
handleError(err);
|
|
497
|
-
}
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
|
-
function buildGet(agent) {
|
|
501
|
-
agent
|
|
502
|
-
.command("get <session-id>")
|
|
503
|
-
.description("Get details of an agent session")
|
|
504
|
-
.requiredOption("--computer <name-or-id>", "Computer name or ID")
|
|
505
|
-
.option("--json", "Output as JSON")
|
|
506
|
-
.action(async (sessionId, opts) => {
|
|
507
|
-
try {
|
|
508
|
-
const config = loadConfig();
|
|
509
|
-
const c = new MiosaClient(config);
|
|
510
|
-
const computer = await resolveComputer(c, opts.computer);
|
|
511
|
-
const payload = await c.apiGet(apiV1(`/computers/${enc(computer.id)}/control/sessions/${enc(sessionId)}`));
|
|
512
|
-
const session = dataOf(payload);
|
|
513
|
-
if (isJsonMode(opts)) {
|
|
514
|
-
console.log(JSON.stringify(session, null, 2));
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
const rows = [
|
|
518
|
-
["Session", session.id],
|
|
519
|
-
["Computer", session.computer_name ?? computer.name],
|
|
520
|
-
["Status", colorStatus(session.status)],
|
|
521
|
-
["Started", session.started_at ?? chalk.dim("—")],
|
|
522
|
-
["Goal", session.goal],
|
|
523
|
-
];
|
|
524
|
-
if (session.actions_total != null) {
|
|
525
|
-
const parts = [`${session.actions_total} total`];
|
|
526
|
-
if (session.actions_exec != null)
|
|
527
|
-
parts.push(`${session.actions_exec} exec`);
|
|
528
|
-
if (session.actions_click != null)
|
|
529
|
-
parts.push(`${session.actions_click} click`);
|
|
530
|
-
if (session.actions_type != null)
|
|
531
|
-
parts.push(`${session.actions_type} type`);
|
|
532
|
-
rows.push(["Actions", parts.join(", ")]);
|
|
533
|
-
}
|
|
534
|
-
if (session.screenshots != null) {
|
|
535
|
-
rows.push(["Screenshots", String(session.screenshots)]);
|
|
536
|
-
}
|
|
537
|
-
rows.push([
|
|
538
|
-
"Duration",
|
|
539
|
-
duration(session.started_at, session.finished_at),
|
|
540
|
-
]);
|
|
541
|
-
if (session.model_id) {
|
|
542
|
-
rows.push(["Model", session.model_id]);
|
|
543
|
-
}
|
|
544
|
-
for (const [label, value] of rows) {
|
|
545
|
-
console.log(`${chalk.bold(label.padEnd(14))} ${value}`);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
catch (err) {
|
|
549
|
-
handleError(err);
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
function buildTask(agent) {
|
|
554
|
-
agent
|
|
555
|
-
.command("task <session-id> <instruction>")
|
|
556
|
-
.description("Send a new task to a running agent session")
|
|
557
|
-
.requiredOption("--computer <name-or-id>", "Computer name or ID")
|
|
558
|
-
.option("--json", "Output as JSON")
|
|
559
|
-
.action(async (sessionId, instruction, opts) => {
|
|
560
|
-
try {
|
|
561
|
-
const config = loadConfig();
|
|
562
|
-
const c = new MiosaClient(config);
|
|
563
|
-
const computer = await resolveComputer(c, opts.computer);
|
|
564
|
-
const payload = await c.apiPost(apiV1(`/computers/${enc(computer.id)}/control/sessions/${enc(sessionId)}/task`), { instruction });
|
|
565
|
-
if (isJsonMode(opts)) {
|
|
566
|
-
console.log(JSON.stringify(payload, null, 2));
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
console.log(chalk.green(`Task submitted to ${sessionId}`));
|
|
570
|
-
}
|
|
571
|
-
catch (err) {
|
|
572
|
-
handleError(err);
|
|
573
|
-
}
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
function buildPause(agent) {
|
|
577
|
-
agent
|
|
578
|
-
.command("pause <session-id>")
|
|
579
|
-
.description("Pause a running agent session")
|
|
580
|
-
.requiredOption("--computer <name-or-id>", "Computer name or ID")
|
|
581
|
-
.option("--json", "Output as JSON")
|
|
582
|
-
.action(async (sessionId, opts) => {
|
|
583
|
-
try {
|
|
584
|
-
const config = loadConfig();
|
|
585
|
-
const c = new MiosaClient(config);
|
|
586
|
-
const computer = await resolveComputer(c, opts.computer);
|
|
587
|
-
const payload = await c.apiPost(apiV1(`/computers/${enc(computer.id)}/control/sessions/${enc(sessionId)}/pause`), {});
|
|
588
|
-
if (isJsonMode(opts)) {
|
|
589
|
-
console.log(JSON.stringify(payload, null, 2));
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
console.log(chalk.yellow(`Session ${sessionId} paused.`));
|
|
593
|
-
}
|
|
594
|
-
catch (err) {
|
|
595
|
-
handleError(err);
|
|
596
|
-
}
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
function buildResume(agent) {
|
|
600
|
-
agent
|
|
601
|
-
.command("resume <session-id>")
|
|
602
|
-
.description("Resume a paused agent session")
|
|
603
|
-
.requiredOption("--computer <name-or-id>", "Computer name or ID")
|
|
604
|
-
.option("--json", "Output as JSON")
|
|
605
|
-
.action(async (sessionId, opts) => {
|
|
606
|
-
try {
|
|
607
|
-
const config = loadConfig();
|
|
608
|
-
const c = new MiosaClient(config);
|
|
609
|
-
const computer = await resolveComputer(c, opts.computer);
|
|
610
|
-
const payload = await c.apiPost(apiV1(`/computers/${enc(computer.id)}/control/sessions/${enc(sessionId)}/resume`), {});
|
|
611
|
-
if (isJsonMode(opts)) {
|
|
612
|
-
console.log(JSON.stringify(payload, null, 2));
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
console.log(chalk.green(`Session ${sessionId} resumed.`));
|
|
616
|
-
}
|
|
617
|
-
catch (err) {
|
|
618
|
-
handleError(err);
|
|
619
|
-
}
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
function buildStop(agent) {
|
|
623
|
-
agent
|
|
624
|
-
.command("stop <session-id>")
|
|
625
|
-
.description("Stop (cancel) an agent session")
|
|
626
|
-
.requiredOption("--computer <name-or-id>", "Computer name or ID")
|
|
627
|
-
.option("--json", "Output as JSON")
|
|
628
|
-
.action(async (sessionId, opts) => {
|
|
629
|
-
try {
|
|
630
|
-
const config = loadConfig();
|
|
631
|
-
const c = new MiosaClient(config);
|
|
632
|
-
const computer = await resolveComputer(c, opts.computer);
|
|
633
|
-
const payload = await c.apiDelete(apiV1(`/computers/${enc(computer.id)}/control/sessions/${enc(sessionId)}`));
|
|
634
|
-
if (isJsonMode(opts)) {
|
|
635
|
-
console.log(JSON.stringify(payload ?? { stopped: true }, null, 2));
|
|
636
|
-
return;
|
|
637
|
-
}
|
|
638
|
-
console.log(chalk.green("Agent session stopped."));
|
|
639
|
-
}
|
|
640
|
-
catch (err) {
|
|
641
|
-
handleError(err);
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
function buildHistory(agent) {
|
|
646
|
-
agent
|
|
647
|
-
.command("history <session-id>")
|
|
648
|
-
.description("View the event history of an agent session")
|
|
649
|
-
.requiredOption("--computer <name-or-id>", "Computer name or ID")
|
|
650
|
-
.option("--limit <n>", "Maximum number of events to show")
|
|
651
|
-
.option("--json", "Output as JSON")
|
|
652
|
-
.action(async (sessionId, opts) => {
|
|
653
|
-
try {
|
|
654
|
-
const config = loadConfig();
|
|
655
|
-
const c = new MiosaClient(config);
|
|
656
|
-
const computer = await resolveComputer(c, opts.computer);
|
|
657
|
-
const ticketPayload = await c.apiPost(apiV1(`/computers/${enc(computer.id)}/control/sessions/${enc(sessionId)}/sse-ticket`), {});
|
|
658
|
-
const ticket = dataOf(ticketPayload).ticket;
|
|
659
|
-
if (!ticket) {
|
|
660
|
-
throw new UserError("Could not create an agent history ticket.");
|
|
661
|
-
}
|
|
662
|
-
const search = new URLSearchParams({ ticket });
|
|
663
|
-
if (opts.limit)
|
|
664
|
-
search.set("limit", opts.limit);
|
|
665
|
-
const payload = await c.apiGet(apiV1(`/computers/${enc(computer.id)}/control/sessions/${enc(sessionId)}/events?${search.toString()}`));
|
|
666
|
-
const events = listOf(payload, ["events"]);
|
|
667
|
-
if (isJsonMode(opts)) {
|
|
668
|
-
console.log(JSON.stringify(events, null, 2));
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
671
|
-
if (events.length === 0) {
|
|
672
|
-
console.log(chalk.dim("No events recorded yet."));
|
|
673
|
-
return;
|
|
674
|
-
}
|
|
675
|
-
// Determine base time for relative display from first event
|
|
676
|
-
const firstTimestamp = events[0]?.timestamp ?? events[0]?.inserted_at;
|
|
677
|
-
const baseTime = firstTimestamp
|
|
678
|
-
? new Date(firstTimestamp)
|
|
679
|
-
: new Date();
|
|
680
|
-
for (const event of events) {
|
|
681
|
-
const ts = formatEventTimestamp(event, baseTime);
|
|
682
|
-
const typePart = colorEventType(event.type);
|
|
683
|
-
const contentPart = event.content
|
|
684
|
-
? truncate(event.content, 100)
|
|
685
|
-
: chalk.dim("—");
|
|
686
|
-
console.log(`${ts} [${typePart}] ${contentPart}`);
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
catch (err) {
|
|
690
|
-
handleError(err);
|
|
691
|
-
}
|
|
692
|
-
});
|
|
693
|
-
}
|
|
694
|
-
// ---------------------------------------------------------------------------
|
|
695
|
-
// Registration
|
|
696
|
-
// ---------------------------------------------------------------------------
|
|
697
|
-
export function register(program) {
|
|
698
|
-
const agent = program
|
|
699
|
-
.command("agent")
|
|
700
|
-
.description("Manage AI computer control sessions on Computers - start, monitor, and control agent runs")
|
|
701
|
-
.argument("[computer]", "Computer name or ID")
|
|
702
|
-
.argument("[instruction...]", "Goal/instruction for the agent")
|
|
703
|
-
.option("--model <model-id>", "Model ID override")
|
|
704
|
-
.option("--max-turns <n>", "Maximum agent turns")
|
|
705
|
-
.option("--resume <session-id>", "Resume a paused session, optionally with a new instruction")
|
|
706
|
-
.option("--json", "Output as JSON")
|
|
707
|
-
.action(async (computer, instruction, opts, command) => {
|
|
708
|
-
try {
|
|
709
|
-
if (!computer) {
|
|
710
|
-
command.help();
|
|
711
|
-
return;
|
|
712
|
-
}
|
|
713
|
-
const goal = instruction.join(" ").trim();
|
|
714
|
-
if (opts.resume) {
|
|
715
|
-
await resumeAgentSession(computer, opts.resume, goal || undefined, opts);
|
|
716
|
-
return;
|
|
717
|
-
}
|
|
718
|
-
if (!goal) {
|
|
719
|
-
throw new UserError("No agent instruction provided.", 'Use `miosa agent <computer> "run the tests"` or `miosa agent start --computer <computer> --goal "..."`.');
|
|
720
|
-
}
|
|
721
|
-
await startAgentSession(computer, goal, opts);
|
|
722
|
-
}
|
|
723
|
-
catch (err) {
|
|
724
|
-
handleError(err);
|
|
725
|
-
}
|
|
726
|
-
});
|
|
727
|
-
buildStart(agent);
|
|
728
|
-
buildRun(agent);
|
|
729
|
-
buildLs(agent);
|
|
730
|
-
buildGet(agent);
|
|
731
|
-
buildTask(agent);
|
|
732
|
-
buildPause(agent);
|
|
733
|
-
buildResume(agent);
|
|
734
|
-
buildStop(agent);
|
|
735
|
-
buildHistory(agent);
|
|
736
|
-
}
|
|
737
|
-
//# sourceMappingURL=agent.js.map
|