@ai-support-agent/cli 0.3.0 → 0.3.1-beta.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.
Files changed (63) hide show
  1. package/ansible/callback_plugins/json.py +146 -0
  2. package/ansible/callback_plugins/tests/test_json_callback.py +171 -0
  3. package/ansible/playbook.yml +52 -0
  4. package/ansible/roles/database/tasks/main.yml +121 -0
  5. package/ansible/roles/dns_tls/tasks/main.yml +75 -0
  6. package/ansible/roles/dns_tls/templates/Caddyfile.j2 +4 -0
  7. package/ansible/roles/docker/tasks/main.yml +51 -0
  8. package/ansible/roles/os_init/tasks/main.yml +61 -0
  9. package/ansible/roles/web_server/tasks/main.yml +47 -0
  10. package/dist/api-client.d.ts +26 -1
  11. package/dist/api-client.d.ts.map +1 -1
  12. package/dist/api-client.js +40 -0
  13. package/dist/api-client.js.map +1 -1
  14. package/dist/commands/chat-executor.js +1 -1
  15. package/dist/commands/chat-executor.js.map +1 -1
  16. package/dist/commands/index.d.ts.map +1 -1
  17. package/dist/commands/index.js +14 -0
  18. package/dist/commands/index.js.map +1 -1
  19. package/dist/constants.d.ts +3 -0
  20. package/dist/constants.d.ts.map +1 -1
  21. package/dist/constants.js +7 -0
  22. package/dist/constants.js.map +1 -1
  23. package/dist/mcp/config-writer.d.ts +24 -1
  24. package/dist/mcp/config-writer.d.ts.map +1 -1
  25. package/dist/mcp/config-writer.js +27 -2
  26. package/dist/mcp/config-writer.js.map +1 -1
  27. package/dist/mcp/server.d.ts.map +1 -1
  28. package/dist/mcp/server.js +4 -0
  29. package/dist/mcp/server.js.map +1 -1
  30. package/dist/mcp/tools/send-slack-file.d.ts +5 -0
  31. package/dist/mcp/tools/send-slack-file.d.ts.map +1 -0
  32. package/dist/mcp/tools/send-slack-file.js +22 -0
  33. package/dist/mcp/tools/send-slack-file.js.map +1 -0
  34. package/dist/mcp/tools/update-system-knowledge.d.ts +29 -0
  35. package/dist/mcp/tools/update-system-knowledge.d.ts.map +1 -0
  36. package/dist/mcp/tools/update-system-knowledge.js +63 -0
  37. package/dist/mcp/tools/update-system-knowledge.js.map +1 -0
  38. package/dist/oneshot-runner.d.ts.map +1 -1
  39. package/dist/oneshot-runner.js +5 -2
  40. package/dist/oneshot-runner.js.map +1 -1
  41. package/dist/server-setup/known-hosts-store.d.ts +16 -0
  42. package/dist/server-setup/known-hosts-store.d.ts.map +1 -0
  43. package/dist/server-setup/known-hosts-store.js +89 -0
  44. package/dist/server-setup/known-hosts-store.js.map +1 -0
  45. package/dist/server-setup/server-setup-runner.d.ts +27 -0
  46. package/dist/server-setup/server-setup-runner.d.ts.map +1 -0
  47. package/dist/server-setup/server-setup-runner.js +576 -0
  48. package/dist/server-setup/server-setup-runner.js.map +1 -0
  49. package/dist/types/command.d.ts +5 -1
  50. package/dist/types/command.d.ts.map +1 -1
  51. package/dist/types/command.js.map +1 -1
  52. package/dist/types/index.d.ts +1 -0
  53. package/dist/types/index.d.ts.map +1 -1
  54. package/dist/types/index.js +1 -0
  55. package/dist/types/index.js.map +1 -1
  56. package/dist/types/server-setup.d.ts +30 -0
  57. package/dist/types/server-setup.d.ts.map +1 -0
  58. package/dist/types/server-setup.js +12 -0
  59. package/dist/types/server-setup.js.map +1 -0
  60. package/dist/types/tool-output.d.ts +71 -0
  61. package/dist/types/tool-output.d.ts.map +1 -1
  62. package/docker/Dockerfile +30 -1
  63. package/package.json +2 -1
