@snappedly-tools/shipyard 0.7.0 → 0.9.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/README.md +46 -43
- package/dist/{MountConfig-bZoCs4Dd.d.ts → MountConfig-K5ILnfht.d.ts} +1 -1
- package/dist/SandboxProvider-oUAwYlWm.d.ts +120 -0
- package/dist/{chunk-FDYOTN55.js → chunk-57EEKW3R.js} +361 -984
- package/dist/chunk-57EEKW3R.js.map +1 -0
- package/dist/{chunk-56TDSWFU.js → chunk-HXSZM52J.js} +3 -3
- package/dist/{chunk-56TDSWFU.js.map → chunk-HXSZM52J.js.map} +1 -1
- package/dist/{chunk-WAXEMZUV.js → chunk-JZUBT4WG.js} +241 -33
- package/dist/chunk-JZUBT4WG.js.map +1 -0
- package/dist/chunk-NQRFVKCU.js +1840 -0
- package/dist/chunk-NQRFVKCU.js.map +1 -0
- package/dist/chunk-Z5C4LHVP.js +137 -0
- package/dist/chunk-Z5C4LHVP.js.map +1 -0
- package/dist/createSandbox-DmbnWAZv.d.ts +739 -0
- package/dist/index.d.ts +99 -2606
- package/dist/index.js +412 -7487
- package/dist/index.js.map +1 -1
- package/dist/integrations/github.d.ts +52 -0
- package/dist/integrations/github.js +1049 -0
- package/dist/integrations/github.js.map +1 -0
- package/dist/integrations/releases.d.ts +136 -0
- package/dist/integrations/releases.js +500 -0
- package/dist/integrations/releases.js.map +1 -0
- package/dist/main.js +826 -472
- package/dist/main.js.map +1 -1
- package/dist/publication-BPoy_M9M.d.ts +1200 -0
- package/dist/sandboxes/docker.d.ts +2 -3
- package/dist/sandboxes/docker.js +2 -4
- package/dist/templates/parallel-planner/main.mts +78 -16
- package/dist/templates/parallel-planner/planner-branch.mts +151 -0
- package/dist/templates/parallel-planner/setup.sh +1 -0
- package/dist/templates/parallel-planner-with-review/main.mts +81 -19
- package/dist/templates/parallel-planner-with-review/planner-branch.mts +151 -0
- package/dist/templates/parallel-planner-with-review/setup.sh +1 -0
- package/dist/templates/sequential-reviewer/main.mts +59 -6
- package/dist/templates/sequential-reviewer/setup.sh +1 -0
- package/dist/templates/shared/setup.sh +1 -0
- package/dist/templates/simple-loop/main.mts +58 -5
- package/dist/templates/simple-loop/setup.sh +1 -0
- package/dist/workflow/coordinator/migrations/002_workflow_phase_records.sql +11 -0
- package/dist/workflow/coordinator/migrations/003_phase_record_schema_version.sql +6 -0
- package/dist/workflow.d.ts +472 -0
- package/dist/workflow.js +4345 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +11 -15
- package/dist/SandboxProvider-XJQqEdSf.d.ts +0 -261
- package/dist/chunk-ACD46ZM4.js +0 -136
- package/dist/chunk-ACD46ZM4.js.map +0 -1
- package/dist/chunk-FDYOTN55.js.map +0 -1
- package/dist/chunk-KMGNFXKN.js +0 -38
- package/dist/chunk-KMGNFXKN.js.map +0 -1
- package/dist/chunk-SOJTAJTF.js +0 -78
- package/dist/chunk-SOJTAJTF.js.map +0 -1
- package/dist/chunk-WAXEMZUV.js.map +0 -1
- package/dist/sandboxes/no-sandbox.d.ts +0 -37
- package/dist/sandboxes/no-sandbox.js +0 -4
- package/dist/sandboxes/no-sandbox.js.map +0 -1
- package/dist/sandboxes/vercel.d.ts +0 -104
- package/dist/sandboxes/vercel.js +0 -166
- package/dist/sandboxes/vercel.js.map +0 -1
- package/dist/templates/blank/main.mts +0 -13
- package/dist/templates/blank/prompt.md +0 -12
- package/dist/templates/blank/template.json +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ErrorHandler.ts","../src/modelConfig.ts","../src/EnvResolver.ts","../src/LogRetention.ts"],"names":["Effect","join"],"mappings":";;;;;;AAQO,IAAM,kBAAA,GAAqB,CAAC,KAAA,KAAgC;AACjE,EAAA,QAAQ,MAAM,IAAA;AAAM,IAClB,KAAK,WAAA;AACH,MAAA,OAAO,CAAA,2BAAA,EAA8B,KAAA,CAAM,OAAO,CAAA,GAAA,EAAM,MAAM,OAAO,CAAA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AA;AAAA,MAC9B;AACA,MAAA;AAAA,IACF;AACA,IAAA,IAAI,CAAC,KAAA,CAAM,WAAA,EAAY,EAAG;AAC1B,IAAA,MAAM,aAAA,GAAgB,qBAAA,CAAsB,KAAA,CAAM,IAAI,CAAA;AACtD,IAAA,IAAI,kBAAkB,MAAA,EAAW;AACjC,IAAA,kBAAA,IAAsB,CAAA;AACtB,IAAA,IAAI,MAAA,KAAW,MAAA,IAAa,aAAA,IAAiB,MAAA,EAAQ;AAErD,IAAA,MAAM,GAAG,SAAA,EAAW,EAAE,WAAW,IAAA,EAAM,KAAA,EAAO,MAAM,CAAA;AACpD,IAAA,kBAAA,CAAmB,IAAA,CAAK,MAAM,IAAI,CAAA;AAAA,EACpC;AAEA,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,GAAI,aAAA,KAAkB,MAAA,GAAY,EAAC,GAAI,EAAE,eAAe,UAAA,EAAW;AAAA,IACnE,kBAAA;AAAA,IACA,YAAA,EAAc,kBAAA,CAAmB,MAAA,GAAS,YAAA,CAAa,MAAA;AAAA,IACvD,kBAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-56TDSWFU.js","sourcesContent":["import { Effect } from \"effect\";\nimport { Display } from \"./Display.js\";\nimport type { SandboxError } from \"./errors.js\";\n\n/**\n * Formats a tagged SandboxError into a user-friendly message with\n * context-specific hints about what went wrong and how to recover.\n */\nexport const formatErrorMessage = (error: SandboxError): string => {\n switch (error._tag) {\n case \"ExecError\":\n return `Command failed in sandbox (${error.command}): ${error.message}`;\n case \"ExecHostError\":\n return `Command failed on host (${error.command}): ${error.message}`;\n case \"CopyError\":\n return `File copy failed: ${error.message}`;\n case \"DockerError\":\n return `Docker operation failed: ${error.message}. Is Docker running?`;\n case \"SyncError\":\n return `Git sync failed: ${error.message}`;\n case \"WorktreeError\":\n return `Git worktree operation failed: ${error.message}`;\n case \"PromptError\":\n return `Failed to resolve prompt: ${error.message}`;\n case \"AgentError\":\n return `Agent invocation failed: ${error.message}`;\n case \"ConfigDirError\":\n return `${error.message}`;\n case \"InitError\":\n return `${error.message}`;\n case \"AgentIdleTimeoutError\":\n case \"WorktreeTimeoutError\":\n case \"ContainerStartTimeoutError\":\n case \"CopyToWorktreeTimeoutError\":\n case \"CopyToWorktreeError\":\n case \"SyncInTimeoutError\":\n case \"HookTimeoutError\":\n case \"GitSetupTimeoutError\":\n case \"PromptExpansionTimeoutError\":\n case \"CommitCollectionTimeoutError\":\n case \"MergeToHostTimeoutError\":\n case \"SessionCaptureError\":\n case \"CwdError\":\n return error.message;\n }\n};\n\nconst showErrorAndExit = (error: SandboxError) =>\n Effect.gen(function* () {\n const d = yield* Display;\n yield* d.status(formatErrorMessage(error), \"error\");\n return yield* Effect.sync(() => process.exit(1) as never);\n });\n\n/**\n * Wraps an effect so that any SandboxError is caught, displayed via the\n * Display service as an error-severity status message, then exits the process\n * with code 1. Non-SandboxError errors pass through unchanged.\n */\nexport const withFriendlyErrors = <A, E, R>(\n effect: Effect.Effect<A, E, R>,\n): Effect.Effect<A, Exclude<E, SandboxError>, R | Display> =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Effect.catchTags(effect as Effect.Effect<A, SandboxError, R>, {\n ExecError: showErrorAndExit,\n ExecHostError: showErrorAndExit,\n CopyError: showErrorAndExit,\n DockerError: showErrorAndExit,\n SyncError: showErrorAndExit,\n WorktreeError: showErrorAndExit,\n PromptError: showErrorAndExit,\n AgentError: showErrorAndExit,\n ConfigDirError: showErrorAndExit,\n InitError: showErrorAndExit,\n AgentIdleTimeoutError: showErrorAndExit,\n WorktreeTimeoutError: showErrorAndExit,\n ContainerStartTimeoutError: showErrorAndExit,\n CopyToWorktreeTimeoutError: showErrorAndExit,\n CopyToWorktreeError: showErrorAndExit,\n SyncInTimeoutError: showErrorAndExit,\n HookTimeoutError: showErrorAndExit,\n GitSetupTimeoutError: showErrorAndExit,\n PromptExpansionTimeoutError: showErrorAndExit,\n CommitCollectionTimeoutError: showErrorAndExit,\n MergeToHostTimeoutError: showErrorAndExit,\n SessionCaptureError: showErrorAndExit,\n CwdError: showErrorAndExit,\n }) as Effect.Effect<A, Exclude<E, SandboxError>, R | Display>;\n","/** Reasoning efforts accepted by the Codex CLI. */\nexport const CODEX_REASONING_EFFORTS = [\n \"low\",\n \"medium\",\n \"high\",\n \"xhigh\",\n \"max\",\n] as const;\n\nexport type CodexReasoningEffort = (typeof CODEX_REASONING_EFFORTS)[number];\n\n/** A model identifier plus the reasoning policy used for that model role. */\nexport interface CodexModelConfig {\n readonly model: string;\n readonly effort: CodexReasoningEffort;\n}\n\n/**\n * Default values for Shipyard's built-in Codex roles.\n *\n * Runtime environment variables override these defaults:\n * SHIPYARD_CODEX_ROUTINE_MODEL\n * SHIPYARD_CODEX_ROUTINE_REASONING_EFFORT\n * SHIPYARD_CODEX_STRONG_MODEL\n * SHIPYARD_CODEX_STRONG_REASONING_EFFORT\n *\n * Keep the defaults here so runtime providers, generated templates, and the\n * repository workflows all use the same role definitions.\n */\nconst DEFAULT_CODEX_MODELS = {\n routine: { model: \"gpt-5.6-luna\", effort: \"max\" },\n strong: { model: \"gpt-5.6-sol\", effort: \"max\" },\n} as const satisfies Record<string, CodexModelConfig>;\n\nconst readModel = (role: keyof typeof DEFAULT_CODEX_MODELS): string =>\n process.env[`SHIPYARD_CODEX_${role.toUpperCase()}_MODEL`]?.trim() ||\n DEFAULT_CODEX_MODELS[role].model;\n\nconst readEffort = (\n role: keyof typeof DEFAULT_CODEX_MODELS,\n): CodexReasoningEffort => {\n const envName = `SHIPYARD_CODEX_${role.toUpperCase()}_REASONING_EFFORT`;\n const value = process.env[envName]?.trim();\n if (!value) return DEFAULT_CODEX_MODELS[role].effort;\n if ((CODEX_REASONING_EFFORTS as readonly string[]).includes(value)) {\n return value as CodexReasoningEffort;\n }\n throw new Error(\n `${envName} must be one of ${CODEX_REASONING_EFFORTS.join(\", \")}; received \"${value}\"`,\n );\n};\n\nexport const CODEX_MODELS = {\n routine: {\n model: readModel(\"routine\"),\n effort: readEffort(\"routine\"),\n },\n strong: {\n model: readModel(\"strong\"),\n effort: readEffort(\"strong\"),\n },\n} as const satisfies Record<string, CodexModelConfig>;\n","import { FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\nimport { join } from \"node:path\";\n\nimport { ConfigDirError } from \"./errors.js\";\nimport { assertNoSymlinkComponents } from \"./pathSecurity.js\";\nimport { CONFIG_DIR } from \"./runtimeNames.js\";\n\nconst parseEnvFile = (\n filePath: string,\n): Effect.Effect<Record<string, string>, never, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const symlink = yield* fs.readLink(filePath).pipe(\n Effect.map(() => true),\n Effect.catchAll(() => Effect.succeed(false)),\n );\n // A repository-controlled symlink could redirect this read to a host\n // secret and then expose matching keys to the agent.\n if (symlink) return {};\n const content = yield* fs\n .readFileString(filePath)\n .pipe(Effect.catchAll(() => Effect.succeed(null)));\n if (content === null) return {};\n const vars: Record<string, string> = {};\n for (const line of content.split(\"\\n\")) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith(\"#\")) continue;\n const eqIndex = trimmed.indexOf(\"=\");\n if (eqIndex === -1) continue;\n const key = trimmed.slice(0, eqIndex).trim();\n let value = trimmed.slice(eqIndex + 1).trim();\n const isDoubleQuoted =\n value.length >= 2 &&\n value[0] === '\"' &&\n value[value.length - 1] === '\"';\n const isSingleQuoted =\n value.length >= 2 &&\n value[0] === \"'\" &&\n value[value.length - 1] === \"'\";\n if (isDoubleQuoted || isSingleQuoted) {\n value = value.slice(1, -1);\n }\n if (isDoubleQuoted) {\n value = value.replace(/\\\\([nrt\\\\])/g, (_, ch: string) => {\n const escapes: Record<string, string> = {\n n: \"\\n\",\n r: \"\\r\",\n t: \"\\t\",\n \"\\\\\": \"\\\\\",\n };\n return escapes[ch] ?? ch;\n });\n }\n vars[key] = value;\n }\n return vars;\n });\n\n/**\n * Resolve all env vars from .env files with process.env fallback.\n *\n * Precedence: .shipyard/.env > process.env\n * Only keys declared in .shipyard/.env are resolved from process.env.\n * Repo root .env is not part of the resolution chain.\n */\nexport const resolveEnv = (\n repoDir: string,\n): Effect.Effect<\n Record<string, string>,\n ConfigDirError,\n FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const configDir = join(repoDir, CONFIG_DIR);\n const envPath = join(configDir, \".env\");\n yield* Effect.tryPromise({\n try: () =>\n assertNoSymlinkComponents(repoDir, envPath, \"environment file\"),\n catch: (e) =>\n new ConfigDirError({\n message: `Refusing symlinked environment path: ${e instanceof Error ? e.message : String(e)}`,\n }),\n });\n const shipyardEnv = yield* parseEnvFile(envPath);\n\n const result: Record<string, string> = {};\n for (const key of Object.keys(shipyardEnv)) {\n // A blank placeholder falls back to process.env, so callers can source\n // credentials from a host login for one invocation, e.g.\n // `GH_TOKEN=\"$(gh auth token)\" npx shipyard run`. Only keys declared in\n // .shipyard/.env are eligible for this fallback.\n const value = shipyardEnv[key] || process.env[key];\n if (value) {\n result[key] = value;\n }\n }\n\n return result;\n });\n","import { lstat, readdir, rm } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { CONFIG_DIR, LOGS_DIR } from \"./runtimeNames.js\";\n\n/** The default age threshold for automatic run-log purges. */\nexport const DEFAULT_LOG_RETENTION_DAYS = 8;\n\nconst LOG_DIRECTORY_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\n/** Build the local calendar date directory used for default run logs. */\nexport const buildLogDirectoryName = (date: Date = new Date()): string => {\n if (Number.isNaN(date.getTime())) {\n throw new Error(\"Cannot build a log directory name from an invalid date.\");\n }\n const pad = (value: number): string => String(value).padStart(2, \"0\");\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n};\n\nconst parseLogDirectoryDate = (name: string): Date | undefined => {\n const match = LOG_DIRECTORY_PATTERN.exec(name);\n if (!match) return undefined;\n\n const year = Number(match[1]);\n const month = Number(match[2]);\n const day = Number(match[3]);\n const date = new Date(year, month - 1, day);\n return date.getFullYear() === year &&\n date.getMonth() === month - 1 &&\n date.getDate() === day\n ? date\n : undefined;\n};\n\nconst validateRetentionDays = (retentionDays: number): void => {\n if (!Number.isSafeInteger(retentionDays) || retentionDays < 0) {\n throw new Error(\"Log retention days must be a non-negative integer.\");\n }\n};\n\nexport interface PurgeRunLogsOptions {\n /** Host repository containing `.shipyard/logs/`. */\n readonly repoDir: string;\n /** Remove run logs strictly older than this many calendar days. Omit to remove every default run log. */\n readonly retentionDays?: number;\n /** Local time used to calculate the cutoff. Primarily useful for tests. */\n readonly now?: Date;\n}\n\nexport interface PurgeRunLogsResult {\n readonly logsDir: string;\n readonly retentionDays?: number;\n /** Dated directories on or after this local date are retained when age-based purging is used. */\n readonly cutoffDate?: string;\n readonly scannedDirectories: number;\n readonly removedCount: number;\n /** Directory names removed from `logsDir`, without the parent path. */\n readonly removedDirectories: readonly string[];\n /** Root-level log filenames removed from `logsDir`. */\n readonly removedFiles: readonly string[];\n}\n\n/**\n * Remove default run logs, either all of them or only those older than an\n * explicit retention threshold.\n *\n * Dated default run-log directories and regular root-level `.log` files inside\n * the managed logs directory are considered. Other files, malformed directory\n * names, and symlink entries are left alone.\n */\nexport const purgeRunLogs = async (\n options: PurgeRunLogsOptions,\n): Promise<PurgeRunLogsResult> => {\n const retentionDays = options.retentionDays;\n if (retentionDays !== undefined) validateRetentionDays(retentionDays);\n\n const now = options.now ?? new Date();\n if (retentionDays !== undefined && Number.isNaN(now.getTime())) {\n throw new Error(\"Cannot purge logs using an invalid date.\");\n }\n const cutoff =\n retentionDays === undefined\n ? undefined\n : new Date(\n now.getFullYear(),\n now.getMonth(),\n now.getDate() - retentionDays,\n );\n const cutoffDate =\n cutoff === undefined ? undefined : buildLogDirectoryName(cutoff);\n const logsDir = join(options.repoDir, CONFIG_DIR, LOGS_DIR);\n\n let entries;\n try {\n entries = await readdir(logsDir, { withFileTypes: true });\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\") {\n return {\n logsDir,\n ...(retentionDays === undefined ? {} : { retentionDays, cutoffDate }),\n scannedDirectories: 0,\n removedCount: 0,\n removedDirectories: [],\n removedFiles: [],\n };\n }\n throw error;\n }\n\n const removedDirectories: string[] = [];\n const removedFiles: string[] = [];\n let scannedDirectories = 0;\n for (const entry of entries) {\n const entryPath = join(logsDir, entry.name);\n if (entry.isFile() && entry.name.endsWith(\".log\")) {\n const file = await lstat(entryPath);\n if (file.isFile() && (cutoff === undefined || file.mtime < cutoff)) {\n await rm(entryPath, { force: true });\n removedFiles.push(entry.name);\n }\n continue;\n }\n if (!entry.isDirectory()) continue;\n const directoryDate = parseLogDirectoryDate(entry.name);\n if (directoryDate === undefined) continue;\n scannedDirectories += 1;\n if (cutoff !== undefined && directoryDate >= cutoff) continue;\n\n await rm(entryPath, { recursive: true, force: true });\n removedDirectories.push(entry.name);\n }\n\n return {\n logsDir,\n ...(retentionDays === undefined ? {} : { retentionDays, cutoffDate }),\n scannedDirectories,\n removedCount: removedDirectories.length + removedFiles.length,\n removedDirectories,\n removedFiles,\n };\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/ErrorHandler.ts","../src/modelConfig.ts","../src/EnvResolver.ts","../src/LogRetention.ts"],"names":["Effect","join"],"mappings":";;;;;;AAQO,IAAM,kBAAA,GAAqB,CAAC,KAAA,KAAgC;AACjE,EAAA,QAAQ,MAAM,IAAA;AAAM,IAClB,KAAK,WAAA;AACH,MAAA,OAAO,CAAA,2BAAA,EAA8B,KAAA,CAAM,OAAO,CAAA,GAAA,EAAM,MAAM,OAAO,CAAA,CAAA;AAAA,IACvE,KAAK,eAAA;AACH,MAAA,OAAO,CAAA,wBAAA,EAA2B,KAAA,CAAM,OAAO,CAAA,GAAA,EAAM,MAAM,OAAO,CAAA,CAAA;AAAA,IACpE,KAAK,WAAA;AACH,MAAA,OAAO,CAAA,kBAAA,EAAqB,MAAM,OAAO,CAAA,CAAA;AAAA,IAC3C,KAAK,aAAA;AACH,MAAA,OAAO,CAAA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W,MAAA,IAAa,aAAA,IAAiB,MAAA,EAAQ;AAErD,IAAA,MAAM,GAAG,SAAA,EAAW,EAAE,WAAW,IAAA,EAAM,KAAA,EAAO,MAAM,CAAA;AACpD,IAAA,kBAAA,CAAmB,IAAA,CAAK,MAAM,IAAI,CAAA;AAAA,EACpC;AAEA,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,GAAI,aAAA,KAAkB,MAAA,GAAY,EAAC,GAAI,EAAE,eAAe,UAAA,EAAW;AAAA,IACnE,kBAAA;AAAA,IACA,YAAA,EAAc,kBAAA,CAAmB,MAAA,GAAS,YAAA,CAAa,MAAA;AAAA,IACvD,kBAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-HXSZM52J.js","sourcesContent":["import { Effect } from \"effect\";\nimport { Display } from \"./Display.js\";\nimport type { SandboxError } from \"./errors.js\";\n\n/**\n * Formats a tagged SandboxError into a user-friendly message with\n * context-specific hints about what went wrong and how to recover.\n */\nexport const formatErrorMessage = (error: SandboxError): string => {\n switch (error._tag) {\n case \"ExecError\":\n return `Command failed in sandbox (${error.command}): ${error.message}`;\n case \"ExecHostError\":\n return `Command failed on host (${error.command}): ${error.message}`;\n case \"CopyError\":\n return `File copy failed: ${error.message}`;\n case \"DockerError\":\n return `Docker operation failed: ${error.message}. Is Docker running?`;\n case \"SyncError\":\n return `Git sync failed: ${error.message}`;\n case \"WorktreeError\":\n return `Git worktree operation failed: ${error.message}`;\n case \"PromptError\":\n return `Failed to resolve prompt: ${error.message}`;\n case \"AgentError\":\n return `Agent invocation failed: ${error.message}`;\n case \"ConfigDirError\":\n return `${error.message}`;\n case \"InitError\":\n return `${error.message}`;\n case \"AgentIdleTimeoutError\":\n case \"WorktreeTimeoutError\":\n case \"ContainerStartTimeoutError\":\n case \"CopyToWorktreeTimeoutError\":\n case \"CopyToWorktreeError\":\n case \"SyncInTimeoutError\":\n case \"HookTimeoutError\":\n case \"GitSetupTimeoutError\":\n case \"PromptExpansionTimeoutError\":\n case \"CommitCollectionTimeoutError\":\n case \"MergeToHostTimeoutError\":\n case \"SessionCaptureError\":\n case \"CwdError\":\n return error.message;\n }\n};\n\nconst showErrorAndExit = (error: SandboxError) =>\n Effect.gen(function* () {\n const d = yield* Display;\n yield* d.status(formatErrorMessage(error), \"error\");\n return yield* Effect.sync(() => process.exit(1) as never);\n });\n\n/**\n * Wraps an effect so that any SandboxError is caught, displayed via the\n * Display service as an error-severity status message, then exits the process\n * with code 1. Non-SandboxError errors pass through unchanged.\n */\nexport const withFriendlyErrors = <A, E, R>(\n effect: Effect.Effect<A, E, R>,\n): Effect.Effect<A, Exclude<E, SandboxError>, R | Display> =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Effect.catchTags(effect as Effect.Effect<A, SandboxError, R>, {\n ExecError: showErrorAndExit,\n ExecHostError: showErrorAndExit,\n CopyError: showErrorAndExit,\n DockerError: showErrorAndExit,\n SyncError: showErrorAndExit,\n WorktreeError: showErrorAndExit,\n PromptError: showErrorAndExit,\n AgentError: showErrorAndExit,\n ConfigDirError: showErrorAndExit,\n InitError: showErrorAndExit,\n AgentIdleTimeoutError: showErrorAndExit,\n WorktreeTimeoutError: showErrorAndExit,\n ContainerStartTimeoutError: showErrorAndExit,\n CopyToWorktreeTimeoutError: showErrorAndExit,\n CopyToWorktreeError: showErrorAndExit,\n SyncInTimeoutError: showErrorAndExit,\n HookTimeoutError: showErrorAndExit,\n GitSetupTimeoutError: showErrorAndExit,\n PromptExpansionTimeoutError: showErrorAndExit,\n CommitCollectionTimeoutError: showErrorAndExit,\n MergeToHostTimeoutError: showErrorAndExit,\n SessionCaptureError: showErrorAndExit,\n CwdError: showErrorAndExit,\n }) as Effect.Effect<A, Exclude<E, SandboxError>, R | Display>;\n","/** Reasoning efforts accepted by the Codex CLI. */\nexport const CODEX_REASONING_EFFORTS = [\n \"low\",\n \"medium\",\n \"high\",\n \"xhigh\",\n \"max\",\n] as const;\n\nexport type CodexReasoningEffort = (typeof CODEX_REASONING_EFFORTS)[number];\n\n/** A model identifier plus the reasoning policy used for that model role. */\nexport interface CodexModelConfig {\n readonly model: string;\n readonly effort: CodexReasoningEffort;\n}\n\n/**\n * Default values for Shipyard's built-in Codex roles.\n *\n * Runtime environment variables override these defaults:\n * SHIPYARD_CODEX_ROUTINE_MODEL\n * SHIPYARD_CODEX_ROUTINE_REASONING_EFFORT\n * SHIPYARD_CODEX_STRONG_MODEL\n * SHIPYARD_CODEX_STRONG_REASONING_EFFORT\n *\n * Keep the defaults here so runtime providers, generated templates, and the\n * repository workflows all use the same role definitions.\n */\nconst DEFAULT_CODEX_MODELS = {\n routine: { model: \"gpt-5.6-luna\", effort: \"max\" },\n strong: { model: \"gpt-5.6-sol\", effort: \"max\" },\n} as const satisfies Record<string, CodexModelConfig>;\n\nconst readModel = (role: keyof typeof DEFAULT_CODEX_MODELS): string =>\n process.env[`SHIPYARD_CODEX_${role.toUpperCase()}_MODEL`]?.trim() ||\n DEFAULT_CODEX_MODELS[role].model;\n\nconst readEffort = (\n role: keyof typeof DEFAULT_CODEX_MODELS,\n): CodexReasoningEffort => {\n const envName = `SHIPYARD_CODEX_${role.toUpperCase()}_REASONING_EFFORT`;\n const value = process.env[envName]?.trim();\n if (!value) return DEFAULT_CODEX_MODELS[role].effort;\n if ((CODEX_REASONING_EFFORTS as readonly string[]).includes(value)) {\n return value as CodexReasoningEffort;\n }\n throw new Error(\n `${envName} must be one of ${CODEX_REASONING_EFFORTS.join(\", \")}; received \"${value}\"`,\n );\n};\n\nexport const CODEX_MODELS = {\n routine: {\n model: readModel(\"routine\"),\n effort: readEffort(\"routine\"),\n },\n strong: {\n model: readModel(\"strong\"),\n effort: readEffort(\"strong\"),\n },\n} as const satisfies Record<string, CodexModelConfig>;\n","import { FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\nimport { join } from \"node:path\";\n\nimport { ConfigDirError } from \"./errors.js\";\nimport { assertNoSymlinkComponents } from \"./pathSecurity.js\";\nimport { CONFIG_DIR } from \"./runtimeNames.js\";\n\nconst parseEnvFile = (\n filePath: string,\n): Effect.Effect<Record<string, string>, never, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const symlink = yield* fs.readLink(filePath).pipe(\n Effect.map(() => true),\n Effect.catchAll(() => Effect.succeed(false)),\n );\n // A repository-controlled symlink could redirect this read to a host\n // secret and then expose matching keys to the agent.\n if (symlink) return {};\n const content = yield* fs\n .readFileString(filePath)\n .pipe(Effect.catchAll(() => Effect.succeed(null)));\n if (content === null) return {};\n const vars: Record<string, string> = {};\n for (const line of content.split(\"\\n\")) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith(\"#\")) continue;\n const eqIndex = trimmed.indexOf(\"=\");\n if (eqIndex === -1) continue;\n const key = trimmed.slice(0, eqIndex).trim();\n let value = trimmed.slice(eqIndex + 1).trim();\n const isDoubleQuoted =\n value.length >= 2 &&\n value[0] === '\"' &&\n value[value.length - 1] === '\"';\n const isSingleQuoted =\n value.length >= 2 &&\n value[0] === \"'\" &&\n value[value.length - 1] === \"'\";\n if (isDoubleQuoted || isSingleQuoted) {\n value = value.slice(1, -1);\n }\n if (isDoubleQuoted) {\n value = value.replace(/\\\\([nrt\\\\])/g, (_, ch: string) => {\n const escapes: Record<string, string> = {\n n: \"\\n\",\n r: \"\\r\",\n t: \"\\t\",\n \"\\\\\": \"\\\\\",\n };\n return escapes[ch] ?? ch;\n });\n }\n vars[key] = value;\n }\n return vars;\n });\n\n/**\n * Resolve all env vars from .env files with process.env fallback.\n *\n * Precedence: .shipyard/.env > process.env\n * Only keys declared in .shipyard/.env are resolved from process.env.\n * Repo root .env is not part of the resolution chain.\n */\nexport const resolveEnv = (\n repoDir: string,\n): Effect.Effect<\n Record<string, string>,\n ConfigDirError,\n FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const configDir = join(repoDir, CONFIG_DIR);\n const envPath = join(configDir, \".env\");\n yield* Effect.tryPromise({\n try: () =>\n assertNoSymlinkComponents(repoDir, envPath, \"environment file\"),\n catch: (e) =>\n new ConfigDirError({\n message: `Refusing symlinked environment path: ${e instanceof Error ? e.message : String(e)}`,\n }),\n });\n const shipyardEnv = yield* parseEnvFile(envPath);\n\n const result: Record<string, string> = {};\n for (const key of Object.keys(shipyardEnv)) {\n // A blank placeholder falls back to process.env, so callers can source\n // credentials from a host login for one invocation, e.g.\n // `GH_TOKEN=\"$(gh auth token)\" npx shipyard run`. Only keys declared in\n // .shipyard/.env are eligible for this fallback.\n const value = shipyardEnv[key] || process.env[key];\n if (value) {\n result[key] = value;\n }\n }\n\n return result;\n });\n","import { lstat, readdir, rm } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { CONFIG_DIR, LOGS_DIR } from \"./runtimeNames.js\";\n\n/** The default age threshold for automatic run-log purges. */\nexport const DEFAULT_LOG_RETENTION_DAYS = 8;\n\nconst LOG_DIRECTORY_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\n/** Build the local calendar date directory used for default run logs. */\nexport const buildLogDirectoryName = (date: Date = new Date()): string => {\n if (Number.isNaN(date.getTime())) {\n throw new Error(\"Cannot build a log directory name from an invalid date.\");\n }\n const pad = (value: number): string => String(value).padStart(2, \"0\");\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n};\n\nconst parseLogDirectoryDate = (name: string): Date | undefined => {\n const match = LOG_DIRECTORY_PATTERN.exec(name);\n if (!match) return undefined;\n\n const year = Number(match[1]);\n const month = Number(match[2]);\n const day = Number(match[3]);\n const date = new Date(year, month - 1, day);\n return date.getFullYear() === year &&\n date.getMonth() === month - 1 &&\n date.getDate() === day\n ? date\n : undefined;\n};\n\nconst validateRetentionDays = (retentionDays: number): void => {\n if (!Number.isSafeInteger(retentionDays) || retentionDays < 0) {\n throw new Error(\"Log retention days must be a non-negative integer.\");\n }\n};\n\nexport interface PurgeRunLogsOptions {\n /** Host repository containing `.shipyard/logs/`. */\n readonly repoDir: string;\n /** Remove run logs strictly older than this many calendar days. Omit to remove every default run log. */\n readonly retentionDays?: number;\n /** Local time used to calculate the cutoff. Primarily useful for tests. */\n readonly now?: Date;\n}\n\nexport interface PurgeRunLogsResult {\n readonly logsDir: string;\n readonly retentionDays?: number;\n /** Dated directories on or after this local date are retained when age-based purging is used. */\n readonly cutoffDate?: string;\n readonly scannedDirectories: number;\n readonly removedCount: number;\n /** Directory names removed from `logsDir`, without the parent path. */\n readonly removedDirectories: readonly string[];\n /** Root-level log filenames removed from `logsDir`. */\n readonly removedFiles: readonly string[];\n}\n\n/**\n * Remove default run logs, either all of them or only those older than an\n * explicit retention threshold.\n *\n * Dated default run-log directories and regular root-level `.log` files inside\n * the managed logs directory are considered. Other files, malformed directory\n * names, and symlink entries are left alone.\n */\nexport const purgeRunLogs = async (\n options: PurgeRunLogsOptions,\n): Promise<PurgeRunLogsResult> => {\n const retentionDays = options.retentionDays;\n if (retentionDays !== undefined) validateRetentionDays(retentionDays);\n\n const now = options.now ?? new Date();\n if (retentionDays !== undefined && Number.isNaN(now.getTime())) {\n throw new Error(\"Cannot purge logs using an invalid date.\");\n }\n const cutoff =\n retentionDays === undefined\n ? undefined\n : new Date(\n now.getFullYear(),\n now.getMonth(),\n now.getDate() - retentionDays,\n );\n const cutoffDate =\n cutoff === undefined ? undefined : buildLogDirectoryName(cutoff);\n const logsDir = join(options.repoDir, CONFIG_DIR, LOGS_DIR);\n\n let entries;\n try {\n entries = await readdir(logsDir, { withFileTypes: true });\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\") {\n return {\n logsDir,\n ...(retentionDays === undefined ? {} : { retentionDays, cutoffDate }),\n scannedDirectories: 0,\n removedCount: 0,\n removedDirectories: [],\n removedFiles: [],\n };\n }\n throw error;\n }\n\n const removedDirectories: string[] = [];\n const removedFiles: string[] = [];\n let scannedDirectories = 0;\n for (const entry of entries) {\n const entryPath = join(logsDir, entry.name);\n if (entry.isFile() && entry.name.endsWith(\".log\")) {\n const file = await lstat(entryPath);\n if (file.isFile() && (cutoff === undefined || file.mtime < cutoff)) {\n await rm(entryPath, { force: true });\n removedFiles.push(entry.name);\n }\n continue;\n }\n if (!entry.isDirectory()) continue;\n const directoryDate = parseLogDirectoryDate(entry.name);\n if (directoryDate === undefined) continue;\n scannedDirectories += 1;\n if (cutoff !== undefined && directoryDate >= cutoff) continue;\n\n await rm(entryPath, { recursive: true, force: true });\n removedDirectories.push(entry.name);\n }\n\n return {\n logsDir,\n ...(retentionDays === undefined ? {} : { retentionDays, cutoffDate }),\n scannedDirectories,\n removedCount: removedDirectories.length + removedFiles.length,\n removedDirectories,\n removedFiles,\n };\n};\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { assertProtectedDirectoryIdentities, ACTIVATION_LABEL, CONFIG_DIR, RUNNER_DIR,
|
|
2
|
-
import { createIsolatedSandboxProvider } from './chunk-KMGNFXKN.js';
|
|
3
|
-
import { MAX_TAIL_CHARS, collectProcessOutput } from './chunk-ACD46ZM4.js';
|
|
1
|
+
import { RUNTIME_NAMESPACE, assertProtectedDirectoryIdentities, ACTIVATION_LABEL, CONFIG_DIR, RUNNER_DIR, createIsolatedSandboxProvider, registerShutdown, DockerError, repositoryRunnerEnvironment, SANDBOX_REPO_DIR } from './chunk-57EEKW3R.js';
|
|
4
2
|
import { execFile, execFileSync, spawn } from 'child_process';
|
|
5
|
-
import { resolve, join, posix } from 'path';
|
|
3
|
+
import { resolve, join, posix, dirname, relative, isAbsolute } from 'path';
|
|
6
4
|
import { promisify } from 'util';
|
|
7
5
|
import { randomUUID } from 'crypto';
|
|
8
6
|
import { Effect } from 'effect';
|
|
9
|
-
import { constants } from 'fs';
|
|
7
|
+
import { constants, existsSync, statSync } from 'fs';
|
|
8
|
+
import { homedir } from 'os';
|
|
9
|
+
import { createInterface } from 'readline';
|
|
10
10
|
import { rm, lstat, realpath, mkdir, readFile, access } from 'fs/promises';
|
|
11
11
|
|
|
12
12
|
var exec = promisify(execFile);
|
|
@@ -38,6 +38,79 @@ var copyIntoContainer = async (engine, container, owner, hostPath, sandboxPath)
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
+
var defaultImageName = (repoDir) => {
|
|
42
|
+
const dirName = repoDir.replace(/[\\/]+$/, "").split(/[\\/]/).pop() ?? "local";
|
|
43
|
+
const sanitized = dirName.toLowerCase().replace(/[^a-z0-9_.-]/g, "-");
|
|
44
|
+
return `${RUNTIME_NAMESPACE}:${sanitized || "local"}`;
|
|
45
|
+
};
|
|
46
|
+
var expandTilde = (p, homeDirPath) => {
|
|
47
|
+
const home = homeDirPath ?? homedir();
|
|
48
|
+
if (p === "~") return home;
|
|
49
|
+
if (p.startsWith("~/") || p.startsWith("~\\")) return home + "/" + p.slice(2);
|
|
50
|
+
return p;
|
|
51
|
+
};
|
|
52
|
+
var resolveHostPath = (hostPath) => {
|
|
53
|
+
const expanded = expandTilde(hostPath);
|
|
54
|
+
return isAbsolute(expanded) ? expanded : resolve(process.cwd(), expanded);
|
|
55
|
+
};
|
|
56
|
+
var resolveSandboxPath = (sandboxPath, sandboxHomedir) => {
|
|
57
|
+
const hasTilde = sandboxPath === "~" || sandboxPath.startsWith("~/") || sandboxPath.startsWith("~\\");
|
|
58
|
+
const expanded = hasTilde ? expandTilde(sandboxPath, sandboxHomedir) : sandboxPath;
|
|
59
|
+
return isAbsolute(expanded) ? resolve(expanded) : resolve(SANDBOX_REPO_DIR, expanded);
|
|
60
|
+
};
|
|
61
|
+
var resolveUserMounts = (mounts, sandboxHomedir) => mounts.map((m) => {
|
|
62
|
+
const resolvedHostPath = resolveHostPath(m.hostPath);
|
|
63
|
+
if (!existsSync(resolvedHostPath)) {
|
|
64
|
+
throw new Error(
|
|
65
|
+
`Mount hostPath does not exist: ${m.hostPath}` + (m.hostPath !== resolvedHostPath ? ` (resolved to ${resolvedHostPath})` : "")
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
hostPath: resolvedHostPath,
|
|
70
|
+
sandboxPath: resolveSandboxPath(m.sandboxPath, sandboxHomedir),
|
|
71
|
+
...m.readonly ? { readonly: true } : {}
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
var formatVolumeMount = (mount, selinuxLabel) => {
|
|
75
|
+
const base = `${mount.hostPath}:${mount.sandboxPath}`;
|
|
76
|
+
const options = [mount.readonly ? "ro" : void 0, selinuxLabel || void 0].filter((option) => option !== void 0).join(",");
|
|
77
|
+
return options ? `${base}:${options}` : base;
|
|
78
|
+
};
|
|
79
|
+
var processFileMountParents = (mounts, sandboxHomedir, statFn = statSync) => {
|
|
80
|
+
const parentDirs = /* @__PURE__ */ new Set();
|
|
81
|
+
for (const mount of mounts) {
|
|
82
|
+
let isFile;
|
|
83
|
+
try {
|
|
84
|
+
isFile = statFn(mount.hostPath).isFile();
|
|
85
|
+
} catch {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (!isFile) continue;
|
|
89
|
+
const parentDir = resolve(dirname(mount.sandboxPath));
|
|
90
|
+
const homeDir = resolve(sandboxHomedir);
|
|
91
|
+
if (parentDir === homeDir) continue;
|
|
92
|
+
const fromHome = relative(homeDir, parentDir);
|
|
93
|
+
if (fromHome === ".." || fromHome.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) || isAbsolute(fromHome)) {
|
|
94
|
+
throw new Error(
|
|
95
|
+
`Cannot mount file to '${mount.sandboxPath}': parent directory '${parentDir}' is outside the sandbox home directory ('${homeDir}'). Mount the parent directory instead, or rebuild the image with '${parentDir}' pre-created.`
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
parentDirs.add(parentDir);
|
|
99
|
+
}
|
|
100
|
+
return [...parentDirs];
|
|
101
|
+
};
|
|
102
|
+
var assertIsolatedWorkspaceMounts = (mounts) => {
|
|
103
|
+
for (const mount of mounts) {
|
|
104
|
+
const path = posix.resolve(mount.sandboxPath);
|
|
105
|
+
if (path === "/" || path === SANDBOX_REPO_DIR || path.startsWith(`${SANDBOX_REPO_DIR}/`) || SANDBOX_REPO_DIR.startsWith(`${path}/`)) {
|
|
106
|
+
throw new Error(
|
|
107
|
+
`Mount overlaps the isolated workspace: ${mount.sandboxPath}. Mount outside ${SANDBOX_REPO_DIR} or use copyToWorktree.`
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// src/DockerLifecycle.ts
|
|
41
114
|
var dockerExec = (args) => Effect.async((resume) => {
|
|
42
115
|
execFile(
|
|
43
116
|
"docker",
|
|
@@ -148,6 +221,137 @@ var removeContainer = (containerName) => Effect.gen(function* () {
|
|
|
148
221
|
var removeImage = (imageName) => Effect.gen(function* () {
|
|
149
222
|
yield* dockerExec(["rmi", imageName]);
|
|
150
223
|
});
|
|
224
|
+
|
|
225
|
+
// src/boundedTail.ts
|
|
226
|
+
var MAX_TAIL_CHARS = 64 * 1024;
|
|
227
|
+
var OutputByteCounter = class {
|
|
228
|
+
constructor(maxBytes) {
|
|
229
|
+
this.maxBytes = maxBytes;
|
|
230
|
+
}
|
|
231
|
+
totalBytes = 0;
|
|
232
|
+
limitExceeded = false;
|
|
233
|
+
add(chunk) {
|
|
234
|
+
this.totalBytes += typeof chunk === "string" ? Buffer.byteLength(chunk) : chunk.byteLength;
|
|
235
|
+
if (this.totalBytes > this.maxBytes) this.limitExceeded = true;
|
|
236
|
+
}
|
|
237
|
+
get exceeded() {
|
|
238
|
+
return this.limitExceeded;
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
var BoundedTail = class {
|
|
242
|
+
items = [];
|
|
243
|
+
totalChars = 0;
|
|
244
|
+
maxChars;
|
|
245
|
+
separator;
|
|
246
|
+
/**
|
|
247
|
+
* @param maxChars Maximum length of the joined tail. Defaults to {@link MAX_TAIL_CHARS}.
|
|
248
|
+
* @param separator String placed between items by {@link toString}. Must match
|
|
249
|
+
* how the caller would otherwise have joined the accumulated chunks (e.g.
|
|
250
|
+
* `"\n"` for line streams, `""` for raw chunk streams).
|
|
251
|
+
*/
|
|
252
|
+
constructor(maxChars = MAX_TAIL_CHARS, separator = "") {
|
|
253
|
+
this.maxChars = maxChars;
|
|
254
|
+
this.separator = separator;
|
|
255
|
+
}
|
|
256
|
+
/** Append one item to the tail, evicting oldest items to stay within budget. */
|
|
257
|
+
push(item) {
|
|
258
|
+
const bounded = item.length > this.maxChars ? item.slice(item.length - this.maxChars) : item;
|
|
259
|
+
this.totalChars += bounded.length + (this.items.length > 0 ? this.separator.length : 0);
|
|
260
|
+
this.items.push(bounded);
|
|
261
|
+
while (this.totalChars > this.maxChars && this.items.length > 1) {
|
|
262
|
+
const dropped = this.items.shift();
|
|
263
|
+
this.totalChars -= dropped.length + this.separator.length;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/** Join the retained tail into a single string (length ≤ `maxChars`). */
|
|
267
|
+
toString() {
|
|
268
|
+
return this.items.join(this.separator);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
var StreamedProcessOutput = class {
|
|
272
|
+
maxOutputBytes;
|
|
273
|
+
byteCounter;
|
|
274
|
+
stdoutTail;
|
|
275
|
+
stderrTail;
|
|
276
|
+
onLine;
|
|
277
|
+
outputLimitError;
|
|
278
|
+
constructor(options) {
|
|
279
|
+
this.maxOutputBytes = options.maxOutputBytes;
|
|
280
|
+
this.byteCounter = options.maxOutputBytes === void 0 ? void 0 : new OutputByteCounter(options.maxOutputBytes);
|
|
281
|
+
const tailChars = options.maxOutputBytes ?? options.maxOutputTailChars ?? MAX_TAIL_CHARS;
|
|
282
|
+
this.stdoutTail = new BoundedTail(tailChars, "\n");
|
|
283
|
+
this.stderrTail = new BoundedTail(tailChars, "");
|
|
284
|
+
this.onLine = options.onLine ?? (() => {
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
checkLimit(chunk) {
|
|
288
|
+
if (this.byteCounter === void 0 || this.outputLimitError !== void 0) {
|
|
289
|
+
return this.outputLimitError;
|
|
290
|
+
}
|
|
291
|
+
this.byteCounter.add(chunk);
|
|
292
|
+
if (this.byteCounter.exceeded) {
|
|
293
|
+
this.outputLimitError = new Error(
|
|
294
|
+
`Sandbox command output exceeded ${this.maxOutputBytes} bytes`
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
return this.outputLimitError;
|
|
298
|
+
}
|
|
299
|
+
addStdoutLine(line) {
|
|
300
|
+
this.stdoutTail.push(line);
|
|
301
|
+
this.onLine(line);
|
|
302
|
+
}
|
|
303
|
+
addStderr(chunk) {
|
|
304
|
+
this.stderrTail.push(chunk);
|
|
305
|
+
}
|
|
306
|
+
get error() {
|
|
307
|
+
return this.outputLimitError;
|
|
308
|
+
}
|
|
309
|
+
result(exitCode) {
|
|
310
|
+
return {
|
|
311
|
+
stdout: this.stdoutTail.toString(),
|
|
312
|
+
stderr: this.stderrTail.toString(),
|
|
313
|
+
exitCode
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
var collectProcessOutput = (process2, options, resolve3, reject) => {
|
|
318
|
+
if (options.onLine || options.maxOutputBytes !== void 0) {
|
|
319
|
+
const output = new StreamedProcessOutput(options);
|
|
320
|
+
const checkLimit = (chunk) => {
|
|
321
|
+
if (output.checkLimit(chunk) !== void 0) process2.kill();
|
|
322
|
+
};
|
|
323
|
+
process2.stdout.on("data", checkLimit);
|
|
324
|
+
process2.stderr.on("data", checkLimit);
|
|
325
|
+
const lines = createInterface({ input: process2.stdout });
|
|
326
|
+
lines.on("line", (line) => output.addStdoutLine(line));
|
|
327
|
+
process2.stderr.on("data", (chunk) => {
|
|
328
|
+
output.addStderr(chunk.toString());
|
|
329
|
+
});
|
|
330
|
+
process2.onClose((code) => {
|
|
331
|
+
if (output.error !== void 0) {
|
|
332
|
+
reject(output.error);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
resolve3(output.result(code ?? 0));
|
|
336
|
+
});
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const stdoutChunks = [];
|
|
340
|
+
const stderrChunks = [];
|
|
341
|
+
process2.stdout.on("data", (chunk) => {
|
|
342
|
+
stdoutChunks.push(chunk.toString());
|
|
343
|
+
});
|
|
344
|
+
process2.stderr.on("data", (chunk) => {
|
|
345
|
+
stderrChunks.push(chunk.toString());
|
|
346
|
+
});
|
|
347
|
+
process2.onClose((code) => {
|
|
348
|
+
resolve3({
|
|
349
|
+
stdout: stdoutChunks.join(""),
|
|
350
|
+
stderr: stderrChunks.join(""),
|
|
351
|
+
exitCode: code ?? 0
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
};
|
|
151
355
|
var execFileAsync = promisify(execFile);
|
|
152
356
|
var RUNNER_INSTALL_METADATA = ".shipyard-install.json";
|
|
153
357
|
var RUNNER_CONTROLLER_LOCK = ".shipyard-controller.lock";
|
|
@@ -216,7 +420,7 @@ var defaultAdapters = {
|
|
|
216
420
|
}
|
|
217
421
|
},
|
|
218
422
|
signalProcess: (pid, signal) => process.kill(pid, signal),
|
|
219
|
-
pause: (milliseconds) => new Promise((
|
|
423
|
+
pause: (milliseconds) => new Promise((resolve3) => setTimeout(resolve3, milliseconds))
|
|
220
424
|
};
|
|
221
425
|
var lockOwnsProcess = async (lock, adapters) => lock !== void 0 && Number.isInteger(lock.pid) && typeof lock.processStartedAt === "string" && lock.processStartedAt.length > 0 && adapters.isProcessRunning(lock.pid) && await adapters.processIdentity(lock.pid) === lock.processStartedAt;
|
|
222
426
|
var lifecycleFailure = (purpose, error) => error instanceof RunnerLifecycleError ? error : new RunnerLifecycleError(
|
|
@@ -274,12 +478,8 @@ var listRemoteRunners = async (repository, repoDir, environment, adapters) => {
|
|
|
274
478
|
return parseRemoteRunners(response.stdout);
|
|
275
479
|
};
|
|
276
480
|
var validateExistingRepositoryRunner = async (options, adapters = defaultAdapters) => {
|
|
277
|
-
if (!await adapters.exists(options.maskDir)) {
|
|
278
|
-
await adapters.makeDirectory(options.maskDir);
|
|
279
|
-
}
|
|
280
481
|
await assertProtectedDirectoryIdentities(
|
|
281
482
|
options.runnerDir,
|
|
282
|
-
options.maskDir,
|
|
283
483
|
adapters.inspectDirectory
|
|
284
484
|
).catch((error) => {
|
|
285
485
|
throw lifecycleFailure("Validating protected runner directories", error);
|
|
@@ -379,12 +579,8 @@ var recoverRepositoryRunner = async (options, adapters = defaultAdapters) => {
|
|
|
379
579
|
if (lock) await adapters.remove(lockPath);
|
|
380
580
|
const workDir = join(options.runnerDir, RUNNER_WORK_DIR);
|
|
381
581
|
if (await adapters.exists(workDir)) await adapters.remove(workDir);
|
|
382
|
-
if (await adapters.exists(options.maskDir))
|
|
383
|
-
await adapters.remove(options.maskDir);
|
|
384
|
-
await adapters.makeDirectory(options.maskDir);
|
|
385
582
|
await assertProtectedDirectoryIdentities(
|
|
386
583
|
options.runnerDir,
|
|
387
|
-
options.maskDir,
|
|
388
584
|
adapters.inspectDirectory
|
|
389
585
|
).catch((error) => {
|
|
390
586
|
throw lifecycleFailure("Validating protected runner directories", error);
|
|
@@ -536,19 +732,33 @@ var unregisterRepositoryRunner = async (metadata, repoDir, runnerDir, environmen
|
|
|
536
732
|
var removeRepositoryRunner = async (options, adapters = defaultAdapters) => {
|
|
537
733
|
const configDir = join(options.repoDir, CONFIG_DIR);
|
|
538
734
|
const runnerDir = join(configDir, RUNNER_DIR);
|
|
539
|
-
const maskDir = join(configDir, RUNNER_SANDBOX_MASK_DIR);
|
|
540
735
|
if (!await adapters.exists(runnerDir)) {
|
|
541
736
|
throw new RunnerLifecycleError(
|
|
542
737
|
`No repository runner is installed at ${runnerDir}.`
|
|
543
738
|
);
|
|
544
739
|
}
|
|
740
|
+
try {
|
|
741
|
+
await assertProtectedDirectoryIdentities(
|
|
742
|
+
runnerDir,
|
|
743
|
+
adapters.inspectDirectory
|
|
744
|
+
);
|
|
745
|
+
} catch (error) {
|
|
746
|
+
if (!options.force) {
|
|
747
|
+
throw lifecycleFailure("Validating protected runner directory", error);
|
|
748
|
+
}
|
|
749
|
+
await adapters.remove(runnerDir);
|
|
750
|
+
return {
|
|
751
|
+
removed: true,
|
|
752
|
+
forced: true,
|
|
753
|
+
manualCleanup: "Check GitHub Settings > Actions > Runners and manually remove any orphan repository runner registration."
|
|
754
|
+
};
|
|
755
|
+
}
|
|
545
756
|
let metadata;
|
|
546
757
|
try {
|
|
547
758
|
metadata = await requireInstallMetadata(runnerDir, adapters);
|
|
548
759
|
} catch (error) {
|
|
549
760
|
if (!options.force) throw error;
|
|
550
761
|
await adapters.remove(runnerDir);
|
|
551
|
-
if (await adapters.exists(maskDir)) await adapters.remove(maskDir);
|
|
552
762
|
return {
|
|
553
763
|
removed: true,
|
|
554
764
|
forced: true,
|
|
@@ -578,14 +788,12 @@ var removeRepositoryRunner = async (options, adapters = defaultAdapters) => {
|
|
|
578
788
|
);
|
|
579
789
|
}
|
|
580
790
|
await adapters.remove(runnerDir);
|
|
581
|
-
if (await adapters.exists(maskDir)) await adapters.remove(maskDir);
|
|
582
791
|
return {
|
|
583
792
|
removed: true,
|
|
584
793
|
forced: true,
|
|
585
794
|
manualCleanup: `Remove runner ${metadata.name} from ${metadata.repository} in GitHub Settings > Actions > Runners.`
|
|
586
795
|
};
|
|
587
796
|
}
|
|
588
|
-
if (await adapters.exists(maskDir)) await adapters.remove(maskDir);
|
|
589
797
|
await adapters.remove(runnerDir);
|
|
590
798
|
return { removed: true, forced: false };
|
|
591
799
|
};
|
|
@@ -642,7 +850,7 @@ var docker = (options) => {
|
|
|
642
850
|
)
|
|
643
851
|
);
|
|
644
852
|
for (const dir of parentDirsToCreate) {
|
|
645
|
-
await new Promise((
|
|
853
|
+
await new Promise((resolve3, reject) => {
|
|
646
854
|
execFile(
|
|
647
855
|
"docker",
|
|
648
856
|
[
|
|
@@ -665,7 +873,7 @@ var docker = (options) => {
|
|
|
665
873
|
)
|
|
666
874
|
);
|
|
667
875
|
} else {
|
|
668
|
-
|
|
876
|
+
resolve3();
|
|
669
877
|
}
|
|
670
878
|
}
|
|
671
879
|
);
|
|
@@ -688,7 +896,7 @@ var docker = (options) => {
|
|
|
688
896
|
if (opts?.stdin !== void 0) args.push("-i");
|
|
689
897
|
if (opts?.cwd) args.push("-w", opts.cwd);
|
|
690
898
|
args.push(containerName, "sh", "-c", effectiveCommand);
|
|
691
|
-
return new Promise((
|
|
899
|
+
return new Promise((resolve3, reject) => {
|
|
692
900
|
const proc = spawn("docker", args, {
|
|
693
901
|
signal: opts?.signal,
|
|
694
902
|
stdio: [
|
|
@@ -712,13 +920,13 @@ var docker = (options) => {
|
|
|
712
920
|
onClose: (listener) => proc.on("close", listener)
|
|
713
921
|
},
|
|
714
922
|
{ ...opts, maxOutputTailChars },
|
|
715
|
-
|
|
923
|
+
resolve3,
|
|
716
924
|
reject
|
|
717
925
|
);
|
|
718
926
|
});
|
|
719
927
|
},
|
|
720
928
|
interactiveExec: (args, opts) => {
|
|
721
|
-
return new Promise((
|
|
929
|
+
return new Promise((resolve3, reject) => {
|
|
722
930
|
opts.signal?.throwIfAborted();
|
|
723
931
|
const executionId = randomUUID();
|
|
724
932
|
const pidFile = `/tmp/shipyard-interactive-${executionId}.pid`;
|
|
@@ -750,7 +958,7 @@ var docker = (options) => {
|
|
|
750
958
|
settled = true;
|
|
751
959
|
opts.signal?.removeEventListener("abort", onAbort);
|
|
752
960
|
if ("error" in result) reject(result.error);
|
|
753
|
-
else
|
|
961
|
+
else resolve3(result);
|
|
754
962
|
};
|
|
755
963
|
const onAbort = () => {
|
|
756
964
|
if (cancelling || settled) return;
|
|
@@ -813,7 +1021,7 @@ var docker = (options) => {
|
|
|
813
1021
|
hostPath,
|
|
814
1022
|
sandboxPath
|
|
815
1023
|
),
|
|
816
|
-
copyFileOut: (sandboxPath, hostPath) => new Promise((
|
|
1024
|
+
copyFileOut: (sandboxPath, hostPath) => new Promise((resolve3, reject) => {
|
|
817
1025
|
execFile(
|
|
818
1026
|
"docker",
|
|
819
1027
|
["cp", `${containerName}:${sandboxPath}`, hostPath],
|
|
@@ -821,7 +1029,7 @@ var docker = (options) => {
|
|
|
821
1029
|
if (error) {
|
|
822
1030
|
reject(new Error(`docker cp (out) failed: ${error.message}`));
|
|
823
1031
|
} else {
|
|
824
|
-
|
|
1032
|
+
resolve3();
|
|
825
1033
|
}
|
|
826
1034
|
}
|
|
827
1035
|
);
|
|
@@ -835,7 +1043,7 @@ var docker = (options) => {
|
|
|
835
1043
|
}
|
|
836
1044
|
});
|
|
837
1045
|
};
|
|
838
|
-
var checkImageUid = (imageName, expectedUid) => new Promise((
|
|
1046
|
+
var checkImageUid = (imageName, expectedUid) => new Promise((resolve3, reject) => {
|
|
839
1047
|
execFile(
|
|
840
1048
|
"docker",
|
|
841
1049
|
["image", "inspect", imageName, "--format", "{{.Config.User}}"],
|
|
@@ -850,13 +1058,13 @@ var checkImageUid = (imageName, expectedUid) => new Promise((resolve2, reject) =
|
|
|
850
1058
|
}
|
|
851
1059
|
const imageUser = (stdout ?? "").toString().trim();
|
|
852
1060
|
if (!imageUser) {
|
|
853
|
-
|
|
1061
|
+
resolve3();
|
|
854
1062
|
return;
|
|
855
1063
|
}
|
|
856
1064
|
const uidPart = imageUser.split(":")[0];
|
|
857
1065
|
const imageUid = parseInt(uidPart, 10);
|
|
858
1066
|
if (isNaN(imageUid)) {
|
|
859
|
-
|
|
1067
|
+
resolve3();
|
|
860
1068
|
return;
|
|
861
1069
|
}
|
|
862
1070
|
if (imageUid !== expectedUid) {
|
|
@@ -866,12 +1074,12 @@ var checkImageUid = (imageName, expectedUid) => new Promise((resolve2, reject) =
|
|
|
866
1074
|
)
|
|
867
1075
|
);
|
|
868
1076
|
} else {
|
|
869
|
-
|
|
1077
|
+
resolve3();
|
|
870
1078
|
}
|
|
871
1079
|
}
|
|
872
1080
|
);
|
|
873
1081
|
});
|
|
874
1082
|
|
|
875
|
-
export { REPOSITORY_RUNNER_OWNER_ENV, RUNNER_CONTROLLER_LOCK, RUNNER_INSTALL_METADATA, RUNNER_WORK_DIR, RunnerLifecycleError, buildImage, docker, recoverRepositoryRunner, removeImage, removeOwnedRepositoryRunnerContainers, removeRepositoryRunner, validateExistingRepositoryRunner };
|
|
876
|
-
//# sourceMappingURL=chunk-
|
|
877
|
-
//# sourceMappingURL=chunk-
|
|
1083
|
+
export { REPOSITORY_RUNNER_OWNER_ENV, RUNNER_CONTROLLER_LOCK, RUNNER_INSTALL_METADATA, RUNNER_WORK_DIR, RunnerLifecycleError, buildImage, defaultImageName, docker, lockOwnsProcess, recoverRepositoryRunner, removeImage, removeOwnedRepositoryRunnerContainers, removeRepositoryRunner, validateExistingRepositoryRunner };
|
|
1084
|
+
//# sourceMappingURL=chunk-JZUBT4WG.js.map
|
|
1085
|
+
//# sourceMappingURL=chunk-JZUBT4WG.js.map
|