@rosthq/cli 0.7.32 → 0.7.33

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.
@@ -0,0 +1,39 @@
1
+ export declare const MODEL_SPAWN_ENV_ALLOWLIST: readonly ["PATH", "HOME", "LANG", "LC_ALL", "TMPDIR", "SHELL", "NODE_OPTIONS"];
2
+ export declare function buildModelSpawnEnv(base: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
3
+ export type ForgeCredential = {
4
+ token: string;
5
+ expiresAt: string;
6
+ };
7
+ export type ForgeWorkspace = {
8
+ baseRepo: string;
9
+ worktreeDir: string;
10
+ branch: string;
11
+ readOnly: boolean;
12
+ baseSha: string;
13
+ };
14
+ export type ForgeWorkspaceProfile = "build" | "review";
15
+ export type PrepareForgeWorkspaceOptions = {
16
+ baseDir: string;
17
+ tenantId: string;
18
+ buildRequestId: string;
19
+ changeset: {
20
+ id: string;
21
+ ordinal: number;
22
+ total: number;
23
+ };
24
+ profile: ForgeWorkspaceProfile;
25
+ headSha?: string;
26
+ repo: {
27
+ owner: string;
28
+ name: string;
29
+ default_branch: string;
30
+ };
31
+ credential: ForgeCredential;
32
+ remoteUrl?: string;
33
+ };
34
+ export declare function prepareForgeWorkspace(options: PrepareForgeWorkspaceOptions): Promise<ForgeWorkspace>;
35
+ export declare function pushChangeset(ws: ForgeWorkspace, credential: ForgeCredential): Promise<{
36
+ commitSha: string;
37
+ } | null>;
38
+ export declare function removeWorkspace(ws: ForgeWorkspace): Promise<void>;
39
+ //# sourceMappingURL=forge-workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forge-workspace.d.ts","sourceRoot":"","sources":["../src/forge-workspace.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,yBAAyB,gFAQ5B,CAAC;AAEX,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAW7E;AAID,MAAM,MAAM,eA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) {
51670
51670
  }
51671
51671
 
51672
51672
  // src/runner-serve.ts
51673
- import { execFile as execFileCallback3, spawn } from "node:child_process";
51673
+ import { execFile as execFileCallback4, spawn } from "node:child_process";
51674
51674
  import { createHash } from "node:crypto";
51675
51675
  import { chmod, mkdir as mkdir2, readFile as readFile3, rename, rm as rm3, statfs, writeFile as writeFile2 } from "node:fs/promises";
51676
51676
  import { cpus, homedir as homedir2, hostname as hostname3, platform, totalmem, tmpdir } from "node:os";
51677
51677
  import path4 from "node:path";
51678
51678
  import { setTimeout as sleep2 } from "node:timers/promises";
51679
+ import { promisify as promisify4 } from "node:util";
51680
+
51681
+ // src/forge-workspace.ts
51682
+ import { execFile as execFileCallback3 } from "node:child_process";
51679
51683
  import { promisify as promisify3 } from "node:util";
51684
+ var execFile3 = promisify3(execFileCallback3);
51685
+ var MODEL_SPAWN_ENV_ALLOWLIST = [
51686
+ "PATH",
51687
+ "HOME",
51688
+ "LANG",
51689
+ "LC_ALL",
51690
+ "TMPDIR",
51691
+ "SHELL",
51692
+ "NODE_OPTIONS"
51693
+ ];
51694
+ function buildModelSpawnEnv(base) {
51695
+ const out = {};
51696
+ for (const key of MODEL_SPAWN_ENV_ALLOWLIST) {
51697
+ const value = base[key];
51698
+ if (typeof value === "string") {
51699
+ out[key] = value;
51700
+ }
51701
+ }
51702
+ return out;
51703
+ }
51704
+ var CLONE_TIMEOUT_MS = 10 * 6e4;
51705
+ var FETCH_TIMEOUT_MS = 5 * 6e4;
51706
+ var PUSH_TIMEOUT_MS = 5 * 6e4;
51707
+ var GIT_MAX_BUFFER = 64 * 1024 * 1024;
51708
+ var FORGE_GIT_AUTHOR_NAME = `${BRAND.name} ${RSF_ADDON_BRAND.shortName}`;
51709
+ var FORGE_GIT_AUTHOR_EMAIL = `${RSF_ADDON_BRAND.cliGroup}@${BRAND_DISTRIBUTION.cliBinName}.invalid`;
51680
51710
 
51681
51711
  // src/runner-sandbox.ts
51682
51712
  import { existsSync as existsSync2, realpathSync } from "node:fs";
@@ -51913,7 +51943,7 @@ async function sweepStaleRunnerTempFiles(dir, options = {}) {
51913
51943
  }
51914
51944
 
