@sylphx/sdk 0.19.2 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -15,10 +15,11 @@ function detectSdkPlatform() {
15
15
  if (typeof runtimeGlobal.EdgeRuntime !== "undefined") return "edge";
16
16
  return "node";
17
17
  }
18
- var SDK_API_PATH, DEFAULT_SDK_API_HOST, SDK_VERSION, SDK_PLATFORM, DEFAULT_TIMEOUT_MS, SANDBOX_CREATE_TIMEOUT_MS, SESSION_TOKEN_LIFETIME_SECONDS, SESSION_TOKEN_LIFETIME_MS, REFRESH_TOKEN_LIFETIME_SECONDS, FLAGS_CACHE_TTL_MS, FLAGS_STALE_WHILE_REVALIDATE_MS, MAX_RETRY_DELAY_MS, BASE_RETRY_DELAY_MS, ANALYTICS_SESSION_TIMEOUT_MS, WEBHOOK_MAX_AGE_MS, WEBHOOK_CLOCK_SKEW_MS, PKCE_CODE_TTL_MS, JOBS_DLQ_MAX_AGE_MS, SESSION_REPLAY_MAX_DURATION_MS, FLAGS_EXPOSURE_DEDUPE_WINDOW_MS, CLICK_ID_EXPIRY_MS, STALE_TIME_FREQUENT_MS, STALE_TIME_MODERATE_MS, STALE_TIME_STABLE_MS, STALE_TIME_STATS_MS, NEW_USER_THRESHOLD_MS, STORAGE_MULTIPART_THRESHOLD_BYTES, STORAGE_DEFAULT_MAX_SIZE_BYTES, STORAGE_AVATAR_MAX_SIZE_BYTES, STORAGE_LARGE_MAX_SIZE_BYTES, JWK_CACHE_TTL_MS, CIRCUIT_BREAKER_FAILURE_THRESHOLD, CIRCUIT_BREAKER_WINDOW_MS, CIRCUIT_BREAKER_OPEN_DURATION_MS, ETAG_CACHE_MAX_ENTRIES, ETAG_CACHE_TTL_MS;
18
+ var ENV_SECRET_URL, SDK_API_PATH, DEFAULT_SDK_API_HOST, SDK_VERSION, SDK_PLATFORM, DEFAULT_TIMEOUT_MS, SANDBOX_CREATE_TIMEOUT_MS, SESSION_TOKEN_LIFETIME_SECONDS, SESSION_TOKEN_LIFETIME_MS, REFRESH_TOKEN_LIFETIME_SECONDS, FLAGS_CACHE_TTL_MS, FLAGS_STALE_WHILE_REVALIDATE_MS, MAX_RETRY_DELAY_MS, BASE_RETRY_DELAY_MS, ANALYTICS_SESSION_TIMEOUT_MS, WEBHOOK_MAX_AGE_MS, WEBHOOK_CLOCK_SKEW_MS, PKCE_CODE_TTL_MS, JOBS_DLQ_MAX_AGE_MS, SESSION_REPLAY_MAX_DURATION_MS, FLAGS_EXPOSURE_DEDUPE_WINDOW_MS, CLICK_ID_EXPIRY_MS, STALE_TIME_FREQUENT_MS, STALE_TIME_MODERATE_MS, STALE_TIME_STABLE_MS, STALE_TIME_STATS_MS, NEW_USER_THRESHOLD_MS, STORAGE_MULTIPART_THRESHOLD_BYTES, STORAGE_DEFAULT_MAX_SIZE_BYTES, STORAGE_AVATAR_MAX_SIZE_BYTES, STORAGE_LARGE_MAX_SIZE_BYTES, JWK_CACHE_TTL_MS, CIRCUIT_BREAKER_FAILURE_THRESHOLD, CIRCUIT_BREAKER_WINDOW_MS, CIRCUIT_BREAKER_OPEN_DURATION_MS, ETAG_CACHE_MAX_ENTRIES, ETAG_CACHE_TTL_MS;
19
19
  var init_constants = __esm({
20
20
  "src/constants.ts"() {
21
21
  "use strict";
22
+ ENV_SECRET_URL = "SYLPHX_SECRET_URL";
22
23
  SDK_API_PATH = `/v1`;
23
24
  DEFAULT_SDK_API_HOST = "api.sylphx.com";
24
25
  SDK_VERSION = "0.5.0";
@@ -1058,6 +1059,15 @@ function escapeCsvField(value) {
1058
1059
  return value;
1059
1060
  }
1060
1061
 
1062
+ // src/ci-runner-profiles.ts
1063
+ import {
1064
+ CI_LINUX_RUNNER_SIZES,
1065
+ CI_MACOS_RUNNER_SIZES,
1066
+ CI_RUNNER_PROFILES,
1067
+ formatCiRunnerWorkflowRunsOn,
1068
+ getCiRunnerProfileById
1069
+ } from "@sylphx/contract";
1070
+
1061
1071
  // src/formatting.ts
1062
1072
  function calculatePercentage(count, total, decimals = 2) {
1063
1073
  if (total === 0) return 100;
@@ -1392,6 +1402,13 @@ async function getWorkspace(config, workspaceId) {
1392
1402
  );
1393
1403
  return result.workspace;
1394
1404
  }
1405
+ async function getWorkspaceCapacity(config, workspaceId) {
1406
+ const result = await callApi(
1407
+ config,
1408
+ `/workspaces/${encodeURIComponent(workspaceId)}/capacity`
1409
+ );
1410
+ return result.snapshot;
1411
+ }
1395
1412
  async function createWorkspace(config, input) {
1396
1413
  const result = await callApi(config, "/workspaces", {
1397
1414
  method: "POST",
@@ -1412,6 +1429,26 @@ async function forkWorkspace(config, sourceWorkspaceId, input = {}) {
1412
1429
  );
1413
1430
  return result.workspace;
1414
1431
  }
1432
+ async function pinWorkspace(config, workspaceId, input = {}) {
1433
+ return callApi(
1434
+ config,
1435
+ `/workspaces/${encodeURIComponent(workspaceId)}/pins`,
1436
+ {
1437
+ method: "POST",
1438
+ body: input
1439
+ }
1440
+ );
1441
+ }
1442
+ async function reclaimWorkspace(config, workspaceId, input = {}) {
1443
+ return callApi(
1444
+ config,
1445
+ `/workspaces/${encodeURIComponent(workspaceId)}/reclaim`,
1446
+ {
1447
+ method: "POST",
1448
+ body: input
1449
+ }
1450
+ );
1451
+ }
1415
1452
  async function deleteWorkspace(config, workspaceId) {
1416
1453
  await callApi(config, `/workspaces/${encodeURIComponent(workspaceId)}`, {
1417
1454
  method: "DELETE"
@@ -1545,9 +1582,12 @@ var CI_SIZE_MULTIPLIERS = {
1545
1582
  "2xlarge": 8
1546
1583
  };
1547
1584
  var CI_MACOS_SIZE_MULTIPLIERS = {
1585
+ nano: 10,
1586
+ small: 10,
1548
1587
  standard: 10,
1549
1588
  large: 20,
1550
- xlarge: 40
1589
+ xlarge: 40,
1590
+ "2xlarge": 80
1551
1591
  };
1552
1592
  var CI_MACOS_MULTIPLIER = CI_MACOS_SIZE_MULTIPLIERS.standard;
1553
1593
  var CREDIT_EXPIRY_MONTHS = 12;
@@ -3827,6 +3867,29 @@ async function platformUserError(res, operation) {
3827
3867
  });
3828
3868
  }
3829
3869
 
3870
+ // src/service-account-auth.ts
3871
+ async function signInAsService(config, credentials) {
3872
+ const data = await callApi(config, "/oauth/token", {
3873
+ method: "POST",
3874
+ body: {
3875
+ grant_type: "client_credentials",
3876
+ client_id: credentials.clientId,
3877
+ client_secret: credentials.clientSecret,
3878
+ ...credentials.scope !== void 0 ? { scope: credentials.scope } : {}
3879
+ }
3880
+ });
3881
+ if (!data.access_token) {
3882
+ throw new Error("Invalid client-credentials token response: missing access_token");
3883
+ }
3884
+ return {
3885
+ token: data.access_token,
3886
+ accessToken: data.access_token,
3887
+ expiresIn: data.expires_in ?? 0,
3888
+ tokenType: data.token_type ?? "Bearer",
3889
+ ...data.scope !== void 0 ? { scope: data.scope } : {}
3890
+ };
3891
+ }
3892
+
3830
3893
  // src/auth.ts
3831
3894
  async function signIn(config, input) {
3832
3895
  const body = input;
@@ -5537,6 +5600,24 @@ var TriggersClient = {
5537
5600
  publishEvent
5538
5601
  };
5539
5602
 
5603
+ // src/lib/tasks/connection.ts
5604
+ init_constants();
5605
+ function resolveTaskServerConnectionUrl(options = {}) {
5606
+ const explicit = options.explicitConnectionUrl?.trim();
5607
+ if (explicit) return explicit;
5608
+ if (typeof process === "undefined") return null;
5609
+ return process.env[ENV_SECRET_URL]?.trim() || null;
5610
+ }
5611
+ function requireTaskServerConnectionUrl(options = {}) {
5612
+ const connectionUrl = resolveTaskServerConnectionUrl(options);
5613
+ if (!connectionUrl) {
5614
+ throw new Error(
5615
+ `[sylphx/tasks] No server connection URL found. Set ${ENV_SECRET_URL} env var or pass config to trigger options.`
5616
+ );
5617
+ }
5618
+ return connectionUrl;
5619
+ }
5620
+
5540
5621
  // src/lib/tasks/handler.ts
5541
5622
  import { createHmac, timingSafeEqual } from "crypto";
5542
5623
  var StepCompleteSignal = class {
@@ -5546,6 +5627,23 @@ var StepCompleteSignal = class {
5546
5627
  }
5547
5628
  _isStepCompleteSignal = true;
5548
5629
  };
5630
+ var StepSideEffectStartSignal = class {
5631
+ constructor(stepName, effectKey, externalService) {
5632
+ this.stepName = stepName;
5633
+ this.effectKey = effectKey;
5634
+ this.externalService = externalService;
5635
+ }
5636
+ _isStepSideEffectStartSignal = true;
5637
+ };
5638
+ var StepSideEffectCompleteSignal = class {
5639
+ constructor(stepName, effectKey, handle, result) {
5640
+ this.stepName = stepName;
5641
+ this.effectKey = effectKey;
5642
+ this.handle = handle;
5643
+ this.result = result;
5644
+ }
5645
+ _isStepSideEffectCompleteSignal = true;
5646
+ };
5549
5647
  var StepSleepSignal = class {
5550
5648
  constructor(stepName, duration) {
5551
5649
  this.stepName = stepName;
@@ -5561,7 +5659,7 @@ var StepWaitEventSignal = class {
5561
5659
  }
5562
5660
  _isStepWaitEventSignal = true;
5563
5661
  };
5564
- function createStepContext(completedSteps, resolvedWaits) {
5662
+ function createStepContext(completedSteps, resolvedWaits, sideEffectReceipts = /* @__PURE__ */ new Map()) {
5565
5663
  return {
5566
5664
  /**
5567
5665
  * Execute a named step.
@@ -5576,6 +5674,27 @@ function createStepContext(completedSteps, resolvedWaits) {
5576
5674
  const result = await fn();
5577
5675
  throw new StepCompleteSignal(name, result);
5578
5676
  },
5677
+ async sideEffect(stepName, effectKey, externalService, fn) {
5678
+ const receipt = sideEffectReceipts.get(sideEffectReceiptKey(stepName, effectKey));
5679
+ if (!receipt) {
5680
+ throw new StepSideEffectStartSignal(stepName, effectKey, externalService);
5681
+ }
5682
+ if (receipt.externalService !== externalService) {
5683
+ throw new Error(
5684
+ `Side-effect external service mismatch for ${stepName}/${effectKey}: receipt=${receipt.externalService} handler=${externalService}`
5685
+ );
5686
+ }
5687
+ if (receipt.completedAt) {
5688
+ return receipt.result;
5689
+ }
5690
+ const outcome = await fn(receipt.idempotencyKey);
5691
+ throw new StepSideEffectCompleteSignal(
5692
+ stepName,
5693
+ effectKey,
5694
+ normalizeOptionalStepKey(outcome.handle),
5695
+ outcome.result
5696
+ );
5697
+ },
5579
5698
  /**
5580
5699
  * Sleep for the given duration.
5581
5700
  *
@@ -5616,6 +5735,13 @@ function createStepContext(completedSteps, resolvedWaits) {
5616
5735
  }
5617
5736
  };
5618
5737
  }
5738
+ function normalizeOptionalStepKey(value) {
5739
+ const trimmed = value?.trim();
5740
+ return trimmed ? trimmed.slice(0, 500) : void 0;
5741
+ }
5742
+ function sideEffectReceiptKey(stepName, effectKey) {
5743
+ return `${stepName}\0${effectKey}`;
5744
+ }
5619
5745
  function verifySignature(body, signature, secret) {
5620
5746
  try {
5621
5747
  const hmac = createHmac("sha256", secret).update(body, "utf8").digest("hex");
@@ -5696,7 +5822,11 @@ function createTasksHandler(taskDefs, options = {}) {
5696
5822
  for (const wait of context?.waits ?? []) {
5697
5823
  resolvedWaits.set(wait.name, wait.result ?? void 0);
5698
5824
  }
5699
- const stepCtx = createStepContext(completedSteps, resolvedWaits);
5825
+ const sideEffectReceipts = /* @__PURE__ */ new Map();
5826
+ for (const receipt of context?.sideEffects ?? []) {
5827
+ sideEffectReceipts.set(sideEffectReceiptKey(receipt.stepName, receipt.effectKey), receipt);
5828
+ }
5829
+ const stepCtx = createStepContext(completedSteps, resolvedWaits, sideEffectReceipts);
5700
5830
  try {
5701
5831
  const result = await taskDef.handler(payload, { step: stepCtx });
5702
5832
  return Response.json({ status: "complete", result });
@@ -5709,6 +5839,25 @@ function createTasksHandler(taskDefs, options = {}) {
5709
5839
  result: signal.result
5710
5840
  });
5711
5841
  }
5842
+ if (err instanceof StepSideEffectStartSignal || err?._isStepSideEffectStartSignal) {
5843
+ const signal = err;
5844
+ return Response.json({
5845
+ status: "side_effect_start",
5846
+ stepName: signal.stepName,
5847
+ effectKey: signal.effectKey,
5848
+ externalService: signal.externalService
5849
+ });
5850
+ }
5851
+ if (err instanceof StepSideEffectCompleteSignal || err?._isStepSideEffectCompleteSignal) {
5852
+ const signal = err;
5853
+ return Response.json({
5854
+ status: "side_effect_complete",
5855
+ stepName: signal.stepName,
5856
+ effectKey: signal.effectKey,
5857
+ handle: signal.handle ?? null,
5858
+ result: signal.result
5859
+ });
5860
+ }
5712
5861
  if (err instanceof StepSleepSignal || err?._isStepSleepSignal) {
5713
5862
  const signal = err;
5714
5863
  return Response.json({
@@ -5742,6 +5891,191 @@ function createTasksHandler(taskDefs, options = {}) {
5742
5891
  return { GET, POST };
5743
5892
  }
5744
5893
 
5894
+ // src/lib/tasks/serve.ts
5895
+ var triggerSyncDone = false;
5896
+ var triggerSyncPromise = null;
5897
+ async function syncTriggers(tasks, options) {
5898
+ const connectionUrl = resolveTaskServerConnectionUrl({
5899
+ explicitConnectionUrl: options.connectionUrl
5900
+ });
5901
+ if (!connectionUrl) {
5902
+ return;
5903
+ }
5904
+ const tasksWithTriggers = tasks.filter((t) => t._trigger);
5905
+ if (tasksWithTriggers.length === 0) return;
5906
+ const config = createServerClient(connectionUrl);
5907
+ const results = await Promise.allSettled(
5908
+ tasksWithTriggers.flatMap((t) => {
5909
+ const promises = [];
5910
+ if (t._trigger?.cron) {
5911
+ promises.push(
5912
+ TriggersClient.create(config, {
5913
+ name: `${t.id}:cron`,
5914
+ source: { type: "cron", expression: t._trigger.cron },
5915
+ target: { type: "task", taskName: t.id },
5916
+ idempotencyKey: `task:${t.id}:cron:${t._trigger.cron}`
5917
+ }).catch((err) => {
5918
+ if (err?.status === 409 || err?.message?.includes("already exists")) return;
5919
+ throw err;
5920
+ })
5921
+ );
5922
+ }
5923
+ if (t._trigger?.event) {
5924
+ promises.push(
5925
+ TriggersClient.create(config, {
5926
+ name: `${t.id}:event:${t._trigger.event}`,
5927
+ source: { type: "event", eventName: t._trigger.event },
5928
+ target: { type: "task", taskName: t.id },
5929
+ idempotencyKey: `task:${t.id}:event:${t._trigger.event}`
5930
+ }).catch((err) => {
5931
+ if (err?.status === 409 || err?.message?.includes("already exists")) return;
5932
+ throw err;
5933
+ })
5934
+ );
5935
+ }
5936
+ return promises;
5937
+ })
5938
+ );
5939
+ for (const result of results) {
5940
+ if (result.status === "rejected") {
5941
+ console.warn("[sylphx/tasks] Warning: trigger sync failed", result.reason);
5942
+ }
5943
+ }
5944
+ }
5945
+ function serve(options) {
5946
+ const functionModeTasks = options.tasks.filter((t) => !t._machine && t._run != null);
5947
+ const defs = functionModeTasks.map((t) => ({
5948
+ name: t.id,
5949
+ handler: t._run
5950
+ }));
5951
+ const handlerOptions = {
5952
+ signingSecret: options.signingSecret
5953
+ };
5954
+ const { GET: baseGET, POST: basePOST } = createTasksHandler(defs, handlerOptions);
5955
+ function ensureTriggerSync() {
5956
+ if (triggerSyncDone || triggerSyncPromise) return;
5957
+ triggerSyncPromise = syncTriggers(options.tasks, options).then(() => {
5958
+ triggerSyncDone = true;
5959
+ }).catch((err) => {
5960
+ triggerSyncPromise = null;
5961
+ console.warn("[sylphx/tasks] Trigger sync error:", err);
5962
+ });
5963
+ }
5964
+ return {
5965
+ async GET(req) {
5966
+ ensureTriggerSync();
5967
+ return baseGET(req);
5968
+ },
5969
+ async POST(req) {
5970
+ ensureTriggerSync();
5971
+ return basePOST(req);
5972
+ }
5973
+ };
5974
+ }
5975
+
5976
+ // src/lib/tasks/task.ts
5977
+ function resolveConfig(options) {
5978
+ if (options?.config) return options.config;
5979
+ const connectionUrl = requireTaskServerConnectionUrl();
5980
+ return createServerClient(connectionUrl);
5981
+ }
5982
+ async function pollUntilComplete(config, taskRunId, timeoutMs) {
5983
+ const deadline = Date.now() + timeoutMs;
5984
+ let delay = 500;
5985
+ while (Date.now() < deadline) {
5986
+ const run = await callApi(
5987
+ config,
5988
+ `/tasks/${taskRunId}`,
5989
+ { method: "GET" }
5990
+ );
5991
+ if (run.status === "completed") return run.result;
5992
+ if (run.status === "failed" || run.status === "cancelled") {
5993
+ throw new Error(run.error ?? `Task run ${taskRunId} ${run.status}`);
5994
+ }
5995
+ await new Promise((r) => setTimeout(r, delay));
5996
+ delay = Math.min(delay * 1.5, 5e3);
5997
+ }
5998
+ throw new Error(`Task run ${taskRunId} timed out after ${timeoutMs}ms`);
5999
+ }
6000
+ async function dispatchTask(id, payload, machine, options) {
6001
+ const config = resolveConfig(options);
6002
+ const body = {
6003
+ taskName: id,
6004
+ payload
6005
+ };
6006
+ if (options?.idempotencyKey) body.idempotencyKey = options.idempotencyKey;
6007
+ if (options?.delay) body.delay = options.delay;
6008
+ if (options?.scheduledFor) body.scheduledFor = options.scheduledFor.toISOString();
6009
+ if (options?.maxAttempts) body.maxAttempts = options.maxAttempts;
6010
+ if (options?.queue) body.queue = options.queue;
6011
+ if (machine) body.machine = machine;
6012
+ const result = await callApi(config, "/tasks/trigger", {
6013
+ method: "POST",
6014
+ body
6015
+ });
6016
+ const runId = result.taskRunId;
6017
+ const defaultTimeoutMs = machine ? 24 * 3600 * 1e3 : 3e5;
6018
+ return {
6019
+ id: runId,
6020
+ status: result.status,
6021
+ waitForCompletion(waitOptions) {
6022
+ return pollUntilComplete(config, runId, waitOptions?.timeoutMs ?? defaultTimeoutMs);
6023
+ },
6024
+ async cancel() {
6025
+ const cancelled = await callApi(config, `/tasks/${runId}/cancel`, {
6026
+ method: "POST"
6027
+ });
6028
+ return cancelled.success;
6029
+ }
6030
+ };
6031
+ }
6032
+ function task(config) {
6033
+ return {
6034
+ id: config.id,
6035
+ _trigger: config.trigger,
6036
+ _machine: config.machine,
6037
+ _run: config.run,
6038
+ async trigger(payload, options) {
6039
+ return dispatchTask(config.id, payload, config.machine, options);
6040
+ },
6041
+ async triggerAndWait(payload, options) {
6042
+ const handle = await dispatchTask(
6043
+ config.id,
6044
+ payload,
6045
+ config.machine,
6046
+ options
6047
+ );
6048
+ return handle.waitForCompletion();
6049
+ },
6050
+ async batchTrigger(payloads, options) {
6051
+ const handles = await Promise.all(
6052
+ payloads.map((p) => dispatchTask(config.id, p, config.machine, options))
6053
+ );
6054
+ return { runs: handles };
6055
+ }
6056
+ };
6057
+ }
6058
+ function taskStub(id) {
6059
+ return {
6060
+ id,
6061
+ _machine: void 0,
6062
+ _run: void 0,
6063
+ async trigger(payload, options) {
6064
+ return dispatchTask(id, payload, void 0, options);
6065
+ },
6066
+ async triggerAndWait(payload, options) {
6067
+ const handle = await dispatchTask(id, payload, void 0, options);
6068
+ return handle.waitForCompletion();
6069
+ },
6070
+ async batchTrigger(payloads, options) {
6071
+ const handles = await Promise.all(
6072
+ payloads.map((p) => dispatchTask(id, p, void 0, options))
6073
+ );
6074
+ return { runs: handles };
6075
+ }
6076
+ };
6077
+ }
6078
+
5745
6079
  // src/lib/tasks/api-functions.ts
5746
6080
  async function scheduleTask(config, input) {
5747
6081
  return callApi(config, "/tasks/schedule", {
@@ -5752,6 +6086,9 @@ async function scheduleTask(config, input) {
5752
6086
  async function getTask(config, taskId) {
5753
6087
  return callApi(config, `/tasks/${taskId}`, { method: "GET" });
5754
6088
  }
6089
+ async function getTaskRun(config, runId) {
6090
+ return callApi(config, `/tasks/${runId}`, { method: "GET" });
6091
+ }
5755
6092
  async function cancelTask(config, taskId) {
5756
6093
  const result = await callApi(config, `/tasks/${taskId}/cancel`, {
5757
6094
  method: "POST"
@@ -6952,6 +7289,28 @@ var SandboxWatch = class {
6952
7289
  if (!res.ok) throw new Error(`watch.remove failed: ${await res.text()}`);
6953
7290
  }
6954
7291
  };
7292
+ var SandboxCapabilities = class {
7293
+ constructor(endpoint, token) {
7294
+ this.endpoint = endpoint;
7295
+ this.token = token;
7296
+ }
7297
+ authHeader() {
7298
+ return { Authorization: `Bearer ${this.token}` };
7299
+ }
7300
+ /**
7301
+ * Fetch the typed capability catalog for this sandbox image.
7302
+ *
7303
+ * Use this before selecting heavyweight toolchain paths. For example,
7304
+ * default sandboxes report Android emulator/device-test as `not-local`, so
7305
+ * agents can hand APK/AAB artifacts to a managed device runtime instead of
7306
+ * filling `/workspace` with emulator images.
7307
+ */
7308
+ async get() {
7309
+ const res = await fetch(`${this.endpoint}/capabilities`, { headers: this.authHeader() });
7310
+ if (!res.ok) throw new Error(`capabilities.get failed (${res.status}): ${await res.text()}`);
7311
+ return await res.json();
7312
+ }
7313
+ };
6955
7314
  var SandboxBrowser = class {
6956
7315
  constructor(endpoint, token) {
6957
7316
  this.endpoint = endpoint;
@@ -7169,6 +7528,8 @@ var SandboxClient = class _SandboxClient {
7169
7528
  processes;
7170
7529
  /** Filesystem watch management (direct to exec-server) */
7171
7530
  watch;
7531
+ /** Typed capability catalog (direct to exec-server) */
7532
+ capabilities;
7172
7533
  /** Persistent headful browser sessions (direct to exec-server — ADR-205) */
7173
7534
  browser;
7174
7535
  /** Persistent desktop (computer-use) sessions (direct to exec-server — ADR-207) */
@@ -7181,6 +7542,7 @@ var SandboxClient = class _SandboxClient {
7181
7542
  this.files = endpoint && token ? new SandboxFiles(endpoint, token) : null;
7182
7543
  this.processes = endpoint && token ? new SandboxProcesses(endpoint, token) : null;
7183
7544
  this.watch = endpoint && token ? new SandboxWatch(endpoint, token) : null;
7545
+ this.capabilities = endpoint && token ? new SandboxCapabilities(endpoint, token) : null;
7184
7546
  this.browser = endpoint && token ? new SandboxBrowser(endpoint, token) : null;
7185
7547
  this.computer = endpoint && token ? new SandboxComputer(endpoint, token) : null;
7186
7548
  }
@@ -7406,6 +7768,19 @@ var SandboxClient = class _SandboxClient {
7406
7768
  }
7407
7769
  };
7408
7770
 
7771
+ // src/render.ts
7772
+ var RenderClient = {
7773
+ /**
7774
+ * Render a chart (`engine: 'vega-lite'`, Vega-Lite JSON in `spec`) or a diagram
7775
+ * (`engine: 'graphviz'`, DOT in `spec`) to an image. The engine validates and
7776
+ * repairs the spec before rendering; on success returns base64 image bytes, on
7777
+ * failure a structured `error` with a `code` and `diagnostics`.
7778
+ */
7779
+ async render(config, request) {
7780
+ return callApi(config, "/render", { method: "POST", body: request });
7781
+ }
7782
+ };
7783
+
7409
7784
  // src/workers.ts
7410
7785
  var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
7411
7786
  "succeeded",
@@ -7924,8 +8299,11 @@ export {
7924
8299
  BYTES_PER_GB,
7925
8300
  CI_BUILD_MINUTE_PRICE_MICRODOLLARS,
7926
8301
  CI_FREE_MINUTES_PER_MONTH,
8302
+ CI_LINUX_RUNNER_SIZES,
7927
8303
  CI_MACOS_MULTIPLIER,
8304
+ CI_MACOS_RUNNER_SIZES,
7928
8305
  CI_MACOS_SIZE_MULTIPLIERS,
8306
+ CI_RUNNER_PROFILES,
7929
8307
  CI_SIZE_MULTIPLIERS,
7930
8308
  COMPUTE_PRICE_PER_HOUR_MICRODOLLARS,
7931
8309
  COMPUTE_RAM_RATE_MICRODOLLARS,
@@ -7968,11 +8346,13 @@ export {
7968
8346
  PREMIUM_TRIAL_DAYS,
7969
8347
  RETRYABLE_CODES,
7970
8348
  RateLimitError,
8349
+ RenderClient,
7971
8350
  RunHandle,
7972
8351
  RunsClient,
7973
8352
  SERVICE_METRICS,
7974
8353
  STORAGE_PRICE_PER_GB_MONTH_MICRODOLLARS,
7975
8354
  SandboxBrowser,
8355
+ SandboxCapabilities,
7976
8356
  SandboxClient,
7977
8357
  SandboxComputer,
7978
8358
  SandboxFiles,
@@ -8062,6 +8442,7 @@ export {
8062
8442
  forkWorkspace,
8063
8443
  formatBytes,
8064
8444
  formatCents,
8445
+ formatCiRunnerWorkflowRunsOn,
8065
8446
  formatCurrency,
8066
8447
  formatDate,
8067
8448
  formatDateTime,
@@ -8092,6 +8473,7 @@ export {
8092
8473
  getBillingStatusVariant,
8093
8474
  getBillingUsage,
8094
8475
  getBuildLogHistory,
8476
+ getCiRunnerProfileById,
8095
8477
  getCircuitBreakerState,
8096
8478
  getConsentHistory,
8097
8479
  getConsentTypes,
@@ -8139,6 +8521,7 @@ export {
8139
8521
  getStreak,
8140
8522
  getSubscription,
8141
8523
  getTask,
8524
+ getTaskRun,
8142
8525
  getUser,
8143
8526
  getUserByEmail,
8144
8527
  getUserConsents,
@@ -8151,6 +8534,7 @@ export {
8151
8534
  getWebhookDelivery,
8152
8535
  getWebhookStats,
8153
8536
  getWorkspace,
8537
+ getWorkspaceCapacity,
8154
8538
  hasAllPermissions,
8155
8539
  hasAnyPermission,
8156
8540
  hasBillingAccess,
@@ -8224,6 +8608,7 @@ export {
8224
8608
  parseUserAgent,
8225
8609
  password,
8226
8610
  pauseCron,
8611
+ pinWorkspace,
8227
8612
  platformAuth,
8228
8613
  campaigns as pushCampaigns,
8229
8614
  segments as pushSegments,
@@ -8231,6 +8616,7 @@ export {
8231
8616
  rateLimits,
8232
8617
  realtime,
8233
8618
  realtimeEmit,
8619
+ reclaimWorkspace,
8234
8620
  recordStreakActivity,
8235
8621
  recoverStreak,
8236
8622
  redeemPromo,
@@ -8273,12 +8659,14 @@ export {
8273
8659
  sendEmailToUser,
8274
8660
  sendPush,
8275
8661
  sendTemplatedEmail,
8662
+ serve,
8276
8663
  sessions,
8277
8664
  setConsents,
8278
8665
  setEnvVar,
8279
8666
  setPassword,
8280
8667
  setupTwoFactor,
8281
8668
  signIn,
8669
+ signInAsService,
8282
8670
  signOut,
8283
8671
  signUp,
8284
8672
  startPasskeyRegistration,
@@ -8287,6 +8675,8 @@ export {
8287
8675
  submitScore,
8288
8676
  suspendUser,
8289
8677
  switchOrg,
8678
+ task,
8679
+ taskStub,
8290
8680
  toPublicMachineSize,
8291
8681
  toSylphxError,
8292
8682
  track,