@hoststack.dev/sdk 0.9.2 → 0.11.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/index.d.cts CHANGED
@@ -75,6 +75,41 @@ interface CreateServiceInput {
75
75
  /** True when this service is a dev environment (agentic dev-env image, or manually flagged). */
76
76
  isDevEnvironment?: boolean;
77
77
  }
78
+ /** Companion managed services a standalone dev box can stand up alongside itself. */
79
+ type DevEnvCompanion = 'postgres' | 'redis' | 'meilisearch';
80
+ /** Where a standalone dev box's code comes from. */
81
+ type DevEnvSource = {
82
+ kind: 'github_repo';
83
+ githubRepoId: number;
84
+ branch?: string;
85
+ } | {
86
+ kind: 'url';
87
+ cloneUrl: string;
88
+ branch?: string;
89
+ } | {
90
+ kind: 'blank';
91
+ };
92
+ /**
93
+ * Create a standalone dev environment — a cloud box (Claude Code / Codex /
94
+ * OpenCode on a persistent /workspace) created from a connected GitHub repo, an
95
+ * arbitrary clone URL, or blank, with optional companion Postgres / Redis /
96
+ * Meilisearch wired into its env. Lives in the team's hidden Development home.
97
+ */
98
+ interface CreateDevEnvironmentInput {
99
+ name: string;
100
+ source: DevEnvSource;
101
+ /** Companion databases/search to attach (fresh + empty), like local `make db-up`. */
102
+ databases?: DevEnvCompanion[];
103
+ /** Compute size for the box. Defaults to `micro`. */
104
+ plan?: string;
105
+ }
106
+ /** A dev environment as listed for the Development section — a service plus the
107
+ * companion services attached to it. */
108
+ interface DevEnvironment extends Service {
109
+ devUrl?: string | null;
110
+ /** Companion engines attached to the box (e.g. `['postgres','redis']`). */
111
+ databases?: string[];
112
+ }
78
113
  /**
79
114
  * Fields that live on the `services` row — write via PATCH /services/:tid/:sid.
80
115
  * Nullable fields accept `null` to clear; `undefined` leaves the value unchanged.
@@ -520,6 +555,19 @@ declare class DatabasesResource {
520
555
  * `pgEngineType === 'patroni'` + `status === 'available'` to confirm.
521
556
  */
522
557
  upgradeToHa(teamId: IdInput, databaseId: IdInput): Promise<void>;
558
+ /**
559
+ * In-place engine version upgrade (postgres/redis standalone). The agent
560
+ * dumps the live data, recreates the container at `version` under the same
561
+ * DNS name, and restores — so connection URLs stay valid. There's a brief
562
+ * interruption (seconds) while the new container comes up.
563
+ *
564
+ * `version` must be a supported, strictly-newer version for the engine
565
+ * (e.g. '18' for postgres, '8' for redis). Throws 400 otherwise.
566
+ *
567
+ * Returns 202 — the upgrade is async; poll `get(...)` until `version`
568
+ * matches the target and `status === 'available'` to confirm.
569
+ */
570
+ upgradeVersion(teamId: IdInput, databaseId: IdInput, version: string): Promise<void>;
523
571
  /**
524
572
  * v89 Phase 5: cluster topology + failover history for a Patroni-managed
525
573
  * Postgres database. Returns 400 for standalone databases — call
@@ -882,6 +930,49 @@ declare class ServicesResource {
882
930
  }>;
883
931
  /** Delete a service. */
884
932
  delete(teamId: IdInput, serviceId: IdInput): Promise<void>;
