@sylphx/sdk 0.19.3 → 0.21.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 +47 -3
- package/dist/index.d.ts +843 -23
- package/dist/index.mjs +766 -15
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.mjs +31 -25
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/react/index.d.ts +32 -2
- package/dist/react/index.mjs +92 -9
- package/dist/react/index.mjs.map +1 -1
- package/dist/server/index.d.ts +36 -7
- package/dist/server/index.mjs +31 -29
- package/dist/server/index.mjs.map +1 -1
- package/dist/tasks.d.ts +1463 -0
- package/dist/tasks.mjs +1907 -0
- package/dist/tasks.mjs.map +1 -0
- package/package.json +10 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DEFAULT_MACHINE_SIZE, MACHINE_CONFIGS, MACHINE_MAX_INSTANCES, MACHINE_RESOURCE_REQUIREMENTS, MACHINE_SIZES, MachineConfig, MachineResourceRequirements, MachineTierResources, isMachineSize, parseMachineSize, resolveMachineConfig, resolveMachineMaxInstances, resolveMachineResources, resolveMachineTierResources, toPublicMachineSize } from '@sylphx/contract/compute';
|
|
2
|
-
import { ManagedWorkspace, CreateWorkspaceInput, ForkWorkspaceInput, SdkBillingPlan, SdkBillingSubscription, BillingCheckoutRequest, BillingCheckoutResponse, BillingPortalRequest, BillingPortalResponse, BillingBalanceResponse, BillingUsageResponse, SdkConsentType, UserConsent as UserConsent$1, AIModel as AIModel$1, GetModelsResponse, GetRateLimitResponse, GetUsageResponse, ReferralLeaderboardEntry, ReferralRewardDefaults as ReferralRewardDefaults$1, WebhookDelivery as WebhookDelivery$1, OAuthTokenResponse, OAuthTokenErrorResponse, OAuthClientCredentialsResponse, LogoutInput, RefreshTokenInput, RefreshTokenResult, OAuthIntrospectResponse, PlatformPasswordChangeRequest, PlatformPasswordChangeResponse, PlatformPasswordSetRequest, PlatformPasswordSetResponse, PlatformPasswordStatusResponse, PlatformSessionRenameRequest, PlatformSessionRenameResponse, PlatformSessionRevokeAllResponse, PlatformSessionRevokeRequest, PlatformSessionRevokeOtherResponse, PlatformSessionRevokeResponse, PlatformSessionsListResponse, AuthUserDeleteRequest, AuthUserDeleteResponse, AuthUserExportResponse, DeviceApproveRequest, DeviceApproveResponse, DeviceDenyRequest, DeviceDenyResponse, DeviceInitResponse, DeviceInitRequest, DevicePollResponse, LoginRequest as LoginRequest$1, LoginResponse as LoginResponse$1, UserFullProfile as UserFullProfile$1, RegisterRequest as RegisterRequest$1, RegisterResponse as RegisterResponse$1, ResendEmailVerificationRequest as ResendEmailVerificationRequest$1, ResendEmailVerificationResponse as ResendEmailVerificationResponse$1, AuthTokensResponse, TwoFactorVerifyRequest as TwoFactorVerifyRequest$1, PlatformAuditQueryRequest, PlatformAuditQueryResponse, PlatformRateLimitStatusRequest, PlatformRateLimitStatusResponse, PlatformRateLimitStrategiesListRequest, PlatformRateLimitStrategiesListResponse, PlatformRateLimitStrategyDeleteRequest, PlatformRateLimitStrategyDeleteResponse, PlatformRateLimitStrategyUpsertRequest, PlatformRateLimitStrategyUpsertResponse, File as File$1, UploadId, FileId, TakedownFileRequest, TakedownFileResult, FileVersion, FileVersionId, CreateOrgInput as CreateOrgInput$1, InviteMemberInput as InviteMemberInput$1, OrgSdkRole, OrgInvitation, OrgMember, MembershipInfo, Organization, UpdateOrgInput as UpdateOrgInput$1, UserOrganizationMembership, UserOrganizationsResponse,
|
|
3
|
-
export { BillingBalanceResponse as BalanceResponse, CI_LINUX_RUNNER_SIZES, CI_MACOS_RUNNER_SIZES, CI_RUNNER_PROFILES, BillingCheckoutRequest as CheckoutRequest, BillingCheckoutResponse as CheckoutResponse, CiLinuxRunnerSize, CiMacosRunnerSize, CiRunnerPlatform, CiRunnerProfile, CiRunnerProfileId, CiRunnerWorkflowRunsOn, CreateWorkspaceInput, FileId, FileVersion, FileVersionId, FileVisibility, ForkWorkspaceInput, Organization, BillingPortalRequest as PortalRequest, BillingPortalResponse as PortalResponse, SignedUrlDisposition, File as StorageFile, UploadId, BillingUsageResponse as UsageResponse, formatCiRunnerWorkflowRunsOn, getCiRunnerProfileById } from '@sylphx/contract';
|
|
2
|
+
import { ManagedWorkspace, CreateWorkspaceInput, ForkWorkspaceInput, WorkspaceCapacitySnapshot, PinWorkspaceInput, PinWorkspaceResult, ReclaimWorkspaceInput, ReclaimWorkspaceResult, ReclaimWorkspaceSubpathInput, ReclaimWorkspaceSubpathResult, SdkBillingPlan, SdkBillingSubscription, BillingCheckoutRequest, BillingCheckoutResponse, BillingPortalRequest, BillingPortalResponse, BillingBalanceResponse, BillingUsageResponse, SdkConsentType, UserConsent as UserConsent$1, AIModel as AIModel$1, GetModelsResponse, GetRateLimitResponse, GetUsageResponse, ReferralLeaderboardEntry, ReferralRewardDefaults as ReferralRewardDefaults$1, WebhookDelivery as WebhookDelivery$1, OAuthTokenResponse, OAuthTokenErrorResponse, OAuthClientCredentialsResponse, LogoutInput, RefreshTokenInput, RefreshTokenResult, OAuthIntrospectResponse, PlatformPasswordChangeRequest, PlatformPasswordChangeResponse, PlatformPasswordSetRequest, PlatformPasswordSetResponse, PlatformPasswordStatusResponse, PlatformSessionRenameRequest, PlatformSessionRenameResponse, PlatformSessionRevokeAllResponse, PlatformSessionRevokeRequest, PlatformSessionRevokeOtherResponse, PlatformSessionRevokeResponse, PlatformSessionsListResponse, AuthUserDeleteRequest, AuthUserDeleteResponse, AuthUserExportResponse, DeviceApproveRequest, DeviceApproveResponse, DeviceDenyRequest, DeviceDenyResponse, DeviceInitResponse, DeviceInitRequest, DevicePollResponse, LoginRequest as LoginRequest$1, LoginResponse as LoginResponse$1, UserFullProfile as UserFullProfile$1, RegisterRequest as RegisterRequest$1, RegisterResponse as RegisterResponse$1, ResendEmailVerificationRequest as ResendEmailVerificationRequest$1, ResendEmailVerificationResponse as ResendEmailVerificationResponse$1, AuthTokensResponse, TwoFactorVerifyRequest as TwoFactorVerifyRequest$1, PlatformAuditQueryRequest, PlatformAuditQueryResponse, PlatformRateLimitStatusRequest, PlatformRateLimitStatusResponse, PlatformRateLimitStrategiesListRequest, PlatformRateLimitStrategiesListResponse, PlatformRateLimitStrategyDeleteRequest, PlatformRateLimitStrategyDeleteResponse, PlatformRateLimitStrategyUpsertRequest, PlatformRateLimitStrategyUpsertResponse, File as File$1, UploadId, FileId, TakedownFileRequest, TakedownFileResult, FileVersion, FileVersionId, MachineSize, DurableWorkGetTaskRunResponse, DurableWorkTaskRunStep, CreateOrgInput as CreateOrgInput$1, InviteMemberInput as InviteMemberInput$1, OrgSdkRole, OrgInvitation, OrgMember, MembershipInfo, Organization, UpdateOrgInput as UpdateOrgInput$1, UserOrganizationMembership, UserOrganizationsResponse, SandboxCapabilitiesReport, PublishArtifactRequest, ArtifactResult, ListArtifactsResult, ArtifactDetail, ArtifactContent, DeleteArtifactResult, RestoreArtifactResult, ReshareArtifactResult, RenderRequest, RenderResult, GrantRequest, Grant, BalanceSummary, ReserveRequest, Reservation, ConsumeRequest, LedgerEntry, ReleaseRequest, VoidGrantRequest, CreateDeviceSessionInput, DeviceSessionResult, ListDeviceSessionsQuery, ListDeviceSessionsResult, InstallDeviceSessionAppInput, InstallDeviceSessionAppResult, DeviceSessionInput, DeviceSessionInputResult, LaunchDeviceSessionAppInput, LaunchDeviceSessionAppResult, DeviceSessionScreenshotResult, DeviceSessionLogcatQuery, DeviceSessionLogcatResult, DeviceSessionStreamConnectInput, DeviceSessionStreamConnectResult, DeleteDeviceSessionResult, DurableWorkRunCompletionMode, DistributedRun, DistributedRunShard, DistributedRunAggregateStatus } from '@sylphx/contract';
|
|
3
|
+
export { ArtifactResult, BillingBalanceResponse as BalanceResponse, CI_LINUX_RUNNER_SIZES, CI_MACOS_RUNNER_SIZES, CI_RUNNER_PROFILES, BillingCheckoutRequest as CheckoutRequest, BillingCheckoutResponse as CheckoutResponse, CiLinuxRunnerSize, CiMacosRunnerSize, CiRunnerPlatform, CiRunnerProfile, CiRunnerProfileId, CiRunnerWorkflowRunsOn, CreateDeviceSessionInput, CreateWorkspaceInput, DeleteDeviceSessionResult, DeviceSessionInput, DeviceSessionInputResult, DeviceSessionLogcatQuery, DeviceSessionLogcatResult, DeviceSessionResult, DeviceSessionScreenshotResult, DeviceSessionStreamConnectInput, DeviceSessionStreamConnectResult, DistributedRun, DistributedRunShard, DurableWorkRunCompletionMode, FileId, FileVersion, FileVersionId, FileVisibility, ForkWorkspaceInput, InstallDeviceSessionAppInput, InstallDeviceSessionAppResult, LaunchDeviceSessionAppInput, LaunchDeviceSessionAppResult, ListDeviceSessionsQuery, ListDeviceSessionsResult, Organization, PinWorkspaceInput, BillingPortalRequest as PortalRequest, BillingPortalResponse as PortalResponse, PublishArtifactRequest, ReclaimWorkspaceInput, ReclaimWorkspaceSubpathInput, RenderRequest, RenderResult, SandboxCapabilitiesReport, SignedUrlDisposition, File as StorageFile, UploadId, BillingUsageResponse as UsageResponse, WorkspaceCapacitySnapshot, formatCiRunnerWorkflowRunsOn, getCiRunnerProfileById } from '@sylphx/contract';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Functions Admin namespace — Platform-plane function-bundle admin
|
|
@@ -619,8 +619,12 @@ type WorkspaceRecord = ManagedWorkspace;
|
|
|
619
619
|
|
|
620
620
|
declare function listWorkspaces(config: SylphxConfig): Promise<readonly WorkspaceRecord[]>;
|
|
621
621
|
declare function getWorkspace(config: SylphxConfig, workspaceId: string): Promise<WorkspaceRecord>;
|
|
622
|
+
declare function getWorkspaceCapacity(config: SylphxConfig, workspaceId: string): Promise<WorkspaceCapacitySnapshot>;
|
|
622
623
|
declare function createWorkspace(config: SylphxConfig, input: CreateWorkspaceInput): Promise<WorkspaceRecord>;
|
|
623
624
|
declare function forkWorkspace(config: SylphxConfig, sourceWorkspaceId: string, input?: ForkWorkspaceInput): Promise<WorkspaceRecord>;
|
|
625
|
+
declare function pinWorkspace(config: SylphxConfig, workspaceId: string, input?: PinWorkspaceInput): Promise<PinWorkspaceResult>;
|
|
626
|
+
declare function reclaimWorkspace(config: SylphxConfig, workspaceId: string, input?: ReclaimWorkspaceInput): Promise<ReclaimWorkspaceResult>;
|
|
627
|
+
declare function reclaimWorkspaceSubpath(config: SylphxConfig, workspaceId: string, input: ReclaimWorkspaceSubpathInput): Promise<ReclaimWorkspaceSubpathResult>;
|
|
624
628
|
declare function deleteWorkspace(config: SylphxConfig, workspaceId: string): Promise<void>;
|
|
625
629
|
|
|
626
630
|
/**
|
|
@@ -733,7 +737,14 @@ declare const COMPUTE_VCPU_ACTIVE_RATE_MICRODOLLARS = 400;
|
|
|
733
737
|
declare const COMPUTE_VCPU_IDLE_RATE_MICRODOLLARS = 50;
|
|
734
738
|
/** RAM rate: $0.010/GB-hr = $0.000167/GB-min = 167 microdollars/GB-min (ADR-034) */
|
|
735
739
|
declare const COMPUTE_RAM_RATE_MICRODOLLARS = 167;
|
|
736
|
-
/**
|
|
740
|
+
/**
|
|
741
|
+
* Build minute prices by machine type in microdollars per minute (ADR-034).
|
|
742
|
+
*
|
|
743
|
+
* `standard` repriced $0.014 → $0.006 per ADR-2571 to match the GitHub Actions
|
|
744
|
+
* Jan-2026 Linux floor and resolve the SSOT conflict with the billed DB row
|
|
745
|
+
* (migration 0062 was $0.008). The DB row is superseded to $0.006 in the same
|
|
746
|
+
* change (migration 0084, effective 2026-07-20).
|
|
747
|
+
*/
|
|
737
748
|
declare const BUILD_MINUTE_PRICES: Record<string, number>;
|
|
738
749
|
/** Build minute size multipliers for quota tracking (ADR-034) */
|
|
739
750
|
declare const BUILD_SIZE_MULTIPLIERS: Record<string, number>;
|
|
@@ -3364,6 +3375,13 @@ interface RegisterInput {
|
|
|
3364
3375
|
email: string;
|
|
3365
3376
|
password: string;
|
|
3366
3377
|
name?: string;
|
|
3378
|
+
/**
|
|
3379
|
+
* Server-verified CAPTCHA challenge token for projects that require
|
|
3380
|
+
* bot protection on email/password registration. Obtain this from the
|
|
3381
|
+
* public app metadata CAPTCHA config and never send provider secrets to
|
|
3382
|
+
* the browser.
|
|
3383
|
+
*/
|
|
3384
|
+
captchaToken?: string;
|
|
3367
3385
|
metadata?: Record<string, unknown>;
|
|
3368
3386
|
invitationToken?: string;
|
|
3369
3387
|
}
|
|
@@ -4637,6 +4655,268 @@ declare const campaigns: {
|
|
|
4637
4655
|
stats(config: SylphxConfig, id: string): Promise<PushCampaignStats>;
|
|
4638
4656
|
};
|
|
4639
4657
|
|
|
4658
|
+
/**
|
|
4659
|
+
* task() / taskStub()
|
|
4660
|
+
*
|
|
4661
|
+
* Core compute primitives — Trigger.dev v4 inspired.
|
|
4662
|
+
*
|
|
4663
|
+
* task() — define a TypeScript task handler that gets a typed TaskHandle
|
|
4664
|
+
* taskStub() — typed stub for cross-language tasks (Python, etc.)
|
|
4665
|
+
*
|
|
4666
|
+
* Both return a TaskHandle<TPayload, TResult> with:
|
|
4667
|
+
* .trigger(payload) → fire-and-forget, returns RunHandle
|
|
4668
|
+
* .triggerAndWait(payload) → dispatch + poll until complete
|
|
4669
|
+
* .batchTrigger(payloads) → parallel dispatch N runs
|
|
4670
|
+
*
|
|
4671
|
+
* RunHandle exposes waitForCompletion() and cancel().
|
|
4672
|
+
*
|
|
4673
|
+
* Config is auto-resolved from SYLPHX_SECRET_URL or passed explicitly via
|
|
4674
|
+
* TriggerOptions.config.
|
|
4675
|
+
*
|
|
4676
|
+
* @example TypeScript task (function mode — HTTP callback in running service)
|
|
4677
|
+
* ```typescript
|
|
4678
|
+
* export const sendEmail = task({
|
|
4679
|
+
* id: 'send-email',
|
|
4680
|
+
* run: async ({ to, subject }, { step }) => {
|
|
4681
|
+
* const validated = await step.run('validate', () => validate(to))
|
|
4682
|
+
* await step.sleep('cooldown', '5 minutes')
|
|
4683
|
+
* return step.run('send', () => mailer.send(validated, subject))
|
|
4684
|
+
* }
|
|
4685
|
+
* })
|
|
4686
|
+
*
|
|
4687
|
+
* // From anywhere — fully type-safe
|
|
4688
|
+
* const handle = await sendEmail.trigger({ to: 'kyle@...', subject: 'Hi' })
|
|
4689
|
+
* const result = await handle.waitForCompletion()
|
|
4690
|
+
* ```
|
|
4691
|
+
*
|
|
4692
|
+
* @example TypeScript task (job mode — isolated runtime, managed machine)
|
|
4693
|
+
* ```typescript
|
|
4694
|
+
* export const processVideo = task({
|
|
4695
|
+
* id: 'process-video',
|
|
4696
|
+
* machine: 'large',
|
|
4697
|
+
* run: async ({ videoUrl }) => { ... }
|
|
4698
|
+
* })
|
|
4699
|
+
* ```
|
|
4700
|
+
*
|
|
4701
|
+
* @example Cross-language stub (Python ML training)
|
|
4702
|
+
* ```typescript
|
|
4703
|
+
* // Register in sylphx.toml, then stub here for type safety:
|
|
4704
|
+
* export const trainFold = taskStub<
|
|
4705
|
+
* { fold: number; n_trials?: number },
|
|
4706
|
+
* { best_icir: number }
|
|
4707
|
+
* >('train-fold')
|
|
4708
|
+
*
|
|
4709
|
+
* // Dispatch 5 parallel folds
|
|
4710
|
+
* const handles = await trainFold.batchTrigger(
|
|
4711
|
+
* Array.from({ length: 5 }, (_, i) => ({ fold: i, n_trials: 200 }))
|
|
4712
|
+
* )
|
|
4713
|
+
* await Promise.all(handles.runs.map(h => h.waitForCompletion()))
|
|
4714
|
+
* ```
|
|
4715
|
+
*/
|
|
4716
|
+
|
|
4717
|
+
type TaskMachineSize = MachineSize;
|
|
4718
|
+
interface TaskRunContext {
|
|
4719
|
+
step: StepContext;
|
|
4720
|
+
/** Current attempt number (starts at 1) */
|
|
4721
|
+
attempt: number;
|
|
4722
|
+
}
|
|
4723
|
+
interface StepContext {
|
|
4724
|
+
/** Execute a named step. Replays from cache if already completed (durable). */
|
|
4725
|
+
run<T>(id: string, fn: () => T | Promise<T>): Promise<T>;
|
|
4726
|
+
/** Sleep for a duration. Replays instantly if already resolved. */
|
|
4727
|
+
sleep(id: string, duration: string): Promise<void>;
|
|
4728
|
+
}
|
|
4729
|
+
interface TriggerOptions {
|
|
4730
|
+
/** Override auto-resolved config (defaults to SYLPHX_SECRET_URL env var) */
|
|
4731
|
+
config?: SylphxConfig;
|
|
4732
|
+
/** Deduplication key — same key within 24h returns existing run */
|
|
4733
|
+
idempotencyKey?: string;
|
|
4734
|
+
/** Delay dispatch, e.g. '5m', '1h' */
|
|
4735
|
+
delay?: string;
|
|
4736
|
+
/** Dispatch at specific time */
|
|
4737
|
+
scheduledFor?: Date;
|
|
4738
|
+
/** Override max retry attempts */
|
|
4739
|
+
maxAttempts?: number;
|
|
4740
|
+
/** Queue name override */
|
|
4741
|
+
queue?: string;
|
|
4742
|
+
}
|
|
4743
|
+
interface RunHandle$1<TResult = unknown> {
|
|
4744
|
+
/** Task run UUID */
|
|
4745
|
+
id: string;
|
|
4746
|
+
/** Current status at time of trigger */
|
|
4747
|
+
status: string;
|
|
4748
|
+
/**
|
|
4749
|
+
* Poll until the run reaches a terminal state (completed/failed/cancelled).
|
|
4750
|
+
* Throws if failed or timed out.
|
|
4751
|
+
*/
|
|
4752
|
+
waitForCompletion(options?: {
|
|
4753
|
+
timeoutMs?: number;
|
|
4754
|
+
}): Promise<TResult>;
|
|
4755
|
+
/**
|
|
4756
|
+
* Record durable cancellation for this run. Pending/running/waiting/failed
|
|
4757
|
+
* runs become terminal and job-mode cleanup is retried by Platform.
|
|
4758
|
+
*/
|
|
4759
|
+
cancel(): Promise<boolean>;
|
|
4760
|
+
}
|
|
4761
|
+
interface BatchHandle<TResult = unknown> {
|
|
4762
|
+
runs: RunHandle$1<TResult>[];
|
|
4763
|
+
}
|
|
4764
|
+
/** Inline trigger configuration on a task definition (ADR-040) */
|
|
4765
|
+
interface TaskTriggerConfig {
|
|
4766
|
+
/**
|
|
4767
|
+
* Cron schedule — automatically fires this task on the given schedule.
|
|
4768
|
+
* Standard 5-field cron expression: '0 2 * * *' (every day at 2am)
|
|
4769
|
+
* The platform registers this trigger on deploy via serve().
|
|
4770
|
+
*/
|
|
4771
|
+
cron?: string;
|
|
4772
|
+
/**
|
|
4773
|
+
* Event name — automatically fires this task when the named event is published.
|
|
4774
|
+
* e.g. 'user.signup', 'order.created'
|
|
4775
|
+
* Future: event triggers are not yet dispatched by the platform.
|
|
4776
|
+
*/
|
|
4777
|
+
event?: string;
|
|
4778
|
+
}
|
|
4779
|
+
interface TaskConfig<TPayload, TResult> {
|
|
4780
|
+
/** Stable task identifier — must not change across deploys */
|
|
4781
|
+
id: string;
|
|
4782
|
+
/**
|
|
4783
|
+
* Automatic trigger configuration (ADR-040).
|
|
4784
|
+
* If set, the platform registers this trigger when serve() is called.
|
|
4785
|
+
* trigger.cron → cron schedule fires task automatically
|
|
4786
|
+
* trigger.event → event fires task automatically
|
|
4787
|
+
*/
|
|
4788
|
+
trigger?: TaskTriggerConfig;
|
|
4789
|
+
/**
|
|
4790
|
+
* Managed machine size. If set → task runs in an isolated runtime (job mode).
|
|
4791
|
+
* If absent → task runs as an HTTP callback in the running service (function mode).
|
|
4792
|
+
*/
|
|
4793
|
+
machine?: TaskMachineSize;
|
|
4794
|
+
/** Queue config */
|
|
4795
|
+
queue?: {
|
|
4796
|
+
name?: string;
|
|
4797
|
+
concurrency?: number;
|
|
4798
|
+
};
|
|
4799
|
+
/** Retry policy */
|
|
4800
|
+
retry?: {
|
|
4801
|
+
maxAttempts?: number;
|
|
4802
|
+
backoff?: 'fixed' | 'exponential';
|
|
4803
|
+
};
|
|
4804
|
+
/** Timeout in seconds (default: 300 for function mode, 86400 for job mode) */
|
|
4805
|
+
timeout?: number;
|
|
4806
|
+
/** The task handler. In function mode: runs via HTTP dispatch. In job mode: runs in an isolated runtime. */
|
|
4807
|
+
run: (payload: TPayload, ctx: TaskRunContext) => Promise<TResult>;
|
|
4808
|
+
}
|
|
4809
|
+
interface TaskHandle<TPayload = unknown, TResult = unknown> {
|
|
4810
|
+
/** The stable task ID */
|
|
4811
|
+
readonly id: string;
|
|
4812
|
+
/** Trigger config if task has an automatic trigger (cron/event) */
|
|
4813
|
+
readonly _trigger?: TaskTriggerConfig;
|
|
4814
|
+
/** Managed machine size if job-mode task (undefined for function-mode or stubs) */
|
|
4815
|
+
readonly _machine?: TaskMachineSize;
|
|
4816
|
+
/**
|
|
4817
|
+
* The run function — used internally by serve() to register the handler.
|
|
4818
|
+
* undefined for taskStub (cross-language).
|
|
4819
|
+
*/
|
|
4820
|
+
readonly _run?: (payload: TPayload, ctx: TaskRunContext) => Promise<TResult>;
|
|
4821
|
+
/** Dispatch the task. Returns immediately with a RunHandle. */
|
|
4822
|
+
trigger(payload: TPayload, options?: TriggerOptions): Promise<RunHandle$1<TResult>>;
|
|
4823
|
+
/** Dispatch and wait for result. Convenience wrapper over trigger + waitForCompletion. */
|
|
4824
|
+
triggerAndWait(payload: TPayload, options?: TriggerOptions): Promise<TResult>;
|
|
4825
|
+
/** Dispatch N runs in parallel. Returns handles for all. */
|
|
4826
|
+
batchTrigger(payloads: TPayload[], options?: TriggerOptions): Promise<BatchHandle<TResult>>;
|
|
4827
|
+
}
|
|
4828
|
+
/**
|
|
4829
|
+
* Define a typed task.
|
|
4830
|
+
*
|
|
4831
|
+
* Returns a TaskHandle<TPayload, TResult> that can be used to trigger the task
|
|
4832
|
+
* from anywhere (same service or different service) with full type safety.
|
|
4833
|
+
*
|
|
4834
|
+
* The returned handle's _run function is used by serve() to register the
|
|
4835
|
+
* HTTP handler for function-mode tasks.
|
|
4836
|
+
*/
|
|
4837
|
+
declare function task<TPayload = unknown, TResult = unknown>(config: TaskConfig<TPayload, TResult>): TaskHandle<TPayload, TResult>;
|
|
4838
|
+
/**
|
|
4839
|
+
* Create a typed stub for a cross-language task (e.g. Python ML worker).
|
|
4840
|
+
*
|
|
4841
|
+
* The task must be registered separately via sylphx.toml manifest.
|
|
4842
|
+
* The stub provides type safety for the trigger call without requiring
|
|
4843
|
+
* a TypeScript handler.
|
|
4844
|
+
*
|
|
4845
|
+
* @example
|
|
4846
|
+
* ```typescript
|
|
4847
|
+
* export const trainFold = taskStub<
|
|
4848
|
+
* { fold: number; n_trials?: number },
|
|
4849
|
+
* { best_icir: number }
|
|
4850
|
+
* >('train-fold')
|
|
4851
|
+
*
|
|
4852
|
+
* const result = await trainFold.triggerAndWait({ fold: 0 })
|
|
4853
|
+
* console.log(result.best_icir) // typed!
|
|
4854
|
+
* ```
|
|
4855
|
+
*/
|
|
4856
|
+
declare function taskStub<TPayload = unknown, TResult = unknown>(id: string): TaskHandle<TPayload, TResult>;
|
|
4857
|
+
|
|
4858
|
+
/**
|
|
4859
|
+
* serve()
|
|
4860
|
+
*
|
|
4861
|
+
* Create a Web API-compatible route handler for a set of task definitions.
|
|
4862
|
+
* Supports Next.js App Router, Hono, and any Web API Request/Response handler.
|
|
4863
|
+
*
|
|
4864
|
+
* serve() wires up:
|
|
4865
|
+
* - GET → health check, returns registered task IDs + trigger sync status
|
|
4866
|
+
* - POST → dispatch handler (receives from platform, routes to task run fn)
|
|
4867
|
+
*
|
|
4868
|
+
* On startup (first GET or POST), serve() automatically syncs all inline triggers
|
|
4869
|
+
* (task({ trigger: { cron: '...' } })) to the platform via TriggersClient.
|
|
4870
|
+
* This is idempotent — uses idempotencyKey = `task:{taskId}:{triggerType}:{value}`.
|
|
4871
|
+
*
|
|
4872
|
+
* Only function-mode tasks (no machine config) register HTTP handlers here.
|
|
4873
|
+
* Job-mode tasks are dispatched directly by the platform, but their
|
|
4874
|
+
* inline triggers are still synced.
|
|
4875
|
+
*
|
|
4876
|
+
* @example Next.js App Router
|
|
4877
|
+
* ```typescript
|
|
4878
|
+
* // app/api/tasks/route.ts
|
|
4879
|
+
* import { serve } from '@sylphx/sdk/tasks'
|
|
4880
|
+
* import { sendEmail, dailyCleanup } from '@/tasks'
|
|
4881
|
+
*
|
|
4882
|
+
* export const { GET, POST } = serve({ tasks: [sendEmail, dailyCleanup] })
|
|
4883
|
+
* ```
|
|
4884
|
+
*
|
|
4885
|
+
* @example Inline cron trigger
|
|
4886
|
+
* ```typescript
|
|
4887
|
+
* export const dailyCleanup = task({
|
|
4888
|
+
* id: 'daily-cleanup',
|
|
4889
|
+
* trigger: { cron: '0 2 * * *' },
|
|
4890
|
+
* run: async () => { ... },
|
|
4891
|
+
* })
|
|
4892
|
+
* // No TriggersClient.create() call needed — serve() registers it automatically.
|
|
4893
|
+
* ```
|
|
4894
|
+
*/
|
|
4895
|
+
|
|
4896
|
+
interface ServeOptions {
|
|
4897
|
+
/** Task handles to serve */
|
|
4898
|
+
tasks: TaskHandle<unknown, unknown>[];
|
|
4899
|
+
/** Platform signing secret for verifying dispatches. Defaults to SYLPHX_SIGNING_SECRET env var. */
|
|
4900
|
+
signingSecret?: string;
|
|
4901
|
+
/**
|
|
4902
|
+
* Server connection URL for trigger registration.
|
|
4903
|
+
* Defaults to SYLPHX_SECRET_URL env var.
|
|
4904
|
+
* Only required if any tasks have inline trigger config.
|
|
4905
|
+
*/
|
|
4906
|
+
connectionUrl?: string;
|
|
4907
|
+
}
|
|
4908
|
+
interface ServeResult {
|
|
4909
|
+
GET: (req: Request) => Promise<Response>;
|
|
4910
|
+
POST: (req: Request) => Promise<Response>;
|
|
4911
|
+
}
|
|
4912
|
+
/**
|
|
4913
|
+
* Create a route handler that serves task definitions.
|
|
4914
|
+
*
|
|
4915
|
+
* Auto-syncs inline triggers (task({ trigger: { cron: '...' } })) on first request.
|
|
4916
|
+
* Task sync is idempotent and non-blocking — handler responds even if sync is in progress.
|
|
4917
|
+
*/
|
|
4918
|
+
declare function serve(options: ServeOptions): ServeResult;
|
|
4919
|
+
|
|
4640
4920
|
/** Cron schedule */
|
|
4641
4921
|
interface CronSchedule {
|
|
4642
4922
|
/** Cron expression */
|
|
@@ -4664,6 +4944,15 @@ type NativeStepContext = {
|
|
|
4664
4944
|
* On replay: returns the cached result without re-running fn.
|
|
4665
4945
|
*/
|
|
4666
4946
|
run<T>(name: string, fn: () => T | Promise<T>): Promise<T>;
|
|
4947
|
+
/**
|
|
4948
|
+
* Execute an external side effect with a durable idempotency key.
|
|
4949
|
+
*
|
|
4950
|
+
* First encounter: signals Platform to persist a side-effect receipt before
|
|
4951
|
+
* the external call. Replay then invokes fn with that persisted key. If the
|
|
4952
|
+
* handler crashes after the external call but before completion settles, the
|
|
4953
|
+
* next replay reuses the same key so the downstream service suppresses duplicates.
|
|
4954
|
+
*/
|
|
4955
|
+
sideEffect<T>(stepName: string, effectKey: string, externalService: string, fn: (idempotencyKey: string) => NativeSideEffectOutcome<T> | Promise<NativeSideEffectOutcome<T>>): Promise<T>;
|
|
4667
4956
|
/**
|
|
4668
4957
|
* Pause execution for the given duration.
|
|
4669
4958
|
*
|
|
@@ -4701,6 +4990,20 @@ type NativeStepContext = {
|
|
|
4701
4990
|
filter?: Record<string, unknown>;
|
|
4702
4991
|
}): Promise<T | null>;
|
|
4703
4992
|
};
|
|
4993
|
+
interface NativeSideEffectOutcome<T = unknown> {
|
|
4994
|
+
readonly handle?: string;
|
|
4995
|
+
readonly result: T;
|
|
4996
|
+
}
|
|
4997
|
+
interface NativeSideEffectReceipt {
|
|
4998
|
+
readonly stepName: string;
|
|
4999
|
+
readonly effectKey: string;
|
|
5000
|
+
readonly externalService: string;
|
|
5001
|
+
readonly idempotencyKey: string;
|
|
5002
|
+
readonly handle: string | null;
|
|
5003
|
+
readonly result: unknown;
|
|
5004
|
+
readonly completedAt: string | null;
|
|
5005
|
+
readonly createdAt: string;
|
|
5006
|
+
}
|
|
4704
5007
|
/**
|
|
4705
5008
|
* A named task definition registered with sylphx.tasks.define().
|
|
4706
5009
|
*/
|
|
@@ -4724,6 +5027,16 @@ interface NativeTaskDefinition<TPayload = unknown, TResult = unknown> {
|
|
|
4724
5027
|
/**
|
|
4725
5028
|
* The shape returned by GET/POST /tasks/:runId in the platform API.
|
|
4726
5029
|
*/
|
|
5030
|
+
type TaskRunDispatchLeaseState = 'active' | 'expired' | 'legacy';
|
|
5031
|
+
interface TaskRunDispatchLease {
|
|
5032
|
+
/**
|
|
5033
|
+
* Customer-safe dispatch claim state. Raw claim tokens and controller
|
|
5034
|
+
* identities are intentionally not exposed through the public SDK.
|
|
5035
|
+
*/
|
|
5036
|
+
state: TaskRunDispatchLeaseState;
|
|
5037
|
+
claimedAt: string | null;
|
|
5038
|
+
expiresAt: string | null;
|
|
5039
|
+
}
|
|
4727
5040
|
interface TaskRunStatus {
|
|
4728
5041
|
id: string;
|
|
4729
5042
|
taskName: string;
|
|
@@ -4736,6 +5049,13 @@ interface TaskRunStatus {
|
|
|
4736
5049
|
scheduledFor?: string;
|
|
4737
5050
|
startedAt?: string;
|
|
4738
5051
|
completedAt?: string;
|
|
5052
|
+
dispatchLease?: TaskRunDispatchLease | null;
|
|
5053
|
+
definition?: {
|
|
5054
|
+
id: string;
|
|
5055
|
+
version: number | null;
|
|
5056
|
+
hash: string | null;
|
|
5057
|
+
source: string | null;
|
|
5058
|
+
} | null;
|
|
4739
5059
|
createdAt: string;
|
|
4740
5060
|
updatedAt: string;
|
|
4741
5061
|
}
|
|
@@ -4794,7 +5114,7 @@ declare class StepSleepSignal {
|
|
|
4794
5114
|
* @param completedSteps Map of stepName → cached result
|
|
4795
5115
|
* @param resolvedWaits Map of stepName → wait result (sleep = undefined, event = event payload)
|
|
4796
5116
|
*/
|
|
4797
|
-
declare function createStepContext(completedSteps: Map<string, unknown>, resolvedWaits: Map<string, unknown>): NativeStepContext;
|
|
5117
|
+
declare function createStepContext(completedSteps: Map<string, unknown>, resolvedWaits: Map<string, unknown>, sideEffectReceipts?: Map<string, NativeSideEffectReceipt>): NativeStepContext;
|
|
4798
5118
|
/**
|
|
4799
5119
|
* Constant-time HMAC-SHA256 signature verification.
|
|
4800
5120
|
* Accepts both raw hex and 'sha256={hex}' formats.
|
|
@@ -4907,8 +5227,24 @@ declare function scheduleTask(config: SylphxConfig, input: TaskInput): Promise<T
|
|
|
4907
5227
|
* Get a task's status by ID
|
|
4908
5228
|
*/
|
|
4909
5229
|
declare function getTask(config: SylphxConfig, taskId: string): Promise<TaskStatus>;
|
|
5230
|
+
/** The durable step ledger entry surfaced by `getTaskRun`. */
|
|
5231
|
+
type TaskRunStep = DurableWorkTaskRunStep;
|
|
5232
|
+
/** The full durable task-run view surfaced by `getTaskRun`. */
|
|
5233
|
+
type TaskRunDetail = DurableWorkGetTaskRunResponse;
|
|
5234
|
+
/**
|
|
5235
|
+
* Get the full durable view of a task run, including the step ledger.
|
|
5236
|
+
*
|
|
5237
|
+
* Each step carries an `executorToken` — the opaque-but-stable identity of the
|
|
5238
|
+
* worker that materialized it. The token changes across a pod-kill resume, so
|
|
5239
|
+
* comparing executor tokens across steps is the evidence that a run resumed on
|
|
5240
|
+
* a different worker (durable HA). `status` reads `executed` for every recorded
|
|
5241
|
+
* step (a step is persisted once, on the dispatch that executed it; later
|
|
5242
|
+
* dispatches replay it from cache and record nothing). The platform never
|
|
5243
|
+
* returns step result payloads — only identity, executor, and timing.
|
|
5244
|
+
*/
|
|
5245
|
+
declare function getTaskRun(config: SylphxConfig, runId: string): Promise<TaskRunDetail>;
|
|
4910
5246
|
/**
|
|
4911
|
-
* Cancel a pending task
|
|
5247
|
+
* Cancel a pending, running, waiting, or failed task run.
|
|
4912
5248
|
*/
|
|
4913
5249
|
declare function cancelTask(config: SylphxConfig, taskId: string): Promise<boolean>;
|
|
4914
5250
|
/**
|
|
@@ -8312,6 +8648,7 @@ interface ComputerUiSnapshot {
|
|
|
8312
8648
|
/** ISO-8601 timestamp the snapshot was captured at. */
|
|
8313
8649
|
capturedAt: string;
|
|
8314
8650
|
}
|
|
8651
|
+
|
|
8315
8652
|
interface SandboxRecord {
|
|
8316
8653
|
id: string;
|
|
8317
8654
|
status: 'starting' | 'running' | 'idle' | 'terminated' | 'error';
|
|
@@ -8383,6 +8720,21 @@ declare class SandboxWatch {
|
|
|
8383
8720
|
/** Stop watching a path. */
|
|
8384
8721
|
remove(path: string): Promise<void>;
|
|
8385
8722
|
}
|
|
8723
|
+
declare class SandboxCapabilities {
|
|
8724
|
+
private readonly endpoint;
|
|
8725
|
+
private readonly token;
|
|
8726
|
+
constructor(endpoint: string, token: string);
|
|
8727
|
+
private authHeader;
|
|
8728
|
+
/**
|
|
8729
|
+
* Fetch the typed capability catalog for this sandbox image.
|
|
8730
|
+
*
|
|
8731
|
+
* Use this before selecting heavyweight toolchain paths. For example,
|
|
8732
|
+
* default sandboxes report Android emulator/device-test as `not-local`, so
|
|
8733
|
+
* agents can hand APK/AAB artifacts to a managed device runtime instead of
|
|
8734
|
+
* filling `/workspace` with emulator images.
|
|
8735
|
+
*/
|
|
8736
|
+
get(): Promise<SandboxCapabilitiesReport>;
|
|
8737
|
+
}
|
|
8386
8738
|
/**
|
|
8387
8739
|
* Provision and drive persistent, headful, stealth browser sessions inside the
|
|
8388
8740
|
* sandbox. The Platform owns the connectable browser primitive; the customer
|
|
@@ -8545,6 +8897,8 @@ declare class SandboxClient {
|
|
|
8545
8897
|
readonly processes: SandboxProcesses | null;
|
|
8546
8898
|
/** Filesystem watch management (direct to exec-server) */
|
|
8547
8899
|
readonly watch: SandboxWatch | null;
|
|
8900
|
+
/** Typed capability catalog (direct to exec-server) */
|
|
8901
|
+
readonly capabilities: SandboxCapabilities | null;
|
|
8548
8902
|
/** Persistent headful browser sessions (direct to exec-server — ADR-205) */
|
|
8549
8903
|
readonly browser: SandboxBrowser | null;
|
|
8550
8904
|
/** Persistent desktop (computer-use) sessions (direct to exec-server — ADR-207) */
|
|
@@ -8634,6 +8988,283 @@ declare class SandboxClient {
|
|
|
8634
8988
|
private assertDirect;
|
|
8635
8989
|
}
|
|
8636
8990
|
|
|
8991
|
+
/**
|
|
8992
|
+
* Artifacts — publish + manage agent-authored interactive web content at a safe
|
|
8993
|
+
* shareable URL.
|
|
8994
|
+
*
|
|
8995
|
+
* Org-scoped client over the BaaS plane `/artifacts`. The Platform stores the
|
|
8996
|
+
* self-contained HTML, isolates it on a separate per-artifact content origin, and
|
|
8997
|
+
* returns a signed, expiring (or durable / auth-gated) shareable URL (ADR-2564).
|
|
8998
|
+
* Slice 2 adds the management plane: list / get / delete (soft) / restore /
|
|
8999
|
+
* reshare. Complement to `RenderClient`: render returns a fixed-format image, an
|
|
9000
|
+
* artifact is a live interactive page at a URL.
|
|
9001
|
+
*
|
|
9002
|
+
* Wire-shape types are re-exported from `@sylphx/contract` (ADR-084). Type-only
|
|
9003
|
+
* imports keep the Effect runtime out of the published `.d.ts` surface
|
|
9004
|
+
* (check-published-sdk-effect-leak).
|
|
9005
|
+
*/
|
|
9006
|
+
|
|
9007
|
+
/**
|
|
9008
|
+
* Artifact client — publish + manage a self-contained HTML page at a safe,
|
|
9009
|
+
* shareable URL.
|
|
9010
|
+
*
|
|
9011
|
+
* @example
|
|
9012
|
+
* ```typescript
|
|
9013
|
+
* import { createServerClient, ArtifactClient } from '@sylphx/sdk'
|
|
9014
|
+
*
|
|
9015
|
+
* const config = createServerClient(process.env.SYLPHX_SECRET_URL!)
|
|
9016
|
+
*
|
|
9017
|
+
* const result = await ArtifactClient.publish(config, {
|
|
9018
|
+
* title: '10-minute timer',
|
|
9019
|
+
* html: '<!doctype html><meta charset="utf-8"><body>…</body>',
|
|
9020
|
+
* })
|
|
9021
|
+
*
|
|
9022
|
+
* if (result.ok) {
|
|
9023
|
+
* console.log(result.url) // share this link; expires at result.expiresAt
|
|
9024
|
+
* // later: list / inspect / delete / restore / reshare
|
|
9025
|
+
* const { artifacts } = await ArtifactClient.list(config)
|
|
9026
|
+
* await ArtifactClient.delete(config, result.id) // soft-delete (reversible)
|
|
9027
|
+
* }
|
|
9028
|
+
* ```
|
|
9029
|
+
*/
|
|
9030
|
+
declare const ArtifactClient: {
|
|
9031
|
+
/**
|
|
9032
|
+
* Publish a self-contained HTML document to a safe, shareable URL. Returns a
|
|
9033
|
+
* signed expiring link by default (`access: 'signed-link'`) — click-to-view, no
|
|
9034
|
+
* login, leaked links decay; `public` for a durable URL. On success returns
|
|
9035
|
+
* `{ id, url, expiresAt?, version }`; on failure a structured `error` with a
|
|
9036
|
+
* `code` (e.g. `blocked_unsafe`) and `diagnostics`.
|
|
9037
|
+
*
|
|
9038
|
+
* **Update in place (ADR-2564 v2):** pass `artifactId` (the `id` from a prior
|
|
9039
|
+
* publish) to REVISE that artifact — the id and the shareable URL are preserved
|
|
9040
|
+
* and `version` increments. The caller must own the artifact (`forbidden`
|
|
9041
|
+
* otherwise), it must still exist (`not_found`), and it must be a versioned
|
|
9042
|
+
* artifact (`conflict` for pre-versioning artifacts). Omit `artifactId` to
|
|
9043
|
+
* create a fresh artifact.
|
|
9044
|
+
*/
|
|
9045
|
+
publish(config: SylphxConfig, request: PublishArtifactRequest): Promise<ArtifactResult>;
|
|
9046
|
+
/**
|
|
9047
|
+
* List the calling project's published artifacts, newest-first. Returns
|
|
9048
|
+
* metadata only — `{ artifacts: [{ id, title?, access, currentVersion,
|
|
9049
|
+
* createdAt, updatedAt, expiresAt? }] }`.
|
|
9050
|
+
*
|
|
9051
|
+
* Excludes soft-deleted artifacts by default. Pass `{ includeDeleted: true }`
|
|
9052
|
+
* to ALSO list tombstoned ones (each carrying `deleted: true` + `deletedAt`),
|
|
9053
|
+
* so you can find a soft-deleted artifact's id and {@link ArtifactClient.restore}
|
|
9054
|
+
* it before the grace-window cleanup erases it.
|
|
9055
|
+
*/
|
|
9056
|
+
list(config: SylphxConfig, options?: {
|
|
9057
|
+
includeDeleted?: boolean;
|
|
9058
|
+
}): Promise<ListArtifactsResult>;
|
|
9059
|
+
/**
|
|
9060
|
+
* Get one artifact's metadata and its immutable version history. Throws
|
|
9061
|
+
* `NOT_FOUND` if the artifact does not exist (or is soft-deleted), `FORBIDDEN`
|
|
9062
|
+
* if it belongs to another project.
|
|
9063
|
+
*/
|
|
9064
|
+
get(config: SylphxConfig, id: string): Promise<ArtifactDetail>;
|
|
9065
|
+
/**
|
|
9066
|
+
* Get an artifact's CURRENT HTML source so you can EDIT it, then re-{@link
|
|
9067
|
+
* ArtifactClient.publish} with `artifactId` to update it in place — instead of
|
|
9068
|
+
* rewriting it blind from a fresh session. Returns `{ id, version, html }`.
|
|
9069
|
+
* Throws `NOT_FOUND` if it does not exist (or is soft-deleted), `FORBIDDEN` if
|
|
9070
|
+
* it belongs to another project. `get` returns metadata only; this returns the
|
|
9071
|
+
* bytes.
|
|
9072
|
+
*/
|
|
9073
|
+
getContent(config: SylphxConfig, id: string): Promise<ArtifactContent>;
|
|
9074
|
+
/**
|
|
9075
|
+
* Soft-delete an artifact (reversible). The shareable URL begins returning
|
|
9076
|
+
* `410 Gone`; the bytes are retained until a later grace-window cleanup, so
|
|
9077
|
+
* {@link ArtifactClient.restore} can bring it back. Throws `NOT_FOUND` /
|
|
9078
|
+
* `FORBIDDEN` as for {@link ArtifactClient.get}.
|
|
9079
|
+
*/
|
|
9080
|
+
delete(config: SylphxConfig, id: string): Promise<DeleteArtifactResult>;
|
|
9081
|
+
/**
|
|
9082
|
+
* Restore a soft-deleted artifact. Pass `version` to roll a prior version
|
|
9083
|
+
* FORWARD as a new current version (history is never rewritten) — the returned
|
|
9084
|
+
* `version` is then the new current. Omit it to simply clear the tombstone.
|
|
9085
|
+
*/
|
|
9086
|
+
restore(config: SylphxConfig, id: string, options?: {
|
|
9087
|
+
version?: number;
|
|
9088
|
+
}): Promise<RestoreArtifactResult>;
|
|
9089
|
+
/**
|
|
9090
|
+
* Re-mint a fresh signed share link (a new capability URL + TTL) for an
|
|
9091
|
+
* artifact — e.g. to extend or rotate a link. Returns `{ url, expiresAt? }`.
|
|
9092
|
+
* For a `public` artifact the durable URL is returned as-is. Pass `ttlSeconds`
|
|
9093
|
+
* to set the new link's lifetime (clamped to the allowed window).
|
|
9094
|
+
*/
|
|
9095
|
+
reshare(config: SylphxConfig, id: string, options?: {
|
|
9096
|
+
ttlSeconds?: number;
|
|
9097
|
+
}): Promise<ReshareArtifactResult>;
|
|
9098
|
+
};
|
|
9099
|
+
|
|
9100
|
+
/**
|
|
9101
|
+
* Render — declarative spec → image (charts via Vega-Lite, diagrams via Graphviz).
|
|
9102
|
+
*
|
|
9103
|
+
* Org-scoped client over the BaaS plane `POST /render`. The render engine runs the
|
|
9104
|
+
* spec in a per-render egress-denied microVM and returns the image bytes (ADR-2358).
|
|
9105
|
+
*
|
|
9106
|
+
* Wire-shape types are re-exported from `@sylphx/contract` (ADR-084). Type-only
|
|
9107
|
+
* imports keep the Effect runtime out of the published `.d.ts` surface
|
|
9108
|
+
* (check-published-sdk-effect-leak).
|
|
9109
|
+
*/
|
|
9110
|
+
|
|
9111
|
+
/**
|
|
9112
|
+
* Render client — turn a declarative spec into an image.
|
|
9113
|
+
*
|
|
9114
|
+
* @example
|
|
9115
|
+
* ```typescript
|
|
9116
|
+
* import { createServerClient, RenderClient } from '@sylphx/sdk'
|
|
9117
|
+
*
|
|
9118
|
+
* const config = createServerClient(process.env.SYLPHX_SECRET_URL!)
|
|
9119
|
+
*
|
|
9120
|
+
* const result = await RenderClient.render(config, {
|
|
9121
|
+
* engine: 'vega-lite',
|
|
9122
|
+
* spec: JSON.stringify({
|
|
9123
|
+
* $schema: 'https://vega.github.io/schema/vega-lite/v5.json',
|
|
9124
|
+
* mark: 'bar',
|
|
9125
|
+
* data: { values: [{ a: 'A', b: 28 }, { a: 'B', b: 55 }] },
|
|
9126
|
+
* encoding: { x: { field: 'a', type: 'nominal' }, y: { field: 'b', type: 'quantitative' } },
|
|
9127
|
+
* }),
|
|
9128
|
+
* format: 'png',
|
|
9129
|
+
* })
|
|
9130
|
+
*
|
|
9131
|
+
* if (result.ok) {
|
|
9132
|
+
* const png = Buffer.from(result.bytesBase64, 'base64') // deliver / save
|
|
9133
|
+
* } else {
|
|
9134
|
+
* console.error(`render ${result.error.code}: ${result.error.message}`)
|
|
9135
|
+
* }
|
|
9136
|
+
* ```
|
|
9137
|
+
*/
|
|
9138
|
+
declare const RenderClient: {
|
|
9139
|
+
/**
|
|
9140
|
+
* Render a chart (`engine: 'vega-lite'`, Vega-Lite JSON in `spec`) or a diagram
|
|
9141
|
+
* (`engine: 'graphviz'`, DOT in `spec`) to an image. The engine validates and
|
|
9142
|
+
* repairs the spec before rendering; on success returns base64 image bytes, on
|
|
9143
|
+
* failure a structured `error` with a `code` and `diagnostics`.
|
|
9144
|
+
*/
|
|
9145
|
+
render(config: SylphxConfig, request: RenderRequest): Promise<RenderResult>;
|
|
9146
|
+
};
|
|
9147
|
+
|
|
9148
|
+
/**
|
|
9149
|
+
* Wallet & Credits — tenant-neutral end-user credits for a project's own users
|
|
9150
|
+
* (daily-free grants, rewarded-ad/top-up/referral credits, two-phase
|
|
9151
|
+
* reserve→consume per action). Org-scoped client over the BaaS plane
|
|
9152
|
+
* `POST /wallet/*` (ADR-2623).
|
|
9153
|
+
*
|
|
9154
|
+
* Wire-shape types are re-exported from `@sylphx/contract` (ADR-084). Type-only
|
|
9155
|
+
* imports keep the Effect runtime out of the published `.d.ts` surface.
|
|
9156
|
+
*/
|
|
9157
|
+
|
|
9158
|
+
/**
|
|
9159
|
+
* Wallet client — grant, meter, and charge credits to your end users.
|
|
9160
|
+
*
|
|
9161
|
+
* @example
|
|
9162
|
+
* ```typescript
|
|
9163
|
+
* import { createServerClient, WalletClient } from '@sylphx/sdk'
|
|
9164
|
+
*
|
|
9165
|
+
* const config = createServerClient(process.env.SYLPHX_SECRET_URL!)
|
|
9166
|
+
*
|
|
9167
|
+
* // Grant a daily free allowance:
|
|
9168
|
+
* await WalletClient.grant(config, { appUserId: 'u_123', amount: 5, category: 'free' })
|
|
9169
|
+
*
|
|
9170
|
+
* // Two-phase debit around a generation:
|
|
9171
|
+
* const r = await WalletClient.reserve(config, { appUserId: 'u_123', amount: 1 })
|
|
9172
|
+
* // …do the work…
|
|
9173
|
+
* await WalletClient.consume(config, { reservationId: r.id })
|
|
9174
|
+
*
|
|
9175
|
+
* const balance = await WalletClient.getBalance(config, { appUserId: 'u_123' })
|
|
9176
|
+
* ```
|
|
9177
|
+
*/
|
|
9178
|
+
declare const WalletClient: {
|
|
9179
|
+
/** Mint a grant block of credits for an end user. */
|
|
9180
|
+
grant(config: SylphxConfig, request: GrantRequest): Promise<Grant>;
|
|
9181
|
+
/** Get an end user's derived balance (`available = posted − reserved`). */
|
|
9182
|
+
getBalance(config: SylphxConfig, request: {
|
|
9183
|
+
appUserId: string;
|
|
9184
|
+
balance?: string;
|
|
9185
|
+
}): Promise<BalanceSummary>;
|
|
9186
|
+
/** Reserve credits (two-phase hold with a mandatory TTL). */
|
|
9187
|
+
reserve(config: SylphxConfig, request: ReserveRequest): Promise<Reservation>;
|
|
9188
|
+
/** Capture a reservation (≤ reserved; releases the remainder). */
|
|
9189
|
+
consume(config: SylphxConfig, request: ConsumeRequest): Promise<LedgerEntry>;
|
|
9190
|
+
/** Release a reservation (return the held credits). */
|
|
9191
|
+
release(config: SylphxConfig, request: ReleaseRequest): Promise<Reservation>;
|
|
9192
|
+
/** Void/claw back a specific grant block (audited ledger entry). */
|
|
9193
|
+
voidGrant(config: SylphxConfig, request: VoidGrantRequest): Promise<Grant>;
|
|
9194
|
+
};
|
|
9195
|
+
|
|
9196
|
+
/**
|
|
9197
|
+
* Device sessions — interactive, long-lived Android devices an agent drives
|
|
9198
|
+
* (ADR-2560). Boot once, then install → input (tap/swipe/key/text) →
|
|
9199
|
+
* screenshot → launch, polling the session handle until `ready`; delete when
|
|
9200
|
+
* done. A session may also be booted stream-capable (ADR-2566): `streamConnect`
|
|
9201
|
+
* mints a short-lived signed descriptor for a browser to join a live WebRTC view.
|
|
9202
|
+
*
|
|
9203
|
+
* Management-plane client over the device-session control plane: project-scoped
|
|
9204
|
+
* `create`/`list`; top-level `get`/control/`delete` by session id. Mirrors the
|
|
9205
|
+
* routes in `apps/api/src/server/platform/routes/management/device-sessions.ts`;
|
|
9206
|
+
* paths sourced from the `@sylphx/contract` device-session endpoints (ADR-084).
|
|
9207
|
+
*
|
|
9208
|
+
* This is the "implement once" typed surface (Principle 18 dogfooding): the CLI's
|
|
9209
|
+
* `authedFetch` passthrough and the Spiron agent tool consume this client rather
|
|
9210
|
+
* than re-deriving the wire shapes.
|
|
9211
|
+
*
|
|
9212
|
+
* Wire-shape types are type-only imports from `@sylphx/contract` so the Effect
|
|
9213
|
+
* runtime never leaks into the published `.d.ts` (check-published-sdk-effect-leak).
|
|
9214
|
+
*/
|
|
9215
|
+
|
|
9216
|
+
/**
|
|
9217
|
+
* Device-session client — drive an interactive Android device, the agent-native
|
|
9218
|
+
* loop (boot → install → input/screenshot → delete).
|
|
9219
|
+
*
|
|
9220
|
+
* @example
|
|
9221
|
+
* ```typescript
|
|
9222
|
+
* import { createServerClient, DeviceSessionClient } from '@sylphx/sdk'
|
|
9223
|
+
*
|
|
9224
|
+
* const config = createServerClient(process.env.SYLPHX_SECRET_URL!)
|
|
9225
|
+
*
|
|
9226
|
+
* // Boot, then poll to ready.
|
|
9227
|
+
* let { session } = await DeviceSessionClient.create(config, projectId, {})
|
|
9228
|
+
* while (session.status === 'booting') {
|
|
9229
|
+
* await new Promise((r) => setTimeout(r, 2000))
|
|
9230
|
+
* ;({ session } = await DeviceSessionClient.get(config, session.id))
|
|
9231
|
+
* }
|
|
9232
|
+
*
|
|
9233
|
+
* // Install an APK, then act + perceive.
|
|
9234
|
+
* await DeviceSessionClient.install(config, session.id, { apkUri: 's3://bucket/app.apk' })
|
|
9235
|
+
* await DeviceSessionClient.input(config, session.id, { type: 'tap', x: 540, y: 1200 })
|
|
9236
|
+
* const shot = await DeviceSessionClient.screenshot(config, session.id) // base64 PNG
|
|
9237
|
+
*
|
|
9238
|
+
* await DeviceSessionClient.delete(config, session.id) // always release the device
|
|
9239
|
+
* ```
|
|
9240
|
+
*/
|
|
9241
|
+
declare const DeviceSessionClient: {
|
|
9242
|
+
/** Boot a long-lived interactive device session in a project (poll to `ready`). */
|
|
9243
|
+
create(config: SylphxConfig, projectId: string, body: CreateDeviceSessionInput): Promise<DeviceSessionResult>;
|
|
9244
|
+
/** List interactive device sessions for a project. */
|
|
9245
|
+
list(config: SylphxConfig, projectId: string, query?: ListDeviceSessionsQuery): Promise<ListDeviceSessionsResult>;
|
|
9246
|
+
/** Get one device session by id — poll for `booting` → `ready`. */
|
|
9247
|
+
get(config: SylphxConfig, sessionId: string): Promise<DeviceSessionResult>;
|
|
9248
|
+
/** Install an APK handle (`http(s)://`, `s3://`, or a storage key) onto the device. */
|
|
9249
|
+
install(config: SylphxConfig, sessionId: string, body: InstallDeviceSessionAppInput): Promise<InstallDeviceSessionAppResult>;
|
|
9250
|
+
/** Send an input event (tap / swipe / key / text) — how the agent acts on the device. */
|
|
9251
|
+
input(config: SylphxConfig, sessionId: string, body: DeviceSessionInput): Promise<DeviceSessionInputResult>;
|
|
9252
|
+
/** Launch an installed app (defaults to the most-recently installed package). */
|
|
9253
|
+
launch(config: SylphxConfig, sessionId: string, body?: LaunchDeviceSessionAppInput): Promise<LaunchDeviceSessionAppResult>;
|
|
9254
|
+
/** Capture a PNG screenshot — how the agent "sees" the device (base64 always present). */
|
|
9255
|
+
screenshot(config: SylphxConfig, sessionId: string): Promise<DeviceSessionScreenshotResult>;
|
|
9256
|
+
/** Read recent logcat output from the device session. */
|
|
9257
|
+
logcat(config: SylphxConfig, sessionId: string, query?: DeviceSessionLogcatQuery): Promise<DeviceSessionLogcatResult>;
|
|
9258
|
+
/**
|
|
9259
|
+
* Mint a short-lived signed descriptor for a browser to join the session's live
|
|
9260
|
+
* WebRTC view (ADR-2566). Requires the session to be booted stream-capable
|
|
9261
|
+
* (`create` with `stream: true`).
|
|
9262
|
+
*/
|
|
9263
|
+
streamConnect(config: SylphxConfig, sessionId: string, body?: DeviceSessionStreamConnectInput): Promise<DeviceSessionStreamConnectResult>;
|
|
9264
|
+
/** Terminate a device session and release its device. */
|
|
9265
|
+
delete(config: SylphxConfig, sessionId: string): Promise<DeleteDeviceSessionResult>;
|
|
9266
|
+
};
|
|
9267
|
+
|
|
8637
9268
|
/**
|
|
8638
9269
|
* Runs Client (ADR-040, formerly Workers)
|
|
8639
9270
|
*
|
|
@@ -8666,33 +9297,41 @@ declare class SandboxClient {
|
|
|
8666
9297
|
* ```
|
|
8667
9298
|
*
|
|
8668
9299
|
* ### Parallel workers (walk-forward training)
|
|
9300
|
+
*
|
|
9301
|
+
* One logical job that fans out to N indexed shards, owned end-to-end by the
|
|
9302
|
+
* platform (ADR distributed-batch-compute). No client-side `Promise.all`
|
|
9303
|
+
* orchestration, no per-app concurrency budget, no hand-rolled partial-failure
|
|
9304
|
+
* merge — the platform gang-admits all shards or none and rolls the per-shard
|
|
9305
|
+
* status up into one aggregate. Each shard self-selects its partition from the
|
|
9306
|
+
* injected `SYLPHX_SHARD_INDEX` (0..N-1) + `SYLPHX_SHARD_COUNT` env vars.
|
|
9307
|
+
*
|
|
8669
9308
|
* ```typescript
|
|
8670
|
-
* const
|
|
8671
|
-
*
|
|
8672
|
-
*
|
|
8673
|
-
*
|
|
8674
|
-
*
|
|
8675
|
-
*
|
|
8676
|
-
*
|
|
8677
|
-
*
|
|
8678
|
-
* timeoutSeconds: 7200,
|
|
8679
|
-
* }),
|
|
8680
|
-
* ),
|
|
8681
|
-
* )
|
|
9309
|
+
* const run = await RunsClient.runDistributed(config, {
|
|
9310
|
+
* image: 'ghcr.io/acme/trainer:sha-abc123',
|
|
9311
|
+
* command: ['python', 'train.py'], // reads SYLPHX_SHARD_INDEX to pick its fold
|
|
9312
|
+
* parallelism: folds.length,
|
|
9313
|
+
* machine: 'large',
|
|
9314
|
+
* volumeMounts: [{ volumeId: sharedCacheVolumeId, mountPath: '/cache' }],
|
|
9315
|
+
* timeoutSeconds: 7200,
|
|
9316
|
+
* })
|
|
8682
9317
|
*
|
|
8683
|
-
* const
|
|
8684
|
-
* const failures =
|
|
9318
|
+
* const status = await run.wait() // resolves on aggregate terminal
|
|
9319
|
+
* const failures = (await run.shards()).filter((s) => s.status === 'failed')
|
|
8685
9320
|
* ```
|
|
8686
9321
|
*
|
|
8687
9322
|
* ## Architecture
|
|
8688
9323
|
*
|
|
8689
9324
|
* - Workers are isolated one-shot runs with no automatic restarts
|
|
9325
|
+
* - A Distributed Run is one logical job fanned out to N indexed shards;
|
|
9326
|
+
* `parallelism` defaults to 1, so a single-shard `run()` is the N=1 case
|
|
9327
|
+
* (zero breaking change)
|
|
8690
9328
|
* - Images come from connected registries and are scanned before execution
|
|
8691
9329
|
* - Volumes: org-level volume resources mounted into the run
|
|
8692
9330
|
* - single-writer for one active writer at a time
|
|
8693
|
-
* - shared for concurrent runs and shared feature caches
|
|
9331
|
+
* - shared for concurrent runs and shared feature caches (one shared
|
|
9332
|
+
* volume mounted into every shard is the result-aggregation convention)
|
|
8694
9333
|
* - Auth: sk_* secret key (server-side only)
|
|
8695
|
-
* - Quota:
|
|
9334
|
+
* - Quota: per-job parallelism budget + an org-level aggregate shard budget
|
|
8696
9335
|
*
|
|
8697
9336
|
* @module
|
|
8698
9337
|
*/
|
|
@@ -8709,13 +9348,26 @@ interface RunVolumeMount {
|
|
|
8709
9348
|
/** Mount as read-only (default: false) */
|
|
8710
9349
|
readOnly?: boolean;
|
|
8711
9350
|
}
|
|
8712
|
-
|
|
9351
|
+
type RunImageSource = {
|
|
8713
9352
|
/**
|
|
8714
9353
|
* OCI image to run from a connected registry.
|
|
8715
9354
|
*
|
|
8716
9355
|
* @example 'ghcr.io/acme/my-trainer:sha-abc123'
|
|
8717
9356
|
*/
|
|
8718
9357
|
image: string;
|
|
9358
|
+
imageFromService?: never;
|
|
9359
|
+
} | {
|
|
9360
|
+
/**
|
|
9361
|
+
* Name of a service in the same project environment. The platform resolves
|
|
9362
|
+
* the service's current deployment artifact to an immutable image digest
|
|
9363
|
+
* before creating the Run.
|
|
9364
|
+
*
|
|
9365
|
+
* @example 'trainer'
|
|
9366
|
+
*/
|
|
9367
|
+
imageFromService: string;
|
|
9368
|
+
image?: never;
|
|
9369
|
+
};
|
|
9370
|
+
interface CreateRunBaseOptions {
|
|
8719
9371
|
/**
|
|
8720
9372
|
* Command + args to execute.
|
|
8721
9373
|
*
|
|
@@ -8744,6 +9396,7 @@ interface CreateRunOptions {
|
|
|
8744
9396
|
*/
|
|
8745
9397
|
volumeMounts?: RunVolumeMount[];
|
|
8746
9398
|
}
|
|
9399
|
+
type CreateRunOptions = CreateRunBaseOptions & RunImageSource;
|
|
8747
9400
|
interface Run {
|
|
8748
9401
|
/** Worker run ID (e.g. 'worker_Vh3kJ9mNpQ2wXsL1') */
|
|
8749
9402
|
id: string;
|
|
@@ -8813,6 +9466,38 @@ interface ListRunsResult {
|
|
|
8813
9466
|
/** True if there are more results (limit was hit) */
|
|
8814
9467
|
has_more: boolean;
|
|
8815
9468
|
}
|
|
9469
|
+
/** Aggregate lifecycle status of a Distributed Run (SSOT: `@sylphx/contract`). */
|
|
9470
|
+
type DistributedRunStatus = DistributedRunAggregateStatus;
|
|
9471
|
+
|
|
9472
|
+
/**
|
|
9473
|
+
* Options for {@link RunsClient.runDistributed}. A strict superset of
|
|
9474
|
+
* {@link CreateRunOptions} plus the distribution knobs. `parallelism` is the
|
|
9475
|
+
* shard count (1..256); each shard self-selects its partition from the
|
|
9476
|
+
* injected `SYLPHX_SHARD_INDEX` / `SYLPHX_SHARD_COUNT` env vars.
|
|
9477
|
+
*/
|
|
9478
|
+
type CreateDistributedRunOptions = CreateRunBaseOptions & RunImageSource & {
|
|
9479
|
+
/**
|
|
9480
|
+
* Number of indexed shards to fan out to (1..256). `1` is equivalent to a
|
|
9481
|
+
* single-shard {@link RunsClient.run}; `> 1` distributes the job.
|
|
9482
|
+
*/
|
|
9483
|
+
parallelism: number;
|
|
9484
|
+
/**
|
|
9485
|
+
* Shard completion mode. `Indexed` (default when sharded) gives each shard a
|
|
9486
|
+
* stable `SYLPHX_SHARD_INDEX`; `NonIndexed` is the interchangeable-worker mode.
|
|
9487
|
+
*/
|
|
9488
|
+
completionMode?: DurableWorkRunCompletionMode;
|
|
9489
|
+
/**
|
|
9490
|
+
* Gang scheduling — all shards are admitted together or none (default `true`
|
|
9491
|
+
* when sharded), so a shard never assumes-then-waits for absent peers.
|
|
9492
|
+
*/
|
|
9493
|
+
gangScheduling?: boolean;
|
|
9494
|
+
/**
|
|
9495
|
+
* Per-index retry budget for opportunistic sharded runs. Only valid together
|
|
9496
|
+
* with `parallelism > 1` and `gangScheduling: false`; defaults to the platform
|
|
9497
|
+
* contract's opportunistic retry budget when omitted.
|
|
9498
|
+
*/
|
|
9499
|
+
backoffLimitPerIndex?: number;
|
|
9500
|
+
};
|
|
8816
9501
|
/**
|
|
8817
9502
|
* Handle to a running (or completed) worker.
|
|
8818
9503
|
* Use `.wait()` to poll until completion, `.logs()` to stream logs, `.cancel()` to abort.
|
|
@@ -8868,6 +9553,55 @@ declare class RunHandle {
|
|
|
8868
9553
|
*/
|
|
8869
9554
|
cancel(): Promise<void>;
|
|
8870
9555
|
}
|
|
9556
|
+
/**
|
|
9557
|
+
* Handle to a distributed (multi-shard) run — one logical job fanned out to N
|
|
9558
|
+
* indexed shards (ADR distributed-batch-compute).
|
|
9559
|
+
*
|
|
9560
|
+
* Use `.status()` / `.shards()` for the aggregate + per-shard drill-down,
|
|
9561
|
+
* `.wait()` to poll until the aggregate reaches a terminal state
|
|
9562
|
+
* (succeeded / failed / partial / cancelled / timed_out), `.logs({ shard })` to
|
|
9563
|
+
* stream one shard's logs, and `.cancel()` to cancel the whole set.
|
|
9564
|
+
*/
|
|
9565
|
+
declare class DistributedRunHandle {
|
|
9566
|
+
readonly id: string;
|
|
9567
|
+
/** Submitted shard count — used to request + render the N-shard aggregate. */
|
|
9568
|
+
readonly parallelism: number;
|
|
9569
|
+
private readonly config;
|
|
9570
|
+
private readonly completionMode;
|
|
9571
|
+
constructor(id: string, config: SylphxConfig, parallelism: number, completionMode: DurableWorkRunCompletionMode);
|
|
9572
|
+
/**
|
|
9573
|
+
* Get the current aggregate status + per-shard drill-down for this run.
|
|
9574
|
+
*
|
|
9575
|
+
* Hits `GET /runs/:id?view=distributed` — the additive superset of the
|
|
9576
|
+
* single-shard read model — passing the submitted `parallelism` so the platform
|
|
9577
|
+
* lays the observed status out across the N indexed shards.
|
|
9578
|
+
*/
|
|
9579
|
+
status(): Promise<DistributedRun>;
|
|
9580
|
+
/** Get the per-shard status list (index, status, exitCode, timings). */
|
|
9581
|
+
shards(): Promise<DistributedRunShard[]>;
|
|
9582
|
+
/**
|
|
9583
|
+
* Poll until the aggregate reaches a terminal state (succeeded, failed,
|
|
9584
|
+
* partial, cancelled, timed_out) and return the final {@link DistributedRun}.
|
|
9585
|
+
*
|
|
9586
|
+
* @param options.pollIntervalMs - How often to poll in ms (default: 3000)
|
|
9587
|
+
* @param options.timeoutMs - Max time to wait before throwing (default: 2h)
|
|
9588
|
+
* @throws Error if the wait timeout is exceeded
|
|
9589
|
+
*/
|
|
9590
|
+
wait(options?: {
|
|
9591
|
+
pollIntervalMs?: number;
|
|
9592
|
+
timeoutMs?: number;
|
|
9593
|
+
}): Promise<DistributedRun>;
|
|
9594
|
+
/**
|
|
9595
|
+
* Fetch captured logs for one shard (default: shard 0).
|
|
9596
|
+
*
|
|
9597
|
+
* @param options.shard - Shard index (0..parallelism-1). Defaults to 0.
|
|
9598
|
+
*/
|
|
9599
|
+
logs(options?: {
|
|
9600
|
+
shard?: number;
|
|
9601
|
+
}): Promise<RunLogsResult>;
|
|
9602
|
+
/** Cancel the whole run (all shards). */
|
|
9603
|
+
cancel(): Promise<void>;
|
|
9604
|
+
}
|
|
8871
9605
|
/**
|
|
8872
9606
|
* Static client for the Workers BaaS service.
|
|
8873
9607
|
*
|
|
@@ -8902,6 +9636,49 @@ declare const RunsClient: {
|
|
|
8902
9636
|
* ```
|
|
8903
9637
|
*/
|
|
8904
9638
|
run(config: SylphxConfig, options: CreateRunOptions): Promise<RunHandle>;
|
|
9639
|
+
/**
|
|
9640
|
+
* Spawn a Distributed Run — one logical job fanned out to N indexed shards —
|
|
9641
|
+
* and return a {@link DistributedRunHandle} (ADR distributed-batch-compute).
|
|
9642
|
+
*
|
|
9643
|
+
* The platform owns sharding, gang start (all shards admitted together or
|
|
9644
|
+
* none), the per-org concurrency budget, and the aggregate/per-shard rollup.
|
|
9645
|
+
* Each shard self-selects its partition from the injected
|
|
9646
|
+
* `SYLPHX_SHARD_INDEX` (0..parallelism-1) + `SYLPHX_SHARD_COUNT` env vars — no
|
|
9647
|
+
* coordinator code for the embarrassingly-parallel case.
|
|
9648
|
+
*
|
|
9649
|
+
* `parallelism: 1` is equivalent to {@link RunsClient.run} (the single-shard
|
|
9650
|
+
* N=1 case); the single-shard `run()` ergonomic path is unchanged.
|
|
9651
|
+
*
|
|
9652
|
+
* @example
|
|
9653
|
+
* ```typescript
|
|
9654
|
+
* const run = await RunsClient.runDistributed(config, {
|
|
9655
|
+
* image: 'ghcr.io/acme/trainer:sha-abc123',
|
|
9656
|
+
* command: ['python', 'train.py'],
|
|
9657
|
+
* parallelism: 16,
|
|
9658
|
+
* machine: 'large',
|
|
9659
|
+
* })
|
|
9660
|
+
* const result = await run.wait()
|
|
9661
|
+
* if (result.status !== 'succeeded') {
|
|
9662
|
+
* const failed = result.shards.filter((s) => s.status === 'failed')
|
|
9663
|
+
* throw new Error(`${failed.length}/${run.parallelism} shards failed`)
|
|
9664
|
+
* }
|
|
9665
|
+
* ```
|
|
9666
|
+
*/
|
|
9667
|
+
runDistributed(config: SylphxConfig, options: CreateDistributedRunOptions): Promise<DistributedRunHandle>;
|
|
9668
|
+
/**
|
|
9669
|
+
* Get a {@link DistributedRunHandle} for an existing distributed run by ID.
|
|
9670
|
+
*
|
|
9671
|
+
* Pass the `parallelism` the run was created with so the handle requests +
|
|
9672
|
+
* renders the correct N-shard aggregate. Useful for resuming monitoring (e.g.
|
|
9673
|
+
* a CLI `runs get <id> --parallelism N`) across processes.
|
|
9674
|
+
*
|
|
9675
|
+
* @example
|
|
9676
|
+
* ```typescript
|
|
9677
|
+
* const handle = RunsClient.runDistributedFromId(config, storedRunId, 16)
|
|
9678
|
+
* const result = await handle.wait()
|
|
9679
|
+
* ```
|
|
9680
|
+
*/
|
|
9681
|
+
runDistributedFromId(config: SylphxConfig, runId: string, parallelism: number, completionMode?: DurableWorkRunCompletionMode): DistributedRunHandle;
|
|
8905
9682
|
/**
|
|
8906
9683
|
* Get a RunHandle for an existing run by ID.
|
|
8907
9684
|
*
|
|
@@ -8964,6 +9741,49 @@ declare const WorkersClient: {
|
|
|
8964
9741
|
* ```
|
|
8965
9742
|
*/
|
|
8966
9743
|
run(config: SylphxConfig, options: CreateRunOptions): Promise<RunHandle>;
|
|
9744
|
+
/**
|
|
9745
|
+
* Spawn a Distributed Run — one logical job fanned out to N indexed shards —
|
|
9746
|
+
* and return a {@link DistributedRunHandle} (ADR distributed-batch-compute).
|
|
9747
|
+
*
|
|
9748
|
+
* The platform owns sharding, gang start (all shards admitted together or
|
|
9749
|
+
* none), the per-org concurrency budget, and the aggregate/per-shard rollup.
|
|
9750
|
+
* Each shard self-selects its partition from the injected
|
|
9751
|
+
* `SYLPHX_SHARD_INDEX` (0..parallelism-1) + `SYLPHX_SHARD_COUNT` env vars — no
|
|
9752
|
+
* coordinator code for the embarrassingly-parallel case.
|
|
9753
|
+
*
|
|
9754
|
+
* `parallelism: 1` is equivalent to {@link RunsClient.run} (the single-shard
|
|
9755
|
+
* N=1 case); the single-shard `run()` ergonomic path is unchanged.
|
|
9756
|
+
*
|
|
9757
|
+
* @example
|
|
9758
|
+
* ```typescript
|
|
9759
|
+
* const run = await RunsClient.runDistributed(config, {
|
|
9760
|
+
* image: 'ghcr.io/acme/trainer:sha-abc123',
|
|
9761
|
+
* command: ['python', 'train.py'],
|
|
9762
|
+
* parallelism: 16,
|
|
9763
|
+
* machine: 'large',
|
|
9764
|
+
* })
|
|
9765
|
+
* const result = await run.wait()
|
|
9766
|
+
* if (result.status !== 'succeeded') {
|
|
9767
|
+
* const failed = result.shards.filter((s) => s.status === 'failed')
|
|
9768
|
+
* throw new Error(`${failed.length}/${run.parallelism} shards failed`)
|
|
9769
|
+
* }
|
|
9770
|
+
* ```
|
|
9771
|
+
*/
|
|
9772
|
+
runDistributed(config: SylphxConfig, options: CreateDistributedRunOptions): Promise<DistributedRunHandle>;
|
|
9773
|
+
/**
|
|
9774
|
+
* Get a {@link DistributedRunHandle} for an existing distributed run by ID.
|
|
9775
|
+
*
|
|
9776
|
+
* Pass the `parallelism` the run was created with so the handle requests +
|
|
9777
|
+
* renders the correct N-shard aggregate. Useful for resuming monitoring (e.g.
|
|
9778
|
+
* a CLI `runs get <id> --parallelism N`) across processes.
|
|
9779
|
+
*
|
|
9780
|
+
* @example
|
|
9781
|
+
* ```typescript
|
|
9782
|
+
* const handle = RunsClient.runDistributedFromId(config, storedRunId, 16)
|
|
9783
|
+
* const result = await handle.wait()
|
|
9784
|
+
* ```
|
|
9785
|
+
*/
|
|
9786
|
+
runDistributedFromId(config: SylphxConfig, runId: string, parallelism: number, completionMode?: DurableWorkRunCompletionMode): DistributedRunHandle;
|
|
8967
9787
|
/**
|
|
8968
9788
|
* Get a RunHandle for an existing run by ID.
|
|
8969
9789
|
*
|
|
@@ -10098,4 +10918,4 @@ declare const functions: {
|
|
|
10098
10918
|
};
|
|
10099
10919
|
};
|
|
10100
10920
|
|
|
10101
|
-
export { ACHIEVEMENT_TIER_CONFIG, type AIListModelsOptions, type AIListModelsResponse, type AIMessage, type AIMessageRole, type AIModel, type AIModelInfo, type AIModelsResponse, type AIProvider, type AIRateLimitInfo, type AIRateLimitResponse, type AIRequestType, type AIStreamChunk, type AITool, type AIToolCall, type AIUsageResponse, type AIUsageStats, type AccessTokenPayload, type AchievementCategory, type AchievementCriteria, type AchievementCriterion, type AchievementDefinition, type AchievementTier, type AchievementType, type AchievementUnlockEvent, type AdminUser, type AuditQueryFilter, type AuditQueryResult, AuthenticationError, AuthorizationError, BILLING_ALLOWED_ROLES, BUILD_MINUTES_INCLUDED, BUILD_MINUTE_PRICES, BUILD_SIZE_MULTIPLIERS, BYTES_PER_GB, type BackupCodesResult, type BatchEvent, type BatchIndexInput, type BatchIndexResult, type BillingAllowedRole, type Breadcrumb, type BrowserCreateOptions, type BrowserSessionInfo, type BrowserSessionStatus, type BuildConnectionUrlInput, type BuildLog, type BuildLogHistoryResponse, type BuildMachineTier, CI_BUILD_MINUTE_PRICE_MICRODOLLARS, CI_FREE_MINUTES_PER_MONTH, CI_MACOS_MULTIPLIER, CI_MACOS_SIZE_MULTIPLIERS, CI_SIZE_MULTIPLIERS, COMPUTE_PRICE_PER_HOUR_MICRODOLLARS, COMPUTE_RAM_RATE_MICRODOLLARS, COMPUTE_VCPU_ACTIVE_RATE_MICRODOLLARS, COMPUTE_VCPU_IDLE_RATE_MICRODOLLARS, CONSOLE_APP_SLUG, CREDENTIAL_REGEX, CREDIT_EXPIRY_MONTHS, type CaptureExceptionRequest, type CaptureMessageRequest, type ChallengeMethod, type ChallengeType, type ChallengeVerifyInput, type ChallengeVerifyResult, type ChatCompletionInput, type ChatCompletionResponse, type ChatInput, type ChatMessage, type ChatResult, type ChatStreamChunk, type CircuitBreakerConfig, CircuitBreakerOpenError, type CircuitState, type CommandResult, type ComputerDesktopStatus, type ComputerInputAction, type ComputerScreenshotFormat, type ComputerSessionInfo, type ComputerSessionStatus, type ComputerUiElement, type ComputerUiSnapshot, type ConnectionCredentialType, type ConnectionEnv, type ConsentCategory, type ConsentHistoryEntry, type ConsentHistoryResult, type ConsentPurposeDefaults, type ConsentType, type ContentPart, type CopyFileOptions, type CreateOrgInput, type CreatePermissionInput, type CreatePromoInput, type CreateRoleInput, type CreateRunOptions, type CreateTriggerOptions, type CriteriaOperator, type CronInput, type CronSchedule, type CronSource, DEFAULT_MAX_INSTANCES, DEFAULT_POINTS_REWARD, DISCOUNT_DURATION_MONTHS, DISCOUNT_PERCENT, type DatabaseConnectionInfo, type DatabaseStatus, type DatabaseStatusInfo, type DebugCategory, type DeduplicationConfig, type DeleteAccountResult, type DeleteDocumentInput, type DeployHistoryResponse, type DeployInfo, type DeployStatus, type DeviceApproveInput, type DeviceApproveResult, type DeviceDenyInput, type DeviceDenyResult, type DeviceGrant, type DeviceInitInput, type DevicePollResult, type DynamicRestClient, ERROR_CODE_STATUS, type EmailChangeInput, type EmailConfirmInput, type EmbedInput, type EmbedResult, type EmbeddingInput, type EmbeddingResponse, type LeaderboardEntry as EngagementLeaderboardEntry, type LeaderboardResult as EngagementLeaderboardResult, type EnvVar, type ErrorCode, type ErrorResponse, type EventSource, type ExceptionFrame, type ExceptionValue, type ExecEvent, type ExecOptions, type ExecResult, type ErrorDetails$1 as ExtractedErrorDetails, FREE_COMPUTE_HOURS, FREE_STORAGE_GB, type FacetsResponse, type FileEvent, type FlagContext, type FlagResult, type GetConsentHistoryInput, type GetConsentsInput, type GetFacetsInput, type GetSecretInput, type GetSecretResult, type GetSecretsInput, type GetSecretsResult, HOURS_PER_MONTH, type HttpTarget, INSTANCE_TYPES, INSTANCE_TYPE_ALIASES, INSTANCE_TYPE_ORDER, INVOICE_DUE_DAYS, type IdentifyInput, type ImpersonationActive, type ImpersonationEndResult, type ImpersonationInfo, type ImpersonationStartResult, type IndexDocumentInput, type IndexDocumentResult, type IngestLogsResult, type InstanceTypeDefinition, type InstanceTypeId, InvalidConnectionUrlError, type InviteMemberInput, type InviteUserRequest, type InviteUserResponse, KV_FREE_STORAGE_GB, type KvExpireRequest, type KvHgetRequest, type KvHgetallRequest, type KvHsetRequest, type KvIncrRequest, type KvLpushRequest, type KvLrangeRequest, type KvMetric, type KvMgetRequest, type KvMsetRequest, type KvRateLimitRequest, type KvRateLimitResult, type KvScanOptions, type KvScanResult, type KvSetOptions, type KvSetRequest, type KvZMember, type KvZaddRequest, type KvZrangeRequest, LEGACY_INSTANCE_TYPE_ORDER, type LeaderboardAggregation, type LeaderboardDefinition, type LeaderboardEntry$1 as LeaderboardEntry, type LeaderboardOptions, type LeaderboardQueryOptions, type LeaderboardResetPeriod, type LeaderboardResult$1 as LeaderboardResult, type LeaderboardSortDirection, type LinkAnonymousConsentsInput, type ListFilesOptions, type ListPromosOptions, type ListPromosResult, type ListRedemptionsOptions, type ListRedemptionsResult, type ListRunsOptions, type ListRunsResult, type ListScheduledEmailsOptions, type ListSecretKeysInput, type ListTriggersResult, type ListUsersOptions, type ListUsersResult, type LogEntry, type LogLevel, type LoginHistoryEntry, type LoginRequest, type LoginResponse, MAX_PASSWORD_LENGTH, MAX_PAYMENT_ATTEMPTS, MICRODOLLARS_PER_CENT, MIN_PASSWORD_LENGTH, type MeResponse, type MemberPermissionsResult, type MintAccessTokenClaims, type MintAccessTokenResult, type MonitoringResponse, type MonitoringSeverity, type NativeStepContext, type NativeTaskDefinition, type TaskRunStatus as NativeTaskRunStatus, NetworkError, NotFoundError, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthCodeExchangeInput, type OAuthProvider, type OAuthProvidersResult, type OidcDiscoveryDocument, type OidcUserInfoResponse, type OrgRole, type OrgScopedTokenResponse, type OrgTokenPayload, type OrganizationInvitation, type OrganizationMember, type OrganizationMembership, type OrganizationsListResult, PASSWORD_REQUIREMENTS, PLATFORM_PLANS, PLATFORM_PLAN_ORDER, PLATFORM_PLAN_ORDER_ALL, PREMIUM_TRIAL_DAYS, type PageInput, type PaginatedResponse, type PaginationInput, type ParsedConnectionUrl, type ParsedUserAgent, type PasskeyRegistrationInput, type PasskeyRegistrationOptions, type PasskeySummary, type PasskeysList, type PasswordSetInput, type Permission, type PkceMethod, type Plan, type PlatformAccessTokenClaims, type PlatformFunctionsDownloadBundleResult, type PlatformLogoutInput, type PlatformPasswordChangeInput, type PlatformPasswordChangeResult, type PlatformPasswordSetInput, type PlatformPasswordSetResult, type PlatformPasswordStatusResult, type PlatformPlanDefinition, type PlatformPlanFeatures, type PlatformPlanId, type PlatformPlanLimits, type PlatformRealtimeChannel, type PlatformRealtimeCreateChannelResult, type PlatformRealtimeDeleteChannelResult, type PlatformRealtimeListChannelsResult, type PlatformRealtimeStatusResult, type PlatformRefreshInput, type PlatformRefreshResult, type PlatformSessionRenameInput, type PlatformSessionRenameResult, type PlatformSessionRevokeAllResult, type PlatformSessionRevokeInput, type PlatformSessionRevokeOtherResult, type PlatformSessionRevokeResult, type PlatformSessionsListResult, type PlatformUserDeleteInput, type PlatformUserDeleteResult, type PlatformUserExportResult, type PlatformUserRecord, type PlatformUserResolution, type ProcessEvent, type ProcessInfo, type ProcessStartOptions, type ProcessSummary, type ProjectMetadata, type PromoCode, type PromoRedemption, type PromoStatus, type PromoType, type PromoValidationPreview, type PublishEventResult, type PushCampaign, type PushCampaignStats, type PushCampaignVariant, type PushNotification, type PushNotificationPayload, type PushSegment, type PushSegmentFilter, type PushServiceWorkerConfig, type PushSubscription, type QueryLogsOptions, type QueryLogsResult, RETRYABLE_CODES, RateLimitError, type RateLimitStatusFilter, type RateLimitStatusResult, type RateLimitStrategiesFilter, type RateLimitStrategiesResult, type RateLimitStrategyDeleteInput, type RateLimitStrategyDeleteResult, type RateLimitStrategyUpsertInput, type RateLimitStrategyUpsertResult, type RealtimeEmitRequest, type RealtimeEmitResponse, type RealtimeHistoryRequest, type RealtimeHistoryResponse, type RealtimeMetric, type RecordActivityInput, type RecordActivityResult, type RedeemPromoInput, type RedeemPromoResult, type RedeemReferralInput, type RedeemResult, type ReferralCode, type ReferralStats, type RegisterInput, type RegisterRequest, type RegisterResponse, type ResendEmailVerificationRequest, type ResendEmailVerificationResponse, type RestClient, type RestClientConfig, type RestDynamicConfig, type RetryConfig, type RevokeTokenOptions, type Role, type RollbackDeployRequest, type Run, RunHandle, type RunLogsResult, type RunMachineSize, type RunResult, type RunStatus, type RunTarget, type RunVolumeMount, type CreateRunOptions as RunWorkerOptions, RunsClient, SERVICE_METRICS, STORAGE_PRICE_PER_GB_MONTH_MICRODOLLARS, SandboxBrowser, SandboxClient, SandboxComputer, type SandboxFile, SandboxFiles, type SandboxMachineSize, type SandboxOptions, SandboxProcesses, type SandboxRecord, SandboxWatch, type ScheduleEmailOptions, type ScheduledEmail, type ScheduledEmailStats, type ScheduledEmailsResult, type SearchInput, type SearchResponse, type SearchResultItem, type SearchStatsResult, type SearchType, type SecretKeyInfo, type SecurityAlert, type SecurityAlertsList, type SecurityScoreResult, type SecuritySettings, type SendEmailOptions, type SendResult, type SendTemplatedEmailOptions, type SendToUserOptions, type ServiceCredentials, type ServiceMetrics, type ServiceTokenResponse, type SessionResult, type SetConsentsInput, type SetEnvVarRequest, type SignedUrlOptions, StepCompleteSignal, StepSleepSignal, type StoredLogEntry, type StreakDefinition, type StreakFrequency, type StreakState, type StreamMessage, type SubmitScoreInput, type SubmitScoreResult, type Subscription, type SuccessResponse, type SylphxClientInput, type SylphxConfig, type SylphxConfigInput, SylphxError, type SylphxErrorCode, type SylphxErrorOptions, TRANSFER_PRICE_PER_GB_MICRODOLLARS, type TaskInput, type TaskResult, type TaskStatus, type TaskTarget, type TextCompletionInput, type TextCompletionResponse, TimeoutError, type TokenIntrospectionResult, type TokenResponse, type Tool, type ToolCall, type TrackClickInput, type TrackInput, type Trigger, type TriggerDeployRequest, type TriggerRunMachineSize, type TriggerSource, type TriggerSourceType, type TriggerStatus, type TriggerTarget, type TriggerTargetType, TriggersClient, type TwoFactorEnableResult, type TwoFactorSetupResult, type TwoFactorVerifyRequest, type UpdateOrgInput, type UpdatePromoInput, type UpdateRoleInput, type UpdateTriggerOptions, type UploadCreateOptions, type UploadProgressEvent, type UpsertDocumentInput, type UpsertDocumentResult, type User, type UserAchievement, type UserConsent, type UserDataExport, type UserFullProfile, type UserOrganization, type UserProfile, type UserSecuritySettings, type UserSession, type UserSessionsList, type UserUpdateProfileInput, type ValidatePromoInput, type ValidatePromoResult, ValidationError, type VisionInput, type WatchEntry, type WatchOptions, type WebhookConfig, type WebhookConfigUpdate, type WebhookDeliveriesResult, type WebhookDelivery, type WebhookStats, RunHandle as WorkerHandle, type RunLogsResult as WorkerLogsResult, type RunResult as WorkerResult, type Run as WorkerRun, type RunStatus as WorkerStatus, type RunVolumeMount as WorkerVolumeMount, WorkersClient, type WorkspaceRecord, acceptAllConsents, acceptOrganizationInvitation, assignMemberRole, audit, authorizeOAuth, batchIndex, buildConnectionUrl, calculatePercentage, canDeleteOrganization, canManageMembers, canManageSettings, cancelScheduledEmail, cancelTask, captureException, captureExceptionRaw, captureMessage, centsToDollars, chat, chatStream, checkFlag, complete, confirmEmailChange, cookies, createCheckout, createClient, createConfig, createCron, createDynamicRestClient, createOrganization, createPermission, createPortalSession, createPromo, createRestClient, createRole, createServerClient, createServiceWorkerScript, createStepContext, createTasksHandler, createTracker, createWorkspace, debugError, debugLog, debugTimer, debugWarn, declineOptionalConsents, deleteCron, deleteDocument, deleteEnvVar, deleteOrganization, deletePasskey, deletePermission, deletePromo, deleteRole, deleteUser, deleteUserAccount, deleteWorkspace, device, disableDebug, disableTwoFactor, disconnectOAuthProvider, dpop, embed, enableDebug, escapeCsvField, escapeHtml, exchangeOAuthCode, exponentialBackoff, exportUserData, extendedSignUp, getErrorDetails$1 as extractErrorDetails, getErrorMessage$1 as extractErrorMessage, forgotPassword, forkWorkspace, formatBytes, formatCents, formatCurrency, formatDate, formatDateTime, formatDuration, formatMicrodollars, formatMonthYear, formatNumber, formatPercent, formatRelativeTime, formatRelativeTimeShort, formatTime, functions, generateAnonymousId, generatePkce, generateReferralCode, generateSlug, getAchievement, getAchievementPoints, getAchievements, getActivePlans, getAllFlags, getAllSecrets, getAllStreaks, getAvailableInstanceTypes, getBackupCodes, getBaseUrl, getBillingBalance, getBillingStatusVariant, getBillingUsage, getBuildLogHistory, getCircuitBreakerState, getConsentHistory, getConsentTypes, getDatabaseConnectionString, getDatabaseStatus, getDebugMode, getDefaultInstanceType, getDeployHistory, getDeployStatus, getEnvPrefix, getErrorCode, getErrorDetails, getErrorMessage, getFacets, getFlagPayload, getFlags, getInvoiceStatusVariant, getLeaderboard, getMemberPermissions, getMyReferralCode, getOidcDiscoveryDocument, getOrgScopedToken, getOrganization, getOrganizationInvitations, getOrganizationMembers, getOrganizations, getPlanMonthlyPrice, getPlans, getProjectMetadata, getPromo, getPushPreferences, getRealtimeHistory, getReferralLeaderboard, getReferralStats, getRestErrorMessage, getRole, getSafeErrorMessage, getScheduledEmail, getScheduledEmailStats, getSearchStats, getSecret, getSecrets, getSecurityScore, getSession, getStreak, getSubscription, getTask, getUser, getUserByEmail, getUserConsents, getUserLeaderboardRank, getUserProfile, getUserSecurity, getVariant, getWebhookConfig, getWebhookDeliveries, getWebhookDelivery, getWebhookStats, getWorkspace, hasAllPermissions, hasAnyPermission, hasBillingAccess, hasConsent, hasError, hasPermission, hasRole, hasSecret, identify, impersonation, incrementAchievementProgress, indexDocument, ingestLogs, initPushServiceWorker, installGlobalDebugHelpers, introspectToken, inviteOrganizationMember, inviteUser, isChallengeRequired, isEmailConfigured, isEnabled, isPlanDeprecated, isRetryableError, isSylphxError, isValidInstanceType, kvDelete, kvExists, kvExpire, kvGet, kvGetJSON, kvHget, kvHgetall, kvHset, kvIncr, kvLpush, kvLrange, kvMget, kvMset, kvRateLimit, kvScan, kvSet, kvSetJSON, kvZadd, kvZrange, leaveOrganization, linkAnonymousConsents, listEnvVars, listOAuthProviders, listOrganizations, listPasskeys, listPermissions, listPromoRedemptions, listPromos, listRoles, listScheduledEmails, listSecretKeys, listSecurityAlerts, listTasks, listUserSessions, listUsers, listWorkspaces, markAllSecurityAlertsRead, markSecurityAlertRead, microsToDollars, oauth, page, parseConnectionUrl, parseOAuthCallback, parseUserAgent, password, pauseCron, platformAuth, campaigns as pushCampaigns, segments as pushSegments, queryLogs, rateLimits, realtime, realtimeEmit, recordStreakActivity, recoverStreak, redeemPromo, redeemReferralCode, refreshToken, regenerateBackupCodes, regenerateReferralCode, registerPush, registerPushServiceWorker, removeOrganizationMember, renamePasskey, renameUserSession, replayWebhookDelivery, requestEmailChange, rescheduleEmail, resendVerificationEmail, resetCircuitBreaker, resetDebugModeCache, resetPassword, resetPlatformCookieCache, resetPlatformJwksCache, resolveCanonicalInstanceType, resolveMaxInstances, resolveResources, resumeCron, revokeAllTokens, revokeOrganizationInvitation, revokeToken, revokeUserSession, rollbackDeploy, safeJsonParse, scheduleEmail, scheduleTask, search, sendEmail, sendEmailToUser, sendPush, sendTemplatedEmail, sessions, setConsents, setEnvVar, setPassword, setupTwoFactor, signIn, signInAsService, signOut, signUp, startPasskeyRegistration, storage, streamToString, submitScore, suspendUser, switchOrg, toSylphxError, track, trackBatch, trackClick, triggerDeploy, unlockAchievement, unregisterPush, updateOrganization, updateOrganizationMemberRole, updatePromo, updatePushPreferences, updateRole, updateUser, updateUserMetadata, updateUserProfile, updateWebhookConfig, upsertDocument, user, userInfo, validateInstanceTypeForPlan, validatePromo, verifyAccessToken, verifyChallenge, verifyEmail, verifyPasskeyRegistration, verifySignature as verifyTaskSignature, verifyTwoFactor, verifyTwoFactorEnable, withToken };
|
|
10921
|
+
export { ACHIEVEMENT_TIER_CONFIG, type AIListModelsOptions, type AIListModelsResponse, type AIMessage, type AIMessageRole, type AIModel, type AIModelInfo, type AIModelsResponse, type AIProvider, type AIRateLimitInfo, type AIRateLimitResponse, type AIRequestType, type AIStreamChunk, type AITool, type AIToolCall, type AIUsageResponse, type AIUsageStats, type AccessTokenPayload, type AchievementCategory, type AchievementCriteria, type AchievementCriterion, type AchievementDefinition, type AchievementTier, type AchievementType, type AchievementUnlockEvent, type AdminUser, ArtifactClient, type AuditQueryFilter, type AuditQueryResult, AuthenticationError, AuthorizationError, BILLING_ALLOWED_ROLES, BUILD_MINUTES_INCLUDED, BUILD_MINUTE_PRICES, BUILD_SIZE_MULTIPLIERS, BYTES_PER_GB, type BackupCodesResult, type BatchEvent, type BatchIndexInput, type BatchIndexResult, type BillingAllowedRole, type Breadcrumb, type BrowserCreateOptions, type BrowserSessionInfo, type BrowserSessionStatus, type BuildConnectionUrlInput, type BuildLog, type BuildLogHistoryResponse, type BuildMachineTier, CI_BUILD_MINUTE_PRICE_MICRODOLLARS, CI_FREE_MINUTES_PER_MONTH, CI_MACOS_MULTIPLIER, CI_MACOS_SIZE_MULTIPLIERS, CI_SIZE_MULTIPLIERS, COMPUTE_PRICE_PER_HOUR_MICRODOLLARS, COMPUTE_RAM_RATE_MICRODOLLARS, COMPUTE_VCPU_ACTIVE_RATE_MICRODOLLARS, COMPUTE_VCPU_IDLE_RATE_MICRODOLLARS, CONSOLE_APP_SLUG, CREDENTIAL_REGEX, CREDIT_EXPIRY_MONTHS, type CaptureExceptionRequest, type CaptureMessageRequest, type ChallengeMethod, type ChallengeType, type ChallengeVerifyInput, type ChallengeVerifyResult, type ChatCompletionInput, type ChatCompletionResponse, type ChatInput, type ChatMessage, type ChatResult, type ChatStreamChunk, type CircuitBreakerConfig, CircuitBreakerOpenError, type CircuitState, type CommandResult, type ComputerDesktopStatus, type ComputerInputAction, type ComputerScreenshotFormat, type ComputerSessionInfo, type ComputerSessionStatus, type ComputerUiElement, type ComputerUiSnapshot, type ConnectionCredentialType, type ConnectionEnv, type ConsentCategory, type ConsentHistoryEntry, type ConsentHistoryResult, type ConsentPurposeDefaults, type ConsentType, type ContentPart, type CopyFileOptions, type CreateDistributedRunOptions, type CreateOrgInput, type CreatePermissionInput, type CreatePromoInput, type CreateRoleInput, type CreateRunOptions, type CreateTriggerOptions, type CriteriaOperator, type CronInput, type CronSchedule, type CronSource, DEFAULT_MAX_INSTANCES, DEFAULT_POINTS_REWARD, DISCOUNT_DURATION_MONTHS, DISCOUNT_PERCENT, type DatabaseConnectionInfo, type DatabaseStatus, type DatabaseStatusInfo, type DebugCategory, type DeduplicationConfig, type DeleteAccountResult, type DeleteDocumentInput, type DeployHistoryResponse, type DeployInfo, type DeployStatus, type DeviceApproveInput, type DeviceApproveResult, type DeviceDenyInput, type DeviceDenyResult, type DeviceGrant, type DeviceInitInput, type DevicePollResult, DeviceSessionClient, DistributedRunHandle, type DistributedRunStatus, type DynamicRestClient, ERROR_CODE_STATUS, type EmailChangeInput, type EmailConfirmInput, type EmbedInput, type EmbedResult, type EmbeddingInput, type EmbeddingResponse, type LeaderboardEntry as EngagementLeaderboardEntry, type LeaderboardResult as EngagementLeaderboardResult, type EnvVar, type ErrorCode, type ErrorResponse, type EventSource, type ExceptionFrame, type ExceptionValue, type ExecEvent, type ExecOptions, type ExecResult, type ErrorDetails$1 as ExtractedErrorDetails, FREE_COMPUTE_HOURS, FREE_STORAGE_GB, type FacetsResponse, type FileEvent, type FlagContext, type FlagResult, type GetConsentHistoryInput, type GetConsentsInput, type GetFacetsInput, type GetSecretInput, type GetSecretResult, type GetSecretsInput, type GetSecretsResult, HOURS_PER_MONTH, type HttpTarget, INSTANCE_TYPES, INSTANCE_TYPE_ALIASES, INSTANCE_TYPE_ORDER, INVOICE_DUE_DAYS, type IdentifyInput, type ImpersonationActive, type ImpersonationEndResult, type ImpersonationInfo, type ImpersonationStartResult, type IndexDocumentInput, type IndexDocumentResult, type IngestLogsResult, type InstanceTypeDefinition, type InstanceTypeId, InvalidConnectionUrlError, type InviteMemberInput, type InviteUserRequest, type InviteUserResponse, KV_FREE_STORAGE_GB, type KvExpireRequest, type KvHgetRequest, type KvHgetallRequest, type KvHsetRequest, type KvIncrRequest, type KvLpushRequest, type KvLrangeRequest, type KvMetric, type KvMgetRequest, type KvMsetRequest, type KvRateLimitRequest, type KvRateLimitResult, type KvScanOptions, type KvScanResult, type KvSetOptions, type KvSetRequest, type KvZMember, type KvZaddRequest, type KvZrangeRequest, LEGACY_INSTANCE_TYPE_ORDER, type LeaderboardAggregation, type LeaderboardDefinition, type LeaderboardEntry$1 as LeaderboardEntry, type LeaderboardOptions, type LeaderboardQueryOptions, type LeaderboardResetPeriod, type LeaderboardResult$1 as LeaderboardResult, type LeaderboardSortDirection, type LinkAnonymousConsentsInput, type ListFilesOptions, type ListPromosOptions, type ListPromosResult, type ListRedemptionsOptions, type ListRedemptionsResult, type ListRunsOptions, type ListRunsResult, type ListScheduledEmailsOptions, type ListSecretKeysInput, type ListTriggersResult, type ListUsersOptions, type ListUsersResult, type LogEntry, type LogLevel, type LoginHistoryEntry, type LoginRequest, type LoginResponse, MAX_PASSWORD_LENGTH, MAX_PAYMENT_ATTEMPTS, MICRODOLLARS_PER_CENT, MIN_PASSWORD_LENGTH, type MeResponse, type MemberPermissionsResult, type MintAccessTokenClaims, type MintAccessTokenResult, type MonitoringResponse, type MonitoringSeverity, type NativeStepContext, type NativeTaskDefinition, type TaskRunStatus as NativeTaskRunStatus, NetworkError, NotFoundError, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthCodeExchangeInput, type OAuthProvider, type OAuthProvidersResult, type OidcDiscoveryDocument, type OidcUserInfoResponse, type OrgRole, type OrgScopedTokenResponse, type OrgTokenPayload, type OrganizationInvitation, type OrganizationMember, type OrganizationMembership, type OrganizationsListResult, PASSWORD_REQUIREMENTS, PLATFORM_PLANS, PLATFORM_PLAN_ORDER, PLATFORM_PLAN_ORDER_ALL, PREMIUM_TRIAL_DAYS, type PageInput, type PaginatedResponse, type PaginationInput, type ParsedConnectionUrl, type ParsedUserAgent, type PasskeyRegistrationInput, type PasskeyRegistrationOptions, type PasskeySummary, type PasskeysList, type PasswordSetInput, type Permission, type PkceMethod, type Plan, type PlatformAccessTokenClaims, type PlatformFunctionsDownloadBundleResult, type PlatformLogoutInput, type PlatformPasswordChangeInput, type PlatformPasswordChangeResult, type PlatformPasswordSetInput, type PlatformPasswordSetResult, type PlatformPasswordStatusResult, type PlatformPlanDefinition, type PlatformPlanFeatures, type PlatformPlanId, type PlatformPlanLimits, type PlatformRealtimeChannel, type PlatformRealtimeCreateChannelResult, type PlatformRealtimeDeleteChannelResult, type PlatformRealtimeListChannelsResult, type PlatformRealtimeStatusResult, type PlatformRefreshInput, type PlatformRefreshResult, type PlatformSessionRenameInput, type PlatformSessionRenameResult, type PlatformSessionRevokeAllResult, type PlatformSessionRevokeInput, type PlatformSessionRevokeOtherResult, type PlatformSessionRevokeResult, type PlatformSessionsListResult, type PlatformUserDeleteInput, type PlatformUserDeleteResult, type PlatformUserExportResult, type PlatformUserRecord, type PlatformUserResolution, type ProcessEvent, type ProcessInfo, type ProcessStartOptions, type ProcessSummary, type ProjectMetadata, type PromoCode, type PromoRedemption, type PromoStatus, type PromoType, type PromoValidationPreview, type PublishEventResult, type PushCampaign, type PushCampaignStats, type PushCampaignVariant, type PushNotification, type PushNotificationPayload, type PushSegment, type PushSegmentFilter, type PushServiceWorkerConfig, type PushSubscription, type QueryLogsOptions, type QueryLogsResult, RETRYABLE_CODES, RateLimitError, type RateLimitStatusFilter, type RateLimitStatusResult, type RateLimitStrategiesFilter, type RateLimitStrategiesResult, type RateLimitStrategyDeleteInput, type RateLimitStrategyDeleteResult, type RateLimitStrategyUpsertInput, type RateLimitStrategyUpsertResult, type RealtimeEmitRequest, type RealtimeEmitResponse, type RealtimeHistoryRequest, type RealtimeHistoryResponse, type RealtimeMetric, type RecordActivityInput, type RecordActivityResult, type RedeemPromoInput, type RedeemPromoResult, type RedeemReferralInput, type RedeemResult, type ReferralCode, type ReferralStats, type RegisterInput, type RegisterRequest, type RegisterResponse, RenderClient, type ResendEmailVerificationRequest, type ResendEmailVerificationResponse, type RestClient, type RestClientConfig, type RestDynamicConfig, type RetryConfig, type RevokeTokenOptions, type Role, type RollbackDeployRequest, type Run, RunHandle, type RunLogsResult, type RunMachineSize, type RunResult, type RunStatus, type RunTarget, type RunVolumeMount, type CreateRunOptions as RunWorkerOptions, RunsClient, SERVICE_METRICS, STORAGE_PRICE_PER_GB_MONTH_MICRODOLLARS, SandboxBrowser, SandboxCapabilities, SandboxClient, SandboxComputer, type SandboxFile, SandboxFiles, type SandboxMachineSize, type SandboxOptions, SandboxProcesses, type SandboxRecord, SandboxWatch, type ScheduleEmailOptions, type ScheduledEmail, type ScheduledEmailStats, type ScheduledEmailsResult, type SearchInput, type SearchResponse, type SearchResultItem, type SearchStatsResult, type SearchType, type SecretKeyInfo, type SecurityAlert, type SecurityAlertsList, type SecurityScoreResult, type SecuritySettings, type SendEmailOptions, type SendResult, type SendTemplatedEmailOptions, type SendToUserOptions, type ServeOptions, type ServeResult, type ServiceCredentials, type ServiceMetrics, type ServiceTokenResponse, type SessionResult, type SetConsentsInput, type SetEnvVarRequest, type SignedUrlOptions, StepCompleteSignal, StepSleepSignal, type StoredLogEntry, type StreakDefinition, type StreakFrequency, type StreakState, type StreamMessage, type SubmitScoreInput, type SubmitScoreResult, type Subscription, type SuccessResponse, type SylphxClientInput, type SylphxConfig, type SylphxConfigInput, SylphxError, type SylphxErrorCode, type SylphxErrorOptions, TRANSFER_PRICE_PER_GB_MICRODOLLARS, type TaskConfig, type TaskHandle, type TaskInput, type TaskMachineSize, type TaskResult, type TaskRunContext, type TaskRunDetail, type TaskRunStep, type TaskStatus, type TaskTarget, type TextCompletionInput, type TextCompletionResponse, TimeoutError, type TokenIntrospectionResult, type TokenResponse, type Tool, type ToolCall, type TrackClickInput, type TrackInput, type Trigger, type TriggerDeployRequest, type TriggerOptions, type TriggerRunMachineSize, type TriggerSource, type TriggerSourceType, type TriggerStatus, type TriggerTarget, type TriggerTargetType, TriggersClient, type TwoFactorEnableResult, type TwoFactorSetupResult, type TwoFactorVerifyRequest, type UpdateOrgInput, type UpdatePromoInput, type UpdateRoleInput, type UpdateTriggerOptions, type UploadCreateOptions, type UploadProgressEvent, type UpsertDocumentInput, type UpsertDocumentResult, type User, type UserAchievement, type UserConsent, type UserDataExport, type UserFullProfile, type UserOrganization, type UserProfile, type UserSecuritySettings, type UserSession, type UserSessionsList, type UserUpdateProfileInput, type ValidatePromoInput, type ValidatePromoResult, ValidationError, type VisionInput, WalletClient, type WatchEntry, type WatchOptions, type WebhookConfig, type WebhookConfigUpdate, type WebhookDeliveriesResult, type WebhookDelivery, type WebhookStats, RunHandle as WorkerHandle, type RunLogsResult as WorkerLogsResult, type RunResult as WorkerResult, type Run as WorkerRun, type RunStatus as WorkerStatus, type RunVolumeMount as WorkerVolumeMount, WorkersClient, type WorkspaceRecord, acceptAllConsents, acceptOrganizationInvitation, assignMemberRole, audit, authorizeOAuth, batchIndex, buildConnectionUrl, calculatePercentage, canDeleteOrganization, canManageMembers, canManageSettings, cancelScheduledEmail, cancelTask, captureException, captureExceptionRaw, captureMessage, centsToDollars, chat, chatStream, checkFlag, complete, confirmEmailChange, cookies, createCheckout, createClient, createConfig, createCron, createDynamicRestClient, createOrganization, createPermission, createPortalSession, createPromo, createRestClient, createRole, createServerClient, createServiceWorkerScript, createStepContext, createTasksHandler, createTracker, createWorkspace, debugError, debugLog, debugTimer, debugWarn, declineOptionalConsents, deleteCron, deleteDocument, deleteEnvVar, deleteOrganization, deletePasskey, deletePermission, deletePromo, deleteRole, deleteUser, deleteUserAccount, deleteWorkspace, device, disableDebug, disableTwoFactor, disconnectOAuthProvider, dpop, embed, enableDebug, escapeCsvField, escapeHtml, exchangeOAuthCode, exponentialBackoff, exportUserData, extendedSignUp, getErrorDetails$1 as extractErrorDetails, getErrorMessage$1 as extractErrorMessage, forgotPassword, forkWorkspace, formatBytes, formatCents, formatCurrency, formatDate, formatDateTime, formatDuration, formatMicrodollars, formatMonthYear, formatNumber, formatPercent, formatRelativeTime, formatRelativeTimeShort, formatTime, functions, generateAnonymousId, generatePkce, generateReferralCode, generateSlug, getAchievement, getAchievementPoints, getAchievements, getActivePlans, getAllFlags, getAllSecrets, getAllStreaks, getAvailableInstanceTypes, getBackupCodes, getBaseUrl, getBillingBalance, getBillingStatusVariant, getBillingUsage, getBuildLogHistory, getCircuitBreakerState, getConsentHistory, getConsentTypes, getDatabaseConnectionString, getDatabaseStatus, getDebugMode, getDefaultInstanceType, getDeployHistory, getDeployStatus, getEnvPrefix, getErrorCode, getErrorDetails, getErrorMessage, getFacets, getFlagPayload, getFlags, getInvoiceStatusVariant, getLeaderboard, getMemberPermissions, getMyReferralCode, getOidcDiscoveryDocument, getOrgScopedToken, getOrganization, getOrganizationInvitations, getOrganizationMembers, getOrganizations, getPlanMonthlyPrice, getPlans, getProjectMetadata, getPromo, getPushPreferences, getRealtimeHistory, getReferralLeaderboard, getReferralStats, getRestErrorMessage, getRole, getSafeErrorMessage, getScheduledEmail, getScheduledEmailStats, getSearchStats, getSecret, getSecrets, getSecurityScore, getSession, getStreak, getSubscription, getTask, getTaskRun, getUser, getUserByEmail, getUserConsents, getUserLeaderboardRank, getUserProfile, getUserSecurity, getVariant, getWebhookConfig, getWebhookDeliveries, getWebhookDelivery, getWebhookStats, getWorkspace, getWorkspaceCapacity, hasAllPermissions, hasAnyPermission, hasBillingAccess, hasConsent, hasError, hasPermission, hasRole, hasSecret, identify, impersonation, incrementAchievementProgress, indexDocument, ingestLogs, initPushServiceWorker, installGlobalDebugHelpers, introspectToken, inviteOrganizationMember, inviteUser, isChallengeRequired, isEmailConfigured, isEnabled, isPlanDeprecated, isRetryableError, isSylphxError, isValidInstanceType, kvDelete, kvExists, kvExpire, kvGet, kvGetJSON, kvHget, kvHgetall, kvHset, kvIncr, kvLpush, kvLrange, kvMget, kvMset, kvRateLimit, kvScan, kvSet, kvSetJSON, kvZadd, kvZrange, leaveOrganization, linkAnonymousConsents, listEnvVars, listOAuthProviders, listOrganizations, listPasskeys, listPermissions, listPromoRedemptions, listPromos, listRoles, listScheduledEmails, listSecretKeys, listSecurityAlerts, listTasks, listUserSessions, listUsers, listWorkspaces, markAllSecurityAlertsRead, markSecurityAlertRead, microsToDollars, oauth, page, parseConnectionUrl, parseOAuthCallback, parseUserAgent, password, pauseCron, pinWorkspace, platformAuth, campaigns as pushCampaigns, segments as pushSegments, queryLogs, rateLimits, realtime, realtimeEmit, reclaimWorkspace, reclaimWorkspaceSubpath, recordStreakActivity, recoverStreak, redeemPromo, redeemReferralCode, refreshToken, regenerateBackupCodes, regenerateReferralCode, registerPush, registerPushServiceWorker, removeOrganizationMember, renamePasskey, renameUserSession, replayWebhookDelivery, requestEmailChange, rescheduleEmail, resendVerificationEmail, resetCircuitBreaker, resetDebugModeCache, resetPassword, resetPlatformCookieCache, resetPlatformJwksCache, resolveCanonicalInstanceType, resolveMaxInstances, resolveResources, resumeCron, revokeAllTokens, revokeOrganizationInvitation, revokeToken, revokeUserSession, rollbackDeploy, safeJsonParse, scheduleEmail, scheduleTask, search, sendEmail, sendEmailToUser, sendPush, sendTemplatedEmail, serve, sessions, setConsents, setEnvVar, setPassword, setupTwoFactor, signIn, signInAsService, signOut, signUp, startPasskeyRegistration, storage, streamToString, submitScore, suspendUser, switchOrg, task, taskStub, toSylphxError, track, trackBatch, trackClick, triggerDeploy, unlockAchievement, unregisterPush, updateOrganization, updateOrganizationMemberRole, updatePromo, updatePushPreferences, updateRole, updateUser, updateUserMetadata, updateUserProfile, updateWebhookConfig, upsertDocument, user, userInfo, validateInstanceTypeForPlan, validatePromo, verifyAccessToken, verifyChallenge, verifyEmail, verifyPasskeyRegistration, verifySignature as verifyTaskSignature, verifyTwoFactor, verifyTwoFactorEnable, withToken };
|