@miosa/sdk 3.6.0 → 3.7.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 +87 -0
- package/dist/{client-C_uXhex9.d.ts → client-D3gBlypv.d.ts} +186 -1
- package/dist/helpers/index.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +95 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import * as http2 from 'http2';
|
|
|
10
10
|
import { createRequire } from 'module';
|
|
11
11
|
|
|
12
12
|
// src/version.ts
|
|
13
|
-
var SDK_VERSION = "3.
|
|
13
|
+
var SDK_VERSION = "3.7.0";
|
|
14
14
|
var SDK_USER_AGENT = `@miosa/sdk/${SDK_VERSION}`;
|
|
15
15
|
|
|
16
16
|
// src/http.ts
|
|
@@ -10557,6 +10557,31 @@ var Regions = class {
|
|
|
10557
10557
|
}
|
|
10558
10558
|
};
|
|
10559
10559
|
|
|
10560
|
+
// src/resources/runtimes.ts
|
|
10561
|
+
var SANDBOX_RUNTIME_PROFILE = {
|
|
10562
|
+
firecracker: "standard",
|
|
10563
|
+
soma: "soma",
|
|
10564
|
+
auto: "auto"
|
|
10565
|
+
};
|
|
10566
|
+
function runtimeProfile(runtime) {
|
|
10567
|
+
return runtime === void 0 ? void 0 : SANDBOX_RUNTIME_PROFILE[runtime];
|
|
10568
|
+
}
|
|
10569
|
+
var Runtimes = class {
|
|
10570
|
+
constructor(http) {
|
|
10571
|
+
this.http = http;
|
|
10572
|
+
}
|
|
10573
|
+
http;
|
|
10574
|
+
/**
|
|
10575
|
+
* `GET /sandboxes/runtimes`: list selectable sandbox runtimes with their gate
|
|
10576
|
+
* state and capabilities.
|
|
10577
|
+
*/
|
|
10578
|
+
async list() {
|
|
10579
|
+
const res = await this.http.get("/sandboxes/runtimes");
|
|
10580
|
+
const data = Array.isArray(res) ? res : res?.data ?? [];
|
|
10581
|
+
return data;
|
|
10582
|
+
}
|
|
10583
|
+
};
|
|
10584
|
+
|
|
10560
10585
|
// src/resources/runtime-env.ts
|
|
10561
10586
|
function unwrap47(payload) {
|
|
10562
10587
|
if (payload !== null && typeof payload === "object" && "data" in payload && payload.data !== void 0) {
|
|
@@ -11269,6 +11294,7 @@ function createBody2(params = {}) {
|
|
|
11269
11294
|
github_clone_path: params.githubClonePath ?? params.github_clone_path,
|
|
11270
11295
|
name: params.name,
|
|
11271
11296
|
region: params.region,
|
|
11297
|
+
runtime_profile: runtimeProfile(params.runtime),
|
|
11272
11298
|
entrypoint: params.entrypoint,
|
|
11273
11299
|
tags: params.tags,
|
|
11274
11300
|
slug: params.slug,
|
|
@@ -12341,6 +12367,48 @@ var Sandbox = class _Sandbox {
|
|
|
12341
12367
|
this.data = { ...this.data, ...data };
|
|
12342
12368
|
return this;
|
|
12343
12369
|
}
|
|
12370
|
+
/**
|
|
12371
|
+
* Run one cell in the sandbox's persistent interpreter and return its output.
|
|
12372
|
+
*
|
|
12373
|
+
* `language` is `"python"` (default) or `"javascript"`. `context` names an
|
|
12374
|
+
* independent namespace (default `"default"`), so one sandbox can keep several
|
|
12375
|
+
* sessions. Variables, imports, and definitions persist across calls until
|
|
12376
|
+
* {@link resetCode}.
|
|
12377
|
+
*/
|
|
12378
|
+
async runCode(code, options = {}) {
|
|
12379
|
+
const body5 = { code };
|
|
12380
|
+
if (options.language !== void 0) body5.language = options.language;
|
|
12381
|
+
if (options.context !== void 0) body5.context = options.context;
|
|
12382
|
+
if (options.timeout !== void 0) body5.timeout = options.timeout;
|
|
12383
|
+
return unwrap49(
|
|
12384
|
+
await this.http.post(
|
|
12385
|
+
`/sandboxes/${this.id}/code/run`,
|
|
12386
|
+
body5
|
|
12387
|
+
)
|
|
12388
|
+
);
|
|
12389
|
+
}
|
|
12390
|
+
/** List the interpreter contexts that exist for `language`. */
|
|
12391
|
+
async codeContexts(options = {}) {
|
|
12392
|
+
const data = unwrap49(
|
|
12393
|
+
await this.http.get(
|
|
12394
|
+
`/sandboxes/${this.id}/code/contexts`,
|
|
12395
|
+
options.language !== void 0 ? { language: options.language } : void 0
|
|
12396
|
+
)
|
|
12397
|
+
);
|
|
12398
|
+
return data.contexts ?? [];
|
|
12399
|
+
}
|
|
12400
|
+
/** Reset a single `context`, or every context for `language`. */
|
|
12401
|
+
async resetCode(options = {}) {
|
|
12402
|
+
const query3 = options.language !== void 0 ? { language: options.language } : void 0;
|
|
12403
|
+
if (options.context !== void 0) {
|
|
12404
|
+
await this.http.delete(
|
|
12405
|
+
`/sandboxes/${this.id}/code/contexts/${encodeURIComponent(options.context)}`,
|
|
12406
|
+
query3
|
|
12407
|
+
);
|
|
12408
|
+
} else {
|
|
12409
|
+
await this.http.delete(`/sandboxes/${this.id}/code`, query3);
|
|
12410
|
+
}
|
|
12411
|
+
}
|
|
12344
12412
|
/**
|
|
12345
12413
|
* Resume a paused (or persistent-stopped) sandbox.
|
|
12346
12414
|
*
|
|
@@ -12874,6 +12942,28 @@ var Sandboxes = class {
|
|
|
12874
12942
|
async usage(id) {
|
|
12875
12943
|
return (await this.get(id)).usage();
|
|
12876
12944
|
}
|
|
12945
|
+
/**
|
|
12946
|
+
* Mint a scoped, expiring, revocable CDP grant for a sandbox browser
|
|
12947
|
+
* session (`POST /sandboxes/:id/browser/cdp-url`).
|
|
12948
|
+
*
|
|
12949
|
+
* Returns every URL a Chrome DevTools Protocol client needs. Point Selenium
|
|
12950
|
+
* at `cdp_debugger_address` (or `127.0.0.1:9222` through the MIOSA CLI port
|
|
12951
|
+
* forward) and chromedp at `cdp_host` as its base URL. The grant embeds the
|
|
12952
|
+
* token in the path for `cdp_ws_url` / `cdp_http_url`; use `cdp_url` when the
|
|
12953
|
+
* client can set an auth header. Pass `options.ttlSeconds` (60-604800) to
|
|
12954
|
+
* request a lifetime; the server default applies otherwise. The call only
|
|
12955
|
+
* mints the grant - it does not start or proxy a browser; run a CDP-speaking
|
|
12956
|
+
* browser inside the sandbox.
|
|
12957
|
+
*/
|
|
12958
|
+
async browserCdpUrl(id, options = {}) {
|
|
12959
|
+
const body5 = options.ttlSeconds === void 0 ? {} : { ttl_seconds: options.ttlSeconds };
|
|
12960
|
+
return unwrap49(
|
|
12961
|
+
await this.http.post(
|
|
12962
|
+
`/sandboxes/${id}/browser/cdp-url`,
|
|
12963
|
+
body5
|
|
12964
|
+
)
|
|
12965
|
+
);
|
|
12966
|
+
}
|
|
12877
12967
|
async pause(id) {
|
|
12878
12968
|
return (await this.get(id)).pause();
|
|
12879
12969
|
}
|
|
@@ -15562,6 +15652,8 @@ var Miosa = class _Miosa {
|
|
|
15562
15652
|
tenant;
|
|
15563
15653
|
/** Datacenter regions, compute sizes, pricing, community templates. */
|
|
15564
15654
|
regions;
|
|
15655
|
+
/** Selectable sandbox runtimes (firecracker | soma | auto) with gate state. */
|
|
15656
|
+
runtimes;
|
|
15565
15657
|
/** Tenant settings — workspace config, branding, BYOK provider keys. */
|
|
15566
15658
|
settings;
|
|
15567
15659
|
/** Aggregated platform dashboard and health overview. */
|
|
@@ -15781,6 +15873,7 @@ var Miosa = class _Miosa {
|
|
|
15781
15873
|
this.forge = new Forge(this.http);
|
|
15782
15874
|
this.tenant = new Tenant(this.http);
|
|
15783
15875
|
this.regions = new Regions(this.http);
|
|
15876
|
+
this.runtimes = new Runtimes(this.http);
|
|
15784
15877
|
this.settings = new Settings(this.http);
|
|
15785
15878
|
this.dashboard = new Dashboard(this.http);
|
|
15786
15879
|
this.analytics = new Analytics(this.http);
|
|
@@ -16362,6 +16455,6 @@ var AppAuth = class {
|
|
|
16362
16455
|
}
|
|
16363
16456
|
};
|
|
16364
16457
|
|
|
16365
|
-
export { AGENT_BUILD_KIND_SPECS, Admin, AgentChats, AgentDefinitions, AgentRuntimeProfiles, AgentSettingsResource, AgentSignins, AiGateway, Analytics, ApiKeys, AppAuth, AppDocuments, AuditLog, Benchmarks, BillTo, BuilderSessions, BulkResource, Channels, Checkpoints, Cloud, CommandCenter, Community, Completions, Computer, ComputerAudit, ComputerAutoStop, ComputerConnectors, ComputerEnv, ComputerInbox, ComputerLogs, ComputerNetwork, ComputerOsa, ComputerPorts, ComputerSecrets, ComputerShares, ComputerTerminal, ComputerVolumes, Computers, Connections, Connectors, Credits, CronJobs, DEFAULT_AGENT_BUILD_OUTPUT_ROOT, DEFAULT_AGENT_BUILD_PACKET_VERSION, Dashboard, Databases, DeploymentConnectors, DeploymentDomains, DeploymentReleases, DeploymentRuntimeInstances, DeploymentVersions, Deployments, Desktop, Devices, DnsAddressResolver, DockerDeploy, Domains, EgressAudit, EgressNetwork, EgressSecrets, Email, EmailCampaigns, EmailInbox, EmailTemplates, Embeddings, Environments, EventSubscriptions, Exec, ExternalKeys, ExternalQuotas, ExternalUsers, Files, FlatCustomDomains, Forge, ForgeContractError, ForgePolicyViolationError, ForgeRepositories, ForgeStorageError, ForgeUnavailableError, FsApi, Functions, HealthChecks, Http2Transport, Http3Transport, Integrations, MachineAgent, Mcp, Miosa, Models, NamedSnapshots, NetworkPolicy, OAuthFlow, OpenComputers, OrgInvites, OrganizationMembers, Organizations, PortTunnel, ProjectAuth, ProjectIntegrations, ProviderDefaults, Quotas, RacingTransport, Regions, RunGroups, RunnerClient, RunnerConnectError, RunnerError, RunnerTimeoutError, Runs, RuntimeCapabilitiesResource, RuntimeEnv, SANDBOX_TEMPLATE, Sandbox, SandboxAudit, SandboxBatches, SandboxCommands, SandboxConnectors, SandboxEnv, SandboxEvents, SandboxFiles, SandboxNetwork, SandboxPreview, SandboxPreviews, SandboxSecrets, SandboxSsh, SandboxTags, SandboxTemplates, SandboxTerminal, SandboxTunnel, Sandboxes, ScopedFs, ScopedTokens, ServiceAccounts, Settings, SharedLinks, SnapshotWarmingError, Snapshots, SnapshotsStandalone, StaticAddressResolver, Storage, TUNNEL_CLOSE_REASONS, TUNNEL_SUBPROTOCOL, Templates, Tenant, TenantEventStreamResource, TenantMembersResource, TenantPolicy, Tokens, TunnelClosedError, Usage, Volumes, WEBHOOK_DELIVERY_HEADER, WEBHOOK_EVENT_HEADER, WEBHOOK_SIGNATURE_HEADER, WebhookSignatureError, Webhooks, WorkspaceInvites, WorkspaceMembers, WorkspaceMembersResource, WorkspacePolicyResource, WorkspaceProxy, Workspaces, buildSshCommand, buildSshConfig, constructWebhookEvent, createAgentBuildExecutionPacket, createAgentBuildExpectedOutputs, createAgentBuildPrompt, createBestTransport, createBuildRunParams, daysUntil, decodeSomaBytes, detectHttp3Support, encodeSomaBytes, generateSshKeyPair, getAgentBuildKindSpec, hyphenateInstanceId, isConnectFailure, regionFromApiKey, regionHostname, resetHttp3DetectionCache, resolveAgentBuildKind, sandboxTag, signWebhookBody, tagHostname, unwrapSomaEnvelope, verifySignature, verifyWebhookSignature, verifyWebhookSignatureAsync };
|
|
16458
|
+
export { AGENT_BUILD_KIND_SPECS, Admin, AgentChats, AgentDefinitions, AgentRuntimeProfiles, AgentSettingsResource, AgentSignins, AiGateway, Analytics, ApiKeys, AppAuth, AppDocuments, AuditLog, Benchmarks, BillTo, BuilderSessions, BulkResource, Channels, Checkpoints, Cloud, CommandCenter, Community, Completions, Computer, ComputerAudit, ComputerAutoStop, ComputerConnectors, ComputerEnv, ComputerInbox, ComputerLogs, ComputerNetwork, ComputerOsa, ComputerPorts, ComputerSecrets, ComputerShares, ComputerTerminal, ComputerVolumes, Computers, Connections, Connectors, Credits, CronJobs, DEFAULT_AGENT_BUILD_OUTPUT_ROOT, DEFAULT_AGENT_BUILD_PACKET_VERSION, Dashboard, Databases, DeploymentConnectors, DeploymentDomains, DeploymentReleases, DeploymentRuntimeInstances, DeploymentVersions, Deployments, Desktop, Devices, DnsAddressResolver, DockerDeploy, Domains, EgressAudit, EgressNetwork, EgressSecrets, Email, EmailCampaigns, EmailInbox, EmailTemplates, Embeddings, Environments, EventSubscriptions, Exec, ExternalKeys, ExternalQuotas, ExternalUsers, Files, FlatCustomDomains, Forge, ForgeContractError, ForgePolicyViolationError, ForgeRepositories, ForgeStorageError, ForgeUnavailableError, FsApi, Functions, HealthChecks, Http2Transport, Http3Transport, Integrations, MachineAgent, Mcp, Miosa, Models, NamedSnapshots, NetworkPolicy, OAuthFlow, OpenComputers, OrgInvites, OrganizationMembers, Organizations, PortTunnel, ProjectAuth, ProjectIntegrations, ProviderDefaults, Quotas, RacingTransport, Regions, RunGroups, RunnerClient, RunnerConnectError, RunnerError, RunnerTimeoutError, Runs, RuntimeCapabilitiesResource, RuntimeEnv, Runtimes, SANDBOX_RUNTIME_PROFILE, SANDBOX_TEMPLATE, Sandbox, SandboxAudit, SandboxBatches, SandboxCommands, SandboxConnectors, SandboxEnv, SandboxEvents, SandboxFiles, SandboxNetwork, SandboxPreview, SandboxPreviews, SandboxSecrets, SandboxSsh, SandboxTags, SandboxTemplates, SandboxTerminal, SandboxTunnel, Sandboxes, ScopedFs, ScopedTokens, ServiceAccounts, Settings, SharedLinks, SnapshotWarmingError, Snapshots, SnapshotsStandalone, StaticAddressResolver, Storage, TUNNEL_CLOSE_REASONS, TUNNEL_SUBPROTOCOL, Templates, Tenant, TenantEventStreamResource, TenantMembersResource, TenantPolicy, Tokens, TunnelClosedError, Usage, Volumes, WEBHOOK_DELIVERY_HEADER, WEBHOOK_EVENT_HEADER, WEBHOOK_SIGNATURE_HEADER, WebhookSignatureError, Webhooks, WorkspaceInvites, WorkspaceMembers, WorkspaceMembersResource, WorkspacePolicyResource, WorkspaceProxy, Workspaces, buildSshCommand, buildSshConfig, constructWebhookEvent, createAgentBuildExecutionPacket, createAgentBuildExpectedOutputs, createAgentBuildPrompt, createBestTransport, createBuildRunParams, daysUntil, decodeSomaBytes, detectHttp3Support, encodeSomaBytes, generateSshKeyPair, getAgentBuildKindSpec, hyphenateInstanceId, isConnectFailure, regionFromApiKey, regionHostname, resetHttp3DetectionCache, resolveAgentBuildKind, runtimeProfile, sandboxTag, signWebhookBody, tagHostname, unwrapSomaEnvelope, verifySignature, verifyWebhookSignature, verifyWebhookSignatureAsync };
|
|
16366
16459
|
//# sourceMappingURL=index.js.map
|
|
16367
16460
|
//# sourceMappingURL=index.js.map
|