933
+ /**
934
+ * List the team's dev environments (the Development section), each annotated
935
+ * with the companion services attached to it (`databases`).
936
+ */
937
+ listDevEnvironments(teamId: IdInput): Promise<{
938
+ environments: DevEnvironment[];
939
+ }>;
940
+ /**
941
+ * Create a STANDALONE dev environment — a cloud box (Claude Code / Codex /
942
+ * OpenCode on a persistent /workspace) from a connected GitHub repo, an
943
+ * arbitrary clone URL, or blank, with optional companion Postgres / Redis /
944
+ * Meilisearch. Unlike `spinUpDevEnvironment`, there's no source service — the
945
+ * box lives in the team's hidden Development home. Returns the box, its dev
946
+ * URL, and the first deploy id. Tear it down with `tearDownDevEnvironment`.
947
+ */
948
+ createDevEnvironment(teamId: IdInput, data: CreateDevEnvironmentInput): Promise<{
949
+ service: Service;
950
+ devUrl: string;
951
+ deployId: number | null;
952
+ }>;
953
+ /**
954
+ * Spin up an agentic dev environment FROM this service: a dev box that runs
955
+ * a clone of the app (repo auto-cloned into /workspace, env-vars copied, and
956
+ * the linked database cloned so it never touches prod), with an unguessable
957
+ * public dev URL and seamless `git push`. Returns the dev box, its dev URL,
958
+ * and the first deploy id.
959
+ */
960
+ spinUpDevEnvironment(teamId: IdInput, serviceId: IdInput, options?: {
961
+ includeDatabaseClone?: boolean;
962
+ name?: string;
963
+ }): Promise<{
964
+ service: Service;
965
+ devUrl: string;
966
+ deployId: number | null;
967
+ }>;
968
+ /**
969
+ * Tear a dev environment down: removes the dev box and cascade-deletes its
970
+ * cloned database, /workspace volume, and the empty `development`
971
+ * environment. `serviceId` is the dev box itself.
972
+ */
973
+ tearDownDevEnvironment(teamId: IdInput, serviceId: IdInput): Promise<{
974
+ success: true;
975
+ }>;
885
976
  /** Suspend a service. */
886
977
  suspend(teamId: IdInput, serviceId: IdInput): Promise<void>;
887
978
  /** Resume a suspended service. */
@@ -1182,4 +1273,4 @@ interface PaginatedResponse<T> {
1182
1273
  */
1183
1274
  declare function buildPaginationQuery(params?: PaginationParams): string;
1184
1275
 
1185
- 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 };
1276
+ 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
@@ -75,6 +75,41 @@ interface CreateServiceInput {
75
75
  /** True when this service is a dev environment (agentic dev-env image, or manually flagged). */
76
76
  isDevEnvironment?: boolean;
77
77
  }
78
+ /** Companion managed services a standalone dev box can stand up alongside itself. */
79
+ type DevEnvCompanion = 'postgres' | 'redis' | 'meilisearch';
80
+ /** Where a standalone dev box's code comes from. */
81
+ type DevEnvSource = {
82
+ kind: 'github_repo';
83
+ githubRepoId: number;
84
+ branch?: string;
85
+ } | {
86
+ kind: 'url';
87
+ cloneUrl: string;
88
+ branch?: string;
89
+ } | {
90
+ kind: 'blank';
91
+ };
92
+ /**
93
+ * Create a standalone dev environment — a cloud box (Claude Code / Codex /
94
+ * OpenCode on a persistent /workspace) created from a connected GitHub repo, an
95
+ * arbitrary clone URL, or blank, with optional companion Postgres / Redis /
96
+ * Meilisearch wired into its env. Lives in the team's hidden Development home.
97
+ */
98
+ interface CreateDevEnvironmentInput {
99
+ name: string;
100
+ source: DevEnvSource;
101
+ /** Companion databases/search to attach (fresh + empty), like local `make db-up`. */
102
+ databases?: DevEnvCompanion[];
103
+ /** Compute size for the box. Defaults to `micro`. */
104
+ plan?: string;
105
+ }
106
+ /** A dev environment as listed for the Development section — a service plus the
107
+ * companion services attached to it. */
108
+ interface DevEnvironment extends Service {
109
+ devUrl?: string | null;
110
+ /** Companion engines attached to the box (e.g. `['postgres','redis']`). */
111
+ databases?: string[];
112
+ }
78
113
  /**
79
114
  * Fields that live on the `services` row — write via PATCH /services/:tid/:sid.
80
115
  * Nullable fields accept `null` to clear; `undefined` leaves the value unchanged.
@@ -520,6 +555,19 @@ declare class DatabasesResource {
520
555
  * `pgEngineType === 'patroni'` + `status === 'available'` to confirm.
521
556
  */
