@wpelevator/tug 0.3.0 → 0.4.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/agent.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import { WebSocket } from 'ws';
3
+ import type { ContainerSummary, DockerApi } from './docker-api.ts';
3
4
  import type { AgentLiveCommand, AgentLiveFrame } from './protocol.ts';
4
5
  import type { LiveEngineOptions } from './live.ts';
5
6
  import { parseDuration } from './util.ts';
6
- import type { DockerRunner, HostRunner, HttpClient } from './runners.ts';
7
+ import type { HostRunner, HttpClient } from './runners.ts';
7
8
  import type { Command, CommandResult, DesiredState, HealthCheck, ProjectStatus, ImageArtifact, PortBinding, ServiceEndpoint } from './protocol.ts';
8
9
  export interface AgentContext {
9
- docker: DockerRunner;
10
+ docker: DockerApi;
10
11
  http: HttpClient;
11
12
  nodeName: string;
12
13
  stateDir: string;
@@ -57,25 +58,23 @@ export declare class AgentLiveOperations {
57
58
  private readonly emit;
58
59
  private readonly engine;
59
60
  private readonly sessions;
60
- constructor(ctx: AgentContext, emit: (frame: AgentLiveOutputFrame) => void, options?: Omit<LiveEngineOptions, 'emit'>);
61
+ constructor(ctx: AgentContext, emit: (frame: AgentLiveOutputFrame) => void, options?: Omit<LiveEngineOptions, 'emit' | 'docker'>);
61
62
  handle(frame: AgentLiveControlFrame): Promise<void>;
62
63
  dispose(): void;
63
64
  private fail;
64
65
  private open;
65
66
  }
66
- export declare function containerIp(ctx: AgentContext, project: string, service: string, cwd: string, composeFile?: string): Promise<string>;
67
- export declare function waitForHealth(ctx: AgentContext, project: string, service: string, health: HealthCheck | null | undefined, cwd: string, composeFile?: string): Promise<void>;
67
+ /** The container's address on the project network, which health checks dial. */
68
+ export declare function containerIp(ctx: AgentContext, project: string, container: string): Promise<string>;
69
+ export declare function waitForHealth(ctx: AgentContext, project: string, container: string, service: string, health: HealthCheck | null | undefined): Promise<void>;
68
70
  export { parseDuration };
69
71
  export interface PublicListener {
70
72
  project: string;
71
73
  container: string;
72
74
  listen: string;
73
75
  }
74
- /**
75
- * Containers of Tug projects (`projects`, plus their rolling revision projects `<project>-…`) that
76
- * listen on all interfaces or on a public IP, from `docker ps --format '{{.Label "com.docker.compose.project"}}\t{{.Names}}\t{{.Ports}}'`.
77
- */
78
- export declare function publicListeners(psOutput: string, projects: readonly string[]): PublicListener[];
76
+ /** Containers of Tug projects (`projects`) that publish a port on all interfaces or on a public IP. */
77
+ export declare function publicListeners(containers: ContainerSummary[], projects: readonly string[]): PublicListener[];
79
78
  export declare function executeCommand(command: Command, ctx?: AgentContext): Promise<CommandResult>;
80
79
  export declare function ensureArtifact(ctx: AgentContext, artifact: ImageArtifact): Promise<void>;
81
80
  export declare function pruneManagedImages(ctx: AgentContext, retained: string[]): Promise<void>;