@miosa/cli 1.3.3 → 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 -105
- 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 -29
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -86
- 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/client.js
DELETED
|
@@ -1,865 +0,0 @@
|
|
|
1
|
-
import { request } from "undici";
|
|
2
|
-
import { AuthError, mapHttpError, NetworkError, UserError } from "./errors.js";
|
|
3
|
-
import { isDebugMode } from "./cli-env.js";
|
|
4
|
-
import { CLI_USER_AGENT } from "./version.js";
|
|
5
|
-
// Retry policy for idempotent POSTs — mirrors the TS/Python SDK transports.
|
|
6
|
-
const RETRY_STATUS = new Set([429, 500, 502, 503, 504]);
|
|
7
|
-
const DEFAULT_CREATE_MAX_RETRIES = 3;
|
|
8
|
-
const RETRY_BASE_DELAY_MS = 500;
|
|
9
|
-
function sleep(ms) {
|
|
10
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
11
|
-
}
|
|
12
|
-
function retryDelay(attempt, retryAfter) {
|
|
13
|
-
if (retryAfter !== null) {
|
|
14
|
-
const seconds = parseInt(retryAfter, 10);
|
|
15
|
-
if (!Number.isNaN(seconds))
|
|
16
|
-
return seconds * 1000;
|
|
17
|
-
}
|
|
18
|
-
return RETRY_BASE_DELAY_MS * 2 ** attempt + Math.random() * 100;
|
|
19
|
-
}
|
|
20
|
-
export class MiosaClient {
|
|
21
|
-
endpoint;
|
|
22
|
-
apiKey;
|
|
23
|
-
tenant;
|
|
24
|
-
workspace;
|
|
25
|
-
constructor(config) {
|
|
26
|
-
if (!config.api_key) {
|
|
27
|
-
throw new AuthError("You are not logged in. Run: miosa login", "Run `miosa login` to authenticate.");
|
|
28
|
-
}
|
|
29
|
-
this.endpoint = config.endpoint.replace(/\/$/, "");
|
|
30
|
-
this.apiKey = config.api_key;
|
|
31
|
-
this.tenant = config.tenant ?? null;
|
|
32
|
-
this.workspace = config.workspace ?? null;
|
|
33
|
-
}
|
|
34
|
-
headers() {
|
|
35
|
-
const headers = {
|
|
36
|
-
Authorization: `Bearer ${this.apiKey}`,
|
|
37
|
-
"Content-Type": "application/json",
|
|
38
|
-
Accept: "application/json",
|
|
39
|
-
"User-Agent": CLI_USER_AGENT,
|
|
40
|
-
};
|
|
41
|
-
if (this.tenant)
|
|
42
|
-
headers["X-MIOSA-Tenant"] = this.tenant;
|
|
43
|
-
if (this.workspace)
|
|
44
|
-
headers["X-MIOSA-Workspace"] = this.workspace;
|
|
45
|
-
return headers;
|
|
46
|
-
}
|
|
47
|
-
url(path) {
|
|
48
|
-
return `${this.endpoint}${path}`;
|
|
49
|
-
}
|
|
50
|
-
async parseError(res, method, path) {
|
|
51
|
-
const rawBody = await res.body.text();
|
|
52
|
-
const requestId = responseHeader(res, "x-request-id");
|
|
53
|
-
let body = {};
|
|
54
|
-
try {
|
|
55
|
-
body = JSON.parse(rawBody);
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
body = { message: rawBody || `HTTP ${res.statusCode}` };
|
|
59
|
-
}
|
|
60
|
-
debugHttpError(method, path, res.statusCode, requestId, rawBody);
|
|
61
|
-
throw mapHttpError(res.statusCode, body, rawBody, requestId);
|
|
62
|
-
}
|
|
63
|
-
async get(path) {
|
|
64
|
-
let res;
|
|
65
|
-
try {
|
|
66
|
-
res = await request(this.url(path), {
|
|
67
|
-
method: "GET",
|
|
68
|
-
headers: this.headers(),
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`, "Check your connection and endpoint: miosa status");
|
|
73
|
-
}
|
|
74
|
-
if (res.statusCode >= 400)
|
|
75
|
-
return this.parseError(res, "GET", path);
|
|
76
|
-
return res.body.json();
|
|
77
|
-
}
|
|
78
|
-
async post(path, body, extraHeaders) {
|
|
79
|
-
let res;
|
|
80
|
-
try {
|
|
81
|
-
res = await request(this.url(path), {
|
|
82
|
-
method: "POST",
|
|
83
|
-
headers: { ...this.headers(), ...extraHeaders },
|
|
84
|
-
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
catch (err) {
|
|
88
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`, "Check your connection and endpoint: miosa status");
|
|
89
|
-
}
|
|
90
|
-
if (res.statusCode >= 400)
|
|
91
|
-
return this.parseError(res, "POST", path);
|
|
92
|
-
return res.body.json();
|
|
93
|
-
}
|
|
94
|
-
async delete(path) {
|
|
95
|
-
let res;
|
|
96
|
-
try {
|
|
97
|
-
res = await request(this.url(path), {
|
|
98
|
-
method: "DELETE",
|
|
99
|
-
headers: this.headers(),
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`);
|
|
104
|
-
}
|
|
105
|
-
if (res.statusCode >= 400)
|
|
106
|
-
return this.parseError(res, "DELETE", path);
|
|
107
|
-
if (res.statusCode === 204)
|
|
108
|
-
return undefined;
|
|
109
|
-
return res.body.json();
|
|
110
|
-
}
|
|
111
|
-
/** Generic GET for command groups that map directly to stable API routes. */
|
|
112
|
-
async apiGet(path) {
|
|
113
|
-
return this.get(path);
|
|
114
|
-
}
|
|
115
|
-
/** Generic binary GET for file/artifact download routes. */
|
|
116
|
-
async apiGetBinary(path) {
|
|
117
|
-
let res;
|
|
118
|
-
try {
|
|
119
|
-
res = await request(this.url(path), {
|
|
120
|
-
method: "GET",
|
|
121
|
-
headers: this.headers(),
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
catch (err) {
|
|
125
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`, "Check your connection and endpoint: miosa status");
|
|
126
|
-
}
|
|
127
|
-
if (res.statusCode >= 400)
|
|
128
|
-
return this.parseError(res, "GET", path);
|
|
129
|
-
const chunks = [];
|
|
130
|
-
for await (const chunk of res.body) {
|
|
131
|
-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
132
|
-
}
|
|
133
|
-
return Buffer.concat(chunks);
|
|
134
|
-
}
|
|
135
|
-
/** Generic SSE GET for command groups that stream API events. */
|
|
136
|
-
async apiStream(path) {
|
|
137
|
-
let res;
|
|
138
|
-
try {
|
|
139
|
-
res = await request(this.url(path), {
|
|
140
|
-
method: "GET",
|
|
141
|
-
headers: {
|
|
142
|
-
...this.headers(),
|
|
143
|
-
Accept: "text/event-stream, application/json, */*",
|
|
144
|
-
},
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
catch (err) {
|
|
148
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`, "Check your connection and endpoint: miosa status");
|
|
149
|
-
}
|
|
150
|
-
if (res.statusCode >= 400)
|
|
151
|
-
return this.parseError(res, "GET", path);
|
|
152
|
-
return res;
|
|
153
|
-
}
|
|
154
|
-
/** Generic POST for command groups that map directly to stable API routes. */
|
|
155
|
-
async apiPost(path, body, headers) {
|
|
156
|
-
return this.post(path, body, headers);
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* POST with bounded exponential-backoff retry on 429/500/502/503/504 and
|
|
160
|
-
* transient network errors — matching the TS/Python SDK retry policy.
|
|
161
|
-
*
|
|
162
|
-
* The request headers (including any ``Idempotency-Key``) are built ONCE and
|
|
163
|
-
* re-sent unchanged on every retry, so this is only safe for idempotent
|
|
164
|
-
* calls. Callers that need dedup MUST pass an ``Idempotency-Key`` header; a
|
|
165
|
-
* retried create without one could spawn a duplicate, billable sandbox.
|
|
166
|
-
*/
|
|
167
|
-
async apiPostWithRetry(path, body, extraHeaders, opts = {}) {
|
|
168
|
-
const maxRetries = opts.maxRetries ?? DEFAULT_CREATE_MAX_RETRIES;
|
|
169
|
-
// Built once — the same headers (and Idempotency-Key) are reused on every
|
|
170
|
-
// retry so the server dedups instead of creating duplicates.
|
|
171
|
-
const headers = { ...this.headers(), ...extraHeaders };
|
|
172
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
173
|
-
let res;
|
|
174
|
-
try {
|
|
175
|
-
res = await request(this.url(path), {
|
|
176
|
-
method: "POST",
|
|
177
|
-
headers,
|
|
178
|
-
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
catch (err) {
|
|
182
|
-
if (attempt < maxRetries) {
|
|
183
|
-
await sleep(retryDelay(attempt, null));
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`, "Check your connection and endpoint: miosa status");
|
|
187
|
-
}
|
|
188
|
-
if (RETRY_STATUS.has(res.statusCode) && attempt < maxRetries) {
|
|
189
|
-
const retryAfter = responseHeader(res, "retry-after");
|
|
190
|
-
// Drain the body so the socket can be reused for the retry.
|
|
191
|
-
await res.body.dump();
|
|
192
|
-
await sleep(retryDelay(attempt, retryAfter));
|
|
193
|
-
continue;
|
|
194
|
-
}
|
|
195
|
-
if (res.statusCode >= 400)
|
|
196
|
-
return this.parseError(res, "POST", path);
|
|
197
|
-
return res.body.json();
|
|
198
|
-
}
|
|
199
|
-
// Unreachable: the loop either returns or throws on the final attempt.
|
|
200
|
-
throw new NetworkError("Max retries exceeded", "Check your connection and endpoint: miosa status");
|
|
201
|
-
}
|
|
202
|
-
/** Generic PUT for command groups that map directly to stable API routes. */
|
|
203
|
-
async apiPut(path, body) {
|
|
204
|
-
let res;
|
|
205
|
-
try {
|
|
206
|
-
res = await request(this.url(path), {
|
|
207
|
-
method: "PUT",
|
|
208
|
-
headers: this.headers(),
|
|
209
|
-
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
catch (err) {
|
|
213
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`, "Check your connection and endpoint: miosa status");
|
|
214
|
-
}
|
|
215
|
-
if (res.statusCode >= 400)
|
|
216
|
-
return this.parseError(res, "PUT", path);
|
|
217
|
-
return res.body.json();
|
|
218
|
-
}
|
|
219
|
-
/** Generic PATCH for command groups that map directly to stable API routes. */
|
|
220
|
-
async apiPatch(path, body) {
|
|
221
|
-
let res;
|
|
222
|
-
try {
|
|
223
|
-
res = await request(this.url(path), {
|
|
224
|
-
method: "PATCH",
|
|
225
|
-
headers: this.headers(),
|
|
226
|
-
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
catch (err) {
|
|
230
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`, "Check your connection and endpoint: miosa status");
|
|
231
|
-
}
|
|
232
|
-
if (res.statusCode >= 400)
|
|
233
|
-
return this.parseError(res, "PATCH", path);
|
|
234
|
-
return res.body.json();
|
|
235
|
-
}
|
|
236
|
-
/** Generic DELETE for command groups that map directly to stable API routes. */
|
|
237
|
-
async apiDelete(path) {
|
|
238
|
-
return this.delete(path);
|
|
239
|
-
}
|
|
240
|
-
/** DELETE with the attributable operation metadata returned in response headers. */
|
|
241
|
-
async apiDeleteWithReceipt(path) {
|
|
242
|
-
let res;
|
|
243
|
-
try {
|
|
244
|
-
res = await request(this.url(path), {
|
|
245
|
-
method: "DELETE",
|
|
246
|
-
headers: this.headers(),
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
catch (err) {
|
|
250
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`, "Check your connection and endpoint: miosa status");
|
|
251
|
-
}
|
|
252
|
-
if (res.statusCode >= 400)
|
|
253
|
-
return this.parseError(res, "DELETE", path);
|
|
254
|
-
await res.body.dump();
|
|
255
|
-
const operationId = responseHeader(res, "x-forge-operation-id");
|
|
256
|
-
if (!operationId) {
|
|
257
|
-
throw new UserError("Forge delete did not return an operation receipt.", "Retry with --debug and contact MIOSA support if the response remains incomplete.");
|
|
258
|
-
}
|
|
259
|
-
return {
|
|
260
|
-
operationId,
|
|
261
|
-
replayed: responseHeader(res, "idempotency-replayed") === "true",
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
// --- ClinicIQ / workspace admin SDK helpers ---
|
|
265
|
-
async listWorkspaces() {
|
|
266
|
-
return unwrapData(await this.get("/api/v1/workspaces"), []);
|
|
267
|
-
}
|
|
268
|
-
async createWorkspace(attrs) {
|
|
269
|
-
return unwrapData(await this.post("/api/v1/workspaces", attrs));
|
|
270
|
-
}
|
|
271
|
-
async getWorkspaceInventory(workspaceId) {
|
|
272
|
-
return unwrapData(await this.get(`/api/v1/workspaces/${encodeURIComponent(workspaceId)}/inventory`));
|
|
273
|
-
}
|
|
274
|
-
async cleanupWorkspaceResources(workspaceId, opts) {
|
|
275
|
-
return unwrapData(await this.post(`/api/v1/workspaces/${encodeURIComponent(workspaceId)}/cleanup`, opts));
|
|
276
|
-
}
|
|
277
|
-
async deleteWorkspace(workspaceId, opts) {
|
|
278
|
-
const qs = queryString({
|
|
279
|
-
force: opts?.force,
|
|
280
|
-
dry_run: opts?.dryRun,
|
|
281
|
-
});
|
|
282
|
-
return unwrapData(await this.delete(`/api/v1/workspaces/${encodeURIComponent(workspaceId)}${qs}`));
|
|
283
|
-
}
|
|
284
|
-
async listComputers(params) {
|
|
285
|
-
return unwrapList(await this.get(`/api/v1/computers${queryString(paramsToApi(params))}`), ["computers", "data"]);
|
|
286
|
-
}
|
|
287
|
-
async deleteComputer(computerId) {
|
|
288
|
-
return unwrapData(await this.delete(`/api/v1/computers/${encodeURIComponent(computerId)}`));
|
|
289
|
-
}
|
|
290
|
-
async listSandboxes(params) {
|
|
291
|
-
return unwrapList(await this.get(`/api/v1/sandboxes${queryString(paramsToApi(params))}`));
|
|
292
|
-
}
|
|
293
|
-
async deleteSandbox(sandboxId) {
|
|
294
|
-
return unwrapData(await this.delete(`/api/v1/sandboxes/${encodeURIComponent(sandboxId)}`));
|
|
295
|
-
}
|
|
296
|
-
async listDomains(params) {
|
|
297
|
-
return unwrapList(await this.get(`/api/v1/custom-domains${queryString(paramsToApi(params))}`));
|
|
298
|
-
}
|
|
299
|
-
async deleteDomain(hostnameOrId) {
|
|
300
|
-
return unwrapData(await this.delete(`/api/v1/domains/${encodeURIComponent(hostnameOrId)}`));
|
|
301
|
-
}
|
|
302
|
-
async listDatabases(params) {
|
|
303
|
-
return unwrapList(await this.get(`/api/v1/databases${queryString(paramsToApi(params))}`));
|
|
304
|
-
}
|
|
305
|
-
async deleteDatabase(databaseId) {
|
|
306
|
-
return unwrapData(await this.delete(`/api/v1/databases/${encodeURIComponent(databaseId)}`));
|
|
307
|
-
}
|
|
308
|
-
async listSecretsMetadata(params) {
|
|
309
|
-
return unwrapList(await this.get(`/api/v1/egress/secrets${queryString(paramsToApi(params))}`));
|
|
310
|
-
}
|
|
311
|
-
async unsetSecret(secretId) {
|
|
312
|
-
return unwrapData(await this.delete(`/api/v1/egress/secrets/${encodeURIComponent(secretId)}`));
|
|
313
|
-
}
|
|
314
|
-
async listStorageBuckets(params) {
|
|
315
|
-
return unwrapList(await this.get(`/api/v1/storage/buckets${queryString(paramsToApi(params))}`));
|
|
316
|
-
}
|
|
317
|
-
async deleteStorageBucket(bucketId) {
|
|
318
|
-
return unwrapData(await this.delete(`/api/v1/storage/buckets/${encodeURIComponent(bucketId)}`));
|
|
319
|
-
}
|
|
320
|
-
async getAuditEvents(params) {
|
|
321
|
-
return unwrapList(await this.get(`/api/v1/audit-log${queryString(paramsToApi(params))}`));
|
|
322
|
-
}
|
|
323
|
-
// --- Tenant ---
|
|
324
|
-
async getTenant() {
|
|
325
|
-
const response = await this.get("/api/v1/platform/tenants/current");
|
|
326
|
-
const tenant = normalizeTenantResponse(response);
|
|
327
|
-
const billingOverview = await this.getBillingOverview().catch(() => null);
|
|
328
|
-
const billingCreditBalance = billingOverview?.available_balance_cents ??
|
|
329
|
-
(billingOverview
|
|
330
|
-
? Math.max(0, (billingOverview.usage_budget_cents ?? 0) +
|
|
331
|
-
(billingOverview.topup_balance_cents ?? 0) -
|
|
332
|
-
(billingOverview.billing_period_usage_cents ?? 0))
|
|
333
|
-
: null);
|
|
334
|
-
return {
|
|
335
|
-
...tenant,
|
|
336
|
-
plan: tenant.plan ?? tenant.plan_name ?? null,
|
|
337
|
-
credit_balance: billingCreditBalance ?? tenant.credit_balance ?? 0,
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
async getBillingOverview() {
|
|
341
|
-
const response = await this.get("/api/v1/billing/overview");
|
|
342
|
-
return response.data ?? response;
|
|
343
|
-
}
|
|
344
|
-
// --- Hosts ---
|
|
345
|
-
async listHosts() {
|
|
346
|
-
return this.get("/api/v1/opencomputers/hosts").then((r) => r.data ?? []);
|
|
347
|
-
}
|
|
348
|
-
async getHost(idOrName) {
|
|
349
|
-
// Try by ID first; if 404 fallback to name search
|
|
350
|
-
try {
|
|
351
|
-
return await this.get(`/api/v1/opencomputers/hosts/${encodeURIComponent(idOrName)}`).then((r) => r.data);
|
|
352
|
-
}
|
|
353
|
-
catch {
|
|
354
|
-
// Fallback: search by name
|
|
355
|
-
const hosts = await this.listHosts();
|
|
356
|
-
const match = hosts.find((h) => h.name === idOrName || h.id === idOrName);
|
|
357
|
-
if (!match) {
|
|
358
|
-
const { UserError } = await import("./errors.js");
|
|
359
|
-
const hint = /^(sbx_|sb_)/.test(idOrName)
|
|
360
|
-
? "This looks like a sandbox id. Use `miosa sandbox ls` / `miosa sandbox cp` for sandboxes."
|
|
361
|
-
: "Run `miosa hosts` to list available fleet hosts.";
|
|
362
|
-
throw new UserError(`Host not found: ${idOrName}`, hint);
|
|
363
|
-
}
|
|
364
|
-
return match;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
async createHost(params) {
|
|
368
|
-
return this.post("/api/v1/opencomputers/hosts", params).then((r) => r.data);
|
|
369
|
-
}
|
|
370
|
-
// --- Terminal ---
|
|
371
|
-
async getTerminalTicket(hostId) {
|
|
372
|
-
return this.post(`/api/v1/opencomputers/hosts/${hostId}/terminal/ticket`).then((r) => r.data);
|
|
373
|
-
}
|
|
374
|
-
// --- Jobs ---
|
|
375
|
-
async createJob(hostId, params) {
|
|
376
|
-
return this.post(`/api/v1/opencomputers/hosts/${hostId}/jobs`, params).then((r) => r.data);
|
|
377
|
-
}
|
|
378
|
-
/** Returns a raw Response for SSE streaming */
|
|
379
|
-
async streamJob(hostId, params) {
|
|
380
|
-
let res;
|
|
381
|
-
try {
|
|
382
|
-
res = await request(this.url(`/api/v1/opencomputers/hosts/${hostId}/jobs`), {
|
|
383
|
-
method: "POST",
|
|
384
|
-
headers: {
|
|
385
|
-
...this.headers(),
|
|
386
|
-
Accept: "text/event-stream, application/json, */*",
|
|
387
|
-
},
|
|
388
|
-
body: JSON.stringify({ ...params, stream: true }),
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
catch (err) {
|
|
392
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`);
|
|
393
|
-
}
|
|
394
|
-
if (res.statusCode >= 400) {
|
|
395
|
-
return this.parseError(res, "POST", `/api/v1/opencomputers/hosts/${hostId}/jobs`);
|
|
396
|
-
}
|
|
397
|
-
return res;
|
|
398
|
-
}
|
|
399
|
-
// --- Filesystem ---
|
|
400
|
-
async listFs(hostId, path) {
|
|
401
|
-
return this.get(`/api/v1/opencomputers/hosts/${hostId}/fs?path=${encodeURIComponent(path)}`).then((r) => r.data);
|
|
402
|
-
}
|
|
403
|
-
async downloadFile(hostId, remotePath) {
|
|
404
|
-
let res;
|
|
405
|
-
try {
|
|
406
|
-
res = await request(this.url(`/api/v1/opencomputers/hosts/${hostId}/fs/content?path=${encodeURIComponent(remotePath)}`), { method: "GET", headers: this.headers() });
|
|
407
|
-
}
|
|
408
|
-
catch (err) {
|
|
409
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`);
|
|
410
|
-
}
|
|
411
|
-
if (res.statusCode >= 400) {
|
|
412
|
-
return this.parseError(res, "GET", `/api/v1/opencomputers/hosts/${hostId}/fs/content`);
|
|
413
|
-
}
|
|
414
|
-
return res;
|
|
415
|
-
}
|
|
416
|
-
async uploadFile(hostId, remotePath, data, filename) {
|
|
417
|
-
const boundary = `----MiosaUpload${Date.now()}`;
|
|
418
|
-
const header = `--${boundary}\r\n` +
|
|
419
|
-
`Content-Disposition: form-data; name="file"; filename="${filename}"\r\n` +
|
|
420
|
-
`Content-Type: application/octet-stream\r\n\r\n`;
|
|
421
|
-
const footer = `\r\n--${boundary}--\r\n`;
|
|
422
|
-
const body = Buffer.concat([
|
|
423
|
-
Buffer.from(header),
|
|
424
|
-
data,
|
|
425
|
-
Buffer.from(footer),
|
|
426
|
-
]);
|
|
427
|
-
let res;
|
|
428
|
-
try {
|
|
429
|
-
res = await request(this.url(`/api/v1/opencomputers/hosts/${hostId}/fs/content`), {
|
|
430
|
-
method: "POST",
|
|
431
|
-
headers: {
|
|
432
|
-
...this.headers(),
|
|
433
|
-
"Content-Type": `multipart/form-data; boundary=${boundary}`,
|
|
434
|
-
"X-Remote-Path": remotePath,
|
|
435
|
-
},
|
|
436
|
-
body,
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
catch (err) {
|
|
440
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`);
|
|
441
|
-
}
|
|
442
|
-
if (res.statusCode >= 400) {
|
|
443
|
-
await this.parseError(res, "POST", `/api/v1/opencomputers/hosts/${hostId}/fs/content`);
|
|
444
|
-
}
|
|
445
|
-
await res.body.dump();
|
|
446
|
-
}
|
|
447
|
-
async deleteFs(hostId, path, recursive) {
|
|
448
|
-
await this.delete(`/api/v1/opencomputers/hosts/${hostId}/fs?path=${encodeURIComponent(path)}&recursive=${recursive}`);
|
|
449
|
-
}
|
|
450
|
-
// --- Computers (Firecracker microVMs) filesystem ---
|
|
451
|
-
async computerListFiles(computerId, remotePath) {
|
|
452
|
-
return this.get(`/api/v1/computers/${computerId}/files?path=${encodeURIComponent(remotePath)}`).then((r) => r.data);
|
|
453
|
-
}
|
|
454
|
-
async computerWriteFile(computerId, remotePath, content) {
|
|
455
|
-
const body = content instanceof Buffer ? content.toString("base64") : content;
|
|
456
|
-
await this.post(`/api/v1/computers/${computerId}/files/write`, {
|
|
457
|
-
path: remotePath,
|
|
458
|
-
content: body,
|
|
459
|
-
encoding: content instanceof Buffer ? "base64" : "utf8",
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
async computerDownloadFile(computerId, remotePath) {
|
|
463
|
-
let res;
|
|
464
|
-
try {
|
|
465
|
-
res = await request(this.url(`/api/v1/computers/${computerId}/files/download?path=${encodeURIComponent(remotePath)}`), { method: "GET", headers: this.headers() });
|
|
466
|
-
}
|
|
467
|
-
catch (err) {
|
|
468
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`);
|
|
469
|
-
}
|
|
470
|
-
if (res.statusCode >= 400) {
|
|
471
|
-
return this.parseError(res, "GET", `/api/v1/computers/${computerId}/files/download`);
|
|
472
|
-
}
|
|
473
|
-
return res;
|
|
474
|
-
}
|
|
475
|
-
async computerUploadFile(computerId, remotePath, data, filename) {
|
|
476
|
-
const boundary = `----MiosaComputerUpload${Date.now()}`;
|
|
477
|
-
const header = `--${boundary}\r\n` +
|
|
478
|
-
`Content-Disposition: form-data; name="file"; filename="${filename}"\r\n` +
|
|
479
|
-
`Content-Type: application/octet-stream\r\n\r\n`;
|
|
480
|
-
const footer = `\r\n--${boundary}--\r\n`;
|
|
481
|
-
const body = Buffer.concat([
|
|
482
|
-
Buffer.from(header),
|
|
483
|
-
data,
|
|
484
|
-
Buffer.from(footer),
|
|
485
|
-
]);
|
|
486
|
-
let res;
|
|
487
|
-
try {
|
|
488
|
-
res = await request(this.url(`/api/v1/computers/${computerId}/files/upload`), {
|
|
489
|
-
method: "POST",
|
|
490
|
-
headers: {
|
|
491
|
-
...this.headers(),
|
|
492
|
-
"Content-Type": `multipart/form-data; boundary=${boundary}`,
|
|
493
|
-
"X-Remote-Path": remotePath,
|
|
494
|
-
},
|
|
495
|
-
body,
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
catch (err) {
|
|
499
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`);
|
|
500
|
-
}
|
|
501
|
-
if (res.statusCode >= 400) {
|
|
502
|
-
await this.parseError(res, "POST", `/api/v1/computers/${computerId}/files/upload`);
|
|
503
|
-
}
|
|
504
|
-
await res.body.dump();
|
|
505
|
-
}
|
|
506
|
-
async computerMkdir(computerId, remotePath) {
|
|
507
|
-
await this.post(`/api/v1/computers/${computerId}/files/mkdir`, {
|
|
508
|
-
path: remotePath,
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
async computerDeleteFile(computerId, remotePath) {
|
|
512
|
-
await this.delete(`/api/v1/computers/${computerId}/files?path=${encodeURIComponent(remotePath)}`);
|
|
513
|
-
}
|
|
514
|
-
async computerStat(computerId, remotePath) {
|
|
515
|
-
return this.post(`/api/v1/computers/${computerId}/files/stat`, { path: remotePath }).then((r) => r.data);
|
|
516
|
-
}
|
|
517
|
-
// --- Computers exec ---
|
|
518
|
-
async computerExec(computerId, command, opts) {
|
|
519
|
-
const path = opts?.language === "python"
|
|
520
|
-
? `/api/v1/computers/${computerId}/exec/python`
|
|
521
|
-
: `/api/v1/computers/${computerId}/exec`;
|
|
522
|
-
let res;
|
|
523
|
-
try {
|
|
524
|
-
res = await request(this.url(path), {
|
|
525
|
-
method: "POST",
|
|
526
|
-
headers: {
|
|
527
|
-
...this.headers(),
|
|
528
|
-
Accept: "text/event-stream, application/json, */*",
|
|
529
|
-
},
|
|
530
|
-
body: JSON.stringify({ command }),
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
catch (err) {
|
|
534
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`);
|
|
535
|
-
}
|
|
536
|
-
if (res.statusCode >= 400)
|
|
537
|
-
return this.parseError(res, "POST", path);
|
|
538
|
-
return res;
|
|
539
|
-
}
|
|
540
|
-
// --- Tunnels ---
|
|
541
|
-
async listTunnels(hostId) {
|
|
542
|
-
return this.get(`/api/v1/opencomputers/hosts/${hostId}/tunnels`).then((r) => r.data);
|
|
543
|
-
}
|
|
544
|
-
async createTunnel(hostId, params) {
|
|
545
|
-
return this.post(`/api/v1/opencomputers/hosts/${hostId}/tunnels`, params).then((r) => r.data);
|
|
546
|
-
}
|
|
547
|
-
async closeTunnel(hostId, slug) {
|
|
548
|
-
await this.delete(`/api/v1/opencomputers/hosts/${hostId}/tunnels/${slug}`);
|
|
549
|
-
}
|
|
550
|
-
// --- Agent ---
|
|
551
|
-
async dispatchAgent(hostId, params) {
|
|
552
|
-
let res;
|
|
553
|
-
try {
|
|
554
|
-
res = await request(this.url(`/api/v1/opencomputers/hosts/${hostId}/agent/dispatch`), {
|
|
555
|
-
method: "POST",
|
|
556
|
-
headers: {
|
|
557
|
-
...this.headers(),
|
|
558
|
-
Accept: "text/event-stream, application/json, */*",
|
|
559
|
-
},
|
|
560
|
-
body: JSON.stringify(params),
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
catch (err) {
|
|
564
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`);
|
|
565
|
-
}
|
|
566
|
-
if (res.statusCode >= 400) {
|
|
567
|
-
return this.parseError(res, "POST", `/api/v1/opencomputers/hosts/${hostId}/agent/dispatch`);
|
|
568
|
-
}
|
|
569
|
-
return res;
|
|
570
|
-
}
|
|
571
|
-
// --- Deployments ---
|
|
572
|
-
async listDeployments(params) {
|
|
573
|
-
const qs = new URLSearchParams();
|
|
574
|
-
if (params?.state)
|
|
575
|
-
qs.set("state", params.state);
|
|
576
|
-
const workspaceId = params?.workspace_id ?? params?.workspace;
|
|
577
|
-
if (workspaceId)
|
|
578
|
-
qs.set("workspace_id", workspaceId);
|
|
579
|
-
if (params?.limit != null)
|
|
580
|
-
qs.set("limit", String(params.limit));
|
|
581
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
582
|
-
return this.get(`/api/v1/deployments${suffix}`).then((r) => r.data);
|
|
583
|
-
}
|
|
584
|
-
async getDeployment(id) {
|
|
585
|
-
return this.get(`/api/v1/deployments/${encodeURIComponent(id)}`).then((r) => r.data);
|
|
586
|
-
}
|
|
587
|
-
async createDeployment(params) {
|
|
588
|
-
return this.post("/api/v1/deployments", params);
|
|
589
|
-
}
|
|
590
|
-
async deleteDeployment(id) {
|
|
591
|
-
return this.delete(`/api/v1/deployments/${encodeURIComponent(id)}`);
|
|
592
|
-
}
|
|
593
|
-
async redeployDeployment(id) {
|
|
594
|
-
return this.post(`/api/v1/deployments/${encodeURIComponent(id)}/redeploy`).then((r) => r.data);
|
|
595
|
-
}
|
|
596
|
-
async listBuilds(id) {
|
|
597
|
-
return this.get(`/api/v1/deployments/${encodeURIComponent(id)}/builds`).then((r) => r.data);
|
|
598
|
-
}
|
|
599
|
-
async getBuild(id, bid) {
|
|
600
|
-
return this.get(`/api/v1/deployments/${encodeURIComponent(id)}/builds/${encodeURIComponent(bid)}`).then((r) => r.data);
|
|
601
|
-
}
|
|
602
|
-
/** Returns a raw SSE Response for deployment log streaming */
|
|
603
|
-
async streamDeploymentLogs(id) {
|
|
604
|
-
let res;
|
|
605
|
-
try {
|
|
606
|
-
res = await request(this.url(`/api/v1/deployments/${encodeURIComponent(id)}/logs`), {
|
|
607
|
-
method: "GET",
|
|
608
|
-
headers: {
|
|
609
|
-
...this.headers(),
|
|
610
|
-
Accept: "text/event-stream, application/json, */*",
|
|
611
|
-
},
|
|
612
|
-
});
|
|
613
|
-
}
|
|
614
|
-
catch (err) {
|
|
615
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`);
|
|
616
|
-
}
|
|
617
|
-
if (res.statusCode >= 400) {
|
|
618
|
-
return this.parseError(res, "GET", `/api/v1/deployments/${encodeURIComponent(id)}/logs`);
|
|
619
|
-
}
|
|
620
|
-
return res;
|
|
621
|
-
}
|
|
622
|
-
/** Returns a raw SSE Response for build log streaming */
|
|
623
|
-
async streamBuildLogs(id, buildId) {
|
|
624
|
-
let res;
|
|
625
|
-
try {
|
|
626
|
-
res = await request(this.url(`/api/v1/deployments/${encodeURIComponent(id)}/builds/${encodeURIComponent(buildId)}/logs`), {
|
|
627
|
-
method: "GET",
|
|
628
|
-
headers: {
|
|
629
|
-
...this.headers(),
|
|
630
|
-
Accept: "text/event-stream, application/json, */*",
|
|
631
|
-
},
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
catch (err) {
|
|
635
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`);
|
|
636
|
-
}
|
|
637
|
-
if (res.statusCode >= 400) {
|
|
638
|
-
return this.parseError(res, "GET", `/api/v1/deployments/${encodeURIComponent(id)}/builds/${encodeURIComponent(buildId)}/logs`);
|
|
639
|
-
}
|
|
640
|
-
return res;
|
|
641
|
-
}
|
|
642
|
-
async getDeploymentEnv(id) {
|
|
643
|
-
return this.get(`/api/v1/deployments/${encodeURIComponent(id)}/env`).then((r) => r.data);
|
|
644
|
-
}
|
|
645
|
-
async setDeploymentEnv(id, env) {
|
|
646
|
-
return this.post(`/api/v1/deployments/${encodeURIComponent(id)}/env`, { env }).then((r) => r.data);
|
|
647
|
-
}
|
|
648
|
-
// --- Watch ---
|
|
649
|
-
async watchEvents(hostId) {
|
|
650
|
-
let res;
|
|
651
|
-
try {
|
|
652
|
-
res = await request(this.url(`/api/v1/opencomputers/hosts/${hostId}/events`), {
|
|
653
|
-
method: "GET",
|
|
654
|
-
headers: {
|
|
655
|
-
...this.headers(),
|
|
656
|
-
Accept: "text/event-stream, application/json, */*",
|
|
657
|
-
},
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
catch (err) {
|
|
661
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`);
|
|
662
|
-
}
|
|
663
|
-
if (res.statusCode >= 400) {
|
|
664
|
-
return this.parseError(res, "GET", `/api/v1/opencomputers/hosts/${hostId}/events`);
|
|
665
|
-
}
|
|
666
|
-
return res;
|
|
667
|
-
}
|
|
668
|
-
/** Open an SSE event stream for a Computer (Firecracker microVM). */
|
|
669
|
-
async watchComputerEvents(computerId) {
|
|
670
|
-
let res;
|
|
671
|
-
try {
|
|
672
|
-
res = await request(this.url(`/api/v1/computers/${computerId}/events`), {
|
|
673
|
-
method: "GET",
|
|
674
|
-
headers: {
|
|
675
|
-
...this.headers(),
|
|
676
|
-
Accept: "text/event-stream, application/json, */*",
|
|
677
|
-
},
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
catch (err) {
|
|
681
|
-
throw new NetworkError(`Network error: ${err instanceof Error ? err.message : String(err)}`);
|
|
682
|
-
}
|
|
683
|
-
if (res.statusCode >= 400) {
|
|
684
|
-
return this.parseError(res, "GET", `/api/v1/computers/${computerId}/events`);
|
|
685
|
-
}
|
|
686
|
-
return res;
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
function normalizeTenantResponse(response) {
|
|
690
|
-
const candidate = response.data ?? response.tenant ?? response;
|
|
691
|
-
if (!isRecord(candidate)) {
|
|
692
|
-
throw malformedTenantError();
|
|
693
|
-
}
|
|
694
|
-
const name = stringField(candidate, "name");
|
|
695
|
-
const slug = stringField(candidate, "slug");
|
|
696
|
-
if (!name || !slug) {
|
|
697
|
-
throw malformedTenantError();
|
|
698
|
-
}
|
|
699
|
-
return candidate;
|
|
700
|
-
}
|
|
701
|
-
function malformedTenantError() {
|
|
702
|
-
return new UserError("MIOSA returned an invalid account response.", "Run `miosa status --json` and try `miosa login` again. If this persists, contact MIOSA support with --debug output.");
|
|
703
|
-
}
|
|
704
|
-
function stringField(record, key) {
|
|
705
|
-
const value = record[key];
|
|
706
|
-
return typeof value === "string" && value.trim() !== "" ? value : null;
|
|
707
|
-
}
|
|
708
|
-
function responseHeader(res, name) {
|
|
709
|
-
const headers = res.headers;
|
|
710
|
-
if (Array.isArray(headers)) {
|
|
711
|
-
for (let i = 0; i < headers.length; i += 2) {
|
|
712
|
-
const key = String(headers[i] ?? "").toLowerCase();
|
|
713
|
-
if (key === name.toLowerCase())
|
|
714
|
-
return String(headers[i + 1] ?? "");
|
|
715
|
-
}
|
|
716
|
-
return null;
|
|
717
|
-
}
|
|
718
|
-
const value = headers?.[name] ?? headers?.[name.toLowerCase()];
|
|
719
|
-
if (Array.isArray(value))
|
|
720
|
-
return value[0] ?? null;
|
|
721
|
-
return value ?? null;
|
|
722
|
-
}
|
|
723
|
-
function unwrapData(payload, fallback) {
|
|
724
|
-
if (isRecord(payload) && "data" in payload)
|
|
725
|
-
return payload["data"];
|
|
726
|
-
if (payload === undefined && fallback !== undefined)
|
|
727
|
-
return fallback;
|
|
728
|
-
return payload;
|
|
729
|
-
}
|
|
730
|
-
function unwrapList(payload, keys = ["data"]) {
|
|
731
|
-
if (Array.isArray(payload))
|
|
732
|
-
return payload;
|
|
733
|
-
if (isRecord(payload)) {
|
|
734
|
-
for (const key of keys) {
|
|
735
|
-
const value = payload[key];
|
|
736
|
-
if (Array.isArray(value))
|
|
737
|
-
return value;
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
return [];
|
|
741
|
-
}
|
|
742
|
-
function queryString(values) {
|
|
743
|
-
if (!values)
|
|
744
|
-
return "";
|
|
745
|
-
const params = new URLSearchParams();
|
|
746
|
-
for (const [key, value] of Object.entries(values)) {
|
|
747
|
-
if (value === undefined ||
|
|
748
|
-
value === null ||
|
|
749
|
-
value === false ||
|
|
750
|
-
value === "")
|
|
751
|
-
continue;
|
|
752
|
-
params.set(key, String(value));
|
|
753
|
-
}
|
|
754
|
-
const encoded = params.toString();
|
|
755
|
-
return encoded ? `?${encoded}` : "";
|
|
756
|
-
}
|
|
757
|
-
function paramsToApi(params) {
|
|
758
|
-
if (!params)
|
|
759
|
-
return undefined;
|
|
760
|
-
const result = { ...params };
|
|
761
|
-
if (params.workspace && !params.workspace_id)
|
|
762
|
-
result["workspace_id"] = params.workspace;
|
|
763
|
-
delete result["workspace"];
|
|
764
|
-
return result;
|
|
765
|
-
}
|
|
766
|
-
function isRecord(value) {
|
|
767
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
768
|
-
}
|
|
769
|
-
function debugHttpError(method, path, status, requestId, rawBody) {
|
|
770
|
-
if (!isDebugMode())
|
|
771
|
-
return;
|
|
772
|
-
const requestIdText = requestId ? ` request_id=${requestId}` : "";
|
|
773
|
-
process.stderr.write(`[debug] ${method} ${path} -> HTTP ${status}${requestIdText}\n`);
|
|
774
|
-
if (rawBody) {
|
|
775
|
-
process.stderr.write(`[debug] response_body=${rawBody}\n`);
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
// SSE parser — consumes undici body stream, yields parsed events
|
|
779
|
-
export async function* parseSse(body) {
|
|
780
|
-
let buffer = "";
|
|
781
|
-
for await (const chunk of body) {
|
|
782
|
-
buffer += chunk.toString();
|
|
783
|
-
const lines = buffer.split("\n");
|
|
784
|
-
// Keep last potentially incomplete line
|
|
785
|
-
buffer = lines.pop() ?? "";
|
|
786
|
-
let eventType = "";
|
|
787
|
-
let dataLines = [];
|
|
788
|
-
for (const line of lines) {
|
|
789
|
-
if (line.startsWith("event:")) {
|
|
790
|
-
eventType = line.slice(6).trim();
|
|
791
|
-
}
|
|
792
|
-
else if (line.startsWith("data:")) {
|
|
793
|
-
dataLines.push(line.slice(5).trim());
|
|
794
|
-
}
|
|
795
|
-
else if (line === "") {
|
|
796
|
-
// Dispatch event
|
|
797
|
-
if (dataLines.length > 0) {
|
|
798
|
-
const raw = dataLines.join("\n");
|
|
799
|
-
yield parseSseEvent(eventType, raw);
|
|
800
|
-
}
|
|
801
|
-
eventType = "";
|
|
802
|
-
dataLines = [];
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
function parseSseEvent(eventType, raw) {
|
|
808
|
-
let parsed;
|
|
809
|
-
try {
|
|
810
|
-
parsed = JSON.parse(raw);
|
|
811
|
-
}
|
|
812
|
-
catch {
|
|
813
|
-
return { type: "unknown", raw };
|
|
814
|
-
}
|
|
815
|
-
const data = parsed;
|
|
816
|
-
// Normalize event type from field or explicit event: line
|
|
817
|
-
const type = eventType || (typeof data["type"] === "string" ? data["type"] : "unknown");
|
|
818
|
-
switch (type) {
|
|
819
|
-
case "stdout":
|
|
820
|
-
// Sandbox exec/stream frames are `data: {"line": "..."}` (see
|
|
821
|
-
// apps/web/lib/web/controllers/sandboxes/execution_controller.ex);
|
|
822
|
-
// `data`/`output` are kept as fallbacks for other stream producers.
|
|
823
|
-
return {
|
|
824
|
-
type: "stdout",
|
|
825
|
-
data: String(data["line"] ?? data["data"] ?? data["output"] ?? ""),
|
|
826
|
-
};
|
|
827
|
-
case "stderr":
|
|
828
|
-
return {
|
|
829
|
-
type: "stderr",
|
|
830
|
-
data: String(data["line"] ?? data["data"] ?? data["output"] ?? ""),
|
|
831
|
-
};
|
|
832
|
-
case "exit":
|
|
833
|
-
return {
|
|
834
|
-
type: "exit",
|
|
835
|
-
exit_code: Number(data["exit_code"] ?? data["code"] ?? 0),
|
|
836
|
-
};
|
|
837
|
-
case "error":
|
|
838
|
-
return { type: "error", message: String(data["message"] ?? raw) };
|
|
839
|
-
case "thought":
|
|
840
|
-
return {
|
|
841
|
-
type: "thought",
|
|
842
|
-
content: String(data["content"] ?? data["thought"] ?? ""),
|
|
843
|
-
};
|
|
844
|
-
case "tool_call":
|
|
845
|
-
return {
|
|
846
|
-
type: "tool_call",
|
|
847
|
-
tool: String(data["tool"] ?? ""),
|
|
848
|
-
input: data["input"],
|
|
849
|
-
};
|
|
850
|
-
case "tool_result":
|
|
851
|
-
return {
|
|
852
|
-
type: "tool_result",
|
|
853
|
-
tool: String(data["tool"] ?? ""),
|
|
854
|
-
output: data["output"],
|
|
855
|
-
};
|
|
856
|
-
case "done":
|
|
857
|
-
return { type: "done", result: data["result"] };
|
|
858
|
-
case "heartbeat":
|
|
859
|
-
case "ping":
|
|
860
|
-
return { type: "heartbeat" };
|
|
861
|
-
default:
|
|
862
|
-
return { type: "unknown", raw };
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
//# sourceMappingURL=client.js.map
|