51915
51945
  // src/runner-serve.ts
51916
- var execFile3 = promisify3(execFileCallback3);
51946
+ var execFile4 = promisify4(execFileCallback4);
51917
51947
  var RUNNER_WORK_ORDER_TOOLS = [
51918
51948
  "mcp__rost__rost_get_context",
51919
51949
  "mcp__rost__rost_report_status",
@@ -52276,7 +52306,7 @@ async function detectCapabilities(cliVersion, env, homeDir) {
52276
52306
  }
52277
52307
  async function probe(command) {
52278
52308
  try {
52279
- const { stdout, stderr } = await execFile3(command, ["--version"], { timeout: 1500 });
52309
+ const { stdout, stderr } = await execFile4(command, ["--version"], { timeout: 1500 });
52280
52310
  return { installed: true, version: (stdout || stderr).trim() || null, auth_state: "ready" };
52281
52311
  } catch {
52282
52312
  return { installed: false, version: null, auth_state: "unknown" };
@@ -52284,7 +52314,7 @@ async function probe(command) {
52284
52314
  }
52285
52315
  async function probeGit() {
52286
52316
  try {
52287
- const { stdout, stderr } = await execFile3("git", ["--version"], { timeout: 1500 });
52317
+ const { stdout, stderr } = await execFile4("git", ["--version"], { timeout: 1500 });
52288
52318
  const raw = (stdout || stderr).trim();
52289
52319
  return { installed: true, version: /(\d+\.\d+(?:\.\d+)?)/.exec(raw)?.[1] ?? (raw || null) };
52290
52320
  } catch {
@@ -52293,7 +52323,7 @@ async function probeGit() {
52293
52323
  }
52294
52324
  async function probeGh() {
52295
52325
  try {
52296
- const { stdout, stderr } = await execFile3("gh", ["--version"], { timeout: 1500 });
52326
+ const { stdout, stderr } = await execFile4("gh", ["--version"], { timeout: 1500 });
52297
52327
  const raw = (stdout || stderr).trim().split("\n")[0]?.trim() ?? "";
52298
52328
  const authenticated = await probeGhAuth();
52299
52329
  return { installed: true, version: /(\d+\.\d+\.\d+)/.exec(raw)?.[1] ?? (raw || null), authenticated };
@@ -52303,7 +52333,7 @@ async function probeGh() {
52303
52333
  }
52304
52334
  async function probeGhAuth() {
52305
52335
  try {
52306
- await execFile3("gh", ["auth", "status"], { timeout: 1500 });
52336
+ await execFile4("gh", ["auth", "status"], { timeout: 1500 });
52307
52337
  return true;
52308
52338
  } catch {
52309
52339
  return false;
@@ -52515,6 +52545,7 @@ async function spawnRunnerTurn(appUrl2, workOrder, runtime, kind, sandbox, state
52515
52545
  };
52516
52546
  const child = spawn(command, args, {
52517
52547
  cwd: tmpdir(),
52548
+ env: buildModelSpawnEnv(process.env),
52518
52549
  stdio: ["ignore", "pipe", "pipe"]
52519
52550
  });
52520
52551
  let out = "";
@@ -52642,13 +52673,13 @@ function usage() {
52642
52673
  }
52643
52674
 
52644
52675
  // src/runner-service.ts
52645
- import { execFile as execFileCallback4 } from "node:child_process";
52676
+ import { execFile as execFileCallback5 } from "node:child_process";
52646
52677
  import { realpathSync as realpathSync2 } from "node:fs";
52647
52678
  import { access as access2, mkdir as mkdir3, readFile as readFile4, rm as rm4, writeFile as writeFile3 } from "node:fs/promises";
52648
52679
  import { homedir as homedir3 } from "node:os";
52649
52680
  import path5 from "node:path";
52650
- import { promisify as promisify4 } from "node:util";
52651
- var execFile4 = promisify4(execFileCallback4);
52681
+ import { promisify as promisify5 } from "node:util";
52682
+ var execFile5 = promisify5(execFileCallback5);
52652
52683
  var SERVICE_VERBS = ["install-service", "start", "stop", "restart", "status", "logs", "uninstall"];
52653
52684
  function isServiceVerb(value) {
52654
52685
  return value !== void 0 && SERVICE_VERBS.includes(value);
@@ -53207,7 +53238,7 @@ function escapePlist(value) {
53207
53238
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
53208
53239
  }
53209
53240
  var defaultExec = async (file2, args, options) => {
53210
- const result = await execFile4(file2, args, options?.env ? { env: options.env } : {});
53241
+ const result = await execFile5(file2, args, options?.env ? { env: options.env } : {});
53211
53242
  return { stdout: String(result.stdout), stderr: String(result.stderr) };
53212
53243
  };
53213
53244
  function assertNever2(value) {