@sylphx/cli 0.13.0 → 0.14.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/dist/main.js CHANGED
@@ -15,7 +15,7 @@ var init_package = __esm({
15
15
  "package.json"() {
16
16
  package_default = {
17
17
  name: "@sylphx/cli",
18
- version: "0.13.0",
18
+ version: "0.14.0",
19
19
  description: "Sylphx Platform CLI \u2014 deploy and manage your applications from the terminal. 63 commands across deployment, logs, env vars, domains, databases, storage, monitoring, self-service (user), admin (users/quotas/audit/invitations/jwt-keys/project-migrate), and more.",
20
20
  type: "module",
21
21
  homepage: "https://sylphx.com",
@@ -71,7 +71,7 @@ var init_package = __esm({
71
71
  "@effect/cli": "0.75.1",
72
72
  "@effect/platform": "0.96.0",
73
73
  "@effect/platform-bun": "0.89.0",
74
- "@sylphx/sdk": "0.13.9",
74
+ "@sylphx/sdk": "0.14.0",
75
75
  chalk: "^5.3.0",
76
76
  effect: "3.21.0",
77
77
  eventsource: "^2.0.2",
@@ -411,7 +411,7 @@ var init_admin_apm = __esm({
411
411
 
412
412
  // ../contract/dist/schemas/ids.js
413
413
  import { Schema as Schema4 } from "effect";
414
- var brandedId, OrgId, ProjectId, EnvironmentId, ServiceId, UserId, SessionId, DeploymentId, BuildId, DomainId, HostnameId, SecretId, DatabaseId, BranchDatabaseId, ResourceId, VolumeMountId, ProxyRuleId, InvitationId;
414
+ var brandedId, OrgId, ProjectId, EnvironmentId, ServiceId, UserId, SessionId, DeploymentId, BuildId, DomainId, HostnameId, SecretId, DatabaseId, BranchDatabaseId, ResourceId, WorkspaceId, VolumeMountId, ProxyRuleId, InvitationId;
415
415
  var init_ids = __esm({
416
416
  "../contract/dist/schemas/ids.js"() {
417
417
  "use strict";
@@ -430,6 +430,7 @@ var init_ids = __esm({
430
430
  DatabaseId = brandedId("DatabaseId");
431
431
  BranchDatabaseId = brandedId("BranchDatabaseId");
432
432
  ResourceId = brandedId("ResourceId");
433
+ WorkspaceId = brandedId("WorkspaceId");
433
434
  VolumeMountId = brandedId("VolumeMountId");
434
435
  ProxyRuleId = brandedId("ProxyRuleId");
435
436
  InvitationId = brandedId("InvitationId");
@@ -14945,340 +14946,398 @@ var init_webhooks = __esm({
14945
14946
  }
14946
14947
  });
14947
14948
 
14948
- // ../contract/dist/errors.js
14949
+ // ../contract/dist/schemas/workspaces.js
14949
14950
  import { Schema as Schema112 } from "effect";
14951
+ var WorkspaceStatus, WorkspaceVolumeSharing, WorkspaceVolumeStatus, ManagedWorkspaceVolume, ManagedWorkspace, WorkspaceProjectParams, WorkspaceProjectIdParams, WorkspaceIdParams, CreateWorkspaceInput, ForkWorkspaceInput, ListWorkspacesResult, WorkspaceResult, DeleteWorkspaceResult;
14952
+ var init_workspaces = __esm({
14953
+ "../contract/dist/schemas/workspaces.js"() {
14954
+ "use strict";
14955
+ init_ids();
14956
+ WorkspaceStatus = Schema112.Literal("provisioning", "ready", "error", "archived");
14957
+ WorkspaceVolumeSharing = Schema112.Literal("single-writer", "shared");
14958
+ WorkspaceVolumeStatus = Schema112.Literal("provisioning", "active", "error");
14959
+ ManagedWorkspaceVolume = Schema112.Struct({
14960
+ sharing: WorkspaceVolumeSharing,
14961
+ status: WorkspaceVolumeStatus
14962
+ });
14963
+ ManagedWorkspace = Schema112.Struct({
14964
+ id: WorkspaceId,
14965
+ projectId: ProjectId,
14966
+ environmentId: EnvironmentId,
14967
+ key: Schema112.String,
14968
+ name: Schema112.String,
14969
+ sizeGb: Schema112.Number,
14970
+ sourceWorkspaceId: Schema112.NullOr(WorkspaceId),
14971
+ status: WorkspaceStatus,
14972
+ statusMessage: Schema112.optional(Schema112.NullOr(Schema112.String)),
14973
+ createdAt: Schema112.String,
14974
+ updatedAt: Schema112.String,
14975
+ volume: Schema112.optional(ManagedWorkspaceVolume)
14976
+ });
14977
+ WorkspaceProjectParams = Schema112.Struct({ projectId: ProjectId });
14978
+ WorkspaceProjectIdParams = Schema112.Struct({
14979
+ projectId: ProjectId,
14980
+ workspaceId: WorkspaceId
14981
+ });
14982
+ WorkspaceIdParams = Schema112.Struct({ workspaceId: WorkspaceId });
14983
+ CreateWorkspaceInput = Schema112.Struct({
14984
+ name: Schema112.String,
14985
+ key: Schema112.optional(Schema112.String),
14986
+ sizeGb: Schema112.optional(Schema112.Number),
14987
+ environmentId: Schema112.optional(EnvironmentId)
14988
+ });
14989
+ ForkWorkspaceInput = Schema112.Struct({
14990
+ name: Schema112.optional(Schema112.String),
14991
+ key: Schema112.optional(Schema112.String),
14992
+ sizeGb: Schema112.optional(Schema112.Number)
14993
+ });
14994
+ ListWorkspacesResult = Schema112.Struct({
14995
+ workspaces: Schema112.Array(ManagedWorkspace)
14996
+ });
14997
+ WorkspaceResult = Schema112.Struct({
14998
+ workspace: ManagedWorkspace
14999
+ });
15000
+ DeleteWorkspaceResult = Schema112.Struct({
15001
+ deleted: Schema112.Boolean,
15002
+ workspaceId: WorkspaceId
15003
+ });
15004
+ }
15005
+ });
15006
+
15007
+ // ../contract/dist/errors.js
15008
+ import { Schema as Schema113 } from "effect";
14950
15009
  var BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitedError, InternalServerError, ApiError;
14951
15010
  var init_errors = __esm({
14952
15011
  "../contract/dist/errors.js"() {
14953
15012
  "use strict";
14954
- BadRequestError = Schema112.Struct({
14955
- _tag: Schema112.Literal("BadRequest"),
14956
- code: Schema112.String,
14957
- message: Schema112.String,
14958
- details: Schema112.optional(Schema112.Unknown)
15013
+ BadRequestError = Schema113.Struct({
15014
+ _tag: Schema113.Literal("BadRequest"),
15015
+ code: Schema113.String,
15016
+ message: Schema113.String,
15017
+ details: Schema113.optional(Schema113.Unknown)
14959
15018
  });
14960
- UnauthorizedError = Schema112.Struct({
14961
- _tag: Schema112.Literal("Unauthorized"),
14962
- code: Schema112.String,
14963
- message: Schema112.String
15019
+ UnauthorizedError = Schema113.Struct({
15020
+ _tag: Schema113.Literal("Unauthorized"),
15021
+ code: Schema113.String,
15022
+ message: Schema113.String
14964
15023
  });
14965
- ForbiddenError = Schema112.Struct({
14966
- _tag: Schema112.Literal("Forbidden"),
14967
- code: Schema112.String,
14968
- message: Schema112.String
15024
+ ForbiddenError = Schema113.Struct({
15025
+ _tag: Schema113.Literal("Forbidden"),
15026
+ code: Schema113.String,
15027
+ message: Schema113.String
14969
15028
  });
14970
- NotFoundError = Schema112.Struct({
14971
- _tag: Schema112.Literal("NotFound"),
14972
- code: Schema112.String,
14973
- message: Schema112.String
15029
+ NotFoundError = Schema113.Struct({
15030
+ _tag: Schema113.Literal("NotFound"),
15031
+ code: Schema113.String,
15032
+ message: Schema113.String
14974
15033
  });
14975
- ConflictError = Schema112.Struct({
14976
- _tag: Schema112.Literal("Conflict"),
14977
- code: Schema112.String,
14978
- message: Schema112.String
15034
+ ConflictError = Schema113.Struct({
15035
+ _tag: Schema113.Literal("Conflict"),
15036
+ code: Schema113.String,
15037
+ message: Schema113.String
14979
15038
  });
14980
- UnprocessableEntityError = Schema112.Struct({
14981
- _tag: Schema112.Literal("UnprocessableEntity"),
14982
- code: Schema112.String,
14983
- message: Schema112.String,
14984
- details: Schema112.optional(Schema112.Unknown)
15039
+ UnprocessableEntityError = Schema113.Struct({
15040
+ _tag: Schema113.Literal("UnprocessableEntity"),
15041
+ code: Schema113.String,
15042
+ message: Schema113.String,
15043
+ details: Schema113.optional(Schema113.Unknown)
14985
15044
  });
14986
- RateLimitedError = Schema112.Struct({
14987
- _tag: Schema112.Literal("RateLimited"),
14988
- code: Schema112.String,
14989
- message: Schema112.String,
14990
- retryAfterSeconds: Schema112.optional(Schema112.Number)
15045
+ RateLimitedError = Schema113.Struct({
15046
+ _tag: Schema113.Literal("RateLimited"),
15047
+ code: Schema113.String,
15048
+ message: Schema113.String,
15049
+ retryAfterSeconds: Schema113.optional(Schema113.Number)
14991
15050
  });
14992
- InternalServerError = Schema112.Struct({
14993
- _tag: Schema112.Literal("InternalServer"),
14994
- code: Schema112.String,
14995
- message: Schema112.String
15051
+ InternalServerError = Schema113.Struct({
15052
+ _tag: Schema113.Literal("InternalServer"),
15053
+ code: Schema113.String,
15054
+ message: Schema113.String
14996
15055
  });
14997
- ApiError = Schema112.Union(BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitedError, InternalServerError);
15056
+ ApiError = Schema113.Union(BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitedError, InternalServerError);
14998
15057
  }
14999
15058
  });
15000
15059
 
15001
15060
  // ../contract/dist/schemas/ai.js
15002
- import { Schema as Schema113 } from "effect";
15061
+ import { Schema as Schema114 } from "effect";
15003
15062
  var AIUsagePeriod, AIModelCapability, AIModel, GetModelsResponse, TokensBreakdown, CostBreakdown, ModelUsage, TypeUsage, GetUsageResponse, CurrentRateLimitUsage, GetRateLimitResponse;
15004
15063
  var init_ai = __esm({
15005
15064
  "../contract/dist/schemas/ai.js"() {
15006
15065
  "use strict";
15007
- AIUsagePeriod = Schema113.Literal("day", "week", "month");
15008
- AIModelCapability = Schema113.Literal("chat", "vision", "tool", "embedding");
15009
- AIModel = Schema113.Struct({
15010
- id: Schema113.String,
15011
- name: Schema113.String,
15012
- contextWindow: Schema113.Number,
15013
- capabilities: Schema113.Array(AIModelCapability),
15014
- inputCostPer1M: Schema113.Number,
15015
- outputCostPer1M: Schema113.Number,
15016
- description: Schema113.optional(Schema113.String)
15017
- });
15018
- GetModelsResponse = Schema113.Struct({
15019
- models: Schema113.Array(AIModel),
15020
- nextCursor: Schema113.NullOr(Schema113.String),
15021
- hasMore: Schema113.Boolean
15022
- });
15023
- TokensBreakdown = Schema113.Struct({
15024
- input: Schema113.Number,
15025
- output: Schema113.Number,
15026
- total: Schema113.Number
15027
- });
15028
- CostBreakdown = Schema113.Struct({
15029
- microdollars: Schema113.Number,
15030
- formatted: Schema113.String
15031
- });
15032
- ModelUsage = Schema113.Struct({
15033
- requests: Schema113.Number,
15034
- tokens: Schema113.Number,
15035
- cost: Schema113.Number
15036
- });
15037
- TypeUsage = Schema113.Struct({
15038
- requests: Schema113.Number,
15039
- tokens: Schema113.Number
15040
- });
15041
- GetUsageResponse = Schema113.Struct({
15066
+ AIUsagePeriod = Schema114.Literal("day", "week", "month");
15067
+ AIModelCapability = Schema114.Literal("chat", "vision", "tool", "embedding");
15068
+ AIModel = Schema114.Struct({
15069
+ id: Schema114.String,
15070
+ name: Schema114.String,
15071
+ contextWindow: Schema114.Number,
15072
+ capabilities: Schema114.Array(AIModelCapability),
15073
+ inputCostPer1M: Schema114.Number,
15074
+ outputCostPer1M: Schema114.Number,
15075
+ description: Schema114.optional(Schema114.String)
15076
+ });
15077
+ GetModelsResponse = Schema114.Struct({
15078
+ models: Schema114.Array(AIModel),
15079
+ nextCursor: Schema114.NullOr(Schema114.String),
15080
+ hasMore: Schema114.Boolean
15081
+ });
15082
+ TokensBreakdown = Schema114.Struct({
15083
+ input: Schema114.Number,
15084
+ output: Schema114.Number,
15085
+ total: Schema114.Number
15086
+ });
15087
+ CostBreakdown = Schema114.Struct({
15088
+ microdollars: Schema114.Number,
15089
+ formatted: Schema114.String
15090
+ });
15091
+ ModelUsage = Schema114.Struct({
15092
+ requests: Schema114.Number,
15093
+ tokens: Schema114.Number,
15094
+ cost: Schema114.Number
15095
+ });
15096
+ TypeUsage = Schema114.Struct({
15097
+ requests: Schema114.Number,
15098
+ tokens: Schema114.Number
15099
+ });
15100
+ GetUsageResponse = Schema114.Struct({
15042
15101
  period: AIUsagePeriod,
15043
- requests: Schema113.Number,
15102
+ requests: Schema114.Number,
15044
15103
  tokens: TokensBreakdown,
15045
15104
  cost: CostBreakdown,
15046
- byModel: Schema113.Record({ key: Schema113.String, value: ModelUsage }),
15047
- byType: Schema113.Record({ key: Schema113.String, value: TypeUsage })
15048
- });
15049
- CurrentRateLimitUsage = Schema113.Struct({
15050
- requestsThisMinute: Schema113.Number,
15051
- requestsToday: Schema113.Number,
15052
- tokensThisMinute: Schema113.Number,
15053
- tokensToday: Schema113.Number,
15054
- costToday: Schema113.Number
15055
- });
15056
- GetRateLimitResponse = Schema113.Struct({
15057
- requestsPerMinute: Schema113.NullOr(Schema113.Number),
15058
- requestsPerDay: Schema113.NullOr(Schema113.Number),
15059
- tokensPerMinute: Schema113.NullOr(Schema113.Number),
15060
- tokensPerDay: Schema113.NullOr(Schema113.Number),
15061
- costPerDayMicrodollars: Schema113.NullOr(Schema113.Number),
15105
+ byModel: Schema114.Record({ key: Schema114.String, value: ModelUsage }),
15106
+ byType: Schema114.Record({ key: Schema114.String, value: TypeUsage })
15107
+ });
15108
+ CurrentRateLimitUsage = Schema114.Struct({
15109
+ requestsThisMinute: Schema114.Number,
15110
+ requestsToday: Schema114.Number,
15111
+ tokensThisMinute: Schema114.Number,
15112
+ tokensToday: Schema114.Number,
15113
+ costToday: Schema114.Number
15114
+ });
15115
+ GetRateLimitResponse = Schema114.Struct({
15116
+ requestsPerMinute: Schema114.NullOr(Schema114.Number),
15117
+ requestsPerDay: Schema114.NullOr(Schema114.Number),
15118
+ tokensPerMinute: Schema114.NullOr(Schema114.Number),
15119
+ tokensPerDay: Schema114.NullOr(Schema114.Number),
15120
+ costPerDayMicrodollars: Schema114.NullOr(Schema114.Number),
15062
15121
  current: CurrentRateLimitUsage
15063
15122
  });
15064
15123
  }
15065
15124
  });
15066
15125
 
15067
15126
  // ../contract/dist/schemas/billing.js
15068
- import { Schema as Schema114 } from "effect";
15127
+ import { Schema as Schema115 } from "effect";
15069
15128
  var SdkBillingInterval, SdkBillingSubscriptionStatus, SdkBillingStatusLevel, SdkBillingType, SdkBillingTrustLevel, SdkBillingPlan, BillingPlansListResponse, SdkBillingSubscription, BillingSubscriptionResponse, BillingCheckoutRequest, BillingCheckoutResponse, BillingPortalRequest, BillingPortalResponse, SdkBillingBalanceInfo, SdkBillingStatusInfo, BillingBalanceResponse, SdkBillingUsagePeriod, SdkBillingUsageMetrics, BillingUsageResponse;
15070
15129
  var init_billing = __esm({
15071
15130
  "../contract/dist/schemas/billing.js"() {
15072
15131
  "use strict";
15073
- SdkBillingInterval = Schema114.Literal("monthly", "annual", "lifetime");
15074
- SdkBillingSubscriptionStatus = Schema114.Literal("active", "canceled", "past_due", "incomplete", "trialing", "paused");
15075
- SdkBillingStatusLevel = Schema114.Literal("healthy", "low", "critical", "exhausted");
15076
- SdkBillingType = Schema114.Literal("prepaid", "postpaid", "enterprise");
15077
- SdkBillingTrustLevel = Schema114.Literal("new", "standard", "trusted", "enterprise");
15078
- SdkBillingPlan = Schema114.Struct({
15079
- id: Schema114.String,
15080
- slug: Schema114.String,
15081
- name: Schema114.String,
15082
- description: Schema114.NullOr(Schema114.String),
15083
- features: Schema114.Array(Schema114.String),
15084
- monthlyPrice: Schema114.Number,
15085
- annualPrice: Schema114.Number,
15086
- lifetimePrice: Schema114.NullOr(Schema114.Number),
15087
- isPopular: Schema114.Boolean,
15088
- isActive: Schema114.Boolean,
15089
- sortOrder: Schema114.Number
15090
- });
15091
- BillingPlansListResponse = Schema114.Array(SdkBillingPlan);
15092
- SdkBillingSubscription = Schema114.Struct({
15093
- id: Schema114.String,
15094
- userId: Schema114.String,
15095
- planId: Schema114.String,
15096
- planSlug: Schema114.String,
15097
- planName: Schema114.String,
15132
+ SdkBillingInterval = Schema115.Literal("monthly", "annual", "lifetime");
15133
+ SdkBillingSubscriptionStatus = Schema115.Literal("active", "canceled", "past_due", "incomplete", "trialing", "paused");
15134
+ SdkBillingStatusLevel = Schema115.Literal("healthy", "low", "critical", "exhausted");
15135
+ SdkBillingType = Schema115.Literal("prepaid", "postpaid", "enterprise");
15136
+ SdkBillingTrustLevel = Schema115.Literal("new", "standard", "trusted", "enterprise");
15137
+ SdkBillingPlan = Schema115.Struct({
15138
+ id: Schema115.String,
15139
+ slug: Schema115.String,
15140
+ name: Schema115.String,
15141
+ description: Schema115.NullOr(Schema115.String),
15142
+ features: Schema115.Array(Schema115.String),
15143
+ monthlyPrice: Schema115.Number,
15144
+ annualPrice: Schema115.Number,
15145
+ lifetimePrice: Schema115.NullOr(Schema115.Number),
15146
+ isPopular: Schema115.Boolean,
15147
+ isActive: Schema115.Boolean,
15148
+ sortOrder: Schema115.Number
15149
+ });
15150
+ BillingPlansListResponse = Schema115.Array(SdkBillingPlan);
15151
+ SdkBillingSubscription = Schema115.Struct({
15152
+ id: Schema115.String,
15153
+ userId: Schema115.String,
15154
+ planId: Schema115.String,
15155
+ planSlug: Schema115.String,
15156
+ planName: Schema115.String,
15098
15157
  status: SdkBillingSubscriptionStatus,
15099
15158
  interval: SdkBillingInterval,
15100
- currentPeriodStart: Schema114.NullOr(Schema114.String),
15101
- currentPeriodEnd: Schema114.NullOr(Schema114.String),
15102
- cancelAtPeriodEnd: Schema114.Boolean,
15103
- trialEnd: Schema114.NullOr(Schema114.String)
15104
- });
15105
- BillingSubscriptionResponse = Schema114.NullOr(SdkBillingSubscription);
15106
- BillingCheckoutRequest = Schema114.Struct({
15107
- userId: Schema114.String,
15108
- planSlug: Schema114.String,
15159
+ currentPeriodStart: Schema115.NullOr(Schema115.String),
15160
+ currentPeriodEnd: Schema115.NullOr(Schema115.String),
15161
+ cancelAtPeriodEnd: Schema115.Boolean,
15162
+ trialEnd: Schema115.NullOr(Schema115.String)
15163
+ });
15164
+ BillingSubscriptionResponse = Schema115.NullOr(SdkBillingSubscription);
15165
+ BillingCheckoutRequest = Schema115.Struct({
15166
+ userId: Schema115.String,
15167
+ planSlug: Schema115.String,
15109
15168
  interval: SdkBillingInterval,
15110
- successUrl: Schema114.String,
15111
- cancelUrl: Schema114.String
15169
+ successUrl: Schema115.String,
15170
+ cancelUrl: Schema115.String
15112
15171
  });
15113
- BillingCheckoutResponse = Schema114.Struct({
15114
- checkoutUrl: Schema114.NullOr(Schema114.String),
15115
- sessionId: Schema114.String
15172
+ BillingCheckoutResponse = Schema115.Struct({
15173
+ checkoutUrl: Schema115.NullOr(Schema115.String),
15174
+ sessionId: Schema115.String
15116
15175
  });
15117
- BillingPortalRequest = Schema114.Struct({
15118
- userId: Schema114.String,
15119
- returnUrl: Schema114.String
15176
+ BillingPortalRequest = Schema115.Struct({
15177
+ userId: Schema115.String,
15178
+ returnUrl: Schema115.String
15120
15179
  });
15121
- BillingPortalResponse = Schema114.Struct({
15122
- portalUrl: Schema114.String
15180
+ BillingPortalResponse = Schema115.Struct({
15181
+ portalUrl: Schema115.String
15123
15182
  });
15124
- SdkBillingBalanceInfo = Schema114.Struct({
15125
- current: Schema114.Number,
15126
- currentFormatted: Schema114.String
15183
+ SdkBillingBalanceInfo = Schema115.Struct({
15184
+ current: Schema115.Number,
15185
+ currentFormatted: Schema115.String
15127
15186
  });
15128
- SdkBillingStatusInfo = Schema114.Struct({
15187
+ SdkBillingStatusInfo = Schema115.Struct({
15129
15188
  level: SdkBillingStatusLevel,
15130
- isHealthy: Schema114.Boolean,
15131
- isLow: Schema114.Boolean,
15132
- alertThreshold: Schema114.Number
15189
+ isHealthy: Schema115.Boolean,
15190
+ isLow: Schema115.Boolean,
15191
+ alertThreshold: Schema115.Number
15133
15192
  });
15134
- BillingBalanceResponse = Schema114.Struct({
15193
+ BillingBalanceResponse = Schema115.Struct({
15135
15194
  balance: SdkBillingBalanceInfo,
15136
15195
  status: SdkBillingStatusInfo,
15137
15196
  billingType: SdkBillingType,
15138
15197
  trustLevel: SdkBillingTrustLevel,
15139
- spendingCap: Schema114.NullOr(Schema114.Number),
15140
- currentMonthSpend: Schema114.Number,
15141
- spendingCapPercent: Schema114.NullOr(Schema114.Number),
15142
- gracePeriodEndsAt: Schema114.NullOr(Schema114.String),
15143
- isAdminOrg: Schema114.Boolean
15144
- });
15145
- SdkBillingUsagePeriod = Schema114.Struct({
15146
- type: Schema114.Literal("month"),
15147
- start: Schema114.String,
15148
- end: Schema114.String
15149
- });
15150
- SdkBillingUsageMetrics = Schema114.Struct({
15151
- aiCostMicrodollars: Schema114.Number,
15152
- storageBytesUsed: Schema114.Number,
15153
- storageEgressBytes: Schema114.Number,
15154
- storageUploads: Schema114.Number,
15155
- dbStorageBytes: Schema114.Number,
15156
- dbComputeSeconds: Schema114.Number,
15157
- emailSentCount: Schema114.Number,
15158
- jobInvocationCount: Schema114.Number,
15159
- cronActiveCount: Schema114.Number,
15160
- notificationsSentCount: Schema114.Number,
15161
- analyticsEventCount: Schema114.Number,
15162
- webhookDeliveryCount: Schema114.Number,
15163
- errorEventCount: Schema114.Number,
15164
- authMau: Schema114.Number
15165
- });
15166
- BillingUsageResponse = Schema114.Struct({
15198
+ spendingCap: Schema115.NullOr(Schema115.Number),
15199
+ currentMonthSpend: Schema115.Number,
15200
+ spendingCapPercent: Schema115.NullOr(Schema115.Number),
15201
+ gracePeriodEndsAt: Schema115.NullOr(Schema115.String),
15202
+ isAdminOrg: Schema115.Boolean
15203
+ });
15204
+ SdkBillingUsagePeriod = Schema115.Struct({
15205
+ type: Schema115.Literal("month"),
15206
+ start: Schema115.String,
15207
+ end: Schema115.String
15208
+ });
15209
+ SdkBillingUsageMetrics = Schema115.Struct({
15210
+ aiCostMicrodollars: Schema115.Number,
15211
+ storageBytesUsed: Schema115.Number,
15212
+ storageEgressBytes: Schema115.Number,
15213
+ storageUploads: Schema115.Number,
15214
+ dbStorageBytes: Schema115.Number,
15215
+ dbComputeSeconds: Schema115.Number,
15216
+ emailSentCount: Schema115.Number,
15217
+ jobInvocationCount: Schema115.Number,
15218
+ cronActiveCount: Schema115.Number,
15219
+ notificationsSentCount: Schema115.Number,
15220
+ analyticsEventCount: Schema115.Number,
15221
+ webhookDeliveryCount: Schema115.Number,
15222
+ errorEventCount: Schema115.Number,
15223
+ authMau: Schema115.Number
15224
+ });
15225
+ BillingUsageResponse = Schema115.Struct({
15167
15226
  period: SdkBillingUsagePeriod,
15168
- metrics: Schema114.NullOr(SdkBillingUsageMetrics)
15227
+ metrics: Schema115.NullOr(SdkBillingUsageMetrics)
15169
15228
  });
15170
15229
  }
15171
15230
  });
15172
15231
 
15173
15232
  // ../contract/dist/schemas/consent.js
15174
- import { Schema as Schema115 } from "effect";
15233
+ import { Schema as Schema116 } from "effect";
15175
15234
  var SdkConsentCategory, SdkConsentType, UserConsent, ConsentItem, SetConsentsRequest, SetConsentsResponse;
15176
15235
  var init_consent = __esm({
15177
15236
  "../contract/dist/schemas/consent.js"() {
15178
15237
  "use strict";
15179
- SdkConsentCategory = Schema115.Literal("necessary", "analytics", "marketing", "preferences", "functional");
15180
- SdkConsentType = Schema115.Struct({
15181
- id: Schema115.String,
15182
- slug: Schema115.String,
15238
+ SdkConsentCategory = Schema116.Literal("necessary", "analytics", "marketing", "preferences", "functional");
15239
+ SdkConsentType = Schema116.Struct({
15240
+ id: Schema116.String,
15241
+ slug: Schema116.String,
15183
15242
  category: SdkConsentCategory,
15184
- name: Schema115.String,
15185
- description: Schema115.String,
15186
- required: Schema115.Boolean,
15187
- defaultEnabled: Schema115.Boolean
15243
+ name: Schema116.String,
15244
+ description: Schema116.String,
15245
+ required: Schema116.Boolean,
15246
+ defaultEnabled: Schema116.Boolean
15188
15247
  });
15189
- UserConsent = Schema115.Struct({
15190
- slug: Schema115.String,
15248
+ UserConsent = Schema116.Struct({
15249
+ slug: Schema116.String,
15191
15250
  category: SdkConsentCategory,
15192
- name: Schema115.String,
15193
- required: Schema115.Boolean,
15194
- granted: Schema115.Boolean,
15195
- grantedAt: Schema115.NullOr(Schema115.String),
15196
- version: Schema115.NullOr(Schema115.Number)
15251
+ name: Schema116.String,
15252
+ required: Schema116.Boolean,
15253
+ granted: Schema116.Boolean,
15254
+ grantedAt: Schema116.NullOr(Schema116.String),
15255
+ version: Schema116.NullOr(Schema116.Number)
15197
15256
  });
15198
- ConsentItem = Schema115.Struct({
15199
- slug: Schema115.String,
15200
- granted: Schema115.Boolean
15257
+ ConsentItem = Schema116.Struct({
15258
+ slug: Schema116.String,
15259
+ granted: Schema116.Boolean
15201
15260
  });
15202
- SetConsentsRequest = Schema115.Struct({
15203
- userId: Schema115.optional(Schema115.String),
15204
- anonymousId: Schema115.optional(Schema115.String),
15205
- consents: Schema115.Array(ConsentItem),
15206
- source: Schema115.optional(Schema115.Literal("banner", "settings", "api")),
15207
- userAgent: Schema115.optional(Schema115.String)
15261
+ SetConsentsRequest = Schema116.Struct({
15262
+ userId: Schema116.optional(Schema116.String),
15263
+ anonymousId: Schema116.optional(Schema116.String),
15264
+ consents: Schema116.Array(ConsentItem),
15265
+ source: Schema116.optional(Schema116.Literal("banner", "settings", "api")),
15266
+ userAgent: Schema116.optional(Schema116.String)
15208
15267
  });
15209
- SetConsentsResponse = Schema115.Struct({
15210
- consents: Schema115.Array(ConsentItem)
15268
+ SetConsentsResponse = Schema116.Struct({
15269
+ consents: Schema116.Array(ConsentItem)
15211
15270
  });
15212
15271
  }
15213
15272
  });
15214
15273
 
15215
15274
  // ../contract/dist/schemas/referrals.js
15216
- import { Schema as Schema116 } from "effect";
15275
+ import { Schema as Schema117 } from "effect";
15217
15276
  var ReferralCodeStatus, ReferralLeaderboardPeriod, ReferralRewardKind, ReferralRewardConfig, ReferralRewardDefaults, GetCodeResponse, RegenerateCodeResponse, GetStatsResponse, RedeemRequest, RedeemResponse, ReferralLeaderboardEntry, ReferralLeaderboardResponse;
15218
15277
  var init_referrals = __esm({
15219
15278
  "../contract/dist/schemas/referrals.js"() {
15220
15279
  "use strict";
15221
- ReferralCodeStatus = Schema116.Literal("pending", "completed", "expired");
15222
- ReferralLeaderboardPeriod = Schema116.Literal("all", "month", "week");
15223
- ReferralRewardKind = Schema116.Literal("points", "premium_trial", "discount", "credit");
15224
- ReferralRewardConfig = Schema116.Struct({
15280
+ ReferralCodeStatus = Schema117.Literal("pending", "completed", "expired");
15281
+ ReferralLeaderboardPeriod = Schema117.Literal("all", "month", "week");
15282
+ ReferralRewardKind = Schema117.Literal("points", "premium_trial", "discount", "credit");
15283
+ ReferralRewardConfig = Schema117.Struct({
15225
15284
  type: ReferralRewardKind,
15226
- points: Schema116.optional(Schema116.Number),
15227
- days: Schema116.optional(Schema116.Number),
15228
- discountPercent: Schema116.optional(Schema116.Number),
15229
- creditCents: Schema116.optional(Schema116.Number)
15230
- });
15231
- ReferralRewardDefaults = Schema116.Struct({
15232
- referrerReward: Schema116.optional(ReferralRewardConfig),
15233
- refereeReward: Schema116.optional(ReferralRewardConfig),
15234
- doubleReward: Schema116.optional(Schema116.Boolean),
15235
- minimumDaysBeforeReward: Schema116.optional(Schema116.Number)
15236
- });
15237
- GetCodeResponse = Schema116.Struct({
15238
- code: Schema116.String,
15285
+ points: Schema117.optional(Schema117.Number),
15286
+ days: Schema117.optional(Schema117.Number),
15287
+ discountPercent: Schema117.optional(Schema117.Number),
15288
+ creditCents: Schema117.optional(Schema117.Number)
15289
+ });
15290
+ ReferralRewardDefaults = Schema117.Struct({
15291
+ referrerReward: Schema117.optional(ReferralRewardConfig),
15292
+ refereeReward: Schema117.optional(ReferralRewardConfig),
15293
+ doubleReward: Schema117.optional(Schema117.Boolean),
15294
+ minimumDaysBeforeReward: Schema117.optional(Schema117.Number)
15295
+ });
15296
+ GetCodeResponse = Schema117.Struct({
15297
+ code: Schema117.String,
15239
15298
  status: ReferralCodeStatus
15240
15299
  });
15241
- RegenerateCodeResponse = Schema116.Struct({
15242
- code: Schema116.String,
15243
- totalReferrals: Schema116.Number,
15244
- completedReferrals: Schema116.Number,
15245
- pendingReferrals: Schema116.Number
15246
- });
15247
- GetStatsResponse = Schema116.Struct({
15248
- totalReferrals: Schema116.Number,
15249
- completedReferrals: Schema116.Number,
15250
- pendingReferrals: Schema116.Number
15251
- });
15252
- RedeemRequest = Schema116.Struct({
15253
- code: Schema116.String,
15254
- defaults: Schema116.optional(ReferralRewardDefaults)
15255
- });
15256
- RedeemResponse = Schema116.Struct({
15257
- success: Schema116.Boolean,
15258
- rewardType: Schema116.String,
15259
- referredReward: Schema116.optional(Schema116.Record({ key: Schema116.String, value: Schema116.Unknown })),
15260
- referrerReward: Schema116.optional(Schema116.Record({ key: Schema116.String, value: Schema116.Unknown }))
15261
- });
15262
- ReferralLeaderboardEntry = Schema116.Struct({
15263
- rank: Schema116.Number,
15264
- userId: Schema116.NullOr(Schema116.String),
15265
- displayName: Schema116.String,
15266
- avatarUrl: Schema116.NullOr(Schema116.String),
15267
- value: Schema116.Number,
15268
- isCurrentUser: Schema116.Boolean,
15269
- metadata: Schema116.optional(Schema116.Record({ key: Schema116.String, value: Schema116.Unknown })),
15270
- submittedAt: Schema116.String
15271
- });
15272
- ReferralLeaderboardResponse = Schema116.Struct({
15300
+ RegenerateCodeResponse = Schema117.Struct({
15301
+ code: Schema117.String,
15302
+ totalReferrals: Schema117.Number,
15303
+ completedReferrals: Schema117.Number,
15304
+ pendingReferrals: Schema117.Number
15305
+ });
15306
+ GetStatsResponse = Schema117.Struct({
15307
+ totalReferrals: Schema117.Number,
15308
+ completedReferrals: Schema117.Number,
15309
+ pendingReferrals: Schema117.Number
15310
+ });
15311
+ RedeemRequest = Schema117.Struct({
15312
+ code: Schema117.String,
15313
+ defaults: Schema117.optional(ReferralRewardDefaults)
15314
+ });
15315
+ RedeemResponse = Schema117.Struct({
15316
+ success: Schema117.Boolean,
15317
+ rewardType: Schema117.String,
15318
+ referredReward: Schema117.optional(Schema117.Record({ key: Schema117.String, value: Schema117.Unknown })),
15319
+ referrerReward: Schema117.optional(Schema117.Record({ key: Schema117.String, value: Schema117.Unknown }))
15320
+ });
15321
+ ReferralLeaderboardEntry = Schema117.Struct({
15322
+ rank: Schema117.Number,
15323
+ userId: Schema117.NullOr(Schema117.String),
15324
+ displayName: Schema117.String,
15325
+ avatarUrl: Schema117.NullOr(Schema117.String),
15326
+ value: Schema117.Number,
15327
+ isCurrentUser: Schema117.Boolean,
15328
+ metadata: Schema117.optional(Schema117.Record({ key: Schema117.String, value: Schema117.Unknown })),
15329
+ submittedAt: Schema117.String
15330
+ });
15331
+ ReferralLeaderboardResponse = Schema117.Struct({
15273
15332
  period: ReferralLeaderboardPeriod,
15274
- entries: Schema116.Array(ReferralLeaderboardEntry),
15275
- currentUserRank: Schema116.NullOr(Schema116.Number)
15333
+ entries: Schema117.Array(ReferralLeaderboardEntry),
15334
+ currentUserRank: Schema117.NullOr(Schema117.Number)
15276
15335
  });
15277
15336
  }
15278
15337
  });
15279
15338
 
15280
15339
  // ../contract/dist/schemas/service.js
15281
- import { Schema as Schema117 } from "effect";
15340
+ import { Schema as Schema118 } from "effect";
15282
15341
  function scalePolicyErrorPath(message) {
15283
15342
  if (message.includes("scaleToZero"))
15284
15343
  return ["scaleToZero"];
@@ -15336,16 +15395,16 @@ var init_service = __esm({
15336
15395
  targetPercentMin: 1,
15337
15396
  targetPercentMax: 100
15338
15397
  };
15339
- ScalePolicyStruct = Schema117.Struct({
15340
- min: Schema117.optional(Schema117.Number.pipe(Schema117.int(), Schema117.between(SCALE_POLICY_LIMITS.minInstancesMin, SCALE_POLICY_LIMITS.minInstancesMax))),
15341
- max: Schema117.optional(Schema117.Number.pipe(Schema117.int(), Schema117.between(SCALE_POLICY_LIMITS.maxInstancesMin, SCALE_POLICY_LIMITS.maxInstancesMax))),
15342
- scaleToZero: Schema117.optional(Schema117.Boolean),
15343
- idleTimeoutSeconds: Schema117.optional(Schema117.Number.pipe(Schema117.int(), Schema117.between(SCALE_POLICY_LIMITS.idleTimeoutSecondsMin, SCALE_POLICY_LIMITS.idleTimeoutSecondsMax))),
15344
- regions: Schema117.optional(Schema117.Array(Schema117.String)),
15345
- targetCPUPercent: Schema117.optional(Schema117.Number.pipe(Schema117.int(), Schema117.between(SCALE_POLICY_LIMITS.targetPercentMin, SCALE_POLICY_LIMITS.targetPercentMax))),
15346
- targetMemoryPercent: Schema117.optional(Schema117.Number.pipe(Schema117.int(), Schema117.between(SCALE_POLICY_LIMITS.targetPercentMin, SCALE_POLICY_LIMITS.targetPercentMax)))
15398
+ ScalePolicyStruct = Schema118.Struct({
15399
+ min: Schema118.optional(Schema118.Number.pipe(Schema118.int(), Schema118.between(SCALE_POLICY_LIMITS.minInstancesMin, SCALE_POLICY_LIMITS.minInstancesMax))),
15400
+ max: Schema118.optional(Schema118.Number.pipe(Schema118.int(), Schema118.between(SCALE_POLICY_LIMITS.maxInstancesMin, SCALE_POLICY_LIMITS.maxInstancesMax))),
15401
+ scaleToZero: Schema118.optional(Schema118.Boolean),
15402
+ idleTimeoutSeconds: Schema118.optional(Schema118.Number.pipe(Schema118.int(), Schema118.between(SCALE_POLICY_LIMITS.idleTimeoutSecondsMin, SCALE_POLICY_LIMITS.idleTimeoutSecondsMax))),
15403
+ regions: Schema118.optional(Schema118.Array(Schema118.String)),
15404
+ targetCPUPercent: Schema118.optional(Schema118.Number.pipe(Schema118.int(), Schema118.between(SCALE_POLICY_LIMITS.targetPercentMin, SCALE_POLICY_LIMITS.targetPercentMax))),
15405
+ targetMemoryPercent: Schema118.optional(Schema118.Number.pipe(Schema118.int(), Schema118.between(SCALE_POLICY_LIMITS.targetPercentMin, SCALE_POLICY_LIMITS.targetPercentMax)))
15347
15406
  });
15348
- ScalePolicy = ScalePolicyStruct.pipe(Schema117.filter((policy) => {
15407
+ ScalePolicy = ScalePolicyStruct.pipe(Schema118.filter((policy) => {
15349
15408
  const message = validateScalePolicyValue(policy);
15350
15409
  if (!message)
15351
15410
  return true;
@@ -15499,6 +15558,7 @@ var init_dist = __esm({
15499
15558
  init_tasks();
15500
15559
  init_user();
15501
15560
  init_webhooks();
15561
+ init_workspaces();
15502
15562
  }
15503
15563
  });
15504
15564
 
@@ -16275,11 +16335,12 @@ __export(environments_exports, {
16275
16335
  create: () => create4,
16276
16336
  delete: () => _delete4,
16277
16337
  list: () => list7,
16338
+ logs: () => logs,
16278
16339
  promote: () => promote,
16279
16340
  resolveId: () => resolveId,
16280
16341
  update: () => update2
16281
16342
  });
16282
- var orgHeaders2, list7, resolveId, promote, create4, update2, _delete4, clone;
16343
+ var orgHeaders2, list7, resolveId, promote, logs, create4, update2, _delete4, clone;
16283
16344
  var init_environments2 = __esm({
16284
16345
  "../management/dist/environments.js"() {
16285
16346
  "use strict";
@@ -16319,6 +16380,19 @@ var init_environments2 = __esm({
16319
16380
  headers: orgHeaders2(options)
16320
16381
  });
16321
16382
  };
16383
+ logs = (client, envId, options = {}) => {
16384
+ const { method, path: path7 } = environmentsEndpoints.logs;
16385
+ return request(client, method, interpolatePath(path7, { envId }), {
16386
+ query: {
16387
+ type: options.type,
16388
+ deploymentId: options.deploymentId,
16389
+ since: options.since,
16390
+ limit: options.limit === void 0 ? void 0 : String(options.limit),
16391
+ level: options.level
16392
+ },
16393
+ headers: orgHeaders2(options)
16394
+ });
16395
+ };
16322
16396
  create4 = (client, projectId, input, options = {}) => {
16323
16397
  const { method, path: path7 } = environmentsEndpoints.createStandalone;
16324
16398
  return request(client, method, path7, {
@@ -17495,7 +17569,7 @@ __export(saml_exports, {
17495
17569
  create: () => create13,
17496
17570
  delete: () => _delete11,
17497
17571
  get: () => get8,
17498
- logs: () => logs,
17572
+ logs: () => logs2,
17499
17573
  metadata: () => metadata,
17500
17574
  nameIdFormats: () => nameIdFormats,
17501
17575
  setStatus: () => setStatus,
@@ -17504,7 +17578,7 @@ __export(saml_exports, {
17504
17578
  testConfig: () => testConfig,
17505
17579
  update: () => update5
17506
17580
  });
17507
- var get8, create13, update5, setStatus, _delete11, metadata, logs, testConfig, templates, nameIdFormats, signatureAlgorithms;
17581
+ var get8, create13, update5, setStatus, _delete11, metadata, logs2, testConfig, templates, nameIdFormats, signatureAlgorithms;
17508
17582
  var init_saml3 = __esm({
17509
17583
  "../management/dist/saml.js"() {
17510
17584
  "use strict";
@@ -17534,7 +17608,7 @@ var init_saml3 = __esm({
17534
17608
  const { method, path: path7 } = samlEndpoints.getMetadata;
17535
17609
  return request(client, method, path7, { query: { organizationId } });
17536
17610
  };
17537
- logs = (client, providerId, limit) => {
17611
+ logs2 = (client, providerId, limit) => {
17538
17612
  const { method, path: path7 } = samlEndpoints.getLogs;
17539
17613
  return request(client, method, path7, {
17540
17614
  query: { providerId, limit: limit !== void 0 ? String(limit) : void 0 }
@@ -18069,6 +18143,42 @@ var init_webhooks2 = __esm({
18069
18143
  }
18070
18144
  });
18071
18145
 
18146
+ // ../management/dist/workspaces.js
18147
+ var workspaces_exports = {};
18148
+ __export(workspaces_exports, {
18149
+ create: () => create20,
18150
+ delete: () => _delete18,
18151
+ fork: () => fork,
18152
+ get: () => get15,
18153
+ list: () => list28
18154
+ });
18155
+ var list28, get15, create20, fork, _delete18;
18156
+ var init_workspaces2 = __esm({
18157
+ "../management/dist/workspaces.js"() {
18158
+ "use strict";
18159
+ init_http();
18160
+ list28 = async (client, projectId) => {
18161
+ const res = await request(client, "GET", interpolatePath("/projects/:projectId/workspaces", { projectId }));
18162
+ return res.workspaces;
18163
+ };
18164
+ get15 = async (client, projectId, workspaceId) => request(client, "GET", interpolatePath("/projects/:projectId/workspaces/:workspaceId", {
18165
+ projectId,
18166
+ workspaceId
18167
+ }));
18168
+ create20 = (client, projectId, input) => request(client, "POST", interpolatePath("/projects/:projectId/workspaces", { projectId }), {
18169
+ body: input
18170
+ });
18171
+ fork = (client, projectId, workspaceId, input = {}) => request(client, "POST", interpolatePath("/projects/:projectId/workspaces/:workspaceId/forks", {
18172
+ projectId,
18173
+ workspaceId
18174
+ }), { body: input });
18175
+ _delete18 = (client, projectId, workspaceId) => request(client, "DELETE", interpolatePath("/projects/:projectId/workspaces/:workspaceId", {
18176
+ projectId,
18177
+ workspaceId
18178
+ }));
18179
+ }
18180
+ });
18181
+
18072
18182
  // ../management/dist/index.js
18073
18183
  var init_dist2 = __esm({
18074
18184
  "../management/dist/index.js"() {
@@ -18143,11 +18253,12 @@ var init_dist2 = __esm({
18143
18253
  init_users2();
18144
18254
  init_volumes();
18145
18255
  init_webhooks2();
18256
+ init_workspaces2();
18146
18257
  }
18147
18258
  });
18148
18259
 
18149
18260
  // src/lib/manifest.ts
18150
- import { Data, Effect, Either, ParseResult, Schema as Schema118 } from "effect";
18261
+ import { Data, Effect, Either, ParseResult, Schema as Schema119 } from "effect";
18151
18262
  function resolveManifestPath(explicit, cwd = process.cwd()) {
18152
18263
  if (explicit && explicit.length > 0) {
18153
18264
  return explicit.startsWith("/") ? explicit : `${cwd}/${explicit}`;
@@ -18193,7 +18304,7 @@ function parseTomlEffect(source, path7) {
18193
18304
  });
18194
18305
  }
18195
18306
  function validateManifestEffect(parsed, path7) {
18196
- const either = Schema118.decodeUnknownEither(SylphxManifest, {
18307
+ const either = Schema119.decodeUnknownEither(SylphxManifest, {
18197
18308
  errors: "all",
18198
18309
  // Reject typos + unknown keys so users catch mistakes locally rather
18199
18310
  // than having the server silently drop fields on apply.
@@ -18515,7 +18626,7 @@ var init_env_flags = __esm({
18515
18626
  import fs from "fs";
18516
18627
  import os from "os";
18517
18628
  import path from "path";
18518
- import { Either as Either2, ParseResult as ParseResult2, Schema as Schema119 } from "effect";
18629
+ import { Either as Either2, ParseResult as ParseResult2, Schema as Schema120 } from "effect";
18519
18630
  function isRecord(value) {
18520
18631
  return value !== null && typeof value === "object" && !Array.isArray(value);
18521
18632
  }
@@ -18653,7 +18764,7 @@ function requireLinkMetadata(link, key) {
18653
18764
  throw new Error(`Cannot create ${MANIFEST_FILENAME}: ProjectLink.${key} is required`);
18654
18765
  }
18655
18766
  function decodeManifestForWrite(filePath, parsed) {
18656
- const decoded = Schema119.decodeUnknownEither(SylphxManifest, {
18767
+ const decoded = Schema120.decodeUnknownEither(SylphxManifest, {
18657
18768
  errors: "all",
18658
18769
  onExcessProperty: "error"
18659
18770
  })(parsed);
@@ -19389,6 +19500,21 @@ async function authedFetch(path7, init = {}) {
19389
19500
  return await res.text();
19390
19501
  });
19391
19502
  }
19503
+ async function resolveLogStreamToken() {
19504
+ if (isExternalAuthActive()) {
19505
+ const auth = resolveAuthToken();
19506
+ if (!auth.token) throw new ApiError2(401, unauthenticatedMessage(auth));
19507
+ return auth.token;
19508
+ }
19509
+ let token;
19510
+ try {
19511
+ token = await ensureFreshAccessToken();
19512
+ } catch (err) {
19513
+ throw mapRefreshFailure(err);
19514
+ }
19515
+ if (!token) throw new ApiError2(401, unauthenticatedMessage());
19516
+ return token;
19517
+ }
19392
19518
  async function createLogStream(projectId, envType, options) {
19393
19519
  const params = new URLSearchParams({ stream: "true", limit: "200" });
19394
19520
  if (options?.envId) {
@@ -19397,25 +19523,30 @@ async function createLogStream(projectId, envType, options) {
19397
19523
  params.set("envType", envType);
19398
19524
  }
19399
19525
  const preferredOrgId = options?.orgId ?? resolvePreferredOrgId();
19400
- let token;
19401
- if (isExternalAuthActive()) {
19402
- const auth = resolveAuthToken();
19403
- if (!auth.token) throw new ApiError2(401, unauthenticatedMessage(auth));
19404
- token = auth.token;
19405
- } else {
19406
- try {
19407
- token = await ensureFreshAccessToken();
19408
- } catch (err) {
19409
- throw mapRefreshFailure(err);
19410
- }
19411
- }
19412
- if (!token) throw new ApiError2(401, unauthenticatedMessage());
19526
+ const token = await resolveLogStreamToken();
19413
19527
  return {
19414
19528
  url: `${API_BASE}/projects/${encodeURIComponent(projectId)}/logs?${params.toString()}`,
19415
19529
  token,
19416
19530
  ...preferredOrgId ? { headers: { "X-Preferred-Org-Id": preferredOrgId } } : {}
19417
19531
  };
19418
19532
  }
19533
+ async function createEnvironmentLogStream(envId, options = {}) {
19534
+ const params = new URLSearchParams({
19535
+ stream: "true",
19536
+ type: options.type ?? "runtime",
19537
+ limit: String(options.limit ?? 200)
19538
+ });
19539
+ if (options.deploymentId) params.set("deploymentId", options.deploymentId);
19540
+ if (options.since) params.set("since", options.since);
19541
+ if (options.level) params.set("level", options.level);
19542
+ const preferredOrgId = options.orgId ?? resolvePreferredOrgId();
19543
+ const token = await resolveLogStreamToken();
19544
+ return {
19545
+ url: `${API_BASE}/environments/${encodeURIComponent(envId)}/logs?${params.toString()}`,
19546
+ token,
19547
+ ...preferredOrgId ? { headers: { "X-Preferred-Org-Id": preferredOrgId } } : {}
19548
+ };
19549
+ }
19419
19550
  var version, BASE_URL, USER_AGENT, PREFERRED_ORG_ENV_VARS, api, API_BASE;
19420
19551
  var init_api = __esm({
19421
19552
  "src/api.ts"() {
@@ -19506,6 +19637,7 @@ var init_api = __esm({
19506
19637
  // ── Environments ───────────────────────────────────────────────────────
19507
19638
  listEnvironments: (projectId) => withClient((c2) => environments_exports.list(c2, projectId)),
19508
19639
  resolveEnvId: (projectId, envType) => withClient((c2) => environments_exports.resolveId(c2, projectId, envType)),
19640
+ listEnvironmentLogs: (envId, options) => withClient((c2) => environments_exports.logs(c2, envId, options)),
19509
19641
  createEnvironment: (projectId, body) => withClient((c2) => environments_exports.create(c2, projectId, body)),
19510
19642
  updateEnvironment: (envId, body) => withClient((c2) => environments_exports.update(c2, envId, body)),
19511
19643
  deleteEnvironment: (envId) => withClient((c2) => environments_exports.delete(c2, envId)),
@@ -19834,9 +19966,9 @@ var init_oidc4 = __esm({
19834
19966
 
19835
19967
  // src/main.ts
19836
19968
  init_package();
19837
- import { Command as Command70 } from "@effect/cli";
19969
+ import { Command as Command71 } from "@effect/cli";
19838
19970
  import { BunContext, BunRuntime } from "@effect/platform-bun";
19839
- import { Console as Console70, Effect as Effect80, Layer as Layer5 } from "effect";
19971
+ import { Console as Console71, Effect as Effect81, Layer as Layer5 } from "effect";
19840
19972
 
19841
19973
  // src/programs/account.ts
19842
19974
  init_dist();
@@ -20075,10 +20207,18 @@ var ApiServiceLive = Layer2.succeed(ApiService, {
20075
20207
  try: () => createLogStream(projectId, envType, options),
20076
20208
  catch: mapApiError("logs")
20077
20209
  }),
20210
+ createEnvironmentLogStream: (envId, options) => Effect7.tryPromise({
20211
+ try: () => createEnvironmentLogStream(envId, options),
20212
+ catch: mapApiError("logs")
20213
+ }),
20078
20214
  listProjectLogs: (projectId, options) => Effect7.tryPromise({
20079
20215
  try: () => withAuthedSdk((c2) => logs_exports.list(c2, projectId, options)),
20080
20216
  catch: mapApiError("logs")
20081
20217
  }),
20218
+ listEnvironmentLogs: (envId, options) => Effect7.tryPromise({
20219
+ try: () => withAuthedSdk((c2) => environments_exports.logs(c2, envId, options)),
20220
+ catch: mapApiError("logs")
20221
+ }),
20082
20222
  triggerDeploy: (projectId, envType, options) => Effect7.tryPromise({
20083
20223
  try: () => withAuthedSdk((c2) => deployments_exports.trigger(c2, projectId, envType, options)),
20084
20224
  catch: mapApiError("deploy")
@@ -20235,6 +20375,26 @@ var ApiServiceLive = Layer2.succeed(ApiService, {
20235
20375
  try: () => withAuthedSdk((c2) => volumes_exports.delete(c2, projectId, volId)),
20236
20376
  catch: mapApiError("volumes")
20237
20377
  }),
20378
+ listWorkspaces: (projectId) => Effect7.tryPromise({
20379
+ try: () => withAuthedSdk((c2) => workspaces_exports.list(c2, projectId)),
20380
+ catch: mapApiError("workspaces")
20381
+ }),
20382
+ getWorkspace: (projectId, workspaceId) => Effect7.tryPromise({
20383
+ try: () => withAuthedSdk((c2) => workspaces_exports.get(c2, projectId, workspaceId)),
20384
+ catch: mapApiError("workspaces")
20385
+ }),
20386
+ createWorkspace: (projectId, data) => Effect7.tryPromise({
20387
+ try: () => withAuthedSdk((c2) => workspaces_exports.create(c2, projectId, data)),
20388
+ catch: mapApiError("workspaces")
20389
+ }),
20390
+ forkWorkspace: (projectId, workspaceId, data) => Effect7.tryPromise({
20391
+ try: () => withAuthedSdk((c2) => workspaces_exports.fork(c2, projectId, workspaceId, data)),
20392
+ catch: mapApiError("workspaces")
20393
+ }),
20394
+ deleteWorkspace: (projectId, workspaceId) => Effect7.tryPromise({
20395
+ try: () => withAuthedSdk((c2) => workspaces_exports.delete(c2, projectId, workspaceId)),
20396
+ catch: mapApiError("workspaces")
20397
+ }),
20238
20398
  listConfig: (projectId, envType, options) => Effect7.tryPromise({
20239
20399
  try: () => withAuthedSdk((c2) => remoteConfig_exports.list(c2, projectId, envType, options)),
20240
20400
  catch: mapApiError("config")
@@ -25430,7 +25590,14 @@ function parseLogLine(raw) {
25430
25590
  const level = status3 === "error" || status3 === "failed" ? "error" : status3 === "success" || status3 === "done" ? "success" : lvl;
25431
25591
  const tsRaw = entry.timestamp ?? entry.ts;
25432
25592
  const timestamp = tsRaw ? new Date(tsRaw) : void 0;
25433
- return { raw, entry, message, level, timestamp, service: entry.service };
25593
+ return {
25594
+ raw,
25595
+ entry,
25596
+ message,
25597
+ level,
25598
+ timestamp,
25599
+ service: entry.service ?? entry.source ?? void 0
25600
+ };
25434
25601
  }
25435
25602
  function formatLogEntry(raw) {
25436
25603
  let entry;
@@ -28580,8 +28747,8 @@ function flagsDeleteEffect(opts) {
28580
28747
  yield* requireAuthEffect;
28581
28748
  const api2 = yield* ApiService;
28582
28749
  const projectId = yield* resolveProjectEffect(opts.project);
28583
- const list28 = yield* api2.listFlags(projectId, { limit: 100 });
28584
- const match = list28.flags.find((f) => f.key === opts.key);
28750
+ const list29 = yield* api2.listFlags(projectId, { limit: 100 });
28751
+ const match = list29.flags.find((f) => f.key === opts.key);
28585
28752
  if (!match) {
28586
28753
  return yield* Effect34.fail(
28587
28754
  new CliCommandError({
@@ -28610,8 +28777,8 @@ function flagsToggleEffect(opts) {
28610
28777
  yield* requireAuthEffect;
28611
28778
  const api2 = yield* ApiService;
28612
28779
  const projectId = yield* resolveProjectEffect(opts.project);
28613
- const list28 = yield* api2.listFlags(projectId, { limit: 100 });
28614
- const match = list28.flags.find((f) => f.key === opts.key);
28780
+ const list29 = yield* api2.listFlags(projectId, { limit: 100 });
28781
+ const match = list29.flags.find((f) => f.key === opts.key);
28615
28782
  if (!match) {
28616
28783
  return yield* Effect34.fail(
28617
28784
  new CliCommandError({
@@ -29294,7 +29461,7 @@ var inspectCommand = Command28.make(
29294
29461
  Options30.withDescription("Machine-readable JSON output (no colour)")
29295
29462
  )
29296
29463
  },
29297
- ({ id, wait, logs: logs2, json }) => inspectEffect({ id, wait, logs: logs2, json })
29464
+ ({ id, wait, logs: logs3, json }) => inspectEffect({ id, wait, logs: logs3, json })
29298
29465
  ).pipe(Command28.withDescription("Inspect a deployment by id"));
29299
29466
 
29300
29467
  // src/programs/link.ts
@@ -29679,6 +29846,10 @@ var serviceOption = Options32.text("service").pipe(
29679
29846
  Options32.withDescription("Restrict to a single service"),
29680
29847
  Options32.optional
29681
29848
  );
29849
+ var logTypeOption = Options32.choice("type", ["runtime", "build"]).pipe(
29850
+ Options32.withDescription("Log source to inspect: runtime app logs or build/deploy logs"),
29851
+ Options32.withDefault("runtime")
29852
+ );
29682
29853
  var jsonOption = Options32.boolean("json").pipe(
29683
29854
  Options32.withDescription("Emit machine-readable NDJSON (one JSON object per line)")
29684
29855
  );
@@ -29786,6 +29957,7 @@ function tailFormat(line) {
29786
29957
  }
29787
29958
  function describeFilters(opts) {
29788
29959
  const parts = [];
29960
+ if (opts.type) parts.push(`type=${opts.type}`);
29789
29961
  if (opts.levels && opts.levels.size > 0) {
29790
29962
  const lst = [...opts.levels].sort().join("/");
29791
29963
  parts.push(opts.levels.size === 1 ? `${lst} only` : `levels=${lst}`);
@@ -29823,13 +29995,13 @@ function logsEffect(input) {
29823
29995
  );
29824
29996
  const target = input.env ?? targetProject.defaultEnv;
29825
29997
  const scope = orgId ? { orgId } : void 0;
29826
- const resolvedEnvId = input.env ? yield* api2.resolveEnvId(targetProject.projectId, input.env, scope) : null;
29827
- if (input.env && !resolvedEnvId) {
29998
+ const resolvedEnvId = yield* api2.resolveEnvId(targetProject.projectId, target, scope);
29999
+ if (!resolvedEnvId) {
29828
30000
  return yield* Effect42.fail(
29829
30001
  new CliCommandError({
29830
30002
  command: "logs",
29831
30003
  reason: "not-found",
29832
- message: `Environment not found: ${input.env}`
30004
+ message: `Environment not found: ${target}`
29833
30005
  })
29834
30006
  );
29835
30007
  }
@@ -29837,10 +30009,11 @@ function logsEffect(input) {
29837
30009
  yield* Console32.log("");
29838
30010
  yield* Console32.log(
29839
30011
  chalk_default.bold(
29840
- ` Logs for ${chalk_default.cyan(targetProject.projectId)} [${chalk_default.white(target)}]${input.follow ? chalk_default.dim(" (following...)") : ""}`
30012
+ ` ${input.type} logs for ${chalk_default.cyan(targetProject.projectId)} [${chalk_default.white(target)}]${input.follow ? chalk_default.dim(" (following...)") : ""}`
29841
30013
  )
29842
30014
  );
29843
30015
  const summary2 = describeFilters({
30016
+ type: input.type,
29844
30017
  levels,
29845
30018
  sinceRaw: input.since,
29846
30019
  grepRaw: input.grep,
@@ -29851,32 +30024,51 @@ function logsEffect(input) {
29851
30024
  yield* Console32.log(chalk_default.dim(` ${"\u2500".repeat(50)}`));
29852
30025
  yield* Console32.log("");
29853
30026
  }
29854
- const logStream = yield* api2.createLogStream(
29855
- targetProject.projectId,
29856
- target,
29857
- orgId || resolvedEnvId ? { ...orgId ? { orgId } : {}, ...resolvedEnvId ? { envId: resolvedEnvId } : {} } : void 0
29858
- );
29859
- const url = appendQuery(logStream.url, {
29860
- since: since ? String(since.getTime()) : void 0,
29861
- limit: input.tail ? String(input.tail) : void 0,
29862
- service: input.service
29863
- });
29864
30027
  const filter = buildFilter({ levels, since, grep, service: input.service });
29865
- yield* Effect42.tryPromise({
29866
- try: () => streamLogs(url, logStream.token, {
29867
- follow: input.follow,
29868
- exitOnDone: false,
29869
- filter,
29870
- format: input.json ? jsonFormat : void 0,
29871
- limit: input.tail,
29872
- headers: logStream.headers
29873
- }),
29874
- catch: (cause) => new CliCommandError({
29875
- command: "logs",
29876
- reason: "transient",
29877
- message: `Log stream failed: ${cause instanceof Error ? cause.message : String(cause)}`
29878
- })
29879
- });
30028
+ if (!input.follow) {
30029
+ const result = yield* api2.listEnvironmentLogs(resolvedEnvId, {
30030
+ type: input.type,
30031
+ ...orgId ? { orgId } : {},
30032
+ ...since ? { since: since.toISOString() } : {},
30033
+ ...input.tail ? { limit: input.tail } : {},
30034
+ ...levels.size === 1 ? { level: [...levels][0] } : {}
30035
+ });
30036
+ let emitted = 0;
30037
+ for (const entry of result.data) {
30038
+ const raw = JSON.stringify(entry);
30039
+ const line = parseLogLine(raw);
30040
+ if (!filter(line)) continue;
30041
+ yield* Console32.log(input.json ? jsonFormat(line) : formatLogEntry(raw));
30042
+ emitted++;
30043
+ if (input.tail && emitted >= input.tail) break;
30044
+ }
30045
+ } else {
30046
+ const logStream = yield* api2.createEnvironmentLogStream(resolvedEnvId, {
30047
+ type: input.type,
30048
+ ...orgId ? { orgId } : {},
30049
+ ...since ? { since: since.toISOString() } : {},
30050
+ ...input.tail ? { limit: input.tail } : {},
30051
+ ...levels.size === 1 ? { level: [...levels][0] } : {}
30052
+ });
30053
+ const url = appendQuery(logStream.url, {
30054
+ service: input.service
30055
+ });
30056
+ yield* Effect42.tryPromise({
30057
+ try: () => streamLogs(url, logStream.token, {
30058
+ follow: true,
30059
+ exitOnDone: false,
30060
+ filter,
30061
+ format: input.json ? jsonFormat : void 0,
30062
+ limit: input.tail,
30063
+ headers: logStream.headers
30064
+ }),
30065
+ catch: (cause) => new CliCommandError({
30066
+ command: "logs",
30067
+ reason: "transient",
30068
+ message: `Log stream failed: ${cause instanceof Error ? cause.message : String(cause)}`
30069
+ })
30070
+ });
30071
+ }
29880
30072
  if (!input.follow && !input.json) {
29881
30073
  yield* Console32.log("");
29882
30074
  }
@@ -29902,6 +30094,7 @@ var logsCommand = Command32.make(
29902
30094
  project: projectOption18,
29903
30095
  org: orgOption9,
29904
30096
  env: envOption9,
30097
+ type: logTypeOption,
29905
30098
  follow: followOption,
29906
30099
  level: levelOption,
29907
30100
  since: sinceOption,
@@ -29910,10 +30103,11 @@ var logsCommand = Command32.make(
29910
30103
  service: serviceOption,
29911
30104
  json: jsonOption
29912
30105
  },
29913
- ({ project, org, env, follow, level, since, tail, grep, service, json }) => logsEffect({
30106
+ ({ project, org, env, type, follow, level, since, tail, grep, service, json }) => logsEffect({
29914
30107
  project: project._tag === "Some" ? project.value : void 0,
29915
30108
  org: org._tag === "Some" ? org.value : void 0,
29916
30109
  env: env._tag === "Some" ? env.value : void 0,
30110
+ type,
29917
30111
  follow,
29918
30112
  level,
29919
30113
  since: since._tag === "Some" ? since.value : void 0,
@@ -29922,7 +30116,11 @@ var logsCommand = Command32.make(
29922
30116
  service: service._tag === "Some" ? service.value : void 0,
29923
30117
  json
29924
30118
  })
29925
- ).pipe(Command32.withDescription("Stream build/runtime logs"));
30119
+ ).pipe(
30120
+ Command32.withDescription(
30121
+ "Inspect runtime logs; use --follow for SSE or --type build for deploy logs"
30122
+ )
30123
+ );
29926
30124
 
29927
30125
  // src/programs/migrate.ts
29928
30126
  import { Command as Command33, Options as Options34 } from "@effect/cli";
@@ -30570,9 +30768,9 @@ function migrateStatusEffect(input) {
30570
30768
  const byProject = /* @__PURE__ */ new Map();
30571
30769
  for (const row of rows) {
30572
30770
  const key = row.projectSlug ?? row.projectId;
30573
- const list28 = byProject.get(key) ?? [];
30574
- list28.push(row);
30575
- byProject.set(key, list28);
30771
+ const list29 = byProject.get(key) ?? [];
30772
+ list29.push(row);
30773
+ byProject.set(key, list29);
30576
30774
  }
30577
30775
  const sortedKeys = [...byProject.keys()].sort();
30578
30776
  for (const key of sortedKeys) {
@@ -36797,8 +36995,20 @@ function tailEffect(input) {
36797
36995
  projectId = linked.projectId;
36798
36996
  target = input.env ?? linked.defaultEnv;
36799
36997
  }
36998
+ const scope = orgId ? { orgId } : void 0;
36999
+ const envId = yield* api2.resolveEnvId(projectId, target, scope);
37000
+ if (!envId) {
37001
+ return yield* Effect71.fail(
37002
+ new CliCommandError({
37003
+ command: "tail",
37004
+ reason: "not-found",
37005
+ message: `Environment not found: ${target}`
37006
+ })
37007
+ );
37008
+ }
36800
37009
  if (!input.json) {
36801
37010
  const summary2 = describeFilters({
37011
+ type: input.type,
36802
37012
  levels,
36803
37013
  sinceRaw: input.since,
36804
37014
  grepRaw: input.grep,
@@ -36807,14 +37017,20 @@ function tailEffect(input) {
36807
37017
  });
36808
37018
  yield* Console61.log("");
36809
37019
  yield* Console61.log(
36810
- chalk_default.dim(` tailing ${chalk_default.cyan(projectId)} [${chalk_default.white(target)}] \xB7 ${summary2}`)
37020
+ chalk_default.dim(
37021
+ ` tailing ${input.type} logs for ${chalk_default.cyan(projectId)} [${chalk_default.white(target)}] \xB7 ${summary2}`
37022
+ )
36811
37023
  );
36812
37024
  yield* Console61.log("");
36813
37025
  }
36814
- const logStream = yield* api2.createLogStream(projectId, target, orgId ? { orgId } : void 0);
37026
+ const logStream = yield* api2.createEnvironmentLogStream(envId, {
37027
+ type: input.type,
37028
+ ...orgId ? { orgId } : {},
37029
+ ...since ? { since: since.toISOString() } : {},
37030
+ ...input.tail ? { limit: input.tail } : {},
37031
+ ...levels.size === 1 ? { level: [...levels][0] } : {}
37032
+ });
36815
37033
  const url = appendQuery(logStream.url, {
36816
- since: since ? String(since.getTime()) : void 0,
36817
- limit: input.tail ? String(input.tail) : void 0,
36818
37034
  service: input.service
36819
37035
  });
36820
37036
  const filter = buildFilter({ levels, since, grep, service: input.service });
@@ -36849,6 +37065,7 @@ var tailCommand = Command61.make(
36849
37065
  project: projectArg,
36850
37066
  org: orgOption25,
36851
37067
  env: envOption9,
37068
+ type: logTypeOption,
36852
37069
  level: levelOption,
36853
37070
  since: sinceOption,
36854
37071
  tail: tailOption,
@@ -36856,10 +37073,11 @@ var tailCommand = Command61.make(
36856
37073
  service: serviceOption,
36857
37074
  json: jsonOption
36858
37075
  },
36859
- ({ project, org, env, level, since, tail, grep, service, json }) => tailEffect({
37076
+ ({ project, org, env, type, level, since, tail, grep, service, json }) => tailEffect({
36860
37077
  project: project._tag === "Some" ? project.value : void 0,
36861
37078
  org: org._tag === "Some" ? org.value : void 0,
36862
37079
  env: env._tag === "Some" ? env.value : void 0,
37080
+ type,
36863
37081
  level,
36864
37082
  since: since._tag === "Some" ? since.value : void 0,
36865
37083
  tail: tail._tag === "Some" ? tail.value : void 0,
@@ -36867,7 +37085,7 @@ var tailCommand = Command61.make(
36867
37085
  service: service._tag === "Some" ? service.value : void 0,
36868
37086
  json
36869
37087
  })
36870
- ).pipe(Command61.withDescription("Tail logs with structured formatting (alias for logs --follow)"));
37088
+ ).pipe(Command61.withDescription("Follow runtime logs with structured formatting"));
36871
37089
 
36872
37090
  // src/programs/tasks.ts
36873
37091
  import { Args as Args42, Command as Command62, Options as Options63 } from "@effect/cli";
@@ -38645,6 +38863,259 @@ var whoamiCommand = Command69.make(
38645
38863
  ({ output }) => whoamiEffectWith(output)
38646
38864
  ).pipe(Command69.withDescription("Show current user, org, and linked project"));
38647
38865
 
38866
+ // src/programs/workspaces.ts
38867
+ import { Args as Args48, Command as Command70, Options as Options69 } from "@effect/cli";
38868
+ import { Console as Console70, Effect as Effect80 } from "effect";
38869
+ init_chalk();
38870
+ init_effect_io();
38871
+ init_spinner();
38872
+ function optionalValue5(option) {
38873
+ return option._tag === "Some" ? option.value : void 0;
38874
+ }
38875
+ function resolveWorkspaceProjectEffect(project, org) {
38876
+ return Effect80.gen(function* () {
38877
+ const orgId = yield* resolveOrgScopeEffect("workspaces", org);
38878
+ const target = yield* resolveProjectTargetWithApiEffect("workspaces", project, orgId);
38879
+ return target.projectId;
38880
+ });
38881
+ }
38882
+ function parseWorkspaceSizeEffect(command, size) {
38883
+ if (size === void 0) return Effect80.succeed(void 0);
38884
+ const sizeGb = Number.parseInt(size, 10);
38885
+ if (Number.isNaN(sizeGb) || sizeGb < 1) {
38886
+ return Effect80.fail(
38887
+ new CliArgError({
38888
+ command,
38889
+ argument: "--size",
38890
+ message: "--size must be a number >= 1"
38891
+ })
38892
+ );
38893
+ }
38894
+ return Effect80.succeed(sizeGb);
38895
+ }
38896
+ function workspaceStatusLabel(status3) {
38897
+ if (status3 === "ready") return chalk_default.green(status3.padEnd(12));
38898
+ if (status3 === "error") return chalk_default.red(status3.padEnd(12));
38899
+ return chalk_default.yellow(status3.padEnd(12));
38900
+ }
38901
+ function renderWorkspaceDetails(workspace) {
38902
+ return Effect80.gen(function* () {
38903
+ yield* Console70.log("");
38904
+ yield* Console70.log(` ${chalk_default.dim("ID:")} ${workspace.id}`);
38905
+ yield* Console70.log(` ${chalk_default.dim("Name:")} ${workspace.name}`);
38906
+ yield* Console70.log(` ${chalk_default.dim("Key:")} ${workspace.key}`);
38907
+ yield* Console70.log(` ${chalk_default.dim("Size:")} ${workspace.sizeGb}Gi`);
38908
+ yield* Console70.log(` ${chalk_default.dim("Status:")} ${workspace.status}`);
38909
+ if (workspace.sourceWorkspaceId) {
38910
+ yield* Console70.log(` ${chalk_default.dim("Source:")} ${workspace.sourceWorkspaceId}`);
38911
+ }
38912
+ yield* Console70.log(` ${chalk_default.dim("Created:")} ${workspace.createdAt}`);
38913
+ yield* Console70.log("");
38914
+ });
38915
+ }
38916
+ function workspacesListEffect(opts = {}) {
38917
+ return Effect80.gen(function* () {
38918
+ yield* requireAuthEffect;
38919
+ const projectId = yield* resolveWorkspaceProjectEffect(opts.project, opts.org);
38920
+ const api2 = yield* ApiService;
38921
+ const workspaces = yield* withSpinner("Fetching workspaces...", api2.listWorkspaces(projectId));
38922
+ if (workspaces.length === 0) {
38923
+ yield* Console70.log(chalk_default.dim(" No workspaces provisioned."));
38924
+ yield* Console70.log(
38925
+ chalk_default.dim(`
38926
+ Run ${chalk_default.cyan("sylphx workspaces create <name>")} to provision.`)
38927
+ );
38928
+ return;
38929
+ }
38930
+ yield* Console70.log("");
38931
+ yield* Console70.log(
38932
+ ` ${chalk_default.bold("NAME".padEnd(28))} ${"SIZE".padEnd(8)} ${"STATUS".padEnd(12)} ID`
38933
+ );
38934
+ yield* Console70.log(` ${"\u2500".repeat(78)}`);
38935
+ for (const workspace of workspaces) {
38936
+ const size = `${workspace.sizeGb}Gi`.padEnd(8);
38937
+ yield* Console70.log(
38938
+ ` ${chalk_default.cyan(workspace.name.padEnd(28))} ${size} ${workspaceStatusLabel(workspace.status)} ${chalk_default.dim(workspace.id)}`
38939
+ );
38940
+ }
38941
+ yield* Console70.log("");
38942
+ });
38943
+ }
38944
+ function workspacesGetEffect(input) {
38945
+ return Effect80.gen(function* () {
38946
+ yield* requireAuthEffect;
38947
+ const projectId = yield* resolveWorkspaceProjectEffect(input.project, input.org);
38948
+ const api2 = yield* ApiService;
38949
+ const result = yield* withSpinner(
38950
+ `Fetching workspace ${input.id}...`,
38951
+ api2.getWorkspace(projectId, input.id)
38952
+ );
38953
+ yield* renderWorkspaceDetails(result.workspace);
38954
+ });
38955
+ }
38956
+ function workspacesCreateEffect(input) {
38957
+ return Effect80.gen(function* () {
38958
+ const sizeGb = yield* parseWorkspaceSizeEffect("workspaces", input.size);
38959
+ yield* requireAuthEffect;
38960
+ const projectId = yield* resolveWorkspaceProjectEffect(input.project, input.org);
38961
+ const api2 = yield* ApiService;
38962
+ const result = yield* withSpinner(
38963
+ `Provisioning workspace '${input.name}'...`,
38964
+ api2.createWorkspace(projectId, {
38965
+ name: input.name,
38966
+ key: input.key,
38967
+ sizeGb,
38968
+ environmentId: input.environment
38969
+ })
38970
+ );
38971
+ yield* Console70.log(chalk_default.green(`\u2713 Workspace '${result.workspace.name}' created`));
38972
+ yield* renderWorkspaceDetails(result.workspace);
38973
+ });
38974
+ }
38975
+ function workspacesForkEffect(input) {
38976
+ return Effect80.gen(function* () {
38977
+ const sizeGb = yield* parseWorkspaceSizeEffect("workspaces", input.size);
38978
+ yield* requireAuthEffect;
38979
+ const projectId = yield* resolveWorkspaceProjectEffect(input.project, input.org);
38980
+ const api2 = yield* ApiService;
38981
+ const result = yield* withSpinner(
38982
+ `Forking workspace ${input.id}...`,
38983
+ api2.forkWorkspace(projectId, input.id, {
38984
+ name: input.name,
38985
+ key: input.key,
38986
+ sizeGb
38987
+ })
38988
+ );
38989
+ yield* Console70.log(chalk_default.green(`\u2713 Workspace '${result.workspace.name}' forked`));
38990
+ yield* renderWorkspaceDetails(result.workspace);
38991
+ });
38992
+ }
38993
+ function workspacesRmEffect(input) {
38994
+ return Effect80.gen(function* () {
38995
+ yield* requireAuthEffect;
38996
+ const projectId = yield* resolveWorkspaceProjectEffect(input.project, input.org);
38997
+ const api2 = yield* ApiService;
38998
+ if (!input.force) {
38999
+ const confirmed = yield* confirmEffect(
39000
+ chalk_default.yellow(
39001
+ ` \u26A0\uFE0F Delete workspace ${chalk_default.bold(input.id)}? This will destroy its data. (y/N) `
39002
+ )
39003
+ );
39004
+ if (!confirmed) {
39005
+ yield* Console70.log(chalk_default.dim(" Cancelled."));
39006
+ return;
39007
+ }
39008
+ }
39009
+ yield* withSpinner(
39010
+ `Deleting workspace ${input.id}...`,
39011
+ api2.deleteWorkspace(projectId, input.id)
39012
+ );
39013
+ yield* Console70.log(chalk_default.green(`\u2713 Workspace ${input.id} deleted`));
39014
+ });
39015
+ }
39016
+ var projectOption41 = Options69.text("project").pipe(
39017
+ Options69.withDescription(
39018
+ "Project id, slug, name, or ref to manage without changing the linked directory"
39019
+ ),
39020
+ Options69.optional
39021
+ );
39022
+ var orgOption29 = Options69.text("org").pipe(
39023
+ Options69.withDescription("Organization slug or id for cross-org project lookup"),
39024
+ Options69.optional
39025
+ );
39026
+ var sizeOption = Options69.text("size").pipe(
39027
+ Options69.withDescription("Size in GiB"),
39028
+ Options69.optional
39029
+ );
39030
+ var keyOption = Options69.text("key").pipe(
39031
+ Options69.withDescription("Stable workspace key"),
39032
+ Options69.optional
39033
+ );
39034
+ var listCmd27 = Command70.make(
39035
+ "list",
39036
+ { project: projectOption41, org: orgOption29 },
39037
+ ({ project, org }) => workspacesListEffect({
39038
+ project: optionalValue5(project),
39039
+ org: optionalValue5(org)
39040
+ })
39041
+ ).pipe(Command70.withDescription("List managed workspaces for the linked or explicit project"));
39042
+ var getCmd12 = Command70.make(
39043
+ "get",
39044
+ { id: Args48.text({ name: "id" }), project: projectOption41, org: orgOption29 },
39045
+ ({ id, project, org }) => workspacesGetEffect({
39046
+ id,
39047
+ project: optionalValue5(project),
39048
+ org: optionalValue5(org)
39049
+ })
39050
+ ).pipe(Command70.withDescription("Get a managed workspace"));
39051
+ var createCmd15 = Command70.make(
39052
+ "create",
39053
+ {
39054
+ name: Args48.text({ name: "name" }),
39055
+ key: keyOption,
39056
+ size: sizeOption,
39057
+ environment: Options69.text("environment").pipe(
39058
+ Options69.withDescription("Environment id for the workspace"),
39059
+ Options69.optional
39060
+ ),
39061
+ project: projectOption41,
39062
+ org: orgOption29
39063
+ },
39064
+ ({ name, key, size, environment, project, org }) => workspacesCreateEffect({
39065
+ name,
39066
+ key: optionalValue5(key),
39067
+ size: optionalValue5(size),
39068
+ environment: optionalValue5(environment),
39069
+ project: optionalValue5(project),
39070
+ org: optionalValue5(org)
39071
+ })
39072
+ ).pipe(Command70.withDescription("Create a managed workspace"));
39073
+ var forkCmd = Command70.make(
39074
+ "fork",
39075
+ {
39076
+ id: Args48.text({ name: "id" }),
39077
+ name: Options69.text("name").pipe(
39078
+ Options69.withDescription("Name for the forked workspace"),
39079
+ Options69.optional
39080
+ ),
39081
+ key: keyOption,
39082
+ size: sizeOption,
39083
+ project: projectOption41,
39084
+ org: orgOption29
39085
+ },
39086
+ ({ id, name, key, size, project, org }) => workspacesForkEffect({
39087
+ id,
39088
+ name: optionalValue5(name),
39089
+ key: optionalValue5(key),
39090
+ size: optionalValue5(size),
39091
+ project: optionalValue5(project),
39092
+ org: optionalValue5(org)
39093
+ })
39094
+ ).pipe(Command70.withDescription("Fork a managed workspace"));
39095
+ var rmCmd7 = Command70.make(
39096
+ "rm",
39097
+ {
39098
+ id: Args48.text({ name: "id" }),
39099
+ force: Options69.boolean("force").pipe(Options69.withDescription("Skip confirmation prompt")),
39100
+ project: projectOption41,
39101
+ org: orgOption29
39102
+ },
39103
+ ({ id, force, project, org }) => workspacesRmEffect({
39104
+ id,
39105
+ force,
39106
+ project: optionalValue5(project),
39107
+ org: optionalValue5(org)
39108
+ })
39109
+ ).pipe(Command70.withDescription("Delete a managed workspace"));
39110
+ var workspacesCommand = Command70.make(
39111
+ "workspaces",
39112
+ {},
39113
+ () => Console70.log("Run `sylphx workspaces --help` for usage")
39114
+ ).pipe(
39115
+ Command70.withDescription("Manage Platform workspace handles"),
39116
+ Command70.withSubcommands([listCmd27, getCmd12, createCmd15, forkCmd, rmCmd7])
39117
+ );
39118
+
38648
39119
  // src/main.ts
38649
39120
  init_effect_io();
38650
39121
 
@@ -38819,10 +39290,10 @@ function renderCliCommandError(err, format = resolveErrorOutputFormat()) {
38819
39290
  }
38820
39291
 
38821
39292
  // src/main.ts
38822
- var root = Command70.make(
39293
+ var root = Command71.make(
38823
39294
  "sylphx",
38824
39295
  {},
38825
- () => Console70.log(
39296
+ () => Console71.log(
38826
39297
  [
38827
39298
  "Run `sylphx --help` for usage. Start with `sylphx login`.",
38828
39299
  "",
@@ -38833,10 +39304,10 @@ var root = Command70.make(
38833
39304
  ].join("\n")
38834
39305
  )
38835
39306
  ).pipe(
38836
- Command70.withDescription(
39307
+ Command71.withDescription(
38837
39308
  "Sylphx Platform CLI \u2014 deploy and manage your applications. Non-interactive auth: set `SYLPHX_TOKEN` or `SYLPHX_TOKEN_FILE`."
38838
39309
  ),
38839
- Command70.withSubcommands([
39310
+ Command71.withSubcommands([
38840
39311
  // auth
38841
39312
  loginCommand,
38842
39313
  logoutCommand,
@@ -38874,6 +39345,7 @@ var root = Command70.make(
38874
39345
  previewsCommand,
38875
39346
  storageCommand,
38876
39347
  volumesCommand,
39348
+ workspacesCommand,
38877
39349
  resourcesCommand,
38878
39350
  servicesCommand,
38879
39351
  configCommand,
@@ -38923,13 +39395,13 @@ var root = Command70.make(
38923
39395
  rateLimitsCommand
38924
39396
  ])
38925
39397
  );
38926
- var cli = Command70.run(root, {
39398
+ var cli = Command71.run(root, {
38927
39399
  name: "Sylphx Platform CLI",
38928
39400
  version: package_default.version
38929
39401
  });
38930
39402
  cli(process.argv).pipe(
38931
- Effect80.catchAll(
38932
- (err) => Effect80.sync(() => {
39403
+ Effect81.catchAll(
39404
+ (err) => Effect81.sync(() => {
38933
39405
  const format = resolveErrorOutputFormat();
38934
39406
  if (err instanceof CliCommandError) {
38935
39407
  process.exitCode = renderCliCommandError(err, format);
@@ -38945,13 +39417,13 @@ cli(process.argv).pipe(
38945
39417
  // never delays normal interactive commands. Metadata/CI invocations
38946
39418
  // are skipped by `runUpdateCheck()` so `--help`, `--version`, and
38947
39419
  // smoke tests stay deterministic and offline.
38948
- Effect80.ensuring(
38949
- Effect80.tryPromise({
39420
+ Effect81.ensuring(
39421
+ Effect81.tryPromise({
38950
39422
  try: () => runUpdateCheck(),
38951
39423
  catch: () => void 0
38952
- }).pipe(Effect80.catchAll(() => Effect80.void))
39424
+ }).pipe(Effect81.catchAll(() => Effect81.void))
38953
39425
  ),
38954
- Effect80.provide(Layer5.mergeAll(BunContext.layer, AppLayer)),
39426
+ Effect81.provide(Layer5.mergeAll(BunContext.layer, AppLayer)),
38955
39427
  BunRuntime.runMain
38956
39428
  );
38957
39429
  //# sourceMappingURL=main.js.map