@hoststack.dev/sdk 0.10.0 → 0.11.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.d.cts CHANGED
@@ -39,6 +39,8 @@ interface Service {
39
39
  status: ServiceStatus;
40
40
  internalUrl?: string | null;
41
41
  projectId: number;
42
+ /** Size tier (memory/CPU/disk bracket), e.g. "standard" / "large". Change via `services.resize`. */
43
+ plan?: string;
42
44
  createdAt: string;
43
45
  updatedAt: string;
44
46
  }
@@ -75,6 +77,54 @@ interface CreateServiceInput {
75
77
  /** True when this service is a dev environment (agentic dev-env image, or manually flagged). */
76
78
  isDevEnvironment?: boolean;
77
79
  }
80
+ /** Companion managed services a standalone dev box can stand up alongside itself. */
81
+ type DevEnvCompanion = 'postgres' | 'redis' | 'meilisearch';
82
+ /** Where a standalone dev box's code comes from. */
83
+ type DevEnvSource = {
84
+ kind: 'github_repo';
85
+ githubRepoId: number;
86
+ branch?: string;
87
+ } | {
88
+ kind: 'url';
89
+ cloneUrl: string;
90
+ branch?: string;
91
+ } | {
92
+ kind: 'blank';
93
+ };
94
+ /**
95
+ * Create a standalone dev environment — a cloud box (Claude Code / Codex /
96
+ * OpenCode on a persistent /workspace) created from a connected GitHub repo, an
97
+ * arbitrary clone URL, or blank, with optional companion Postgres / Redis /
98
+ * Meilisearch wired into its env. Lives in the team's hidden Development home.
99
+ */
100
+ interface CreateDevEnvironmentInput {
101
+ name: string;
102
+ source: DevEnvSource;
103
+ /** Companion databases/search to attach (fresh + empty), like local `make db-up`. */
104
+ databases?: DevEnvCompanion[];
105
+ /** Compute size for the box. Defaults to `micro`. */
106
+ plan?: string;
107
+ }
108
+ /** A dev environment as listed for the Development section — a service plus the
109
+ * companion services attached to it. */
110
+ interface DevEnvironment extends Service {
111
+ devUrl?: string | null;
112
+ /** Companion engines attached to the box (e.g. `['postgres','redis']`). */
113
+ databases?: string[];
114
+ /**
115
+ * Why the box's container last exited recently, if at all. `'oom_killed'`
116
+ * means it ran out of memory (the DB status stays `active` because the
117
+ * health monitor auto-restarts it) — pair with `recommendedSize` to offer
118
+ * a rescale. `null` when it exited cleanly / hasn't exited.
119
+ */
120
+ exitReason?: 'oom_killed' | 'crashed' | null;
121
+ /**
122
+ * Suggested next size tier to rescale to, set when the box recently
123
+ * OOM-killed. `null` when no rescale is recommended (or already at the
124
+ * largest tier).
125
+ */
126
+ recommendedSize?: string | null;
127
+ }
78
128
  /**
79
129
  * Fields that live on the `services` row — write via PATCH /services/:tid/:sid.
80
130
  * Nullable fields accept `null` to clear; `undefined` leaves the value unchanged.
@@ -92,6 +142,14 @@ interface UpdateServiceInput {
92
142
  cronSchedule?: string | null;
93
143
  publishPath?: string | null;
94
144
  runtime?: string;
145
+ /**
146
+ * Resize the service's size tier (memory/CPU/disk bracket). The supported
147
+ * way to scale a box past its current tier's resource ceiling — per-config
148
+ * overrides are clamped to the tier, so growing beyond it needs a tier move.
149
+ * Dev boxes are floored to the OOM-safe minimum. Applies live to the running
150
+ * container (memory/CPU) where possible; disk grows on the next recreate.
151
+ */
152
+ plan?: string;
95
153
  }
