Files
openclaw/src/daemon/service-types.ts
T
Peter Steinberger bb44c2311d fix(windows): repair legacy gateway fallback updates (#101213)
* fix(windows): repair doctor update fallback migration

* fix(windows): remove hidden startup fallback launchers

* fix(windows): preserve recovered gateway tokens

* fix(windows): harden update fallback migration

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* fix(windows): capture fallback runtime before task rewrite

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* fix(windows): complete legacy update restart handoff

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* fix(windows): verify fallback ownership during migration

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* fix(windows): honor update restart policy during repair

* fix(windows): wait for task takeover evidence

* fix(windows): preserve fallback after direct task launch

* fix(windows): preserve repaired task identity

* fix(windows): snapshot gateway before repair

* fix: scope update service repair ownership

* style: satisfy update lint checks

* fix: restart gateways stopped during updates

* fix(windows): enforce fallback process takeover

* fix(windows): prove fallback ownership during takeover

* fix(windows): verify process exit during takeover

* fix(windows): wait through fallback reloads

* fix(windows): harden fallback takeover ownership

* fix(windows): type takeover preflight inputs

* fix(windows): recognize booting replacement task

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* chore: leave changelog release-owned

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-07-07 00:09:48 +01:00

93 lines
3.1 KiB
TypeScript

/** Shared daemon service argument, state, and command config contracts. */
import type { GatewayServiceRuntime } from "./service-runtime.js";
/** Environment map passed to service renderers and platform supervisors. */
export type GatewayServiceEnv = Record<string, string | undefined>;
/** Arguments required to render/install a managed gateway service. */
export type GatewayServiceInstallArgs = {
env: GatewayServiceEnv;
stdout: NodeJS.WritableStream;
warn?: (message: string) => void;
programArguments: string[];
workingDirectory?: string;
environment?: GatewayServiceEnv;
environmentValueSources?: Record<string, GatewayServiceEnvironmentValueSource | undefined>;
description?: string;
// Verified before a config rewrite; Windows uses this to bridge a transient
// listener gap while replacing a Startup-folder fallback.
startupFallbackTakeoverRuntime?: GatewayServiceRuntime;
};
export type GatewayServiceStageArgs = GatewayServiceInstallArgs;
export type GatewayServiceManageArgs = {
env: GatewayServiceEnv;
stdout: NodeJS.WritableStream;
};
export type GatewayServiceControlArgs = {
stdout: NodeJS.WritableStream;
env?: GatewayServiceEnv;
disable?: boolean;
warn?: (message: string) => void;
};
export type GatewayServiceRestartResult = { outcome: "completed" } | { outcome: "scheduled" };
export type GatewayServiceEnvArgs = {
env?: GatewayServiceEnv;
// Bounds service-manager probes (e.g. `systemctl`) so a wedged daemon socket
// cannot hang status reads indefinitely. Only status read paths set this;
// control/install paths leave it unset to preserve their existing behavior.
timeoutMs?: number;
};
/** Options for read-only service inspection that should fail soft under a deadline. */
export type GatewayServiceReadOptions = {
timeoutMs?: number;
};
export type GatewayServiceEnvironmentValueSource = "inline" | "file" | "inline-and-file";
/** Parsed command and env metadata from an installed platform service. */
export type GatewayServiceCommandConfig = {
programArguments: string[];
workingDirectory?: string;
environment?: Record<string, string>;
environmentValueSources?: Record<string, GatewayServiceEnvironmentValueSource>;
sourcePath?: string;
};
export type GatewayServiceState = {
installed: boolean;
loaded: boolean;
running: boolean;
env: GatewayServiceEnv;
command: GatewayServiceCommandConfig | null;
runtime?: GatewayServiceRuntime;
};
export type GatewayServiceStartRepairIssue = {
code: "missing-program" | "temporary-program" | "version-mismatch";
message: string;
};
export type GatewayServiceStartResult =
| { outcome: "started"; state: GatewayServiceState }
| { outcome: "scheduled"; state: GatewayServiceState }
| { outcome: "missing-install"; state: GatewayServiceState }
| {
outcome: "repair-required";
state: GatewayServiceState;
issues: GatewayServiceStartRepairIssue[];
};
export type GatewayServiceRenderArgs = {
description?: string;
programArguments: string[];
workingDirectory?: string;
environment?: GatewayServiceEnv;
environmentFiles?: string[];
};