522
557
  upgradeToHa(teamId: IdInput, databaseId: IdInput): Promise<void>;
558
+ /**
559
+ * In-place engine version upgrade (postgres/redis standalone). The agent
560
+ * dumps the live data, recreates the container at `version` under the same
561
+ * DNS name, and restores — so connection URLs stay valid. There's a brief
562
+ * interruption (seconds) while the new container comes up.
563
+ *
564
+ * `version` must be a supported, strictly-newer version for the engine
565
+ * (e.g. '18' for postgres, '8' for redis). Throws 400 otherwise.
566
+ *
567
+ * Returns 202 — the upgrade is async; poll `get(...)` until `version`
568
+ * matches the target and `status === 'available'` to confirm.
569
+ */
570
+ upgradeVersion(teamId: IdInput, databaseId: IdInput, version: string): Promise<void>;
523
571
  /**
524
572
  * v89 Phase 5: cluster topology + failover history for a Patroni-managed
525
573
  * Postgres database. Returns 400 for standalone databases — call
@@ -882,6 +930,49 @@ declare class ServicesResource {
882
930
  }>;
883
931
  /** Delete a service. */
884
932
  delete(teamId: IdInput, serviceId: IdInput): Promise<void>;
933
+ /**
934
+ * List the team's dev environments (the Development section), each annotated
935
+ * with the companion services attached to it (`databases`).
936
+ */
937
+ listDevEnvironments(teamId: IdInput): Promise<{
938
+ environments: DevEnvironment[];
939
+ }>;
940
+ /**
941
+ * Create a STANDALONE dev environment — a cloud box (Claude Code / Codex /
942
+ * OpenCode on a persistent /workspace) from a connected GitHub repo, an
943
+ * arbitrary clone URL, or blank, with optional companion Postgres / Redis /
944
+ * Meilisearch. Unlike `spinUpDevEnvironment`, there's no source service — the
945
+ * box lives in the team's hidden Development home. Returns the box, its dev
946
+ * URL, and the first deploy id. Tear it down with `tearDownDevEnvironment`.
947
+ */
948
+ createDevEnvironment(teamId: IdInput, data: CreateDevEnvironmentInput): Promise<{
949
+ service: Service;
950
+ devUrl: string;
951
+ deployId: number | null;
952
+ }>;
953
+ /**
954
+ * Spin up an agentic dev environment FROM this service: a dev box that runs
955
+ * a clone of the app (repo auto-cloned into /workspace, env-vars copied, and
956
+ * the linked database cloned so it never touches prod), with an unguessable
957
+ * public dev URL and seamless `git push`. Returns the dev box, its dev URL,
958
+ * and the first deploy id.
959
+ */
960
+ spinUpDevEnvironment(teamId: IdInput, serviceId: IdInput, options?: {
961
+ includeDatabaseClone?: boolean;
962
+ name?: string;
963
+ }): Promise<{
964
+ service: Service;
965
+ devUrl: string;
966
+ deployId: number | null;
967
+ }>;
968
+ /**
969
+ * Tear a dev environment down: removes the dev box and cascade-deletes its
970
+ * cloned database, /workspace volume, and the empty `development`
971
+ * environment. `serviceId` is the dev box itself.
972
+ */
973
+ tearDownDevEnvironment(teamId: IdInput, serviceId: IdInput): Promise<{
974
+ success: true;
975
+ }>;
885
976
  /** Suspend a service. */
886
977
  suspend(teamId: IdInput, serviceId: IdInput): Promise<void>;
887
978
  /** Resume a suspended service. */
@@ -1182,4 +1273,4 @@ interface PaginatedResponse<T> {
1182
1273
  */
1183
1274
  declare function buildPaginationQuery(params?: PaginationParams): string;
1184
1275
 
1185
- 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 };
1276
+ 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
@@ -183,6 +183,25 @@ var DatabasesResource = class {
183
183
  const did = await this.client.resolveId(databaseId, { kind: "database", teamId: tid });
184
184
  return this.client.request("POST", `/api/databases/${tid}/${did}/upgrade-to-ha`);
185
185
  }