96
154
  interface ServiceConfig {
97
155
  memoryMb?: number;
@@ -895,6 +953,37 @@ declare class ServicesResource {
895
953
  }>;
896
954
  /** Delete a service. */
897
955
  delete(teamId: IdInput, serviceId: IdInput): Promise<void>;
956
+ /**
957
+ * Resize a service (incl. dev boxes) to a different size tier. This is the
958
+ * supported way to scale past the current tier's memory/CPU/disk ceiling —
959
+ * per-config overrides are clamped to the tier, so growing beyond it
960
+ * requires moving the tier. The new tier's memory/CPU apply LIVE to the
961
+ * running container (no recreate); disk grows on the next recreate. Dev
962
+ * boxes are floored to the OOM-safe minimum size server-side.
963
+ */
964
+ resize(teamId: IdInput, serviceId: IdInput, plan: string): Promise<{
965
+ service: Service;
966
+ }>;
967
+ /**
968
+ * List the team's dev environments (the Development section), each annotated
969
+ * with the companion services attached to it (`databases`).
970
+ */
971
+ listDevEnvironments(teamId: IdInput): Promise<{
972
+ environments: DevEnvironment[];
973
+ }>;
974
+ /**
975
+ * Create a STANDALONE dev environment — a cloud box (Claude Code / Codex /
976
+ * OpenCode on a persistent /workspace) from a connected GitHub repo, an
977
+ * arbitrary clone URL, or blank, with optional companion Postgres / Redis /
978
+ * Meilisearch. Unlike `spinUpDevEnvironment`, there's no source service — the
979
+ * box lives in the team's hidden Development home. Returns the box, its dev
980
+ * URL, and the first deploy id. Tear it down with `tearDownDevEnvironment`.
981
+ */
982
+ createDevEnvironment(teamId: IdInput, data: CreateDevEnvironmentInput): Promise<{
983
+ service: Service;
984
+ devUrl: string;
985
+ deployId: number | null;
986
+ }>;
898
987
  /**
899
988
  * Spin up an agentic dev environment FROM this service: a dev box that runs
900
989
  * a clone of the app (repo auto-cloned into /workspace, env-vars copied, and
@@ -1218,4 +1307,4 @@ interface PaginatedResponse<T> {
1218
1307
  */
1219
1308
  declare function buildPaginationQuery(params?: PaginationParams): string;
1220
1309
 
1221
- export { type ActivityLogEntry, type AddDomainInput, AuthenticationError, type BulkSetEnvVarsInput, ConflictError, type CreateDatabaseInput, type CreateEnvVarInput, type CreateEnvironmentInput, type CreateProjectInput, type CreateServiceInput, type CreateVolumeInput, type CronExecution, type CronExecutionStatus, type CronExecutionTrigger, type Database, type DatabaseCredentials, type DatabaseEngine, type DatabasePlan, type DatabaseStatus, type Deploy, type DeployListResponse, type DeployLogEntry, type DeployStatus, type DeployTrigger, type Domain, type DomainStatus, type EnvVar, type EnvVarTarget, type Environment, ForbiddenError, HostStack, HostStackError, type HostStackOptions, type IdInput, type LogEntry$1 as LogEntry, type MeResponse, NotFoundError, type NotificationChannel, type NotificationChannelEvent, type NotificationChannelType, type PaginatedResponse, type PaginationParams, type Project, RateLimitError, type RegionId, type Service, type ServiceConfig, type ServiceMetricsPoint, type ServiceMetricsSnapshot, type ServicePlan, type ServiceStatus, type ServiceType, type StreamLogsOptions, type Team, type TeamRole, type TriggerDeployInput, type UpdateDatabaseInput, type UpdateDomainInput, type UpdateEnvVarInput, type UpdateEnvironmentInput, type UpdateProjectInput, type UpdateServiceConfigInput, type UpdateServiceInput, type UpdateVolumeInput, type User, type Volume, buildPaginationQuery };
1310
+ export { type ActivityLogEntry, type AddDomainInput, AuthenticationError, type BulkSetEnvVarsInput, ConflictError, type CreateDatabaseInput, type CreateDevEnvironmentInput, type CreateEnvVarInput, type CreateEnvironmentInput, type CreateProjectInput, type CreateServiceInput, type CreateVolumeInput, type CronExecution, type CronExecutionStatus, type CronExecutionTrigger, type Database, type DatabaseCredentials, type DatabaseEngine, type DatabasePlan, type DatabaseStatus, type Deploy, type DeployListResponse, type DeployLogEntry, type DeployStatus, type DeployTrigger, type DevEnvCompanion, type DevEnvSource, type DevEnvironment, type Domain, type DomainStatus, type EnvVar, type EnvVarTarget, type Environment, ForbiddenError, HostStack, HostStackError, type HostStackOptions, type IdInput, type LogEntry$1 as LogEntry, type MeResponse, NotFoundError, type NotificationChannel, type NotificationChannelEvent, type NotificationChannelType, type PaginatedResponse, type PaginationParams, type Project, RateLimitError, type RegionId, type Service, type ServiceConfig, type ServiceMetricsPoint, type ServiceMetricsSnapshot, type ServicePlan, type ServiceStatus, type ServiceType, type StreamLogsOptions, type Team, type TeamRole, type TriggerDeployInput, type UpdateDatabaseInput, type UpdateDomainInput, type UpdateEnvVarInput, type UpdateEnvironmentInput, type UpdateProjectInput, type UpdateServiceConfigInput, type UpdateServiceInput, type UpdateVolumeInput, type User, type Volume, buildPaginationQuery };
package/dist/index.d.ts CHANGED
@@ -39,6 +39,8 @@ interface Service {
39
39
  status: ServiceStatus;
40
40
  internalUrl?: string | null;
41
41
  projectId: number;
42
+ /** Size tier (memory/CPU/disk bracket), e.g. "standard" / "large". Change via `services.resize`. */
43
+ plan?: string;
42
44
  createdAt: string;
43
45
  updatedAt: string;
44
46
  }
@@ -75,6 +77,54 @@ interface CreateServiceInput {
75
77
  /** True when this service is a dev environment (agentic dev-env image, or manually flagged). */
76
78
  isDevEnvironment?: boolean;
77
79
  }
80
+ /** Companion managed services a standalone dev box can stand up alongside itself. */
81
+ type DevEnvCompanion = 'postgres' | 'redis' | 'meilisearch';
82
+ /** Where a standalone dev box's code comes from. */
83
+ type DevEnvSource = {
84
+ kind: 'github_repo';
85
+ githubRepoId: number;
86
+ branch?: string;
87
+ } | {
88
+ kind: 'url';
89
+ cloneUrl: string;
90
+ branch?: string;
91
+ } | {
92
+ kind: 'blank';
93
+ };
94
+ /**
95
+ * Create a standalone dev environment — a cloud box (Claude Code / Codex /
96
+ * OpenCode on a persistent /workspace) created from a connected GitHub repo, an
97
+ * arbitrary clone URL, or blank, with optional companion Postgres / Redis /
98
+ * Meilisearch wired into its env. Lives in the team's hidden Development home.
99
+ */
100
+ interface CreateDevEnvironmentInput {
101
+ name: string;
102
+ source: DevEnvSource;
103
+ /** Companion databases/search to attach (fresh + empty), like local `make db-up`. */
104
+ databases?: DevEnvCompanion[];
105
+ /** Compute size for the box. Defaults to `micro`. */
106
+ plan?: string;
107
+ }
108
+ /** A dev environment as listed for the Development section — a service plus the
109
+ * companion services attached to it. */
110
+ interface DevEnvironment extends Service {
111
+ devUrl?: string | null;
112
+ /** Companion engines attached to the box (e.g. `['postgres','redis']`). */
113
+ databases?: string[];
114
+ /**
115
+ * Why the box's container last exited recently, if at all. `'oom_killed'`
116
+ * means it ran out of memory (the DB status stays `active` because the
117
+ * health monitor auto-restarts it) — pair with `recommendedSize` to offer
118
+ * a rescale. `null` when it exited cleanly / hasn't exited.
119
+ */
120
+ exitReason?: 'oom_killed' | 'crashed' | null;
121
+ /**
122
+ * Suggested next size tier to rescale to, set when the box recently
123
+ * OOM-killed. `null` when no rescale is recommended (or already at the
124
+ * largest tier).
125
+ */
126
+ recommendedSize?: string | null;
127
+ }
78
128
  /**
79
129
  * Fields that live on the `services` row — write via PATCH /services/:tid/:sid.
80
130
  * Nullable fields accept `null` to clear; `undefined` leaves the value unchanged.
@@ -92,6 +142,14 @@ interface UpdateServiceInput {
92
142
  cronSchedule?: string | null;
93
143
  publishPath?: string | null;
94
144
  runtime?: string;
145
+ /**
146
+ * Resize the service's size tier (memory/CPU/disk bracket). The supported
147
+ * way to scale a box past its current tier's resource ceiling — per-config
148
+ * overrides are clamped to the tier, so growing beyond it needs a tier move.
149
+ * Dev boxes are floored to the OOM-safe minimum. Applies live to the running
150
+ * container (memory/CPU) where possible; disk grows on the next recreate.
151
+ */
152
+ plan?: string;
95
153
  }
