@tensorlakeai/tensorlake 0.5.159 → 0.5.160
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/dist/applications/index.cjs +7 -2
- package/dist/applications/index.cjs.map +1 -1
- package/dist/applications/index.js +7 -2
- package/dist/applications/index.js.map +1 -1
- package/dist/function-agent/main.cjs +1 -1
- package/dist/function-agent/main.cjs.map +1 -1
- package/dist/function-agent/main.js +1 -1
- package/dist/function-agent/main.js.map +1 -1
- package/dist/function-executor/main.cjs +2 -2
- package/dist/function-executor/main.cjs.map +1 -1
- package/dist/function-executor/main.js +2 -2
- package/dist/function-executor/main.js.map +1 -1
- package/dist/index.cjs +62 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +136 -1
- package/dist/index.d.ts +136 -1
- package/dist/index.js +61 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/runtime/function-executor/manifest.json +7 -7
- package/runtime/function-executor/package/dist/function-executor/main.js +2 -2
- package/runtime/function-executor/package/dist/function-executor/main.js.map +1 -1
- package/runtime/function-executor/package/npm-shrinkwrap.json +2 -2
- package/runtime/function-executor/package/package.json +1 -1
- package/runtime/typescript-function-runner/manifest.json +7 -7
- package/runtime/typescript-function-runner/package/dist/function-agent/main.js +1 -1
- package/runtime/typescript-function-runner/package/dist/function-agent/main.js.map +1 -1
- package/runtime/typescript-function-runner/package/npm-shrinkwrap.json +26 -26
- package/runtime/typescript-function-runner/package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -2078,6 +2078,141 @@ declare class RepositoryClient {
|
|
|
2078
2078
|
private tracedJson;
|
|
2079
2079
|
}
|
|
2080
2080
|
|
|
2081
|
+
/** How far back to read instead of the current billing period. */
|
|
2082
|
+
type UsageLookback = "1d" | "7d" | "30d";
|
|
2083
|
+
interface UsageClientOptions {
|
|
2084
|
+
/** Tensorlake API key. Defaults to `TENSORLAKE_API_KEY`. */
|
|
2085
|
+
apiKey?: string;
|
|
2086
|
+
/** Organization to read. Defaults to `TENSORLAKE_ORGANIZATION_ID`. */
|
|
2087
|
+
organizationId?: string;
|
|
2088
|
+
/** Cloud API URL. Defaults to `TENSORLAKE_API_URL`. */
|
|
2089
|
+
apiUrl?: string;
|
|
2090
|
+
}
|
|
2091
|
+
interface UsageReadOptions {
|
|
2092
|
+
/** Read the last `1d`, `7d` or `30d` instead of the current billing period. */
|
|
2093
|
+
last?: UsageLookback;
|
|
2094
|
+
}
|
|
2095
|
+
/** Metered usage, excluding subscription fees and tax. */
|
|
2096
|
+
interface UsageCharge {
|
|
2097
|
+
currency: string;
|
|
2098
|
+
amountMinor: string;
|
|
2099
|
+
resources: {
|
|
2100
|
+
cpuAmountMinor: string;
|
|
2101
|
+
memoryAmountMinor: string;
|
|
2102
|
+
sandboxStorageAmountMinor: string;
|
|
2103
|
+
snapshotStorageAmountMinor: string;
|
|
2104
|
+
};
|
|
2105
|
+
}
|
|
2106
|
+
/** Plan allowance consumption, valued at the overage rate. */
|
|
2107
|
+
interface IncludedUsage {
|
|
2108
|
+
currency: string;
|
|
2109
|
+
includedAmountMinor: string;
|
|
2110
|
+
periodUsedAmountMinor: string;
|
|
2111
|
+
rangeUsageAmountMinor: string;
|
|
2112
|
+
periodStart: string;
|
|
2113
|
+
periodEnd: string;
|
|
2114
|
+
}
|
|
2115
|
+
/** Organization usage totals for a window. */
|
|
2116
|
+
interface UsageSummary {
|
|
2117
|
+
windowStart: string;
|
|
2118
|
+
windowEnd: string;
|
|
2119
|
+
computeUnits: string;
|
|
2120
|
+
/**
|
|
2121
|
+
* `null` when the organization has no metered price, and on plans with
|
|
2122
|
+
* included usage (Pro, Enterprise) when the window is not inside the current
|
|
2123
|
+
* billing period. Use `usageValue` then.
|
|
2124
|
+
*/
|
|
2125
|
+
usageCharge: UsageCharge | null;
|
|
2126
|
+
includedUsage: IncludedUsage | null;
|
|
2127
|
+
/**
|
|
2128
|
+
* Usage valued at the plan's overage rate, before included usage. Set for
|
|
2129
|
+
* every window on plans with included usage, `null` otherwise.
|
|
2130
|
+
*/
|
|
2131
|
+
usageValue: UsageCharge | null;
|
|
2132
|
+
runningSandboxes: number;
|
|
2133
|
+
projects: Array<{
|
|
2134
|
+
projectId: string;
|
|
2135
|
+
projectName: string;
|
|
2136
|
+
computeUnits: string;
|
|
2137
|
+
}>;
|
|
2138
|
+
}
|
|
2139
|
+
interface ResourceUsage {
|
|
2140
|
+
quantity: string;
|
|
2141
|
+
/** `vCPU-hour`, `GiB-hour` or `GiB`. */
|
|
2142
|
+
unit: string;
|
|
2143
|
+
attributedAmountMinor: string | null;
|
|
2144
|
+
usageValueAmountMinor: string | null;
|
|
2145
|
+
}
|
|
2146
|
+
/** Usage of one sandbox and its share of the organization's usage charge. */
|
|
2147
|
+
interface SandboxUsage {
|
|
2148
|
+
sandboxId: string;
|
|
2149
|
+
/** `null` for usage whose project no longer exists. */
|
|
2150
|
+
project: {
|
|
2151
|
+
projectId: string;
|
|
2152
|
+
projectName: string;
|
|
2153
|
+
} | null;
|
|
2154
|
+
attributedAmountMinor: string | null;
|
|
2155
|
+
usageValueAmountMinor: string | null;
|
|
2156
|
+
resources: {
|
|
2157
|
+
cpu: ResourceUsage;
|
|
2158
|
+
memory: ResourceUsage;
|
|
2159
|
+
sandboxStorage: ResourceUsage;
|
|
2160
|
+
snapshotStorage: ResourceUsage;
|
|
2161
|
+
networkEgress: ResourceUsage;
|
|
2162
|
+
};
|
|
2163
|
+
}
|
|
2164
|
+
/** A share of the organization's pooled usage charge. */
|
|
2165
|
+
interface AttributedUsageCharge {
|
|
2166
|
+
currency: string;
|
|
2167
|
+
amountMinor: string;
|
|
2168
|
+
/** `invoice` for a finalized invoice, `current_price_estimate` otherwise. */
|
|
2169
|
+
basis: "invoice" | "current_price_estimate" | "unknown";
|
|
2170
|
+
}
|
|
2171
|
+
/** Every sandbox of a window with its usage and attributed charge. */
|
|
2172
|
+
interface SandboxUsageExport {
|
|
2173
|
+
windowStart: string;
|
|
2174
|
+
windowEnd: string;
|
|
2175
|
+
/**
|
|
2176
|
+
* The organization's usage charge; the sandboxes' attributed amounts add up
|
|
2177
|
+
* to it exactly. `null` when the organization has no metered price, and on
|
|
2178
|
+
* plans with included usage when the window is not inside the current
|
|
2179
|
+
* billing period.
|
|
2180
|
+
*/
|
|
2181
|
+
attributedUsageCharge: AttributedUsageCharge | null;
|
|
2182
|
+
includedUsage: IncludedUsage | null;
|
|
2183
|
+
/**
|
|
2184
|
+
* The organization's usage at the plan's overage rate; the sandboxes' usage
|
|
2185
|
+
* values add up to it exactly. Set for every window on plans with included
|
|
2186
|
+
* usage.
|
|
2187
|
+
*/
|
|
2188
|
+
attributedUsageValue: {
|
|
2189
|
+
currency: string;
|
|
2190
|
+
amountMinor: string;
|
|
2191
|
+
} | null;
|
|
2192
|
+
sandboxes: SandboxUsage[];
|
|
2193
|
+
}
|
|
2194
|
+
/**
|
|
2195
|
+
* Read an organization's sandbox usage and cost.
|
|
2196
|
+
*
|
|
2197
|
+
* Every read covers the current billing period, or the last `1d`, `7d` or
|
|
2198
|
+
* `30d` when `last` is set. Requests, windows and response parsing are done
|
|
2199
|
+
* by the Rust SDK, the same as for Python and the CLI.
|
|
2200
|
+
*/
|
|
2201
|
+
declare class UsageClient {
|
|
2202
|
+
private readonly native;
|
|
2203
|
+
constructor(options?: UsageClientOptions);
|
|
2204
|
+
close(): void;
|
|
2205
|
+
/** Organization usage totals for the window. */
|
|
2206
|
+
summary(options?: UsageReadOptions): Promise<UsageSummary>;
|
|
2207
|
+
/**
|
|
2208
|
+
* Usage and attributed cost of every sandbox that ran in the window.
|
|
2209
|
+
*
|
|
2210
|
+
* The server computes the attribution once and returns every sandbox in one
|
|
2211
|
+
* response.
|
|
2212
|
+
*/
|
|
2213
|
+
sandboxes(options?: UsageReadOptions): Promise<SandboxUsageExport>;
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2081
2216
|
/**
|
|
2082
2217
|
* Build operations for CAS sandbox images.
|
|
2083
2218
|
*
|
|
@@ -2847,4 +2982,4 @@ declare class RequestExecutionError extends Error {
|
|
|
2847
2982
|
constructor(message: string, functionName?: string);
|
|
2848
2983
|
}
|
|
2849
2984
|
|
|
2850
|
-
export { ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, type AttachFileSystemOptions, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CancelImageBuildOutcome, type CancelImageBuildSelector, type CheckpointOptions, type CheckpointType, type ClaimSandboxOptions, CliNotFoundError, CloudClient, CloudClientOptions, CommandExitReason, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, type FileEntry, FileNotFoundInFilesystemError, FileSystem, type FileSystemMount, Filesystem, FilesystemAPIError, FilesystemClient, type FilesystemClientOptions, FilesystemError, type FilesystemFileRead, type FilesystemInfo, FilesystemMount, FilesystemNotFoundError, type FilesystemReadOptions, type FilesystemSnapshot, type FilesystemSnapshotInfo, type FilesystemStatus, type FilesystemVersion, type GPUResources, type GetOrCreateOptions, type GetOrCreateOutcome, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type GpuModel, type GpuRequest, type HealthResponse, Image, ImageBuildCancellationOutcome, ImageBuildCancelledError, ImageBuildError, ImageBuildErrorCode, type ImageBuildErrorDetails, type ImageBuildEvent, ImageBuildFailedError, ImageBuildHandle, ImageBuildInProgressError, type ImageBuildInfo, ImageBuildInterruptedError, ImageBuildKind, ImageBuildNotFoundError, ImageBuildPhase, type ImageBuildResult, ImageBuildStatus, ImageBuildTimeoutError, type ImageBuildWaitOptions, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, MountError, type MountStatus, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, PendingSandbox, type PendingSandboxRecord, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, ReadOnlyMountNotSupportedError, type ReadyOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RepositoryMount, type RepositoryMountOptions, type RepositoryMountStatus, type RepositoryUnmountOptions, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, ResizeErrorReason, ResizeStatus, type ResourceResizeWaitOptions, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, SandboxPending, SandboxPendingReason, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxResizeError, type SandboxResourceResizeInfo, SandboxStatus, SandboxTemplate, Secret, SecretsList, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, type StartImageBuildOptions, StartImageBuildRequest, type StartImageImportOptions, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TERMINATION_REASON_CANCELLED, TERMINATION_REASON_NO_CAPACITY, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpdateSandboxOptions, UpsertSecretResponse, cancelImageBuild, createFileSystem, deleteFileSystem, getImageBuild, isSandboxPending, listFileSystems, sandboxUrlFromIngressEndpoint, startImageBuild, startImageImport, waitImageBuild };
|
|
2985
|
+
export { ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, type AttachFileSystemOptions, type AttributedUsageCharge, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CancelImageBuildOutcome, type CancelImageBuildSelector, type CheckpointOptions, type CheckpointType, type ClaimSandboxOptions, CliNotFoundError, CloudClient, CloudClientOptions, CommandExitReason, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, type FileEntry, FileNotFoundInFilesystemError, FileSystem, type FileSystemMount, Filesystem, FilesystemAPIError, FilesystemClient, type FilesystemClientOptions, FilesystemError, type FilesystemFileRead, type FilesystemInfo, FilesystemMount, FilesystemNotFoundError, type FilesystemReadOptions, type FilesystemSnapshot, type FilesystemSnapshotInfo, type FilesystemStatus, type FilesystemVersion, type GPUResources, type GetOrCreateOptions, type GetOrCreateOutcome, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type GpuModel, type GpuRequest, type HealthResponse, Image, ImageBuildCancellationOutcome, ImageBuildCancelledError, ImageBuildError, ImageBuildErrorCode, type ImageBuildErrorDetails, type ImageBuildEvent, ImageBuildFailedError, ImageBuildHandle, ImageBuildInProgressError, type ImageBuildInfo, ImageBuildInterruptedError, ImageBuildKind, ImageBuildNotFoundError, ImageBuildPhase, type ImageBuildResult, ImageBuildStatus, ImageBuildTimeoutError, type ImageBuildWaitOptions, type IncludedUsage, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, MountError, type MountStatus, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, PendingSandbox, type PendingSandboxRecord, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, ReadOnlyMountNotSupportedError, type ReadyOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RepositoryMount, type RepositoryMountOptions, type RepositoryMountStatus, type RepositoryUnmountOptions, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, ResizeErrorReason, ResizeStatus, type ResourceResizeWaitOptions, type ResourceUsage, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, SandboxPending, SandboxPendingReason, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxResizeError, type SandboxResourceResizeInfo, SandboxStatus, SandboxTemplate, type SandboxUsage, type SandboxUsageExport, Secret, SecretsList, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, type StartImageBuildOptions, StartImageBuildRequest, type StartImageImportOptions, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TERMINATION_REASON_CANCELLED, TERMINATION_REASON_NO_CAPACITY, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpdateSandboxOptions, UpsertSecretResponse, type UsageCharge, UsageClient, type UsageClientOptions, type UsageLookback, type UsageReadOptions, type UsageSummary, cancelImageBuild, createFileSystem, deleteFileSystem, getImageBuild, isSandboxPending, listFileSystems, sandboxUrlFromIngressEndpoint, startImageBuild, startImageImport, waitImageBuild };
|
package/dist/index.d.ts
CHANGED
|
@@ -2078,6 +2078,141 @@ declare class RepositoryClient {
|
|
|
2078
2078
|
private tracedJson;
|
|
2079
2079
|
}
|
|
2080
2080
|
|
|
2081
|
+
/** How far back to read instead of the current billing period. */
|
|
2082
|
+
type UsageLookback = "1d" | "7d" | "30d";
|
|
2083
|
+
interface UsageClientOptions {
|
|
2084
|
+
/** Tensorlake API key. Defaults to `TENSORLAKE_API_KEY`. */
|
|
2085
|
+
apiKey?: string;
|
|
2086
|
+
/** Organization to read. Defaults to `TENSORLAKE_ORGANIZATION_ID`. */
|
|
2087
|
+
organizationId?: string;
|
|
2088
|
+
/** Cloud API URL. Defaults to `TENSORLAKE_API_URL`. */
|
|
2089
|
+
apiUrl?: string;
|
|
2090
|
+
}
|
|
2091
|
+
interface UsageReadOptions {
|
|
2092
|
+
/** Read the last `1d`, `7d` or `30d` instead of the current billing period. */
|
|
2093
|
+
last?: UsageLookback;
|
|
2094
|
+
}
|
|
2095
|
+
/** Metered usage, excluding subscription fees and tax. */
|
|
2096
|
+
interface UsageCharge {
|
|
2097
|
+
currency: string;
|
|
2098
|
+
amountMinor: string;
|
|
2099
|
+
resources: {
|
|
2100
|
+
cpuAmountMinor: string;
|
|
2101
|
+
memoryAmountMinor: string;
|
|
2102
|
+
sandboxStorageAmountMinor: string;
|
|
2103
|
+
snapshotStorageAmountMinor: string;
|
|
2104
|
+
};
|
|
2105
|
+
}
|
|
2106
|
+
/** Plan allowance consumption, valued at the overage rate. */
|
|
2107
|
+
interface IncludedUsage {
|
|
2108
|
+
currency: string;
|
|
2109
|
+
includedAmountMinor: string;
|
|
2110
|
+
periodUsedAmountMinor: string;
|
|
2111
|
+
rangeUsageAmountMinor: string;
|
|
2112
|
+
periodStart: string;
|
|
2113
|
+
periodEnd: string;
|
|
2114
|
+
}
|
|
2115
|
+
/** Organization usage totals for a window. */
|
|
2116
|
+
interface UsageSummary {
|
|
2117
|
+
windowStart: string;
|
|
2118
|
+
windowEnd: string;
|
|
2119
|
+
computeUnits: string;
|
|
2120
|
+
/**
|
|
2121
|
+
* `null` when the organization has no metered price, and on plans with
|
|
2122
|
+
* included usage (Pro, Enterprise) when the window is not inside the current
|
|
2123
|
+
* billing period. Use `usageValue` then.
|
|
2124
|
+
*/
|
|
2125
|
+
usageCharge: UsageCharge | null;
|
|
2126
|
+
includedUsage: IncludedUsage | null;
|
|
2127
|
+
/**
|
|
2128
|
+
* Usage valued at the plan's overage rate, before included usage. Set for
|
|
2129
|
+
* every window on plans with included usage, `null` otherwise.
|
|
2130
|
+
*/
|
|
2131
|
+
usageValue: UsageCharge | null;
|
|
2132
|
+
runningSandboxes: number;
|
|
2133
|
+
projects: Array<{
|
|
2134
|
+
projectId: string;
|
|
2135
|
+
projectName: string;
|
|
2136
|
+
computeUnits: string;
|
|
2137
|
+
}>;
|
|
2138
|
+
}
|
|
2139
|
+
interface ResourceUsage {
|
|
2140
|
+
quantity: string;
|
|
2141
|
+
/** `vCPU-hour`, `GiB-hour` or `GiB`. */
|
|
2142
|
+
unit: string;
|
|
2143
|
+
attributedAmountMinor: string | null;
|
|
2144
|
+
usageValueAmountMinor: string | null;
|
|
2145
|
+
}
|
|
2146
|
+
/** Usage of one sandbox and its share of the organization's usage charge. */
|
|
2147
|
+
interface SandboxUsage {
|
|
2148
|
+
sandboxId: string;
|
|
2149
|
+
/** `null` for usage whose project no longer exists. */
|
|
2150
|
+
project: {
|
|
2151
|
+
projectId: string;
|
|
2152
|
+
projectName: string;
|
|
2153
|
+
} | null;
|
|
2154
|
+
attributedAmountMinor: string | null;
|
|
2155
|
+
usageValueAmountMinor: string | null;
|
|
2156
|
+
resources: {
|
|
2157
|
+
cpu: ResourceUsage;
|
|
2158
|
+
memory: ResourceUsage;
|
|
2159
|
+
sandboxStorage: ResourceUsage;
|
|
2160
|
+
snapshotStorage: ResourceUsage;
|
|
2161
|
+
networkEgress: ResourceUsage;
|
|
2162
|
+
};
|
|
2163
|
+
}
|
|
2164
|
+
/** A share of the organization's pooled usage charge. */
|
|
2165
|
+
interface AttributedUsageCharge {
|
|
2166
|
+
currency: string;
|
|
2167
|
+
amountMinor: string;
|
|
2168
|
+
/** `invoice` for a finalized invoice, `current_price_estimate` otherwise. */
|
|
2169
|
+
basis: "invoice" | "current_price_estimate" | "unknown";
|
|
2170
|
+
}
|
|
2171
|
+
/** Every sandbox of a window with its usage and attributed charge. */
|
|
2172
|
+
interface SandboxUsageExport {
|
|
2173
|
+
windowStart: string;
|
|
2174
|
+
windowEnd: string;
|
|
2175
|
+
/**
|
|
2176
|
+
* The organization's usage charge; the sandboxes' attributed amounts add up
|
|
2177
|
+
* to it exactly. `null` when the organization has no metered price, and on
|
|
2178
|
+
* plans with included usage when the window is not inside the current
|
|
2179
|
+
* billing period.
|
|
2180
|
+
*/
|
|
2181
|
+
attributedUsageCharge: AttributedUsageCharge | null;
|
|
2182
|
+
includedUsage: IncludedUsage | null;
|
|
2183
|
+
/**
|
|
2184
|
+
* The organization's usage at the plan's overage rate; the sandboxes' usage
|
|
2185
|
+
* values add up to it exactly. Set for every window on plans with included
|
|
2186
|
+
* usage.
|
|
2187
|
+
*/
|
|
2188
|
+
attributedUsageValue: {
|
|
2189
|
+
currency: string;
|
|
2190
|
+
amountMinor: string;
|
|
2191
|
+
} | null;
|
|
2192
|
+
sandboxes: SandboxUsage[];
|
|
2193
|
+
}
|
|
2194
|
+
/**
|
|
2195
|
+
* Read an organization's sandbox usage and cost.
|
|
2196
|
+
*
|
|
2197
|
+
* Every read covers the current billing period, or the last `1d`, `7d` or
|
|
2198
|
+
* `30d` when `last` is set. Requests, windows and response parsing are done
|
|
2199
|
+
* by the Rust SDK, the same as for Python and the CLI.
|
|
2200
|
+
*/
|
|
2201
|
+
declare class UsageClient {
|
|
2202
|
+
private readonly native;
|
|
2203
|
+
constructor(options?: UsageClientOptions);
|
|
2204
|
+
close(): void;
|
|
2205
|
+
/** Organization usage totals for the window. */
|
|
2206
|
+
summary(options?: UsageReadOptions): Promise<UsageSummary>;
|
|
2207
|
+
/**
|
|
2208
|
+
* Usage and attributed cost of every sandbox that ran in the window.
|
|
2209
|
+
*
|
|
2210
|
+
* The server computes the attribution once and returns every sandbox in one
|
|
2211
|
+
* response.
|
|
2212
|
+
*/
|
|
2213
|
+
sandboxes(options?: UsageReadOptions): Promise<SandboxUsageExport>;
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2081
2216
|
/**
|
|
2082
2217
|
* Build operations for CAS sandbox images.
|
|
2083
2218
|
*
|
|
@@ -2847,4 +2982,4 @@ declare class RequestExecutionError extends Error {
|
|
|
2847
2982
|
constructor(message: string, functionName?: string);
|
|
2848
2983
|
}
|
|
2849
2984
|
|
|
2850
|
-
export { ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, type AttachFileSystemOptions, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CancelImageBuildOutcome, type CancelImageBuildSelector, type CheckpointOptions, type CheckpointType, type ClaimSandboxOptions, CliNotFoundError, CloudClient, CloudClientOptions, CommandExitReason, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, type FileEntry, FileNotFoundInFilesystemError, FileSystem, type FileSystemMount, Filesystem, FilesystemAPIError, FilesystemClient, type FilesystemClientOptions, FilesystemError, type FilesystemFileRead, type FilesystemInfo, FilesystemMount, FilesystemNotFoundError, type FilesystemReadOptions, type FilesystemSnapshot, type FilesystemSnapshotInfo, type FilesystemStatus, type FilesystemVersion, type GPUResources, type GetOrCreateOptions, type GetOrCreateOutcome, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type GpuModel, type GpuRequest, type HealthResponse, Image, ImageBuildCancellationOutcome, ImageBuildCancelledError, ImageBuildError, ImageBuildErrorCode, type ImageBuildErrorDetails, type ImageBuildEvent, ImageBuildFailedError, ImageBuildHandle, ImageBuildInProgressError, type ImageBuildInfo, ImageBuildInterruptedError, ImageBuildKind, ImageBuildNotFoundError, ImageBuildPhase, type ImageBuildResult, ImageBuildStatus, ImageBuildTimeoutError, type ImageBuildWaitOptions, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, MountError, type MountStatus, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, PendingSandbox, type PendingSandboxRecord, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, ReadOnlyMountNotSupportedError, type ReadyOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RepositoryMount, type RepositoryMountOptions, type RepositoryMountStatus, type RepositoryUnmountOptions, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, ResizeErrorReason, ResizeStatus, type ResourceResizeWaitOptions, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, SandboxPending, SandboxPendingReason, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxResizeError, type SandboxResourceResizeInfo, SandboxStatus, SandboxTemplate, Secret, SecretsList, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, type StartImageBuildOptions, StartImageBuildRequest, type StartImageImportOptions, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TERMINATION_REASON_CANCELLED, TERMINATION_REASON_NO_CAPACITY, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpdateSandboxOptions, UpsertSecretResponse, cancelImageBuild, createFileSystem, deleteFileSystem, getImageBuild, isSandboxPending, listFileSystems, sandboxUrlFromIngressEndpoint, startImageBuild, startImageImport, waitImageBuild };
|
|
2985
|
+
export { ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, type AttachFileSystemOptions, type AttributedUsageCharge, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CancelImageBuildOutcome, type CancelImageBuildSelector, type CheckpointOptions, type CheckpointType, type ClaimSandboxOptions, CliNotFoundError, CloudClient, CloudClientOptions, CommandExitReason, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, type FileEntry, FileNotFoundInFilesystemError, FileSystem, type FileSystemMount, Filesystem, FilesystemAPIError, FilesystemClient, type FilesystemClientOptions, FilesystemError, type FilesystemFileRead, type FilesystemInfo, FilesystemMount, FilesystemNotFoundError, type FilesystemReadOptions, type FilesystemSnapshot, type FilesystemSnapshotInfo, type FilesystemStatus, type FilesystemVersion, type GPUResources, type GetOrCreateOptions, type GetOrCreateOutcome, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type GpuModel, type GpuRequest, type HealthResponse, Image, ImageBuildCancellationOutcome, ImageBuildCancelledError, ImageBuildError, ImageBuildErrorCode, type ImageBuildErrorDetails, type ImageBuildEvent, ImageBuildFailedError, ImageBuildHandle, ImageBuildInProgressError, type ImageBuildInfo, ImageBuildInterruptedError, ImageBuildKind, ImageBuildNotFoundError, ImageBuildPhase, type ImageBuildResult, ImageBuildStatus, ImageBuildTimeoutError, type ImageBuildWaitOptions, type IncludedUsage, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, MountError, type MountStatus, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, PendingSandbox, type PendingSandboxRecord, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, ReadOnlyMountNotSupportedError, type ReadyOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RepositoryMount, type RepositoryMountOptions, type RepositoryMountStatus, type RepositoryUnmountOptions, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, ResizeErrorReason, ResizeStatus, type ResourceResizeWaitOptions, type ResourceUsage, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, SandboxPending, SandboxPendingReason, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxResizeError, type SandboxResourceResizeInfo, SandboxStatus, SandboxTemplate, type SandboxUsage, type SandboxUsageExport, Secret, SecretsList, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, type StartImageBuildOptions, StartImageBuildRequest, type StartImageImportOptions, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TERMINATION_REASON_CANCELLED, TERMINATION_REASON_NO_CAPACITY, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpdateSandboxOptions, UpsertSecretResponse, type UsageCharge, UsageClient, type UsageClientOptions, type UsageLookback, type UsageReadOptions, type UsageSummary, cancelImageBuild, createFileSystem, deleteFileSystem, getImageBuild, isSandboxPending, listFileSystems, sandboxUrlFromIngressEndpoint, startImageBuild, startImageImport, waitImageBuild };
|
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ var init_defaults = __esm({
|
|
|
46
46
|
"src/defaults.ts"() {
|
|
47
47
|
"use strict";
|
|
48
48
|
init_esm_shims();
|
|
49
|
-
SDK_VERSION = "0.5.
|
|
49
|
+
SDK_VERSION = "0.5.160";
|
|
50
50
|
API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
|
|
51
51
|
API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
|
|
52
52
|
NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
|
|
@@ -332,6 +332,11 @@ function createWorkerBinding(runtime) {
|
|
|
332
332
|
return runtime.handle("NativeRepositoryClient", args);
|
|
333
333
|
}
|
|
334
334
|
},
|
|
335
|
+
NativeUsageClient: class {
|
|
336
|
+
constructor(...args) {
|
|
337
|
+
return runtime.handle("NativeUsageClient", args);
|
|
338
|
+
}
|
|
339
|
+
},
|
|
335
340
|
NativeTcpTunnel: class {
|
|
336
341
|
constructor() {
|
|
337
342
|
return runtime.handle("NativeTcpTunnel", []);
|
|
@@ -514,7 +519,7 @@ var init_native_worker_client = __esm({
|
|
|
514
519
|
}
|
|
515
520
|
};
|
|
516
521
|
runtimeKey = /* @__PURE__ */ Symbol.for(
|
|
517
|
-
`tensorlake.native.worker.${false ? "source" : "0.5.
|
|
522
|
+
`tensorlake.native.worker.${false ? "source" : "0.5.160"}.v1`
|
|
518
523
|
);
|
|
519
524
|
runtimes = globalThis;
|
|
520
525
|
}
|
|
@@ -8795,6 +8800,59 @@ function validateTimeoutMs2(timeoutMs) {
|
|
|
8795
8800
|
}
|
|
8796
8801
|
}
|
|
8797
8802
|
|
|
8803
|
+
// src/usage.ts
|
|
8804
|
+
init_esm_shims();
|
|
8805
|
+
init_defaults();
|
|
8806
|
+
init_errors();
|
|
8807
|
+
init_native_sandbox();
|
|
8808
|
+
init_native_worker_client();
|
|
8809
|
+
var UsageClient = class {
|
|
8810
|
+
native;
|
|
8811
|
+
constructor(options) {
|
|
8812
|
+
const apiKey = options?.apiKey ?? API_KEY;
|
|
8813
|
+
if (!apiKey) {
|
|
8814
|
+
throw new SandboxError("Missing TENSORLAKE_API_KEY credentials.");
|
|
8815
|
+
}
|
|
8816
|
+
const organizationId = options?.organizationId ?? process.env.TENSORLAKE_ORGANIZATION_ID;
|
|
8817
|
+
if (!organizationId) {
|
|
8818
|
+
throw new SandboxError(
|
|
8819
|
+
"An organization ID is required. Pass organizationId or set TENSORLAKE_ORGANIZATION_ID."
|
|
8820
|
+
);
|
|
8821
|
+
}
|
|
8822
|
+
const binding = loadNativeSandboxBinding();
|
|
8823
|
+
if (typeof binding.NativeUsageClient !== "function") {
|
|
8824
|
+
throw new SandboxError(
|
|
8825
|
+
"native binding does not export the usage client; rebuild with 'npm run build:native'"
|
|
8826
|
+
);
|
|
8827
|
+
}
|
|
8828
|
+
this.native = new binding.NativeUsageClient(
|
|
8829
|
+
options?.apiUrl ?? API_URL,
|
|
8830
|
+
apiKey,
|
|
8831
|
+
organizationId,
|
|
8832
|
+
`tensorlake-typescript-sdk/${SDK_VERSION}`,
|
|
8833
|
+
DEFAULT_HTTP_TIMEOUT_MS / 1e3
|
|
8834
|
+
);
|
|
8835
|
+
}
|
|
8836
|
+
close() {
|
|
8837
|
+
releaseNativeHandle(this.native);
|
|
8838
|
+
}
|
|
8839
|
+
/** Organization usage totals for the window. */
|
|
8840
|
+
async summary(options) {
|
|
8841
|
+
const { json } = await callNative(() => this.native.summary(options?.last ?? null));
|
|
8842
|
+
return JSON.parse(json);
|
|
8843
|
+
}
|
|
8844
|
+
/**
|
|
8845
|
+
* Usage and attributed cost of every sandbox that ran in the window.
|
|
8846
|
+
*
|
|
8847
|
+
* The server computes the attribution once and returns every sandbox in one
|
|
8848
|
+
* response.
|
|
8849
|
+
*/
|
|
8850
|
+
async sandboxes(options) {
|
|
8851
|
+
const { json } = await callNative(() => this.native.sandboxes(options?.last ?? null));
|
|
8852
|
+
return JSON.parse(json);
|
|
8853
|
+
}
|
|
8854
|
+
};
|
|
8855
|
+
|
|
8798
8856
|
// src/index.ts
|
|
8799
8857
|
init_sandbox_image();
|
|
8800
8858
|
init_image_builds();
|
|
@@ -10707,6 +10765,7 @@ export {
|
|
|
10707
10765
|
TERMINATION_REASON_CANCELLED,
|
|
10708
10766
|
TERMINATION_REASON_NO_CAPACITY,
|
|
10709
10767
|
TcpTunnel,
|
|
10768
|
+
UsageClient,
|
|
10710
10769
|
cancelImageBuild,
|
|
10711
10770
|
createFileSystem,
|
|
10712
10771
|
createSandboxImage,
|