186
+ /**
187
+ * In-place engine version upgrade (postgres/redis standalone). The agent
188
+ * dumps the live data, recreates the container at `version` under the same
189
+ * DNS name, and restores — so connection URLs stay valid. There's a brief
190
+ * interruption (seconds) while the new container comes up.
191
+ *
192
+ * `version` must be a supported, strictly-newer version for the engine
193
+ * (e.g. '18' for postgres, '8' for redis). Throws 400 otherwise.
194
+ *
195
+ * Returns 202 — the upgrade is async; poll `get(...)` until `version`
196
+ * matches the target and `status === 'available'` to confirm.
197
+ */
198
+ async upgradeVersion(teamId, databaseId, version) {
199
+ const tid = await this.client.resolveId(teamId, { kind: "team" });
200
+ const did = await this.client.resolveId(databaseId, { kind: "database", teamId: tid });
201
+ return this.client.request("POST", `/api/databases/${tid}/${did}/upgrade-version`, {
202
+ version
203
+ });
204
+ }
186
205
  /**
187
206
  * v89 Phase 5: cluster topology + failover history for a Patroni-managed
188
207
  * Postgres database. Returns 400 for standalone databases — call
@@ -622,6 +641,52 @@ var ServicesResource = class {
622
641
  const sid = await this.client.resolveId(serviceId, { kind: "service", teamId: tid });
623
642
  return this.client.request("DELETE", `/api/services/${tid}/${sid}`);
624
643
  }
644
+ /**
645
+ * List the team's dev environments (the Development section), each annotated
646
+ * with the companion services attached to it (`databases`).
647
+ */
648
+ async listDevEnvironments(teamId) {
649
+ const tid = await this.client.resolveId(teamId, { kind: "team" });
650
+ return this.client.request("GET", `/api/dev-environments/${tid}`);
651
+ }
652
+ /**
653
+ * Create a STANDALONE dev environment — a cloud box (Claude Code / Codex /
654
+ * OpenCode on a persistent /workspace) from a connected GitHub repo, an
655
+ * arbitrary clone URL, or blank, with optional companion Postgres / Redis /
656
+ * Meilisearch. Unlike `spinUpDevEnvironment`, there's no source service — the
657
+ * box lives in the team's hidden Development home. Returns the box, its dev
658
+ * URL, and the first deploy id. Tear it down with `tearDownDevEnvironment`.
659
+ */
660
+ async createDevEnvironment(teamId, data) {
661
+ const tid = await this.client.resolveId(teamId, { kind: "team" });
662
+ return this.client.request("POST", `/api/dev-environments/${tid}`, data);
663
+ }
664
+ /**
665
+ * Spin up an agentic dev environment FROM this service: a dev box that runs
666
+ * a clone of the app (repo auto-cloned into /workspace, env-vars copied, and
667
+ * the linked database cloned so it never touches prod), with an unguessable
668
+ * public dev URL and seamless `git push`. Returns the dev box, its dev URL,
669
+ * and the first deploy id.
670
+ */
671
+ async spinUpDevEnvironment(teamId, serviceId, options) {
672
+ const tid = await this.client.resolveId(teamId, { kind: "team" });
673
+ const sid = await this.client.resolveId(serviceId, { kind: "service", teamId: tid });
674
+ return this.client.request(
675
+ "POST",
676
+ `/api/services/${tid}/${sid}/dev-environment`,
677
+ options ?? {}
678
+ );
679
+ }
680
+ /**
681
+ * Tear a dev environment down: removes the dev box and cascade-deletes its
682
+ * cloned database, /workspace volume, and the empty `development`
683
+ * environment. `serviceId` is the dev box itself.
684
+ */
685
+ async tearDownDevEnvironment(teamId, serviceId) {
686
+ const tid = await this.client.resolveId(teamId, { kind: "team" });
687
+ const sid = await this.client.resolveId(serviceId, { kind: "service", teamId: tid });
688
+ return this.client.request("DELETE", `/api/services/${tid}/${sid}/dev-environment`);
689
+ }
625
690
  /** Suspend a service. */
626
691
  async suspend(teamId, serviceId) {
627
692
  const tid = await this.client.resolveId(teamId, { kind: "team" });