96
154
  interface ServiceConfig {
97
155
  memoryMb?: number;
@@ -895,6 +953,37 @@ declare class ServicesResource {
895
953
  }>;
896
954
  /** Delete a service. */
897
955
  delete(teamId: IdInput, serviceId: IdInput): Promise<void>;
956
+ /**
957
+ * Resize a service (incl. dev boxes) to a different size tier. This is the
958
+ * supported way to scale past the current tier's memory/CPU/disk ceiling —
959
+ * per-config overrides are clamped to the tier, so growing beyond it
960
+ * requires moving the tier. The new tier's memory/CPU apply LIVE to the
961
+ * running container (no recreate); disk grows on the next recreate. Dev
962
+ * boxes are floored to the OOM-safe minimum size server-side.
963
+ */
964
+ resize(teamId: IdInput, serviceId: IdInput, plan: string): Promise<{
965
+ service: Service;
966
+ }>;
967
+ /**
968
+ * List the team's dev environments (the Development section), each annotated
969
+ * with the companion services attached to it (`databases`).
970
+ */
971
+ listDevEnvironments(teamId: IdInput): Promise<{
972
+ environments: DevEnvironment[];
973
+ }>;
974
+ /**
975
+ * Create a STANDALONE dev environment — a cloud box (Claude Code / Codex /
976
+ * OpenCode on a persistent /workspace) from a connected GitHub repo, an
977
+ * arbitrary clone URL, or blank, with optional companion Postgres / Redis /
978
+ * Meilisearch. Unlike `spinUpDevEnvironment`, there's no source service — the
979
+ * box lives in the team's hidden Development home. Returns the box, its dev
980
+ * URL, and the first deploy id. Tear it down with `tearDownDevEnvironment`.
981
+ */
982
+ createDevEnvironment(teamId: IdInput, data: CreateDevEnvironmentInput): Promise<{
983
+ service: Service;
984
+ devUrl: string;
985
+ deployId: number | null;
986
+ }>;
898
987
  /**
899
988
  * Spin up an agentic dev environment FROM this service: a dev box that runs
900
989
  * a clone of the app (repo auto-cloned into /workspace, env-vars copied, and
@@ -1218,4 +1307,4 @@ interface PaginatedResponse<T> {
1218
1307
  */
1219
1308
  declare function buildPaginationQuery(params?: PaginationParams): string;
1220
1309
 
1221
- export { type ActivityLogEntry, type AddDomainInput, AuthenticationError, type BulkSetEnvVarsInput, ConflictError, type CreateDatabaseInput, type CreateEnvVarInput, type CreateEnvironmentInput, type CreateProjectInput, type CreateServiceInput, type CreateVolumeInput, type CronExecution, type CronExecutionStatus, type CronExecutionTrigger, type Database, type DatabaseCredentials, type DatabaseEngine, type DatabasePlan, type DatabaseStatus, type Deploy, type DeployListResponse, type DeployLogEntry, type DeployStatus, type DeployTrigger, type Domain, type DomainStatus, type EnvVar, type EnvVarTarget, type Environment, ForbiddenError, HostStack, HostStackError, type HostStackOptions, type IdInput, type LogEntry$1 as LogEntry, type MeResponse, NotFoundError, type NotificationChannel, type NotificationChannelEvent, type NotificationChannelType, type PaginatedResponse, type PaginationParams, type Project, RateLimitError, type RegionId, type Service, type ServiceConfig, type ServiceMetricsPoint, type ServiceMetricsSnapshot, type ServicePlan, type ServiceStatus, type ServiceType, type StreamLogsOptions, type Team, type TeamRole, type TriggerDeployInput, type UpdateDatabaseInput, type UpdateDomainInput, type UpdateEnvVarInput, type UpdateEnvironmentInput, type UpdateProjectInput, type UpdateServiceConfigInput, type UpdateServiceInput, type UpdateVolumeInput, type User, type Volume, buildPaginationQuery };
1310
+ export { type ActivityLogEntry, type AddDomainInput, AuthenticationError, type BulkSetEnvVarsInput, ConflictError, type CreateDatabaseInput, type CreateDevEnvironmentInput, type CreateEnvVarInput, type CreateEnvironmentInput, type CreateProjectInput, type CreateServiceInput, type CreateVolumeInput, type CronExecution, type CronExecutionStatus, type CronExecutionTrigger, type Database, type DatabaseCredentials, type DatabaseEngine, type DatabasePlan, type DatabaseStatus, type Deploy, type DeployListResponse, type DeployLogEntry, type DeployStatus, type DeployTrigger, type DevEnvCompanion, type DevEnvSource, type DevEnvironment, type Domain, type DomainStatus, type EnvVar, type EnvVarTarget, type Environment, ForbiddenError, HostStack, HostStackError, type HostStackOptions, type IdInput, type LogEntry$1 as LogEntry, type MeResponse, NotFoundError, type NotificationChannel, type NotificationChannelEvent, type NotificationChannelType, type PaginatedResponse, type PaginationParams, type Project, RateLimitError, type RegionId, type Service, type ServiceConfig, type ServiceMetricsPoint, type ServiceMetricsSnapshot, type ServicePlan, type ServiceStatus, type ServiceType, type StreamLogsOptions, type Team, type TeamRole, type TriggerDeployInput, type UpdateDatabaseInput, type UpdateDomainInput, type UpdateEnvVarInput, type UpdateEnvironmentInput, type UpdateProjectInput, type UpdateServiceConfigInput, type UpdateServiceInput, type UpdateVolumeInput, type User, type Volume, buildPaginationQuery };
package/dist/index.js CHANGED
@@ -641,6 +641,39 @@ var ServicesResource = class {
641
641
  const sid = await this.client.resolveId(serviceId, { kind: "service", teamId: tid });
642
642
  return this.client.request("DELETE", `/api/services/${tid}/${sid}`);
643
643
  }
644
+ /**
645
+ * Resize a service (incl. dev boxes) to a different size tier. This is the
646
+ * supported way to scale past the current tier's memory/CPU/disk ceiling —
647
+ * per-config overrides are clamped to the tier, so growing beyond it
648
+ * requires moving the tier. The new tier's memory/CPU apply LIVE to the
649
+ * running container (no recreate); disk grows on the next recreate. Dev
650
+ * boxes are floored to the OOM-safe minimum size server-side.
651
+ */
652
+ async resize(teamId, serviceId, plan) {
653
+ const tid = await this.client.resolveId(teamId, { kind: "team" });
654
+ const sid = await this.client.resolveId(serviceId, { kind: "service", teamId: tid });
655
+ return this.client.request("PATCH", `/api/services/${tid}/${sid}`, { plan });
656
+ }
657
+ /**
658
+ * List the team's dev environments (the Development section), each annotated
659
+ * with the companion services attached to it (`databases`).
660
+ */
661
+ async listDevEnvironments(teamId) {
662
+ const tid = await this.client.resolveId(teamId, { kind: "team" });
663
+ return this.client.request("GET", `/api/dev-environments/${tid}`);
664
+ }
665
+ /**
666
+ * Create a STANDALONE dev environment — a cloud box (Claude Code / Codex /
667
+ * OpenCode on a persistent /workspace) from a connected GitHub repo, an
668
+ * arbitrary clone URL, or blank, with optional companion Postgres / Redis /
669
+ * Meilisearch. Unlike `spinUpDevEnvironment`, there's no source service — the
670
+ * box lives in the team's hidden Development home. Returns the box, its dev
671
+ * URL, and the first deploy id. Tear it down with `tearDownDevEnvironment`.
672
+ */
673
+ async createDevEnvironment(teamId, data) {
674
+ const tid = await this.client.resolveId(teamId, { kind: "team" });
675
+ return this.client.request("POST", `/api/dev-environments/${tid}`, data);
676
+ }
644
677
  /**
645
678
  * Spin up an agentic dev environment FROM this service: a dev box that runs
646
679
  * a clone of the app (repo auto-cloned into /workspace, env-vars copied, and
@@ -971,7 +1004,14 @@ var HostStack = class {
971
1004
  const cached = this.idCache.get(cacheKey);
972
1005
  if (cached !== void 0) return cached;
973
1006
  const items = await this.fetchForResolution(scope);
974
- const match = items.find((it) => it.publicId === input);
1007
+ let match = items.find((it) => it.publicId === input);
1008
+ if (!match && scope.kind === "service") {
1009
+ try {
1010
+ const d = await this.request("GET", `/api/dev-environments/${scope.teamId}`);
1011
+ match = (d.environments ?? []).find((it) => it.publicId === input);
1012
+ } catch {
1013
+ }
1014
+ }
975
1015
  if (!match) {
976
1016
  throw new NotFoundError(`${scope.kind} ${input} not found`);
977
1017
  }