@@ -0,0 +1,576 @@
1
+ "use strict";
2
+ /**
3
+ * Runner for the `server_setup_exec` command.
4
+ *
5
+ * Fetches the target host's SSH private key Just-In-Time from the API,
6
+ * writes it to a process-local temp directory, runs the bundled Ansible
7
+ * playbook (`ansible/playbook.yml`) against it, and — critically — always
8
+ * removes the temp directory (private key included) afterwards, whether the
9
+ * run succeeded or failed. See admin-docs `docs/features/server-setup.md`
10
+ * ("秘密鍵の受け渡し設計") for the full design and its security rationale.
11
+ *
12
+ * SECURITY: the SSH private key must never be logged, and the temp
13
+ * directory holding it must never survive past this function's execution.
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.runServerSetup = runServerSetup;
50
+ const child_process_1 = require("child_process");
51
+ const fs_1 = require("fs");
52
+ const os = __importStar(require("os"));
53
+ const path = __importStar(require("path"));
54
+ const logger_1 = require("../logger");
55
+ const types_1 = require("../types");
56
+ const utils_1 = require("../utils");
57
+ const known_hosts_store_1 = require("./known-hosts-store");
58
+ /** stepType values supported by the bundled Ansible roles (MVP scope). */
59
+ const ALLOWED_STEP_TYPES = new Set([
60
+ 'os_init',
61
+ 'docker',
62
+ 'web_server',
63
+ 'database',
64
+ 'dns_tls',
65
+ ]);
66
+ /**
67
+ * Allow-list of `params` keys accepted per `stepType`, matching exactly the
68
+ * Jinja variables each bundled role (`ansible/roles/<stepType>/tasks/main.yml`)
69
+ * reads. All `steps[].params` entries are merged into a single
70
+ * `extra-vars.json` passed as `ansible-playbook -e @extra-vars.json`.
71
+ * extra-vars has the *highest* variable precedence in Ansible — higher than
72
+ * inventory vars — so without this allow-list a caller could smuggle in an
73
+ * Ansible "magic variable" (e.g. `ansible_connection: "local"`,
74
+ * `ansible_host`, `ansible_ssh_private_key_file`) as a step param and
75
+ * redirect the whole `become: true` playbook run onto the agent host itself
76
+ * instead of the intended target (see `isReservedOrMagicParamKey` for the
77
+ * belt-and-suspenders check that also blocks any `ansible_`-prefixed key
78
+ * regardless of this table).
79
+ */
80
+ const ALLOWED_STEP_PARAMS = {
81
+ os_init: new Set(),
82
+ docker: new Set(),
83
+ web_server: new Set(['web_server_type']),
84
+ database: new Set(['db_type', 'db_root_password']),
85
+ dns_tls: new Set(['domain']),
86
+ };
87
+ /**
88
+ * Enum-valued `params` keys: the bundled Ansible roles branch on these with a
89
+ * plain string `when: x == 'y'` comparison (see `ansible/roles/database` and
90
+ * `ansible/roles/web_server`), so a typo'd or otherwise-unrecognized value
91
+ * (wrong case, extra whitespace, an unsupported db engine, ...) matches
92
+ * *none* of the role's `when` conditions. Every task in that role is then
93
+ * silently skipped, `ansible-playbook` still exits 0, and — without this
94
+ * check — `runServerSetup` would report the step as a `successResult` even
95
+ * though nothing was actually installed. Rejecting unrecognized values here,
96
+ * before the command ever runs, turns that silent no-op into an explicit
97
+ * validation error. `ansible/roles/database/tasks/main.yml` and
98
+ * `ansible/roles/web_server/tasks/main.yml` also `assert` these same values
99
+ * as a second, independent safety net in case this allow-list and the
100
+ * Ansible roles ever drift apart.
101
+ */
102
+ const STEP_PARAM_ENUM_VALUES = {
103
+ db_type: new Set(['mysql', 'postgresql']),
104
+ web_server_type: new Set(['nginx', 'apache']),
105
+ };
106
+ /**
107
+ * `params` key that MUST be present for a given `stepType` (stepTypes not
108
+ * listed here, e.g. `os_init`/`docker`, have no required param). Without
109
+ * this, a step whose param *key* is entirely absent — e.g.
110
+ * `{ stepType: 'database', params: {} }` — passes every other check (there
111
+ * is no value at all to validate against `STEP_PARAM_ENUM_VALUES`) and
112
+ * reaches the bundled Ansible role, where every task is gated on
113
+ * `db_type == '...'`/`db_type is defined`
114
+ * (`ansible/roles/database/tasks/main.yml`), so *all* of them silently skip
115
+ * while `ansible-playbook` still exits 0 — `runServerSetup` would then
116
+ * report the step as a `successResult` despite installing nothing. Rejecting
117
+ * the missing key here, before the command ever runs, closes that gap the
118
+ * same way `STEP_PARAM_ENUM_VALUES` closes it for a recognized-but-invalid
119
+ * value.
120
+ */
121
+ const REQUIRED_STEP_PARAMS = {
122
+ database: 'db_type',
123
+ web_server: 'web_server_type',
124
+ dns_tls: 'domain',
125
+ };
126
+ /**
127
+ * Ansible "magic variables" / other reserved names that must never be
128
+ * settable via `steps[].params`, no matter what `ALLOWED_STEP_PARAMS` says
129
+ * for a given stepType. This is deliberately conservative and checked
130
+ * independently of the per-stepType allow-list above.
131
+ */
132
+ const RESERVED_PARAM_KEYS = new Set([
133
+ 'hostvars',
134
+ 'groups',
135
+ 'group_names',
136
+ 'environment',
137
+ 'omit',
138
+ 'inventory_hostname',
139
+ 'inventory_hostname_short',
140
+ 'inventory_dir',
141
+ 'inventory_file',
142
+ 'playbook_dir',
143
+ 'play_hosts',
144
+ 'role_name',
145
+ 'role_names',
146
+ 'role_path',
147
+ ]);
148
+ /** True if `key` is an Ansible magic variable / connection-control name that must never be caller-controlled. */
149
+ function isReservedOrMagicParamKey(key) {
150
+ return key.startsWith('ansible_') || RESERVED_PARAM_KEYS.has(key);
151
+ }
152
+ /** Cap on buffered ansible-playbook stdout/stderr to avoid unbounded memory growth. */
153
+ const ANSIBLE_MAX_BUFFER_BYTES = 20 * 1024 * 1024;
154
+ /**
155
+ * Hard wall-clock cap on the whole `ansible-playbook` invocation (all
156
+ * requested steps together). Without this, a hung target host (unreachable
157
+ * SSH, an apt/dpkg lock held forever, etc.) would leave `runServerSetup`
158
+ * pending forever: the resident agent's `processing` flag would stay stuck
159
+ * and the temp directory holding the SSH private key would remain on disk
160
+ * indefinitely. 30 minutes comfortably covers `os_init`'s `apt dist-upgrade`
161
+ * (the slowest single step) plus every other role in one run.
162
+ */
163
+ const ANSIBLE_TIMEOUT_MS = 30 * 60 * 1000;
164
+ function validatePayload(p) {
165
+ const executionId = typeof p?.executionId === 'string' && p.executionId ? p.executionId : null;
166
+ if (!executionId)
167
+ return 'executionId is required for server_setup_exec';
168
+ const sshHostId = typeof p?.sshHostId === 'string' && p.sshHostId ? p.sshHostId : null;
169
+ if (!sshHostId)
170
+ return 'sshHostId is required for server_setup_exec';
171
+ if (!Array.isArray(p?.steps) || p.steps.length === 0) {
172
+ return 'steps (non-empty array) is required for server_setup_exec';
173
+ }
174
+ const steps = [];
175
+ for (let i = 0; i < p.steps.length; i++) {
176
+ const raw = p.steps[i];
177
+ if (typeof raw !== 'object' || raw === null) {
178
+ return `steps[${i}] must be an object`;
179
+ }
180
+ const stepType = raw.stepType;
181
+ if (typeof stepType !== 'string' || !ALLOWED_STEP_TYPES.has(stepType)) {
182
+ return `steps[${i}].stepType must be one of: ${[...ALLOWED_STEP_TYPES].join(', ')}`;
183
+ }
184
+ const rawParams = raw.params ?? {};
185
+ if (typeof rawParams !== 'object' || rawParams === null || Array.isArray(rawParams)) {
186
+ return `steps[${i}].params must be an object`;
187
+ }
188
+ const allowedParams = ALLOWED_STEP_PARAMS[stepType];
189
+ const params = {};
190
+ for (const [key, value] of Object.entries(rawParams)) {
191
+ if (typeof value !== 'string') {
192
+ return `steps[${i}].params.${key} must be a string`;
193
+ }
194
+ // Checked before the per-stepType allow-list so that a magic-variable
195
+ // key is rejected with an unambiguous reason even if a future
196
+ // ALLOWED_STEP_PARAMS entry were mistakenly made too permissive.
197
+ if (isReservedOrMagicParamKey(key)) {
198
+ return `steps[${i}].params.${key} is not allowed (reserved Ansible variable name)`;
199
+ }
200
+ if (!allowedParams.has(key)) {
201
+ return `steps[${i}].params.${key} is not an allowed parameter for stepType '${stepType}'`;
202
+ }
203
+ const enumValues = STEP_PARAM_ENUM_VALUES[key];
204
+ if (enumValues && !enumValues.has(value)) {
205
+ return `steps[${i}].params.${key} must be one of: ${[...enumValues].join(', ')} (got ${JSON.stringify(value)})`;
206
+ }
207
+ params[key] = value;
208
+ }
209
+ const requiredParam = REQUIRED_STEP_PARAMS[stepType];
210
+ if (requiredParam && !(requiredParam in params)) {
211
+ return `steps[${i}].params.${requiredParam} is required for stepType '${stepType}'`;
212
+ }
213
+ steps.push({ stepType: stepType, params });
214
+ }
215
+ return { executionId, sshHostId, steps };
216
+ }
217
+ /**
218
+ * Resolve the directory containing the bundled `playbook.yml` and roles.
219
+ * At runtime `__dirname` is `dist/server-setup` (npm-installed) or
220
+ * `src/server-setup` (ts-node dev); the package root is two levels up in
221
+ * both cases — the same depth used by `getDockerContextDir()` in
222
+ * `src/docker/dockerfile-path.ts`.
223
+ */
224
+ function resolveAnsibleDir() {
225
+ return path.join(__dirname, '..', '..', 'ansible');
226
+ }
227
+ function resolvePlaybookPath() {
228
+ const playbookPath = path.join(resolveAnsibleDir(), 'playbook.yml');
229
+ if (!(0, fs_1.existsSync)(playbookPath)) {
230
+ throw new Error(`Ansible playbook not found: ${playbookPath}`);
231
+ }
232
+ return playbookPath;
233
+ }
234
+ /**
235
+ * Plain hostname or dotted-decimal IPv4 address: letters/digits/hyphens/dots
236
+ * only — no whitespace, quotes, `=`, or other characters that could be
237
+ * (mis)parsed as an extra inventory variable assignment.
238
+ */
239
+ const HOSTNAME_RE = /^[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?$/;
240
+ /** Portable username: letters/digits/underscore/hyphen only. */
241
+ const USERNAME_RE = /^[A-Za-z0-9_-]+$/;
242
+ /**
243
+ * Reject a fetched SSH credential whose hostname/username/port isn't a
244
+ * plain, unambiguous value. Without this, a hostname or username containing
245
+ * e.g. a space or an embedded `ansible_connection=local` could — once
246
+ * written into the inventory — be parsed as *additional* inventory
247
+ * variables for the host, redirecting the `become: true` playbook run away
248
+ * from the intended target.
249
+ */
250
+ function validateSshCredential(credential) {
251
+ if (!HOSTNAME_RE.test(credential.hostname)) {
252
+ return `SSH credential hostname is not a valid hostname/IP address: ${JSON.stringify(credential.hostname)}`;
253
+ }
254
+ if (!USERNAME_RE.test(credential.username)) {
255
+ return `SSH credential username contains disallowed characters: ${JSON.stringify(credential.username)}`;
256
+ }
257
+ if (!Number.isInteger(credential.port) || credential.port < 1 || credential.port > 65535) {
258
+ return `SSH credential port is out of range: ${JSON.stringify(credential.port)}`;
259
+ }
260
+ return null;
261
+ }
262
+ /**
263
+ * Build a minimal single-host Ansible inventory as JSON — written with a
264
+ * `.yml` extension because plain JSON is valid YAML, so ansible-core's
265
+ * bundled `yaml` inventory plugin (which matches by extension) parses it
266
+ * unambiguously. This avoids the previous hand-built INI line, where an
267
+ * unvalidated hostname/username containing whitespace or `key=value` text
268
+ * could have been parsed as extra `ansible_*` inventory variables.
269
+ *
270
+ * `StrictHostKeyChecking=accept-new` (TOFU): the host key is trusted and
271
+ * recorded on first connection, but a *later* run against the same
272
+ * `credential.hostname` with a *different* key is rejected — unlike the
273
+ * previous `StrictHostKeyChecking=no`, which accepted any key on every
274
+ * connection and made a DNS/route hijack of the target silently forward the
275
+ * private key and `extra-vars.json` (which may include `db_root_password`)
276
+ * to an attacker-controlled host.
277
+ */
278
+ function buildInventory(credential, keyPath, knownHostsPath) {
279
+ const commonArgs = `-o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=${knownHostsPath}`;
280
+ const inventory = {
281
+ target: {
282
+ hosts: {
283
+ [credential.hostname]: {
284
+ ansible_host: credential.hostname,
285
+ ansible_port: credential.port,
286
+ ansible_user: credential.username,
287
+ ansible_ssh_private_key_file: keyPath,
288
+ ansible_ssh_common_args: commonArgs,
289
+ },
290
+ },
291
+ },
292
+ };
293
+ return JSON.stringify(inventory);
294
+ }
295
+ /**
296
+ * Run `ansible-playbook` via execFile (never a shell) so step params
297
+ * (which flow into `-e @extra-vars.json`, not shell arguments) cannot be
298
+ * used for shell injection. Resolves rather than rejects on a non-zero exit
299
+ * so callers can still parse the JSON callback output that was produced
300
+ * before the failure. A hard `timeout` (see `ANSIBLE_TIMEOUT_MS`) guards
301
+ * against a hung target host or a stuck apt/dpkg lock leaving this promise
302
+ * (and the caller's temp dir / private key) pending forever.
303
+ */
304
+ function runAnsiblePlaybook(args, env) {
305
+ return new Promise((resolve) => {
306
+ (0, child_process_1.execFile)('ansible-playbook', args, { env, maxBuffer: ANSIBLE_MAX_BUFFER_BYTES, timeout: ANSIBLE_TIMEOUT_MS }, (error, stdout, stderr) => {
307
+ const stdoutStr = stdout ? stdout.toString() : '';
308
+ const stderrStr = stderr ? stderr.toString() : '';
309
+ if (!error) {
310
+ resolve({ code: 0, stdout: stdoutStr, stderr: stderrStr, timedOut: false, spawnError: null });
311
+ return;
312
+ }
313
+ const err = error;
314
+ // Node sets `killed: true` (with the `killSignal`, SIGTERM by
315
+ // default) when execFile's own `timeout` option fires.
316
+ const timedOut = err.killed === true;
317
+ const numericCode = typeof err.code === 'number' ? err.code : null;
318
+ // A non-numeric `code` (e.g. the string 'ENOENT'/'EACCES') combined
319
+ // with no captured output at all means execFile failed to spawn the
320
+ // process — as opposed to the process starting and exiting non-zero.
321
+ const spawnError = !timedOut && numericCode === null && !stdoutStr && !stderrStr ? (0, utils_1.getErrorMessage)(error) : null;
322
+ resolve({
323
+ code: numericCode ?? 1,
324
+ stdout: stdoutStr,
325
+ stderr: stderrStr,
326
+ timedOut,
327
+ spawnError,
328
+ });
329
+ });
330
+ });
331
+ }
332
+ /**
333
+ * Parse the `ansible-playbook --stdout-callback=json`-style output into one
334
+ * result per requested step, plus any failure messages from task groups
335
+ * outside the requested steps (see `ParsedAnsibleOutput.unmatchedFailureMessages`).
336
+ * Task names in the bundled roles are prefixed `"<stepType> : <description>"`
337
+ * (see `ansible/roles/<name>/tasks/main.yml`) so task outcomes can be
338
+ * grouped back to the step that produced them.
339
+ */
340
+ function parseAnsibleOutput(steps, rawOutput) {
341
+ let parsed = null;
342
+ let outputUnparseable = false;
343
+ if (!rawOutput || !rawOutput.trim()) {
344
+ outputUnparseable = true;
345
+ }
346
+ else {
347
+ try {
348
+ parsed = JSON.parse(rawOutput);
349
+ }
350
+ catch {
351
+ parsed = null;
352
+ outputUnparseable = true;
353
+ }
354
+ }
355
+ const resultsByStep = new Map();
356
+ for (const play of parsed?.plays ?? []) {
357
+ for (const task of play.tasks ?? []) {
358
+ const name = task.task?.name ?? '';
359
+ const stepType = name.split(':')[0]?.trim();
360
+ if (!stepType)
361
+ continue;
362
+ const hostResults = Object.values(task.hosts ?? {});
363
+ const existing = resultsByStep.get(stepType) ?? [];
364
+ resultsByStep.set(stepType, existing.concat(hostResults));
365
+ }
366
+ }
367
+ const requestedStepTypes = new Set(steps.map((step) => step.stepType));
368
+ const unmatchedFailureMessages = [];
369
+ for (const [groupName, results] of resultsByStep.entries()) {
370
+ if (requestedStepTypes.has(groupName))
371
+ continue;
372
+ for (const r of results) {
373
+ if (r.failed !== true)
374
+ continue;
375
+ const reason = r.msg ?? (r.unreachable === true ? 'host unreachable' : `${groupName} failed`);
376
+ unmatchedFailureMessages.push(`${groupName}: ${reason}`);
377
+ }
378
+ }
379
+ const stepResults = steps.map((step) => {
380
+ const results = resultsByStep.get(step.stepType) ?? [];
381
+ const failedResult = results.find((r) => r.failed === true);
382
+ if (failedResult) {
383
+ return {
384
+ stepType: step.stepType,
385
+ status: 'failed',
386
+ changed: results.some((r) => r.changed === true),
387
+ message: failedResult.msg ?? `${step.stepType} failed`,
388
+ };
389
+ }
390
+ if (results.length === 0) {
391
+ return {
392
+ stepType: step.stepType,
393
+ status: 'skipped',
394
+ changed: false,
395
+ message: `No task output found for ${step.stepType}`,
396
+ };
397
+ }
398
+ if (results.every((r) => r.skipped === true)) {
399
+ return { stepType: step.stepType, status: 'skipped', changed: false, message: `${step.stepType} skipped` };
400
+ }
401
+ return {
402
+ stepType: step.stepType,
403
+ status: 'ok',
404
+ changed: results.some((r) => r.changed === true),
405
+ message: `${step.stepType} completed`,
406
+ };
407
+ });
408
+ const missingStepTypes = outputUnparseable
409
+ ? []
410
+ : steps.map((step) => step.stepType).filter((stepType) => !resultsByStep.has(stepType));
411
+ return { stepResults, unmatchedFailureMessages, outputUnparseable, missingStepTypes };
412
+ }
413
+ /**
414
+ * Execute a `server_setup_exec` command: fetch the SSH credential, run the
415
+ * bundled playbook, and report per-step results. The temp directory holding
416
+ * the private key is always removed, on every exit path.
417
+ */
418
+ async function runServerSetup(payload, ctx) {
419
+ const validated = validatePayload(payload);
420
+ if (typeof validated === 'string') {
421
+ return (0, types_1.errorResult)(validated);
422
+ }
423
+ let credential;
424
+ try {
425
+ credential = await ctx.client.getServerSetupSshCredential(ctx.commandId, ctx.agentId ?? '');
426
+ }
427
+ catch (error) {
428
+ return (0, types_1.errorResult)(`Failed to fetch SSH credential: ${(0, utils_1.getErrorMessage)(error)}`);
429
+ }
430
+ const credentialError = validateSshCredential(credential);
431
+ if (credentialError) {
432
+ return (0, types_1.errorResult)(credentialError);
433
+ }
434
+ let playbookPath;
435
+ try {
436
+ playbookPath = resolvePlaybookPath();
437
+ }
438
+ catch (error) {
439
+ return (0, types_1.errorResult)((0, utils_1.getErrorMessage)(error));
440
+ }
441
+ // Persistent (not per-run) known_hosts file, namespaced by tenant + SSH
442
+ // host, so `StrictHostKeyChecking=accept-new` (TOFU) actually detects a
443
+ // host key change across runs instead of trusting every run as a "first
444
+ // use" — see known-hosts-store.ts's doc comment. Resolved before the temp
445
+ // dir is created so a failure here (e.g. an unwritable config dir) never
446
+ // leaves a private-key-holding temp dir behind.
447
+ let knownHostsPath;
448
+ try {
449
+ knownHostsPath = (0, known_hosts_store_1.resolveKnownHostsPath)(ctx.client.getTenantCode(), validated.sshHostId);
450
+ }
451
+ catch (error) {
452
+ return (0, types_1.errorResult)(`Failed to resolve known_hosts file: ${(0, utils_1.getErrorMessage)(error)}`);
453
+ }
454
+ const tmpDir = (0, fs_1.mkdtempSync)(path.join(os.tmpdir(), 'ss-'));
455
+ // Every exit path below assigns `result` (in the `try` body or the `catch`
456
+ // clause), but keep a safe default so TypeScript's definite-assignment
457
+ // analysis (and any future refactor that adds an early path) can't leave
458
+ // it unset by the time `finally` reads it.
459
+ let result = (0, types_1.errorResult)('server_setup_exec: no result was produced');
460
+ try {
461
+ result = await (async () => {
462
+ const keyPath = path.join(tmpDir, 'id_rsa');
463
+ // 0600: only the current user may read/write the private key.
464
+ (0, fs_1.writeFileSync)(keyPath, credential.privateKey, { mode: 0o600 });
465
+ // Written with a .yml extension (JSON is valid YAML) so ansible-core's
466
+ // bundled `yaml` inventory plugin — matched by file extension — parses
467
+ // it unambiguously; see buildInventory's doc comment.
468
+ const inventoryPath = path.join(tmpDir, 'inventory.yml');
469
+ (0, fs_1.writeFileSync)(inventoryPath, buildInventory(credential, keyPath, knownHostsPath));
470
+ const extraVars = {};
471
+ for (const step of validated.steps) {
472
+ Object.assign(extraVars, step.params);
473
+ }
474
+ const extraVarsPath = path.join(tmpDir, 'extra-vars.json');
475
+ // 0600: extra-vars.json may carry db_root_password in plaintext —
476
+ // same permission level as the private key and known_hosts file in
477
+ // this directory.
478
+ (0, fs_1.writeFileSync)(extraVarsPath, JSON.stringify(extraVars), { mode: 0o600 });
479
+ const tags = validated.steps.map((s) => s.stepType).join(',');
480
+ const args = ['-i', inventoryPath, playbookPath, '--tags', tags, '-e', `@${extraVarsPath}`];
481
+ logger_1.logger.info(`[server-setup] Running ansible-playbook: executionId=${validated.executionId} tags=${tags}`);
482
+ const { code, stdout, stderr, timedOut, spawnError } = await runAnsiblePlaybook(args, {
483
+ ...process.env,
484
+ ANSIBLE_STDOUT_CALLBACK: 'json',
485
+ });
486
+ if (timedOut) {
487
+ logger_1.logger.error(`[server-setup] ansible-playbook timed out after ${ANSIBLE_TIMEOUT_MS}ms: executionId=${validated.executionId}`);
488
+ return (0, types_1.errorResult)(`ansible-playbook execution timed out after ${Math.floor(ANSIBLE_TIMEOUT_MS / 1000)}s`);
489
+ }
490
+ if (spawnError) {
491
+ // The process never started (e.g. `ansible-playbook` missing from
492
+ // PATH or not executable) — there is no `--tags`-scoped task output
493
+ // to parse, so `stepResults` is deliberately omitted rather than
494
+ // reported as "skipped", which would misleadingly read as an
495
+ // intentional tag-based skip instead of an environment failure.
496
+ logger_1.logger.error(`[server-setup] Failed to start ansible-playbook: ${spawnError}`);
497
+ return (0, types_1.errorResult)(`Failed to start ansible-playbook: ${spawnError}`);
498
+ }
499
+ const { stepResults, unmatchedFailureMessages, outputUnparseable, missingStepTypes } = parseAnsibleOutput(validated.steps, stdout);
500
+ if (code !== 0) {
501
+ const detail = stderr ? stderr.substring(0, 2000) : '';
502
+ // Surfaces failures from task groups outside the requested steps —
503
+ // e.g. the `precheck` "Unsupported OS" fail or an unreachable host —
504
+ // which would otherwise never reach the caller: every requested
505
+ // step would just show up as "skipped: No task output found",
506
+ // silently discarding the actual reason the whole run failed.
507
+ const unmatchedDetail = unmatchedFailureMessages.length ? ` | ${unmatchedFailureMessages.join('; ')}` : '';
508
+ logger_1.logger.error(`[server-setup] ansible-playbook exited with code ${code}`);
509
+ return (0, types_1.errorResult)(`ansible-playbook exited with code ${code}${detail ? `: ${detail}` : ''}${unmatchedDetail}`, { stepResults });
510
+ }
511
+ // Reaching here means ansible-playbook exited 0 — but a `0` exit code
512
+ // alone is not sufficient evidence that the requested steps actually
513
+ // ran (see ParsedAnsibleOutput's `outputUnparseable`/`missingStepTypes`
514
+ // doc comments): a stdout callback that silently failed to load, an
515
+ // ansible-core output-format change, or a tag/task-name mismatch would
516
+ // otherwise all be reported as a quiet successResult. Both checks are
517
+ // deliberately evaluated regardless of the (here, always-0) exit code,
518
+ // so this fail-closed behavior does not silently regress if a future
519
+ // change moves either check earlier.
520
+ if (outputUnparseable) {
521
+ logger_1.logger.error(`[server-setup] ansible-playbook exited 0 but stdout was ${stdout.trim() ? 'not valid JSON' : 'empty'}: executionId=${validated.executionId}`);
522
+ return (0, types_1.errorResult)(`ansible-playbook exited 0 but its stdout ${stdout.trim() ? 'could not be parsed as JSON' : 'was empty'} — unable to confirm any requested step actually ran (json stdout callback not loaded, or an unexpected ansible-core output format)`);
523
+ }
524
+ if (missingStepTypes.length > 0) {
525
+ logger_1.logger.error(`[server-setup] ansible-playbook exited 0 but produced no task output for: ${missingStepTypes.join(', ')}: executionId=${validated.executionId}`);
526
+ return (0, types_1.errorResult)(`ansible-playbook exited 0 but produced no task output for requested step(s): ${missingStepTypes.join(', ')} — treating the run as failed rather than silently reporting success`, { stepResults });
527
+ }
528
+ logger_1.logger.success(`[server-setup] Completed: executionId=${validated.executionId}`);
529
+ return (0, types_1.successResult)({ stepResults });
530
+ })();
531
+ }
532
+ catch (error) {
533
+ result = (0, types_1.errorResult)(`Server setup execution failed: ${(0, utils_1.getErrorMessage)(error)}`);
534
+ }
535
+ finally {
536
+ // Must run on every exit path (success, failed step, thrown error): the
537
+ // private key must never remain on disk after this function returns.
538
+ // The removal itself is best-effort-logged rather than left to throw
539
+ // silently past the function's return: an rmSync failure here would
540
+ // otherwise leave the private key (and extra-vars.json's
541
+ // db_root_password) on disk with no signal to the caller — see
542
+ // `attachCleanupFailure`, which folds this into `result` below.
543
+ try {
544
+ (0, fs_1.rmSync)(tmpDir, { recursive: true, force: true });
545
+ }
546
+ catch (cleanupError) {
547
+ const message = (0, utils_1.getErrorMessage)(cleanupError);
548
+ logger_1.logger.error(`[server-setup] Failed to remove temp dir ${tmpDir}: ${message}`);
549
+ result = attachCleanupFailure(result, tmpDir);
550
+ }
551
+ }
552
+ return result;
553
+ }
554
+ /**
555
+ * Fold a failed best-effort removal of the temp dir (SSH private key and
556
+ * extra-vars.json, which may contain `db_root_password`) into the command
557
+ * result.
558
+ *
559
+ * Design choice: rather than adding a `cleanupFailed: true` flag buried
560
+ * inside an otherwise-`success: true` result's `data` — which a caller that
561
+ * only checks the top-level `success` flag would silently miss — this
562
+ * deliberately turns the *whole* command result into a failure, regardless
563
+ * of whether the ansible-playbook run itself succeeded. Leaving secret
564
+ * material behind on disk is a security incident in its own right; masking
565
+ * that behind an otherwise-green result risks it going unnoticed and
566
+ * unremediated, which is a worse outcome than an ansible run that
567
+ * technically "succeeded" being reported as failed.
568
+ */
569
+ function attachCleanupFailure(result, tmpDir) {
570
+ const note = `Failed to remove temp dir ${tmpDir} after server setup execution; it may still contain the SSH private key and db_root_password — manual cleanup of that directory is required.`;
571
+ if (result.success) {
572
+ return (0, types_1.errorResult)(note, result.data);
573
+ }
574
+ return (0, types_1.errorResult)(`${result.error} | ${note}`, result.data);
575
+ }
576
+ //# sourceMappingURL=server-setup-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-setup-runner.js","sourceRoot":"","sources":["../../src/server-setup/server-setup-runner.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAweH,wCAqKC;AA3oBD,iDAAwC;AACxC,2BAAmE;AACnE,uCAAwB;AACxB,2CAA4B;AAE5B,sCAAkC;AAClC,oCAA6K;AAC7K,oCAA0C;AAE1C,2DAA2D;AAI3D,0EAA0E;AAC1E,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IACtD,SAAS;IACT,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,SAAS;CACV,CAAC,CAAA;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,mBAAmB,GAAuE;IAC9F,OAAO,EAAE,IAAI,GAAG,EAAE;IAClB,MAAM,EAAE,IAAI,GAAG,EAAE;IACjB,UAAU,EAAE,IAAI,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACxC,QAAQ,EAAE,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IAClD,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,QAAQ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IAAI,EAAE,CAAC,CAAA;QAClD,CAAC;QAAC,OAAO,YAAY,EAAE,CAAC;YACtB,MAAM,OAAO,GAAG,IAAA,uBAAe,EAAC,YAAY,CAAC,CAAA;YAC7C,eAAM,CAAC,KAAK,CAAC,4CAA4C,MAAM,KAAK,OAAO,EAAE,CAAC,CAAA;YAC9E,MAAM,GAAG,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAC/C,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAS,oBAAoB,CAAC,MAAqB,EAAE,MAAc;IACjE,MAAM,IAAI,GAAG,6BAA6B,MAAM,8IAA8I,CAAA;IAC9L,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,IAAA,mBAAW,EAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;IACvC,CAAC;IACD,OAAO,IAAA,mBAAW,EAAC,GAAG,MAAM,CAAC,KAAK,MAAM,IAAI,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;AAC9D,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import type { ChatPayload } from './chat';
2
2
  import type { EcsLaunchPayload, EcsStopPayload } from './ecs';
3
- export type AgentCommandType = 'execute_command' | 'file_read' | 'file_write' | 'file_list' | 'file_rename' | 'file_delete' | 'file_mkdir' | 'process_list' | 'process_kill' | 'chat' | 'chat_cancel' | 'setup' | 'config_sync' | 'reboot' | 'update' | 'e2e_test' | 'e2e_script_fix' | 'sync_repository' | 'ecs_launch' | 'ecs_stop';
3
+ import type { ServerSetupExecPayload } from './server-setup';
4
+ export type AgentCommandType = 'execute_command' | 'file_read' | 'file_write' | 'file_list' | 'file_rename' | 'file_delete' | 'file_mkdir' | 'process_list' | 'process_kill' | 'chat' | 'chat_cancel' | 'setup' | 'config_sync' | 'reboot' | 'update' | 'e2e_test' | 'e2e_script_fix' | 'sync_repository' | 'ecs_launch' | 'ecs_stop' | 'server_setup_exec';
4
5
  export type AgentCommandStatus = 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'TIMEOUT';
5
6
  export interface AgentCommand {
6
7
  commandId: string;
@@ -143,5 +144,8 @@ export type CommandDispatch = {
143
144
  } | {
144
145
  type: 'ecs_stop';
145
146
  payload: EcsStopPayload;
147
+ } | {
148
+ type: 'server_setup_exec';
149
+ payload: ServerSetupExecPayload;
146
150
  };
147
151
  //# sourceMappingURL=command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/types/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE7D,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,WAAW,GACX,YAAY,GACZ,WAAW,GACX,aAAa,GACb,aAAa,GACb,YAAY,GACZ,cAAc,GACd,cAAc,GACd,MAAM,GACN,aAAa,GACb,OAAO,GACP,aAAa,GACb,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,gBAAgB,GAChB,iBAAiB,GACjB,YAAY,GACZ,UAAU,CAAA;AAEd,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,SAAS,GACT,WAAW,GACX,QAAQ,GACR,SAAS,CAAA;AAEb,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,gBAAgB,CAAA;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,MAAM,EAAE,kBAAkB,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,gBAAgB,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,MAA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AE,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAA;AACvE,CAAC"}
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/types/command.ts"],"names":[],"mappings":";;AAoDA,sCAEC;AAED,kCAEC;AAND,SAAgB,aAAa,CAAC,IAAa;IACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;AAChC,CAAC;AAED,SAAgB,WAAW,CAAC,KAAa,EAAE,IAAc;IACvD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAA;AACvE,CAAC"}
@@ -7,4 +7,5 @@ export * from './chat';
7
7
  export * from './alert';
8
8
  export * from './tool-output';
9
9
  export * from './ecs';
10
+ export * from './server-setup';
10
11
  //# sourceMappingURL=index.d.ts.map