@happier-dev/stack 0.2.11 → 0.2.12
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/node_modules/@happier-dev/agents/dist/connectedServices/runtimeFallbackCapability.d.ts +1 -0
- package/node_modules/@happier-dev/agents/dist/connectedServices/runtimeFallbackCapability.d.ts.map +1 -1
- package/node_modules/@happier-dev/agents/dist/connectedServices/runtimeFallbackCapability.js +3 -0
- package/node_modules/@happier-dev/agents/dist/connectedServices/runtimeFallbackCapability.js.map +1 -1
- package/node_modules/@happier-dev/agents/dist/manifest.d.ts +1 -0
- package/node_modules/@happier-dev/agents/dist/manifest.d.ts.map +1 -1
- package/node_modules/@happier-dev/agents/dist/manifest.js +1 -0
- package/node_modules/@happier-dev/agents/dist/manifest.js.map +1 -1
- package/node_modules/@happier-dev/agents/dist/runtime/terminal/control.d.ts +1 -1
- package/node_modules/@happier-dev/agents/dist/runtime/terminal/control.d.ts.map +1 -1
- package/node_modules/@happier-dev/agents/dist/runtime/terminal/control.js +2 -0
- package/node_modules/@happier-dev/agents/dist/runtime/terminal/control.js.map +1 -1
- package/node_modules/@happier-dev/agents/dist/types.d.ts +1 -0
- package/node_modules/@happier-dev/agents/dist/types.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/componentArtifacts/buildServerBinaryArtifactPayload.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/componentArtifacts/buildServerBinaryArtifactPayload.js +5 -18
- package/node_modules/@happier-dev/cli-common/dist/componentArtifacts/buildServerBinaryArtifactPayload.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/copyRuntimePayloadTree.d.ts +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/copyRuntimePayloadTree.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/copyRuntimePayloadTree.js +14 -6
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/copyRuntimePayloadTree.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/index.d.ts +2 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/index.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/index.js +2 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/index.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/selfHostServerEnv.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/selfHostServerEnv.js +13 -19
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/selfHostServerEnv.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/serverRuntimeArtifactLayout.d.ts +4 -0
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/serverRuntimeArtifactLayout.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/serverRuntimeArtifactLayout.js +20 -0
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/serverRuntimeArtifactLayout.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/output/index.d.ts +1 -0
- package/node_modules/@happier-dev/cli-common/dist/output/index.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/output/index.js +1 -0
- package/node_modules/@happier-dev/cli-common/dist/output/index.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/output/planet.d.ts +47 -0
- package/node_modules/@happier-dev/cli-common/dist/output/planet.d.ts.map +1 -0
- package/node_modules/@happier-dev/cli-common/dist/output/planet.js +183 -0
- package/node_modules/@happier-dev/cli-common/dist/output/planet.js.map +1 -0
- package/node_modules/@happier-dev/cli-common/dist/output/progress.d.ts +3 -1
- package/node_modules/@happier-dev/cli-common/dist/output/progress.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/output/progress.js +131 -57
- package/node_modules/@happier-dev/cli-common/dist/output/progress.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/relayHost/relayHostEngine.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/relayHost/relayHostEngine.js +41 -78
- package/node_modules/@happier-dev/cli-common/dist/relayHost/relayHostEngine.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/relayHost/remoteRelayRuntimeInstallCommand.d.ts +5 -0
- package/node_modules/@happier-dev/cli-common/dist/relayHost/remoteRelayRuntimeInstallCommand.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/relayHost/remoteRelayRuntimeInstallCommand.js +12 -0
- package/node_modules/@happier-dev/cli-common/dist/relayHost/remoteRelayRuntimeInstallCommand.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/service/windows.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/service/windows.js +30 -8
- package/node_modules/@happier-dev/cli-common/dist/service/windows.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/node_modules/chalk/license +9 -0
- package/node_modules/@happier-dev/cli-common/node_modules/chalk/package.json +83 -0
- package/node_modules/@happier-dev/cli-common/node_modules/chalk/readme.md +297 -0
- package/node_modules/@happier-dev/cli-common/node_modules/chalk/source/index.d.ts +325 -0
- package/node_modules/@happier-dev/cli-common/node_modules/chalk/source/index.js +225 -0
- package/node_modules/@happier-dev/cli-common/node_modules/chalk/source/utilities.js +33 -0
- package/node_modules/@happier-dev/cli-common/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
- package/node_modules/@happier-dev/cli-common/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
- package/node_modules/@happier-dev/cli-common/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
- package/node_modules/@happier-dev/cli-common/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
- package/node_modules/@happier-dev/cli-common/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
- package/node_modules/@happier-dev/cli-common/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
- package/node_modules/@happier-dev/cli-common/package.json +3 -1
- package/node_modules/@happier-dev/protocol/dist/account/encryptionMigrate.d.ts +32 -8
- package/node_modules/@happier-dev/protocol/dist/account/encryptionMigrate.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/account/settings/accountSettings.d.ts +5 -0
- package/node_modules/@happier-dev/protocol/dist/account/settings/accountSettings.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/account/settings/accountSettings.js +3 -0
- package/node_modules/@happier-dev/protocol/dist/account/settings/accountSettings.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/account/settings/notificationChannels.d.ts +6 -0
- package/node_modules/@happier-dev/protocol/dist/account/settings/notificationChannels.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/account/settings/notificationChannels.js +2 -0
- package/node_modules/@happier-dev/protocol/dist/account/settings/notificationChannels.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/actions/actionExecutor.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/actions/actionExecutor.js +106 -9
- package/node_modules/@happier-dev/protocol/dist/actions/actionExecutor.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/actions/actionSpecs.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/actions/actionSpecs.js +23 -9
- package/node_modules/@happier-dev/protocol/dist/actions/actionSpecs.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/actions/permissionPrivilege.d.ts +1 -1
- package/node_modules/@happier-dev/protocol/dist/actions/permissionPrivilege.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/actions/permissionPrivilege.js +16 -4
- package/node_modules/@happier-dev/protocol/dist/actions/permissionPrivilege.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/activity/agentRequestNotificationContent.d.ts +12 -0
- package/node_modules/@happier-dev/protocol/dist/activity/agentRequestNotificationContent.d.ts.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/activity/agentRequestNotificationContent.js +68 -0
- package/node_modules/@happier-dev/protocol/dist/activity/agentRequestNotificationContent.js.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/activity/agentRequestSummary.d.ts +8 -0
- package/node_modules/@happier-dev/protocol/dist/activity/agentRequestSummary.d.ts.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/activity/agentRequestSummary.js +100 -0
- package/node_modules/@happier-dev/protocol/dist/activity/agentRequestSummary.js.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/activity/parseJson.d.ts +2 -0
- package/node_modules/@happier-dev/protocol/dist/activity/parseJson.d.ts.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/activity/parseJson.js +32 -0
- package/node_modules/@happier-dev/protocol/dist/activity/parseJson.js.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/activity/shellCommand.d.ts +12 -0
- package/node_modules/@happier-dev/protocol/dist/activity/shellCommand.d.ts.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/activity/shellCommand.js +120 -0
- package/node_modules/@happier-dev/protocol/dist/activity/shellCommand.js.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/clientCompatibility/index.d.ts +1 -1
- package/node_modules/@happier-dev/protocol/dist/clientCompatibility/index.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/clientCompatibility/index.js +1 -1
- package/node_modules/@happier-dev/protocol/dist/clientCompatibility/index.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/clientCompatibility/primitives.d.ts +2 -1
- package/node_modules/@happier-dev/protocol/dist/clientCompatibility/primitives.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/clientCompatibility/primitives.js +2 -1
- package/node_modules/@happier-dev/protocol/dist/clientCompatibility/primitives.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/connect/accountSubscription.d.ts +36 -0
- package/node_modules/@happier-dev/protocol/dist/connect/accountSubscription.d.ts.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/connect/accountSubscription.js +36 -0
- package/node_modules/@happier-dev/protocol/dist/connect/accountSubscription.js.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/connect/accountUsage.d.ts +143 -0
- package/node_modules/@happier-dev/protocol/dist/connect/accountUsage.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/connect/accountUsage.js +46 -0
- package/node_modules/@happier-dev/protocol/dist/connect/accountUsage.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/connect/connectedServiceSchemas.d.ts +40 -0
- package/node_modules/@happier-dev/protocol/dist/connect/connectedServiceSchemas.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/connect/connectedServiceSchemas.js +9 -0
- package/node_modules/@happier-dev/protocol/dist/connect/connectedServiceSchemas.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/connect/recoveryCreditConsumeIdempotencyKey.d.ts +8 -0
- package/node_modules/@happier-dev/protocol/dist/connect/recoveryCreditConsumeIdempotencyKey.d.ts.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/connect/recoveryCreditConsumeIdempotencyKey.js +22 -0
- package/node_modules/@happier-dev/protocol/dist/connect/recoveryCreditConsumeIdempotencyKey.js.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/daemonExecutionRuns.d.ts +39 -0
- package/node_modules/@happier-dev/protocol/dist/daemonExecutionRuns.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/daemonExecutionRuns.js +4 -1
- package/node_modules/@happier-dev/protocol/dist/daemonExecutionRuns.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/drafts/sessionDrafts.d.ts +80 -20
- package/node_modules/@happier-dev/protocol/dist/drafts/sessionDrafts.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/drafts/sessionDrafts.js +18 -1
- package/node_modules/@happier-dev/protocol/dist/drafts/sessionDrafts.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/executionRunStartRequest.d.ts +25 -0
- package/node_modules/@happier-dev/protocol/dist/executionRunStartRequest.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/executionRunStartRequest.js +18 -0
- package/node_modules/@happier-dev/protocol/dist/executionRunStartRequest.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/executionRuns.d.ts +51 -3
- package/node_modules/@happier-dev/protocol/dist/executionRuns.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/executionRuns.js +5 -2
- package/node_modules/@happier-dev/protocol/dist/executionRuns.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/features/catalog.d.ts +12 -0
- package/node_modules/@happier-dev/protocol/dist/features/catalog.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/features/catalog.js +12 -0
- package/node_modules/@happier-dev/protocol/dist/features/catalog.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/features/decision.d.ts +2 -0
- package/node_modules/@happier-dev/protocol/dist/features/decision.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/features/payload/featureGatesSchema.d.ts +6 -0
- package/node_modules/@happier-dev/protocol/dist/features/payload/featureGatesSchema.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/features/payload/featureGatesSchema.js +4 -0
- package/node_modules/@happier-dev/protocol/dist/features/payload/featureGatesSchema.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/features/payload/featuresResponseSchema.d.ts +6 -0
- package/node_modules/@happier-dev/protocol/dist/features/payload/featuresResponseSchema.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/index.d.ts +11 -3
- package/node_modules/@happier-dev/protocol/dist/index.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/index.js +11 -3
- package/node_modules/@happier-dev/protocol/dist/index.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/prompts/buildAppendSystemPromptBaseV1.js +1 -1
- package/node_modules/@happier-dev/protocol/dist/prompts/buildAppendSystemPromptBaseV1.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/prompts/executionRunsGuidanceV1.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/prompts/executionRunsGuidanceV1.js +25 -35
- package/node_modules/@happier-dev/protocol/dist/prompts/executionRunsGuidanceV1.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/scm.d.ts +6 -0
- package/node_modules/@happier-dev/protocol/dist/scm.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/scm.js +3 -0
- package/node_modules/@happier-dev/protocol/dist/scm.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/scmRepositoryProvisioning.d.ts +6 -0
- package/node_modules/@happier-dev/protocol/dist/scmRepositoryProvisioning.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/sessionControl/contract.d.ts +164 -0
- package/node_modules/@happier-dev/protocol/dist/sessionControl/contract.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/sessionControl/contract.js +3 -0
- package/node_modules/@happier-dev/protocol/dist/sessionControl/contract.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/sessionControl/pendingActivationAuthorizationV1.d.ts +32 -0
- package/node_modules/@happier-dev/protocol/dist/sessionControl/pendingActivationAuthorizationV1.d.ts.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/sessionControl/pendingActivationAuthorizationV1.js +23 -0
- package/node_modules/@happier-dev/protocol/dist/sessionControl/pendingActivationAuthorizationV1.js.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/sessionFolders/folderAssignments.d.ts +12 -0
- package/node_modules/@happier-dev/protocol/dist/sessionFolders/folderAssignments.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/sessionOrganization/constants.d.ts +1 -1
- package/node_modules/@happier-dev/protocol/dist/sessionOrganization/constants.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/sessionOrganization/constants.js +1 -1
- package/node_modules/@happier-dev/protocol/dist/sessionOrganization/constants.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/sessionUserMessageRpc.d.ts +13 -0
- package/node_modules/@happier-dev/protocol/dist/sessionUserMessageRpc.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/sessionUserMessageRpc.js +2 -0
- package/node_modules/@happier-dev/protocol/dist/sessionUserMessageRpc.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/sessionWorkState/sessionWorkStateRpc.d.ts +27 -1
- package/node_modules/@happier-dev/protocol/dist/sessionWorkState/sessionWorkStateRpc.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/sessionWorkState/sessionWorkStateRpc.js +0 -1
- package/node_modules/@happier-dev/protocol/dist/sessionWorkState/sessionWorkStateRpc.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/spawnSession.d.ts +2 -1
- package/node_modules/@happier-dev/protocol/dist/spawnSession.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/spawnSession.js +2 -1
- package/node_modules/@happier-dev/protocol/dist/spawnSession.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/structuredMessages/executionRunCompletionV1.d.ts +20 -0
- package/node_modules/@happier-dev/protocol/dist/structuredMessages/executionRunCompletionV1.d.ts.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/structuredMessages/executionRunCompletionV1.js +21 -0
- package/node_modules/@happier-dev/protocol/dist/structuredMessages/executionRunCompletionV1.js.map +1 -0
- package/node_modules/@happier-dev/protocol/dist/updates.d.ts +35 -0
- package/node_modules/@happier-dev/protocol/dist/updates.d.ts.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/updates.js +2 -0
- package/node_modules/@happier-dev/protocol/dist/updates.js.map +1 -1
- package/package.json +1 -1
- package/scripts/dev_cli_build_ownership.test.mjs +3 -1
- package/scripts/dev_external_server_flags.test.mjs +23 -5
- package/scripts/ghops.test.mjs +9 -3
- package/scripts/provision/linux-ubuntu-provision.sh +5 -0
- package/scripts/provision/linux-ubuntu-provision.test.mjs +3 -1
- package/scripts/self_host_launchd.real.integration.test.mjs +5 -3
- package/scripts/self_host_runtime.mjs +10 -9
- package/scripts/self_host_runtime.test.mjs +2 -2
- package/scripts/utils/dev/expo_dev.buildEnv.test.mjs +14 -0
- package/scripts/utils/dev/expo_dev.mjs +24 -1
- package/scripts/utils/dev_targets/mutagen_project.mjs +4 -1
- package/scripts/utils/dev_targets/mutagen_project.test.mjs +2 -1
- package/scripts/utils/dev_targets/remote_commands.mjs +5 -2
- package/scripts/utils/dev_targets/remote_commands.test.mjs +5 -2
- package/scripts/utils/dev_targets/supervisor.mjs +1 -0
- package/scripts/utils/dev_targets/supervisor.test.mjs +5 -0
- package/scripts/utils/server/apply_runtime_server_sqlite_env.test.mjs +2 -2
- package/scripts/utils/server/resolve_stack_server_port.test.mjs +3 -3
|
@@ -3,6 +3,7 @@ import { createWriteStream } from 'node:fs';
|
|
|
3
3
|
import { mkdir } from 'node:fs/promises';
|
|
4
4
|
import { dirname } from 'node:path';
|
|
5
5
|
import chalk from 'chalk';
|
|
6
|
+
import { isTerminalAnimationDisabled, renderNumericPlanet } from './planet.js';
|
|
6
7
|
function isTty() {
|
|
7
8
|
return Boolean(process.stdout.isTTY && process.stderr.isTTY);
|
|
8
9
|
}
|
|
@@ -24,103 +25,176 @@ function colorResult(chalkLike, result) {
|
|
|
24
25
|
function colorSpinner(chalkLike, frame) {
|
|
25
26
|
return chalkLike.level <= 0 ? String(frame) : chalkLike.cyan(String(frame));
|
|
26
27
|
}
|
|
27
|
-
export function createStepPrinter({ enabled = true, chalkLike = chalk } = {}) {
|
|
28
|
+
export function createStepPrinter({ enabled = true, chalkLike = chalk, appearance = 'compact' } = {}) {
|
|
28
29
|
if (!enabled) {
|
|
29
30
|
return {
|
|
30
31
|
start: () => { },
|
|
31
32
|
stop: () => { },
|
|
32
33
|
info: () => { },
|
|
34
|
+
pause: () => { },
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
|
-
const tty = enabled && isTty();
|
|
37
|
+
const tty = enabled && isTty() && process.env.TERM !== 'dumb';
|
|
38
|
+
const animate = tty && !isTerminalAnimationDisabled();
|
|
39
|
+
const color = tty && !process.env.NO_COLOR;
|
|
40
|
+
const colors = chalkLike;
|
|
36
41
|
const frames = spinnerFrames();
|
|
37
42
|
let timer = null;
|
|
38
43
|
let idx = 0;
|
|
39
44
|
let currentLine = '';
|
|
45
|
+
let drawnRows = 0;
|
|
46
|
+
let initialColumns = 0;
|
|
47
|
+
let initialRows = 0;
|
|
40
48
|
const write = (value) => process.stdout.write(value);
|
|
49
|
+
const resized = () => (process.stdout.columns ?? 80) !== initialColumns || (process.stdout.rows ?? 24) !== initialRows;
|
|
50
|
+
// Called before yielding the terminal to another message/prompt/child.
|
|
51
|
+
// Never move above our own region (in particular, never redraw an auth QR).
|
|
52
|
+
const pause = () => {
|
|
53
|
+
if (timer)
|
|
54
|
+
clearInterval(timer);
|
|
55
|
+
timer = null;
|
|
56
|
+
if (resized()) {
|
|
57
|
+
// Resize may occur immediately before completion, not just on a tick.
|
|
58
|
+
// The terminal owns any reflowed output; leave it intact.
|
|
59
|
+
if (currentLine)
|
|
60
|
+
write('\n');
|
|
61
|
+
}
|
|
62
|
+
else if (drawnRows > 0) {
|
|
63
|
+
write(`\r\x1b[${drawnRows}A\x1b[J`);
|
|
64
|
+
}
|
|
65
|
+
else if (currentLine) {
|
|
66
|
+
write('\r\x1b[2K');
|
|
67
|
+
}
|
|
68
|
+
currentLine = '';
|
|
69
|
+
drawnRows = 0;
|
|
70
|
+
};
|
|
41
71
|
const start = (label) => {
|
|
42
|
-
|
|
72
|
+
pause();
|
|
73
|
+
if (!animate) {
|
|
74
|
+
write(`- [..] ${label}\n`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
initialColumns = process.stdout.columns ?? 80;
|
|
78
|
+
initialRows = process.stdout.rows ?? 24;
|
|
79
|
+
if (appearance === 'planet') {
|
|
80
|
+
// Keep status text outside the redrawn region: URLs/long labels can wrap
|
|
81
|
+
// freely without invalidating our cursor geometry.
|
|
82
|
+
write(`${label}\n`);
|
|
83
|
+
if (initialColumns < 40 || initialRows < 18)
|
|
84
|
+
return;
|
|
85
|
+
const startedAt = Date.now();
|
|
86
|
+
const draw = () => {
|
|
87
|
+
if (resized()) {
|
|
88
|
+
// Once resized, let the terminal keep its reflowed scrollback. Do
|
|
89
|
+
// not guess where those previous rows moved or erase user content.
|
|
90
|
+
if (timer)
|
|
91
|
+
clearInterval(timer);
|
|
92
|
+
timer = null;
|
|
93
|
+
drawnRows = 0;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (drawnRows > 0)
|
|
97
|
+
write(`\x1b[${drawnRows}A`);
|
|
98
|
+
const rows = renderNumericPlanet({ seconds: (Date.now() - startedAt) / 1000, chalkLike: colors, color });
|
|
99
|
+
write(rows.map((row) => `\r\x1b[2K${row}\n`).join(''));
|
|
100
|
+
drawnRows = rows.length;
|
|
101
|
+
};
|
|
102
|
+
draw();
|
|
103
|
+
timer = setInterval(draw, 160);
|
|
104
|
+
timer.unref?.();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
// Long compact labels use the linear mode rather than wrapping a cursor
|
|
108
|
+
// animation onto multiple unowned rows.
|
|
109
|
+
if (label.length + 8 >= initialColumns) {
|
|
43
110
|
write(`- [..] ${label}\n`);
|
|
44
111
|
return;
|
|
45
112
|
}
|
|
46
|
-
currentLine = `- [${colorSpinner(
|
|
113
|
+
currentLine = `- [${color ? colorSpinner(colors, frames[idx % frames.length] ?? '|') : frames[idx % frames.length]}] ${label}`;
|
|
47
114
|
write(currentLine);
|
|
48
115
|
timer = setInterval(() => {
|
|
49
116
|
idx += 1;
|
|
50
|
-
|
|
117
|
+
if (resized()) {
|
|
118
|
+
if (timer)
|
|
119
|
+
clearInterval(timer);
|
|
120
|
+
timer = null;
|
|
121
|
+
currentLine = '';
|
|
122
|
+
write('\n');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const next = `- [${color ? colorSpinner(colors, frames[idx % frames.length] ?? '|') : frames[idx % frames.length]}] ${label}`;
|
|
51
126
|
const pad = currentLine.length > next.length ? ' '.repeat(currentLine.length - next.length) : '';
|
|
52
127
|
currentLine = next;
|
|
53
128
|
write(`\r${next}${pad}`);
|
|
54
129
|
}, 120);
|
|
130
|
+
timer.unref?.();
|
|
55
131
|
};
|
|
56
132
|
const stop = (result, label) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
timer = null;
|
|
60
|
-
if (!tty) {
|
|
61
|
-
write(`- [${colorResult(chalkLike, result)}] ${label}\n`);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const out = `- [${colorResult(chalkLike, result)}] ${label}`;
|
|
65
|
-
const pad = currentLine.length > out.length ? ' '.repeat(currentLine.length - out.length) : '';
|
|
66
|
-
currentLine = '';
|
|
67
|
-
write(`\r${out}${pad}\n`);
|
|
133
|
+
pause();
|
|
134
|
+
write(`- [${color ? colorResult(colors, result) : result}] ${label}\n`);
|
|
68
135
|
};
|
|
69
136
|
const info = (line) => {
|
|
137
|
+
pause();
|
|
70
138
|
write(`${line}\n`);
|
|
71
139
|
};
|
|
72
|
-
return { start, stop, info };
|
|
140
|
+
return { start, stop, info, pause };
|
|
73
141
|
}
|
|
74
142
|
export async function runCommandLogged({ label, cmd, args, cwd, env, logPath, showSteps = true, quiet = true, }) {
|
|
75
143
|
const steps = createStepPrinter({ enabled: showSteps });
|
|
76
144
|
if (quiet) {
|
|
77
145
|
await mkdir(dirname(logPath), { recursive: true }).catch(() => { });
|
|
78
146
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
shell: false,
|
|
85
|
-
});
|
|
86
|
-
let stdout = '';
|
|
87
|
-
let stderr = '';
|
|
147
|
+
// An inherited child owns the terminal, so only buffered commands animate.
|
|
148
|
+
if (quiet)
|
|
149
|
+
steps.start(label);
|
|
150
|
+
else
|
|
151
|
+
steps.info(`- [..] ${label}`);
|
|
88
152
|
let logStream = null;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
153
|
+
try {
|
|
154
|
+
const child = spawn(cmd, args, {
|
|
155
|
+
cwd,
|
|
156
|
+
env,
|
|
157
|
+
stdio: quiet ? ['ignore', 'pipe', 'pipe'] : 'inherit',
|
|
158
|
+
shell: false,
|
|
95
159
|
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
logStream
|
|
160
|
+
let stdout = '';
|
|
161
|
+
let stderr = '';
|
|
162
|
+
if (quiet) {
|
|
163
|
+
logStream = createWriteStream(logPath, { flags: 'a' });
|
|
164
|
+
child.stdout?.on('data', (d) => {
|
|
165
|
+
const s = d.toString();
|
|
166
|
+
stdout += s;
|
|
167
|
+
logStream?.write(s);
|
|
168
|
+
});
|
|
169
|
+
child.stderr?.on('data', (d) => {
|
|
170
|
+
const s = d.toString();
|
|
171
|
+
stderr += s;
|
|
172
|
+
logStream?.write(s);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
const res = await new Promise((resolvePromise, rejectPromise) => {
|
|
176
|
+
child.on('error', rejectPromise);
|
|
177
|
+
child.on('close', (code, signal) => resolvePromise({ code: code ?? 1, signal: signal ?? null }));
|
|
100
178
|
});
|
|
179
|
+
if (res.code === 0) {
|
|
180
|
+
steps.stop('✓', label);
|
|
181
|
+
return { ok: true, code: 0, stdout, stderr, logPath };
|
|
182
|
+
}
|
|
183
|
+
steps.stop('x', label);
|
|
184
|
+
const err = new Error(`${cmd} failed (code=${res.code}${res.signal ? `, sig=${res.signal}` : ''})`);
|
|
185
|
+
err.code = 'EEXIT';
|
|
186
|
+
err.exitCode = res.code;
|
|
187
|
+
err.signal = res.signal;
|
|
188
|
+
err.stdout = stdout;
|
|
189
|
+
err.stderr = stderr;
|
|
190
|
+
err.logPath = logPath;
|
|
191
|
+
throw err;
|
|
101
192
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
try {
|
|
193
|
+
finally {
|
|
194
|
+
// Spawn errors reject before a normal exit status exists. Always release
|
|
195
|
+
// terminal ownership and the log stream before the caller reports failure.
|
|
196
|
+
steps.pause();
|
|
107
197
|
logStream?.end();
|
|
108
198
|
}
|
|
109
|
-
catch {
|
|
110
|
-
// ignore
|
|
111
|
-
}
|
|
112
|
-
if (res.code === 0) {
|
|
113
|
-
steps.stop('✓', label);
|
|
114
|
-
return { ok: true, code: 0, stdout, stderr, logPath };
|
|
115
|
-
}
|
|
116
|
-
steps.stop('x', label);
|
|
117
|
-
const err = new Error(`${cmd} failed (code=${res.code}${res.signal ? `, sig=${res.signal}` : ''})`);
|
|
118
|
-
err.code = 'EEXIT';
|
|
119
|
-
err.exitCode = res.code;
|
|
120
|
-
err.signal = res.signal;
|
|
121
|
-
err.stdout = stdout;
|
|
122
|
-
err.stderr = stderr;
|
|
123
|
-
err.logPath = logPath;
|
|
124
|
-
throw err;
|
|
125
199
|
}
|
|
126
200
|
//# sourceMappingURL=progress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/output/progress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/output/progress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OA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Z,CAAC;YAAS,CAAC;QACT,yEAAyE;QACzE,2EAA2E;QAC3E,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,SAAS,EAAE,GAAG,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relayHostEngine.d.ts","sourceRoot":"","sources":["../../src/relayHost/relayHostEngine.ts"],"names":[],"mappings":"AAQA,OAAO,EAAgC,KAAK,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"relayHostEngine.d.ts","sourceRoot":"","sources":["../../src/relayHost/relayHostEngine.ts"],"names":[],"mappings":"AAQA,OAAO,EAAgC,KAAK,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAoCnH,OAAO,KAAK,EACV,0BAA0B,EAC1B,sBAAsB,EACtB,6BAA6B,EAC9B,MAAM,2CAA2C,CAAC;AAInD,MAAM,MAAM,4BAA4B,GAAG,QAAQ,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAExG,KAAK,mBAAmB,GAAG,QAAQ,CAAC;IAAE,EAAE,EAAE,OAAO,GAAG,QAAQ,CAAC;IAAC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAA;CAAE,CAAC,CAAC;AAEvF,KAAK,UAAU,GAAG,QAAQ,CAAC;IACzB,0BAA0B,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;QAC5C,GAAG,EAAE,6BAA6B,CAAC;QACnC,cAAc,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;KACnC,CAAC,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACpC,aAAa,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;QAC/B,GAAG,EAAE,6BAA6B,CAAC;QACnC,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,CAAC,EAAE,KAAK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AC;IAC9B,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB,GAAG,UAAU,CAAC,CAAC;AAEhB,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,UAAU,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACpF,eAAe,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,OAAO,CAAC,QAAQ,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAA;KAAE,CAAC,CAAC,CAAC;IACtH,OAAO,EAAE,CAAC,MAAM,EAAE,sBAAsB,GAAG,QAAQ,CAAC;QAAE,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,CAAA;KAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/H,CAAC,CAAC;AA4pBH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,mBAAmB,GAAG,eAAe,CA20ChF"}
|
|
@@ -4,7 +4,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
4
4
|
import { rm, readFile } from 'node:fs/promises';
|
|
5
5
|
import { createConnection } from 'node:net';
|
|
6
6
|
import { homedir } from 'node:os';
|
|
7
|
-
import { join
|
|
7
|
+
import { join } from 'node:path';
|
|
8
8
|
import { normalizePublicReleaseRingId } from '@happier-dev/release-runtime/releaseRings';
|
|
9
9
|
import { applyServicePlan, buildServiceCommandEnv, buildReadWindowsScheduledTaskStatusPowerShellCommand, buildServiceDefinition, parseWindowsScheduledTaskStatusPowerShellJson, planServiceAction, resolveServiceBackend, } from '../service/index.js';
|
|
10
10
|
import { checkRelayRuntimeHealth, resolveRelayRuntimeDefaults } from '../firstPartyRuntime/relayRuntime.js';
|
|
@@ -12,7 +12,8 @@ import { installOrUpdateRelayRuntimeLocal, shouldMigrateLegacyUnsuffixedRelayRun
|
|
|
12
12
|
import { resolveNonCollidingRelayPort } from '../firstPartyRuntime/resolveNonCollidingRelayPort.js';
|
|
13
13
|
import { mergeSelfHostServerEnvText, parseEnvText, resolveSelfHostSqliteAutoMigrateValue, renderSelfHostServerEnvTextFromResolvedValues, resolveConfiguredSelfHostBaseUrl, renderPrismaCompatibleSqliteDatabaseUrl, resolveServerLightSqliteDatabaseUrlOptionsFromEnv, } from '../firstPartyRuntime/selfHostServerEnv.js';
|
|
14
14
|
import { buildRelayRuntimeHealthProbeCommand, RELAY_RUNTIME_HEALTH_OK_TOKEN } from './buildRelayRuntimeHealthProbeCommand.js';
|
|
15
|
-
import { buildRemoteRelayRuntimeInstallCommand } from './remoteRelayRuntimeInstallCommand.js';
|
|
15
|
+
import { buildRemoteRelayRuntimeInstallCommand, buildRemoteRelayRuntimeUninstallCommand, } from './remoteRelayRuntimeInstallCommand.js';
|
|
16
|
+
import { resolveRemoteInstalledFirstPartyBinaryPath } from '../systemTasks/kinds/remoteFirstPartyPayloadInstaller.js';
|
|
16
17
|
const RELAY_RUNTIME_CHANNELS = ['stable', 'preview', 'publicdev'];
|
|
17
18
|
function quoteRemoteShellArg(value) {
|
|
18
19
|
const raw = String(value ?? '');
|
|
@@ -242,6 +243,23 @@ function parseLastJsonLineObject(text) {
|
|
|
242
243
|
}
|
|
243
244
|
return null;
|
|
244
245
|
}
|
|
246
|
+
function isStrictRemoteRelayHostUninstallSuccessEnvelope(stdout) {
|
|
247
|
+
const envelope = parseLastJsonLineObject(stdout);
|
|
248
|
+
if (!envelope)
|
|
249
|
+
return false;
|
|
250
|
+
if (Object.keys(envelope).sort().join('\0') !== ['data', 'kind', 'ok', 'v'].join('\0'))
|
|
251
|
+
return false;
|
|
252
|
+
if (envelope.v !== 1
|
|
253
|
+
|| envelope.ok !== true
|
|
254
|
+
|| envelope.kind !== 'relay_host_uninstall'
|
|
255
|
+
|| !envelope.data
|
|
256
|
+
|| typeof envelope.data !== 'object'
|
|
257
|
+
|| Array.isArray(envelope.data)) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
const data = envelope.data;
|
|
261
|
+
return Object.keys(data).length === 1 && data.ok === true;
|
|
262
|
+
}
|
|
245
263
|
function buildRemoteServiceStatusCommand(params) {
|
|
246
264
|
const svc = `${params.serviceName}.service`;
|
|
247
265
|
if (params.backend === 'systemd-user') {
|
|
@@ -529,24 +547,6 @@ function resolveRemoteServiceDefinitionPath(params) {
|
|
|
529
547
|
}
|
|
530
548
|
throw new Error(`Unsupported backend: ${params.backend}`);
|
|
531
549
|
}
|
|
532
|
-
function buildRemoteRelayRuntimeCleanupCommand(params) {
|
|
533
|
-
const privilegedPrefix = params.useSudo ? '${SUDO_PREFIX}' : '';
|
|
534
|
-
return [
|
|
535
|
-
'set -eu',
|
|
536
|
-
...(params.useSudo
|
|
537
|
-
? [
|
|
538
|
-
"SUDO_PREFIX=''",
|
|
539
|
-
'if [ "$(id -u)" -ne 0 ]; then SUDO_PREFIX="sudo -n "; fi',
|
|
540
|
-
]
|
|
541
|
-
: []),
|
|
542
|
-
`${privilegedPrefix}rm -f ${quoteRemoteShellArg(params.definitionPath)}`,
|
|
543
|
-
`${privilegedPrefix}rm -f ${quoteRemoteShellArg(posixPath.join(params.binDir, 'happier-server'))}`,
|
|
544
|
-
`${privilegedPrefix}rm -rf ${quoteRemoteShellArg(params.installRoot)}`,
|
|
545
|
-
`${privilegedPrefix}rm -rf ${quoteRemoteShellArg(params.configDir)}`,
|
|
546
|
-
`${privilegedPrefix}rm -rf ${quoteRemoteShellArg(params.dataDir)}`,
|
|
547
|
-
`${privilegedPrefix}rm -rf ${quoteRemoteShellArg(params.logDir)}`,
|
|
548
|
-
].join('; ');
|
|
549
|
-
}
|
|
550
550
|
function mapRelayRuntimeServiceControlError(params) {
|
|
551
551
|
const stderr = String(params.stderr ?? '').trim();
|
|
552
552
|
if (params.backend === 'systemd-user' && /failed to connect to bus/i.test(stderr)) {
|
|
@@ -1335,17 +1335,11 @@ export function createRelayHostEngine(deps) {
|
|
|
1335
1335
|
statePath,
|
|
1336
1336
|
installServerBinaryPath,
|
|
1337
1337
|
join(defaults.binDir, serverBinaryName),
|
|
1338
|
-
defaults.installRoot,
|
|
1339
|
-
defaults.configDir,
|
|
1340
|
-
defaults.dataDir,
|
|
1341
1338
|
defaults.logDir,
|
|
1342
1339
|
];
|
|
1343
1340
|
for (const path of cleanupTargets) {
|
|
1344
1341
|
await rm(path, { force: true, recursive: true }).catch(() => undefined);
|
|
1345
1342
|
}
|
|
1346
|
-
if (existsSync(defaults.installRoot)) {
|
|
1347
|
-
await rm(defaults.installRoot, { force: true, recursive: true }).catch(() => undefined);
|
|
1348
|
-
}
|
|
1349
1343
|
if (existsSync(statePath)) {
|
|
1350
1344
|
throw new Error('Failed to remove relay runtime state file.');
|
|
1351
1345
|
}
|
|
@@ -1547,62 +1541,31 @@ export function createRelayHostEngine(deps) {
|
|
|
1547
1541
|
}
|
|
1548
1542
|
async function uninstallRemote(params) {
|
|
1549
1543
|
const knownHostsMode = params.ssh.knownHostsPath ? 'app' : 'system';
|
|
1550
|
-
const target = await resolveRemoteTarget(params.ssh, knownHostsMode);
|
|
1551
|
-
const platform = resolveRemotePlatform({ target });
|
|
1552
1544
|
const mode = normalizeMode(params.parsed.mode);
|
|
1553
1545
|
const channel = normalizeChannel(params.parsed.channel);
|
|
1554
|
-
const
|
|
1555
|
-
|
|
1556
|
-
const backend = resolveServiceBackend({ platform, mode });
|
|
1557
|
-
const effectiveServiceName = await resolveRemoteEffectiveServiceName({
|
|
1558
|
-
ssh: params.ssh,
|
|
1559
|
-
knownHostsMode,
|
|
1560
|
-
backend,
|
|
1546
|
+
const remoteCliPath = resolveRemoteInstalledFirstPartyBinaryPath({
|
|
1547
|
+
componentId: 'happier-cli',
|
|
1561
1548
|
channel,
|
|
1562
|
-
remoteHomeDir,
|
|
1563
|
-
defaults,
|
|
1564
|
-
});
|
|
1565
|
-
const serviceSpec = buildRelayRuntimeServiceSpec({
|
|
1566
|
-
label: effectiveServiceName,
|
|
1567
|
-
installRoot: defaults.installRoot,
|
|
1568
|
-
serverBinaryPath: `${defaults.installRoot}/bin/happier-server`,
|
|
1569
|
-
env: {},
|
|
1570
|
-
stdoutPath: `${defaults.logDir}/server.out.log`,
|
|
1571
|
-
stderrPath: `${defaults.logDir}/server.err.log`,
|
|
1572
|
-
});
|
|
1573
|
-
const definitionPath = resolveRemoteServiceDefinitionPath({
|
|
1574
|
-
backend,
|
|
1575
|
-
label: serviceSpec.label,
|
|
1576
|
-
remoteHomeDir,
|
|
1549
|
+
remoteHomeDir: resolveRemoteHomeDirForComponents(),
|
|
1577
1550
|
});
|
|
1578
|
-
const
|
|
1551
|
+
const result = await deps.runRemoteText({
|
|
1579
1552
|
ssh: params.ssh,
|
|
1580
1553
|
knownHostsMode,
|
|
1581
|
-
remoteCommand:
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1554
|
+
remoteCommand: buildRemoteRelayRuntimeUninstallCommand({
|
|
1555
|
+
cliBinaryPath: remoteCliPath,
|
|
1556
|
+
channel: formatRelayChannelLabel(channel),
|
|
1557
|
+
mode,
|
|
1585
1558
|
}),
|
|
1586
1559
|
});
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
logDir: defaults.logDir,
|
|
1597
|
-
useSudo: backend === 'systemd-system' || backend === 'launchd-system',
|
|
1598
|
-
});
|
|
1599
|
-
const cleanupResult = await deps.runRemoteText({
|
|
1600
|
-
ssh: params.ssh,
|
|
1601
|
-
knownHostsMode,
|
|
1602
|
-
remoteCommand: cleanupCommand,
|
|
1603
|
-
});
|
|
1604
|
-
if (cleanupResult.status !== 0) {
|
|
1605
|
-
throw new Error(cleanupResult.stderr.trim() || 'Failed to remove relay runtime files');
|
|
1560
|
+
const envelope = parseLastJsonLineObject(result.stdout);
|
|
1561
|
+
const envelopeError = envelope?.error && typeof envelope.error === 'object' && !Array.isArray(envelope.error)
|
|
1562
|
+
? envelope.error
|
|
1563
|
+
: null;
|
|
1564
|
+
const remoteMessage = typeof envelopeError?.message === 'string' ? envelopeError.message.trim() : '';
|
|
1565
|
+
if (result.status !== 0 || !isStrictRemoteRelayHostUninstallSuccessEnvelope(result.stdout)) {
|
|
1566
|
+
throw new Error(remoteMessage
|
|
1567
|
+
|| result.stderr.trim()
|
|
1568
|
+
|| 'Remote relay host uninstall did not report success. Ensure the installed Happier CLI is present and retry.');
|
|
1606
1569
|
}
|
|
1607
1570
|
}
|
|
1608
1571
|
return {
|
|
@@ -1743,6 +1706,10 @@ export function createRelayHostEngine(deps) {
|
|
|
1743
1706
|
}
|
|
1744
1707
|
const ssh = parsed.target.ssh;
|
|
1745
1708
|
const knownHostsMode = ssh.knownHostsPath ? 'app' : 'system';
|
|
1709
|
+
if (parsed.action === 'uninstall') {
|
|
1710
|
+
await uninstallRemote({ parsed, ssh });
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1746
1713
|
const target = await resolveRemoteTarget(ssh, knownHostsMode);
|
|
1747
1714
|
const platform = resolveRemotePlatform({ target });
|
|
1748
1715
|
const mode = normalizeMode(parsed.mode);
|
|
@@ -1750,10 +1717,6 @@ export function createRelayHostEngine(deps) {
|
|
|
1750
1717
|
const defaults = resolveRelayDefaultsForRemote({ platform, channel, mode });
|
|
1751
1718
|
const remoteHomeDir = await resolveRemoteUserHomeDir(deps, { ssh, knownHostsMode }) ?? resolveRemoteHomeDirForRuntime();
|
|
1752
1719
|
const backend = resolveServiceBackend({ platform, mode });
|
|
1753
|
-
if (parsed.action === 'uninstall') {
|
|
1754
|
-
await uninstallRemote({ parsed, ssh });
|
|
1755
|
-
return;
|
|
1756
|
-
}
|
|
1757
1720
|
const effectiveServiceName = await resolveRemoteEffectiveServiceName({
|
|
1758
1721
|
ssh,
|
|
1759
1722
|
knownHostsMode,
|