apphx 2.0.1 → 2.1.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 +10 -8
- package/dist/cli.js +41 -11
- package/dist/cli.js.map +1 -1
- package/dist/config.js +4 -2
- package/dist/config.js.map +1 -1
- package/dist/integrations.js +154 -95
- package/dist/integrations.js.map +1 -1
- package/dist/notify.js +267 -0
- package/dist/notify.js.map +1 -0
- package/dist/runner.js +119 -20
- package/dist/runner.js.map +1 -1
- package/dist/schemas.js +57 -2
- package/dist/schemas.js.map +1 -1
- package/dist/vendor/obfuscator/dist/config.js +119 -6
- package/dist/vendor/obfuscator/dist/config.js.map +1 -1
- package/dist/vendor/obfuscator/dist/dfa.js +528 -0
- package/dist/vendor/obfuscator/dist/dfa.js.map +1 -0
- package/dist/vendor/obfuscator/dist/flutter.js +3266 -0
- package/dist/vendor/obfuscator/dist/flutter.js.map +1 -0
- package/dist/vendor/obfuscator/dist/image-utils.js +335 -0
- package/dist/vendor/obfuscator/dist/image-utils.js.map +1 -0
- package/dist/vendor/obfuscator/dist/junk.js +1501 -0
- package/dist/vendor/obfuscator/dist/junk.js.map +1 -0
- package/dist/vendor/obfuscator/dist/lexicon-data.js +972 -0
- package/dist/vendor/obfuscator/dist/lexicon-data.js.map +1 -0
- package/dist/vendor/obfuscator/dist/obfuscate.js +51 -2
- package/dist/vendor/obfuscator/dist/obfuscate.js.map +1 -1
- package/dist/vendor/obfuscator/dist/objc-symbols.js +1819 -0
- package/dist/vendor/obfuscator/dist/objc-symbols.js.map +1 -0
- package/dist/vendor/obfuscator/dist/project-identity.js +852 -0
- package/dist/vendor/obfuscator/dist/project-identity.js.map +1 -0
- package/dist/vendor/obfuscator/dist/string-encrypt.js +330 -0
- package/dist/vendor/obfuscator/dist/string-encrypt.js.map +1 -0
- package/examples/android-java.factory.json +40 -5
- package/examples/expo.factory.json +68 -5
- package/examples/flutter.factory.json +40 -4
- package/examples/luggage.json +1 -0
- package/examples/multi-role-agents.md +129 -0
- package/examples/mygo.factory.json +54 -4
- package/examples/queue-loop-demo.md +146 -0
- package/examples/react-native.factory.json +58 -5
- package/examples/roles.example.json +31 -0
- package/examples/swift.factory.json +60 -5
- package/examples/uni-app.factory.json +58 -5
- package/package.json +1 -1
- package/skills/apphx/SKILL.md +39 -4
- package/skills/apphx/resources/requirement.json +1 -0
- package/skills/apphx-obfuscator/LICENSE +21 -0
- package/skills/apphx-obfuscator/SKILL.md +72 -0
package/dist/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","names":[],"sources":["../src/runner.ts"],"sourcesContent":["import { mkdirSync, readFileSync, readdirSync, lstatSync, rmSync, existsSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport { basename, dirname, isAbsolute, join, relative, resolve, delimiter, sep } from 'node:path';\nimport { createHash, randomUUID } from 'node:crypto';\nimport { run, executionEnvironment, processGroupAlive } from './process.js';\nimport { canonicalPath, inside, expandArgv } from './config.js';\nimport { checkPrerequisites } from './preflight.js';\nimport { flutterEnvironment, prepareFlutter } from './flutter.js';\nimport { prepareExportOptions, prepareNativeExportCommands } from './export-options.js';\nimport { dependencyDigest, generatedModulePaths, isGeneratedPath } from './dependencies.js';\nimport { ReviewSchema, SpecSchema, toError, validateJobConfig } from './schemas.js';\nimport type { Job, HostStage, Stage } from './schemas.js';\nimport type { Run, RunOptions, RunResult } from './process.js';\nimport type { Store } from './store.js';\nimport { sourceDigest, prepareWorkspace, projectDirectory, artifactOutputPath } from './workspace.js';\nimport { parseResearch, researchPrompt, reviewInstructions } from './policy.js';\nimport { assertProject, buildInstructions } from './project-profiles.js';\nimport { closestOwnedGoWorkspace } from './go-dependencies.js';\nimport { validateMacOSArtifact } from './macos.js';\nimport { validateMyGoPackaging, validateMyGoCommand } from './mygo-build.js';\nimport { invalidateVerification } from './proof.js';\nimport { prepareIsolatedCommand, type IsolatedCommand, type IsolationCapabilities } from './isolation.js';\n\nfunction requireDependencyProof(job: Job): void {\n if (!job.verifiedDependencyDigest) throw Object.assign(new Error('Dependency resolution proof is missing; retry this stopped task to re-run verification'), { code: 'SETUP_REQUIRED' });\n if (dependencyDigest(job.workspace, job.spec.framework, job.spec.project?.directory) !== job.verifiedDependencyDigest) throw Object.assign(new Error('Dependency resolution changed since verification; re-verification is required'), { code: 'EVIDENCE_CHANGED' });\n}\n\nfunction taskPrompt(job: Job): string {\n return `You are the native host of an embedded multi-stack app Harness. Use your own context, tools and native delegation in ${projectDirectory(job)}; never launch another coding-agent CLI. Preserve the requested framework and existing architecture. Implement only this product. Never hide functionality from users or reviewers. Do not upload, submit, push, read publisher credentials or change factory state. Remote build commands belong only to the explicitly authorized Harness packaging profile, not host turns. The workspace is not a security sandbox. Complete real implementations, not placeholders.\\nImmutable product requirements:\\n${JSON.stringify(job.spec, null, 2)}\\nPrevious verification/review failure (repair the mechanism, never weaken acceptance):\\n${job.feedback ?? job.error ?? 'none'}\\nPersisted execution logs:\\n${JSON.stringify(job.logs.slice(-3))}\\nContinue existing work. Only actual deterministic checks performed by the Harness establish verification; host claims do not.\\n`;\n}\n\nexport interface TurnOptions { buildOnly?: boolean }\nexport interface HostAction {\n job: Job;\n action: 'host' | 'step' | 'wait' | 'done';\n turn?: { id: string; stage: HostStage; prompt: string; cwd: string; environment: Record<string, string> };\n}\n\nfunction assertTurnPermission(_job: Job, _options: TurnOptions): void {\n // No publication permission exists in this build; the flag remains accepted for CLI compatibility.\n}\n\nfunction contextDigest(job: Job): string {\n return createHash('sha256').update(JSON.stringify({\n spec: job.spec, requestSpec: job.requestSpec, config: job.config, workspace: job.workspace,\n stage: job.stage, research: job.research, feedback: job.feedback, logs: job.logs,\n verifiedDigest: job.verifiedDigest, verifiedDependencyDigest: job.verifiedDependencyDigest,\n screenshotDigest: job.screenshotDigest, verifiedAt: job.verifiedAt,\n })).digest('hex');\n}\n\nfunction deadlineExpired(job: Job): boolean {\n return Date.now() - job.createdAt > job.config.maxJobHours * 3600000;\n}\n\nfunction requireReviewProof(job: Job): void {\n try {\n if (!job.verifiedDigest || sourceDigest(job.workspace, true, job.spec.framework, job.spec.project?.directory) !== job.verifiedDigest) throw new Error('Source changed since verification; stale evidence cannot approve a handoff');\n requireDependencyProof(job);\n if (job.spec.screenshotsDir && sourceDigest(inside(projectDirectory(job), job.spec.screenshotsDir), false) !== job.screenshotDigest) throw new Error('Screenshots changed since runtime verification; stale evidence cannot approve a handoff');\n } catch (cause) {\n const error = toError(cause);\n if (error.code !== 'SETUP_REQUIRED') error.code = 'EVIDENCE_CHANGED';\n throw error;\n }\n}\n\nfunction hostAction(store: Store, job: Job): HostAction {\n const turn = job.turn!;\n let instruction: string;\n if (turn.stage === 'research') {\n const portfolio = store.list().filter(value => value.id !== job.id && value.spec.channel === job.spec.channel && value.spec.id !== job.spec.id).map(value => ({ id: value.spec.id, purpose: value.spec.purpose, audience: value.spec.audience, differentiators: value.spec.differentiators }));\n instruction = researchPrompt(job, portfolio);\n } else if (turn.stage === 'build') {\n instruction = `Research plan: ${JSON.stringify(job.research)}\\n${buildInstructions(job.spec)} Implement the entire requested product, accessibility and realistic empty/error states. Add genuine device/simulator acceptance workflows and real screenshots when requested; never fake screenshots or bypass tests. Do not add unrequested offline/backup/account features. Use the returned environment with your tools. Frozen verification and packaging: ${JSON.stringify({ verification: job.config.verification, packaging: job.config.packaging, packageTarget: job.config.packageTarget })}. Complete this turn without a result payload when source is ready; the Harness will then execute verification, not infer success.`;\n } else {\n instruction = reviewInstructions(job);\n }\n // Host-visible JSON carries only task overrides, never inherited credential values.\n const environment = job.spec.framework === 'flutter' ? flutterEnvironment(job.config, job.workspace, { CI: '1' }) : { CI: '1' } as NodeJS.ProcessEnv;\n if (job.spec.framework === 'mygo') Object.assign(environment, { GOENV: 'off', GOTOOLCHAIN: 'local', GOFLAGS: '-mod=readonly', GOWORK: closestOwnedGoWorkspace(job.workspace, job.spec.project?.directory) ?? 'off' });\n if (job.spec.framework === 'flutter' && job.config.toolchain) {\n environment.FLUTTER_ROOT = job.config.toolchain.flutterSdk;\n environment.PATH = `${join(job.config.toolchain.flutterSdk, 'bin')}${process.env.PATH ? `${delimiter}${process.env.PATH}` : ''}`;\n }\n return { job, action: 'host', turn: { id: turn.id, stage: turn.stage, prompt: taskPrompt(job) + instruction, cwd: projectDirectory(job), environment: Object.fromEntries(Object.entries(environment).filter((entry): entry is [string, string] => entry[1] !== undefined)) } };\n}\n\nfunction repair(job: Job, message: string): Partial<Job> {\n return {\n stage: 'build', status: (job.attempts[job.stage] ?? 0) >= job.config.maxAttempts ? 'failed' : 'waiting',\n ...invalidateVerification(), turn: null, feedback: message, error: message,\n nextAt: Date.now() + job.config.retryDelayMs,\n };\n}\n\nexport async function nextTurn(store: Store, id: string, options: TurnOptions = {}): Promise<HostAction> {\n store.acquire();\n try {\n let job = store.get(id);\n assertTurnPermission(job, options);\n if (job.turn) {\n if (job.status !== 'running' || job.stage !== job.turn.stage || contextDigest(job) !== job.turn.contextDigest) throw new Error('Active host turn context changed; abandon its token before requesting another turn');\n if (deadlineExpired(job)) {\n const claimed = job.turn;\n job = store.transition(id, current => {\n assertTurnPermission(current, options);\n if (current.turn?.id !== claimed.id || contextDigest(current) !== claimed.contextDigest) throw new Error('Host turn changed while checking its deadline; inspect the current task');\n return { turn: null, status: 'failed', error: 'Task wall-clock limit reached; the expired host turn cannot resume' };\n });\n return { job, action: 'done' };\n }\n return hostAction(store, job);\n }\n if (job.groups.length && !job.manualRecovery) return { job, action: 'step' };\n if (['failed', 'ready', 'built'].includes(job.status)) return { job, action: 'done' };\n const eligible = ['queued', 'waiting'].includes(job.status) || (job.status === 'blocked' && job.blockedReason?.kind === 'prerequisite');\n if (!eligible || job.nextAt > Date.now() || job.manualRecovery) return { job, action: 'wait' };\n if (!['research', 'build', 'review'].includes(job.stage)) return { job, action: 'step' };\n if (deadlineExpired(job) || job.hostTurns >= job.config.maxHostTurns || (job.attempts[job.stage] ?? 0) >= job.config.maxAttempts) {\n job = store.transition(id, current => {\n assertTurnPermission(current, options);\n return { status: 'failed', error: 'Host turn, stage attempt or task wall-clock limit reached; no further host work will start' };\n });\n return { job, action: 'done' };\n }\n try {\n if (job.stage === 'review') requireReviewProof(job);\n prepareWorkspace(store, job);\n mkdirSync(projectDirectory(job), { recursive: true, mode: 0o700 });\n } catch (cause) {\n const error = toError(cause);\n job = store.update(id, error.code === 'SETUP_REQUIRED' || job.stage !== 'review'\n ? { status: 'blocked', error: error.message }\n : repair(job, error.message));\n return { job, action: 'wait' };\n }\n job = store.transition(id, current => {\n assertTurnPermission(current, options);\n const eligible = ['queued', 'waiting'].includes(current.status) || (current.status === 'blocked' && current.blockedReason?.kind === 'prerequisite');\n if (current.turn || contextDigest(current) !== contextDigest(job) || current.nextAt > Date.now() || !eligible || current.groups.length || current.manualRecovery) throw new Error('Task changed before the host turn could be claimed');\n if (deadlineExpired(current) || current.hostTurns >= current.config.maxHostTurns || (current.attempts[current.stage] ?? 0) >= current.config.maxAttempts) return { status: 'failed', error: 'Host turn, stage attempt or task wall-clock limit reached; no further host work will start' };\n if (current.stage === 'review') requireReviewProof(current);\n const turn = { id: randomUUID(), stage: current.stage as HostStage, createdAt: Date.now(), contextDigest: contextDigest(current) };\n return { turn, hostTurns: current.hostTurns + 1, attempts: { ...current.attempts, [current.stage]: (current.attempts[current.stage] ?? 0) + 1 }, status: 'running', blockedReason: null, error: null };\n });\n return job.turn ? hostAction(store, job) : { job, action: 'done' };\n } finally { store.release(); }\n}\n\nexport function completeTurn(store: Store, id: string, turnId: string, result?: unknown, options: TurnOptions = {}): Job {\n return store.transition(id, job => {\n assertTurnPermission(job, options);\n if (!job.turn || job.turn.id !== turnId || job.turn.stage !== job.stage || job.status !== 'running') throw new Error('Stale, replayed or wrong-phase host turn; use next to inspect the active token');\n if (contextDigest(job) !== job.turn.contextDigest) throw new Error('Host turn context changed; abandon this stale token before continuing');\n if (job.groups.length || job.manualRecovery) throw new Error('Command recovery must finish before completing a host turn');\n if (deadlineExpired(job)) return { turn: null, status: 'failed', error: 'Task wall-clock limit reached; the expired host result was not accepted' };\n let patch: Partial<Job>;\n if (job.stage === 'research') {\n const research = parseResearch(JSON.stringify(result), job.spec.channel);\n patch = research.viable ? { stage: 'build', research } : { status: 'failed', research, error: 'Research rejected this product; no replacement product will be attempted' };\n } else if (job.stage === 'build') {\n if (result !== undefined) throw new Error('Build completion accepts no result payload; actual deterministic verification is required');\n assertProject(projectDirectory(job), job.spec);\n patch = { ...invalidateVerification(), stage: job.config.obfuscation ? 'obfuscate' : 'verify' };\n } else {\n const review = ReviewSchema.parse(result);\n if (!job.spec.acceptance.every(requirement => review.acceptanceEvidence.some(item => item.requirement === requirement))) throw new Error('Review verdict must cover each acceptance requirement with concrete evidence');\n try { requireReviewProof(job); }\n catch (cause) { return repair(job, toError(cause).message); }\n if (!review.approved || review.findings.length) return { ...repair(job, `Independent review rejected the artifact: ${JSON.stringify(review)}`), review };\n patch = { stage: 'package', review };\n }\n store.event(id, { completedTurn: turnId, stage: job.stage });\n return { status: 'queued', nextAt: Date.now(), error: null, turn: null, ...patch };\n });\n}\n\nexport function abandonTurn(store: Store, id: string, turnId: string, options: TurnOptions = {}): Job {\n return store.transition(id, job => {\n assertTurnPermission(job, options);\n if (!job.turn || job.turn.id !== turnId) throw new Error('Stale or replayed host turn; no active claim was abandoned');\n if (job.groups.length || job.manualRecovery) throw new Error('Command recovery must finish before abandoning a host turn');\n store.event(id, { abandonedTurn: turnId, stage: job.turn.stage });\n return { turn: null, status: 'queued', nextAt: Date.now(), error: null };\n });\n}\n\nfunction next(store: Store, job: Job, stage: Stage, extra: Partial<Job> = {}): Job {\n return store.update(job.id, { stage, status: 'queued', nextAt: Date.now(), error: null, groups: [], ...extra });\n}\n\nexport async function executeStep(store: Store, job: Job, { signal }: { signal?: AbortSignal } = {}): Promise<Job> {\n const config = job.config;\n if (['research', 'build', 'review'].includes(job.stage) || job.turn) throw new Error(`Stage ${job.stage} belongs to a native host turn; use next and complete`);\n if (signal?.aborted) return store.update(job.id, { status: 'waiting', nextAt: Date.now(), error: 'Worker was interrupted before this stage started' });\n if (!config.allowLocalExecution) return store.update(job.id, { status: 'blocked', error: config.executionWarning ?? 'Local execution is disabled. Explicitly enable allowLocalExecution only for trusted deterministic commands in a dedicated account or VM.' });\n if (deadlineExpired(job)) return store.update(job.id, { status: 'failed', error: 'Task wall-clock limit reached; no further work will start' });\n const attemptNumber = (job.attempts[job.stage] ?? 0) + 1;\n let attempts = { ...job.attempts };\n let attemptCharged = false;\n const developerEnv = job.spec.framework === 'flutter' ? flutterEnvironment(config, job.workspace, executionEnvironment(config)) : executionEnvironment(config);\n const verifierEnv = job.spec.framework === 'flutter' ? flutterEnvironment(config, job.workspace, executionEnvironment(config), true) : developerEnv;\n const environment = ['verify', 'package'].includes(job.stage) ? verifierEnv : developerEnv;\n const logPath = join(config.stateDir, 'logs', job.id, `${job.stage}-${attemptNumber}-${Date.now()}.log`);\n store.update(job.id, { logs: [...job.logs, logPath] });\n const readableFiles = new Set<string>();\n const trackedRun = async (argv: string[], options: RunOptions = {}, capabilities: IsolationCapabilities = {}): Promise<RunResult> => {\n let pid: number | undefined;\n let isolated: IsolatedCommand | undefined;\n try {\n const effectiveEnv = options.env ?? environment;\n if (job.spec.framework === 'mygo') validateMyGoCommand(config, argv);\n const command = effectiveEnv.FLUTTER_ROOT && ['flutter', 'dart'].includes(argv[0]) ? [join(effectiveEnv.FLUTTER_ROOT, 'bin', argv[0]), ...argv.slice(1)] : argv;\n const cwd = options.cwd ?? projectDirectory(job);\n if (config.isolation && ['obfuscate', 'verify', 'package'].includes(job.stage)) {\n isolated = prepareIsolatedCommand(command, {\n config, workspace: job.workspace, cwd, env: effectiveEnv,\n readableFiles: [...readableFiles, ...(capabilities.readableFiles ?? [])],\n writableDirectories: capabilities.writableDirectories,\n });\n }\n const result = await run(isolated?.argv ?? command, {\n timeoutMs: config.timeoutMs, signal, logPath, ...options, cwd, env: isolated?.env ?? effectiveEnv,\n onSpawn: (value, metadata) => {\n pid = value;\n const current = store.get(job.id);\n store.update(job.id, { groups: [...current.groups, value], commands: { ...current.commands, [value]: metadata }, recoveryStage: job.stage });\n options.onSpawn?.(value, metadata);\n },\n });\n if (pid && processGroupAlive(pid)) {\n try { process.kill(process.platform === 'win32' ? pid : -pid, 'SIGTERM'); } catch {}\n throw new Error('Command left background processes; termination was requested and replay will wait for the owned group to exit');\n }\n return result;\n } finally {\n try {\n const current = store.get(job.id);\n const groups = current.groups.filter(processGroupAlive);\n const commands = Object.fromEntries(Object.entries(current.commands ?? {}).filter(([pid]) => groups.includes(Number(pid))));\n store.update(job.id, { groups, commands, recoveryStage: groups.length ? current.recoveryStage ?? job.stage : undefined });\n } finally { isolated?.cleanup(); }\n }\n };\n const exec: Run = (argv, options) => trackedRun(argv, options);\n const utilityExec: Run = (argv, options) => {\n if (!config.isolation) return trackedRun(argv, options);\n if (argv[0] !== '/usr/bin/plutil') throw Object.assign(new Error('Unexpected isolated export utility'), { code: 'SETUP_REQUIRED' });\n const file = resolve(options?.cwd ?? projectDirectory(job), argv[argv.length - 1]!);\n const actual = canonicalPath(file), state = canonicalPath(config.stateDir), directory = dirname(actual);\n const within = (root: string, target: string): boolean => {\n const path = relative(root, target);\n return path === '' || path !== '..' && !path.startsWith(`..${sep}`) && !isAbsolute(path);\n };\n if (within(job.workspace, file) && !within(job.workspace, actual)\n && !config.isolation.readOnlyPaths.some(root => within(root, actual))) throw Object.assign(new Error('Workspace export options cannot grant access to an unapproved external file'), { code: 'SETUP_REQUIRED' });\n const snapshot = dirname(directory) === state && basename(directory).startsWith('export-options-') && basename(actual) === 'ExportOptions.plist';\n if (within(state, actual) && !snapshot || within(canonicalPath(config.workspaceRoot), actual) && !within(job.workspace, actual)\n || config.configPath && actual === canonicalPath(config.configPath)) throw Object.assign(new Error('Export utility cannot read protected control state or another task'), { code: 'SETUP_REQUIRED' });\n const writing = argv[1] === '-convert' && argv[2] === 'xml1';\n if (writing && !snapshot) throw Object.assign(new Error('Export utility writes require a harness-owned snapshot'), { code: 'SETUP_REQUIRED' });\n return trackedRun([...argv.slice(0, -1), actual], options, {\n readableFiles: within(job.workspace, actual) ? [] : [actual],\n writableDirectories: writing ? [directory] : [],\n });\n };\n const removeArtifact = async (output: string): Promise<void> => {\n if (!config.isolation) { rmSync(output, { recursive: true, force: true }); return; }\n const result = await exec(['/bin/rm', '-rf', '--', output]);\n if (result.code !== 0) throw Object.assign(new Error(`Isolated artifact cleanup was denied: ${result.stderr || result.stdout}`), { code: 'SETUP_REQUIRED' });\n };\n try {\n validateJobConfig(job.spec, config);\n if (job.spec.framework === 'mygo') validateMyGoPackaging(config);\n prepareWorkspace(store, job);\n mkdirSync(projectDirectory(job), { recursive: true, mode: 0o700 });\n if (job.spec.framework === 'mygo') {\n Object.assign(developerEnv, {\n GOENV: 'off', GOTOOLCHAIN: 'local', GOFLAGS: '-mod=readonly',\n GOWORK: closestOwnedGoWorkspace(job.workspace, job.spec.project?.directory) ?? 'off',\n GOCACHE: developerEnv.GOCACHE ?? join(config.stateDir, 'verification-cache', 'go-build'),\n GOMODCACHE: developerEnv.GOMODCACHE ?? join(config.stateDir, 'verification-cache', 'go-mod'),\n });\n for (const key of ['MYGO_UPDATER_PRIVATE_KEY', 'MYGO_WINDOWS_CERTIFICATE_PASSWORD', 'MYGO_CLI_BINARY', 'MYGO_LDFLAGS', 'MYGO_GENERATE', 'MYGO_INSPECTOR']) delete developerEnv[key];\n }\n if (job.stage === 'verify' || job.stage === 'package') {\n await checkPrerequisites(config.verification.prerequisites ?? [], { cwd: projectDirectory(job), env: environment, run: exec, signal });\n }\n if ((job.attempts[job.stage] ?? 0) >= config.maxAttempts) return store.update(job.id, { status: 'failed', error: `Attempt limit reached at ${job.stage}` });\n if (job.spec.framework === 'flutter' && config.toolchain && ['verify', 'package'].includes(job.stage)) {\n const toolchain = await prepareFlutter(job, { run: exec, env: developerEnv, signal });\n if (toolchain) store.update(job.id, { toolchain });\n }\n attempts = { ...attempts, [job.stage]: attemptNumber };\n store.update(job.id, { attempts });\n attemptCharged = true;\n if (job.stage === 'verify') {\n if (job.spec.framework === 'flutter' && config.toolchain) {\n const dependencies = await exec(['flutter', 'pub', 'get']);\n if (dependencies.code !== 0) throw new Error(`Verification dependency resolution failed: ${dependencies.stderr.slice(-4000)}`);\n }\n const before = sourceDigest(job.workspace, true, job.spec.framework, job.spec.project?.directory);\n const dependenciesBefore = dependencyDigest(job.workspace, job.spec.framework, job.spec.project?.directory);\n for (const argv of [...config.verification.checks, ...config.verification.runtime]) {\n const result = await exec(expandArgv(argv, executionEnvironment(config)));\n if (result.code !== 0) throw new Error(`Verification failed (${result.code}) ${JSON.stringify(argv)}:\\n${result.stderr.slice(-5000)}\\n${result.stdout.slice(-5000)}`);\n }\n if (sourceDigest(job.workspace, true, job.spec.framework, job.spec.project?.directory) !== before) throw new Error('Verification changed source files; the new revision must be verified again');\n if (dependencyDigest(job.workspace, job.spec.framework, job.spec.project?.directory) !== dependenciesBefore) throw new Error('Verification changed dependency resolution; the new resolution must be verified again');\n const screenshotDigest = job.spec.screenshotsDir ? sourceDigest(inside(projectDirectory(job), job.spec.screenshotsDir), false) : null;\n return next(store, job, 'review', { verifiedDigest: before, verifiedDependencyDigest: dependenciesBefore, screenshotDigest, verifiedAt: new Date().toISOString() });\n }\n if (job.stage === 'obfuscate') {\n const obfuscation = job.config.obfuscation;\n if (!obfuscation) throw Object.assign(new Error('Obfuscation stage requires config.obfuscation'), { code: 'SETUP_REQUIRED' });\n const expanded = expandArgv(obfuscation.command, environment);\n // The default command resolves to the private obfuscator bundled inside this package, so it\n // works for global installs, local dependency installs and the macOS sandbox alike.\n const bundled = fileURLToPath(new URL('./vendor/obfuscator/dist/cli.js', import.meta.url));\n const resolved = expanded[0] === 'obfuscator' && existsSync(bundled) ? [process.execPath, bundled, ...expanded.slice(1)] : expanded;\n const argv = [\n ...resolved,\n '--project', projectDirectory(job),\n '--config', obfuscation.configPath,\n '--framework', job.spec.framework,\n ...(obfuscation.seed ? ['--seed', obfuscation.seed] : []),\n ];\n const result = await trackedRun(argv, {}, { readableFiles: [obfuscation.configPath] });\n if (result.code !== 0) throw new Error(`Obfuscation failed (${result.code}) ${JSON.stringify(argv)}:\\n${result.stderr.slice(-5000)}\\n${result.stdout.slice(-5000)}`);\n return next(store, job, 'verify');\n }\n if (job.stage === 'package') {\n requireReviewProof(job);\n if (!job.review?.approved || job.review.findings.length) throw new Error('Packaging requires an approved host review');\n const target = config.packageTarget;\n const project = projectDirectory(job);\n const profile = config.packaging;\n if (job.cloudBuildPending) throw Object.assign(new Error('A previous cloud build may have remote effects. Reconcile it with the provider before creating a new task; this build will not be replayed.'), { code: 'SETUP_REQUIRED' });\n if (['ios', 'macos'].includes(job.spec.platform) && profile?.provider !== 'cloud' && process.platform !== 'darwin') throw Object.assign(new Error(`Local ${job.spec.platform} packaging requires a macOS worker`), { code: 'SETUP_REQUIRED' });\n let path: string;\n store.update(job.id, { artifact: null, ipaPath: null, archiveDigest: null });\n if (profile) {\n const output = artifactOutputPath(project, profile.artifactPath);\n const outputRelative = relative(job.workspace, output).split(sep).join('/');\n let generated = isGeneratedPath(profile.artifactPath, job.spec.framework);\n if (!generated) for (const module of generatedModulePaths(job.workspace, job.spec.framework, job.spec.project?.directory)) if (outputRelative.startsWith(`${module}/`)) { generated = true; break; }\n if (!generated || !/(?:^|\\/)(?:build|dist|unpackage)(?:\\/|$)/.test(profile.artifactPath) || /(?:^|\\/)(?:node_modules|\\.git|\\.gradle|\\.factory-cache|Pods)(?:\\/|$)/.test(profile.artifactPath)) throw Object.assign(new Error('packaging.artifactPath must name an exact generated build/dist/unpackage artifact, never source or dependency caches'), { code: 'SETUP_REQUIRED' });\n if (!output.endsWith(target === 'simulator' || target === 'app' ? '.app' : `.${target}`)) throw Object.assign(new Error(`packaging.artifactPath must end in ${target === 'simulator' || target === 'app' ? '.app' : `.${target}`}`), { code: 'SETUP_REQUIRED' });\n const prepared = await prepareNativeExportCommands(profile.commands.map(argv => expandArgv(argv, executionEnvironment(config))), project, config.stateDir, utilityExec);\n try {\n for (const file of prepared.readableFiles) readableFiles.add(file);\n await removeArtifact(output);\n if (profile.provider === 'cloud') store.update(job.id, { cloudBuildPending: true });\n for (const argv of prepared.commands) {\n const result = await exec(argv);\n if (result.code !== 0) throw new Error(`Packaging failed (${result.code}) ${JSON.stringify(argv)}:\\n${result.stderr.slice(-5000)}\\n${result.stdout.slice(-5000)}`);\n }\n path = artifactOutputPath(project, profile.artifactPath);\n } finally {\n for (const file of prepared.readableFiles) readableFiles.delete(file);\n prepared.cleanup();\n }\n } else {\n const output = artifactOutputPath(project, target === 'ipa' ? 'build/ios/ipa' : target === 'simulator' ? 'build/ios/iphonesimulator' : target === 'apk' ? 'build/app/outputs/flutter-apk' : 'build/app/outputs/bundle/release');\n if (target === 'ipa' && !config.apple?.exportOptionsPlist) throw Object.assign(new Error('Configure apple.exportOptionsPlist and valid local signing before IPA packaging'), { code: 'SETUP_REQUIRED' });\n if (target === 'ipa' && !job.spec.apple?.buildNumber) throw Object.assign(new Error('apple.buildNumber is required for IPA signing'), { code: 'SETUP_REQUIRED' });\n let exportOptions: { directory: string; path: string } | undefined;\n try {\n if (target === 'ipa') {\n exportOptions = await prepareExportOptions(config.apple!.exportOptionsPlist!, config.stateDir, utilityExec);\n readableFiles.add(exportOptions.path);\n }\n await removeArtifact(output);\n const argv = target === 'ipa'\n ? ['flutter', 'build', 'ipa', '--release', '--build-name', job.spec.version, '--build-number', job.spec.apple!.buildNumber!, '--export-options-plist', exportOptions!.path]\n : target === 'simulator' ? ['flutter', 'build', 'ios', '--simulator', '--debug', '--no-pub']\n : ['flutter', 'build', target === 'apk' ? 'apk' : 'appbundle', '--release', '--no-pub', '--build-name', job.spec.version];\n const built = await exec(argv);\n if (built.code !== 0) throw new Error(`${job.spec.framework} ${target} build failed: ${built.stderr.slice(-5000)}`);\n } finally {\n if (exportOptions) {\n readableFiles.delete(exportOptions.path);\n rmSync(exportOptions.directory, { recursive: true, force: true });\n }\n }\n const products = readdirSync(output).filter(name => name.endsWith(target === 'simulator' ? '.app' : `.${target}`));\n if (products.length !== 1) throw new Error(`Expected exactly one ${target} artifact in ${relative(job.workspace, output)}`);\n path = artifactOutputPath(project, join(relative(project, output), products[0]));\n }\n requireReviewProof(job);\n const stat = lstatSync(path);\n const bundle = target === 'simulator' || target === 'app';\n if (stat.isSymbolicLink() || (bundle ? !stat.isDirectory() || readdirSync(path).length === 0 : !stat.isFile() || stat.size === 0)) throw new Error('Packaging did not produce a nonempty regular artifact of the requested kind');\n if (target === 'app' || target === 'dmg') await validateMacOSArtifact(path, target, exec);\n const digest = bundle ? sourceDigest(path, false) : createHash('sha256').update(readFileSync(path)).digest('hex');\n const artifact = { kind: target === 'simulator' ? 'ios-simulator' as const : target === 'app' ? 'macos-app' as const : target, path, digest, createdAt: new Date().toISOString() };\n return store.update(job.id, { status: 'built', artifact, cloudBuildPending: false, error: null });\n }\n throw new Error(`Unknown task stage ${job.stage}`);\n } catch (cause) {\n const error = toError(cause);\n if (store.get(job.id).cloudBuildPending) return store.update(job.id, { status: 'blocked', blockedReason: null, error: `Cloud build outcome requires provider reconciliation; automatic replay is forbidden. ${error.message}` });\n if (error.code === 'PROCESS_CLEANUP_BLOCKED') return store.update(job.id, { status: 'blocked', blockedReason: null, manualRecovery: error.message, error: error.message });\n if (signal?.aborted) return store.update(job.id, { status: 'waiting', attempts: { ...attempts, [job.stage]: job.attempts[job.stage] ?? 0 }, nextAt: Date.now(), error: error.message });\n if (error.code === 'PREREQUISITE_FAILED' && error.prerequisite) return store.update(job.id, { status: 'blocked', blockedReason: { kind: 'prerequisite', stage: job.stage, prerequisite: error.prerequisite }, attempts: { ...job.attempts }, nextAt: Date.now() + config.pollMs, error: error.message });\n if (!attemptCharged) return store.update(job.id, { status: 'blocked', blockedReason: null, attempts: { ...job.attempts }, nextAt: Date.now(), error: error.message });\n const blocked = (error.code === 'ENOENT' && error.syscall?.startsWith('spawn')) || /SETUP_REQUIRED|UNSUPPORTED|PROCESS_CLEANUP_BLOCKED/.test(error.code ?? '');\n if (blocked) return store.update(job.id, { status: 'blocked', error: error.message });\n const charged = attempts[job.stage] ?? 0;\n const exhausted = error.code === 'BUDGET' || charged >= config.maxAttempts;\n if (job.stage === 'verify' || (job.stage === 'package' && error.code === 'EVIDENCE_CHANGED')) return store.update(job.id, { ...repair({ ...job, attempts }, error.message), status: exhausted ? 'failed' : 'waiting', nextAt: Date.now() + config.retryDelayMs * charged });\n return store.update(job.id, { status: exhausted ? 'failed' : 'waiting', error: error.message, feedback: error.message, nextAt: Date.now() + config.retryDelayMs * charged });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,uBAAuB,KAAgB;CAC9C,IAAI,CAAC,IAAI,0BAA0B,MAAM,OAAO,uBAAO,IAAI,MAAM,wFAAwF,GAAG,EAAE,MAAM,iBAAiB,CAAC;CACtL,IAAI,iBAAiB,IAAI,WAAW,IAAI,KAAK,WAAW,IAAI,KAAK,SAAS,SAAS,MAAM,IAAI,0BAA0B,MAAM,OAAO,uBAAO,IAAI,MAAM,+EAA+E,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACrQ;AAEA,SAAS,WAAW,KAAkB;CACpC,OAAO,wHAAwH,iBAAiB,GAAG,EAAE,6eAA6e,KAAK,UAAU,IAAI,MAAM,MAAM,CAAC,EAAE,2FAA2F,IAAI,YAAY,IAAI,SAAS,OAAO,+BAA+B,KAAK,UAAU,IAAI,KAAK,MAAM,EAAE,CAAC,EAAE;AACv2B;AAaA,SAAS,cAAc,KAAkB;CACvC,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,KAAK,UAAU;EAChD,MAAM,IAAI;EAAM,aAAa,IAAI;EAAa,QAAQ,IAAI;EAAQ,WAAW,IAAI;EACjF,OAAO,IAAI;EAAO,UAAU,IAAI;EAAU,UAAU,IAAI;EAAU,MAAM,IAAI;EAC5E,gBAAgB,IAAI;EAAgB,0BAA0B,IAAI;EAClE,kBAAkB,IA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":["import { mkdirSync, readFileSync, readdirSync, lstatSync, rmSync, existsSync, writeFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport { basename, dirname, isAbsolute, join, relative, resolve, delimiter, sep } from 'node:path';\nimport { createHash, randomUUID } from 'node:crypto';\nimport { run, executionEnvironment, processGroupAlive } from './process.js';\nimport { canonicalPath, inside, expandArgv } from './config.js';\nimport { checkPrerequisites } from './preflight.js';\nimport { flutterEnvironment, prepareFlutter } from './flutter.js';\nimport { prepareExportOptions, prepareNativeExportCommands } from './export-options.js';\nimport { dependencyDigest, generatedModulePaths, isGeneratedPath } from './dependencies.js';\nimport { ReviewSchema, SpecSchema, toError, validateJobConfig } from './schemas.js';\nimport type { Job, HostStage, Stage } from './schemas.js';\nimport type { Run, RunOptions, RunResult } from './process.js';\nimport type { Store } from './store.js';\nimport { sourceDigest, prepareWorkspace, projectDirectory, artifactOutputPath } from './workspace.js';\nimport { parseResearch, researchPrompt, reviewInstructions } from './policy.js';\nimport { assertProject, buildInstructions } from './project-profiles.js';\nimport { closestOwnedGoWorkspace } from './go-dependencies.js';\nimport { validateMacOSArtifact } from './macos.js';\nimport { validateMyGoPackaging, validateMyGoCommand } from './mygo-build.js';\nimport { invalidateVerification } from './proof.js';\nimport { prepareIsolatedCommand, type IsolatedCommand, type IsolationCapabilities } from './isolation.js';\n\nfunction requireDependencyProof(job: Job): void {\n if (!job.verifiedDependencyDigest) throw Object.assign(new Error('Dependency resolution proof is missing; retry this stopped task to re-run verification'), { code: 'SETUP_REQUIRED' });\n if (dependencyDigest(job.workspace, job.spec.framework, job.spec.project?.directory) !== job.verifiedDependencyDigest) throw Object.assign(new Error('Dependency resolution changed since verification; re-verification is required'), { code: 'EVIDENCE_CHANGED' });\n}\n\nfunction taskPrompt(job: Job): string {\n return `You are the native host of an embedded multi-stack app Harness. Use your own context, tools and native delegation in ${projectDirectory(job)}; never launch another coding-agent CLI. Preserve the requested framework and existing architecture. Implement only this product. Never hide functionality from users or reviewers. Do not upload, submit, push, read publisher credentials or change factory state. Remote build commands belong only to the explicitly authorized Harness packaging profile, not host turns. The workspace is not a security sandbox. Complete real implementations, not placeholders.\\nImmutable product requirements:\\n${JSON.stringify(job.spec, null, 2)}\\nPrevious verification/review failure (repair the mechanism, never weaken acceptance):\\n${job.feedback ?? job.error ?? 'none'}\\nPersisted execution logs:\\n${JSON.stringify(job.logs.slice(-3))}\\nContinue existing work. Only actual deterministic checks performed by the Harness establish verification; host claims do not.\\n`;\n}\n\nexport interface TurnOptions { buildOnly?: boolean }\nexport interface HostAction {\n job: Job;\n action: 'host' | 'step' | 'wait' | 'done';\n turn?: { id: string; stage: HostStage; prompt: string; cwd: string; environment: Record<string, string>; role: string[] };\n}\n\nconst DEFAULT_ROLES: Record<HostStage, string[]> = {\n research: ['product-analyst'],\n build: ['developer'],\n review: ['architect-review', 'qa-engineer', 'acceptance-reviewer'],\n};\n\nfunction assertTurnPermission(_job: Job, _options: TurnOptions): void {\n // No publication permission exists in this build; the flag remains accepted for CLI compatibility.\n}\n\nfunction contextDigest(job: Job): string {\n return createHash('sha256').update(JSON.stringify({\n spec: job.spec, requestSpec: job.requestSpec, config: job.config, workspace: job.workspace,\n stage: job.stage, research: job.research, feedback: job.feedback, logs: job.logs,\n verifiedDigest: job.verifiedDigest, verifiedDependencyDigest: job.verifiedDependencyDigest,\n screenshotDigest: job.screenshotDigest, verifiedAt: job.verifiedAt,\n })).digest('hex');\n}\n\nfunction deadlineExpired(job: Job): boolean {\n return Date.now() - job.createdAt > job.config.maxJobHours * 3600000;\n}\n\nfunction requireReviewProof(job: Job): void {\n try {\n if (!job.verifiedDigest || sourceDigest(job.workspace, true, job.spec.framework, job.spec.project?.directory) !== job.verifiedDigest) throw new Error('Source changed since verification; stale evidence cannot approve a handoff');\n requireDependencyProof(job);\n if (job.spec.screenshotsDir && sourceDigest(inside(projectDirectory(job), job.spec.screenshotsDir), false) !== job.screenshotDigest) throw new Error('Screenshots changed since runtime verification; stale evidence cannot approve a handoff');\n } catch (cause) {\n const error = toError(cause);\n if (error.code !== 'SETUP_REQUIRED') error.code = 'EVIDENCE_CHANGED';\n throw error;\n }\n}\n\nfunction hostAction(store: Store, job: Job): HostAction {\n const turn = job.turn!;\n let instruction: string;\n if (turn.stage === 'research') {\n const portfolio = store.list().filter(value => value.id !== job.id && value.spec.channel === job.spec.channel && value.spec.id !== job.spec.id).map(value => ({ id: value.spec.id, purpose: value.spec.purpose, audience: value.spec.audience, differentiators: value.spec.differentiators }));\n instruction = researchPrompt(job, portfolio);\n } else if (turn.stage === 'build') {\n instruction = `Research plan: ${JSON.stringify(job.research)}\\n${buildInstructions(job.spec)} Implement the entire requested product, accessibility and realistic empty/error states. Add genuine device/simulator acceptance workflows and real screenshots when requested; never fake screenshots or bypass tests. Do not add unrequested offline/backup/account features. Use the returned environment with your tools. Frozen verification and packaging: ${JSON.stringify({ verification: job.config.verification, packaging: job.config.packaging, packageTarget: job.config.packageTarget })}. Complete this turn without a result payload when source is ready; the Harness will then execute verification, not infer success.`;\n } else {\n instruction = reviewInstructions(job);\n }\n // Host-visible JSON carries only task overrides, never inherited credential values.\n const environment = job.spec.framework === 'flutter' ? flutterEnvironment(job.config, job.workspace, { CI: '1' }) : { CI: '1' } as NodeJS.ProcessEnv;\n if (job.spec.framework === 'mygo') Object.assign(environment, { GOENV: 'off', GOTOOLCHAIN: 'local', GOFLAGS: '-mod=readonly', GOWORK: closestOwnedGoWorkspace(job.workspace, job.spec.project?.directory) ?? 'off' });\n if (job.spec.framework === 'flutter' && job.config.toolchain) {\n environment.FLUTTER_ROOT = job.config.toolchain.flutterSdk;\n environment.PATH = `${join(job.config.toolchain.flutterSdk, 'bin')}${process.env.PATH ? `${delimiter}${process.env.PATH}` : ''}`;\n }\n const role = [...(job.config.roles?.[turn.stage] ?? DEFAULT_ROLES[turn.stage])];\n const prompt = `${taskPrompt(job)}${instruction}\\nTurn roles (adopt every role through your native delegation, with independent contexts where the skill requires them): ${JSON.stringify(role)}`;\n return { job, action: 'host', turn: { id: turn.id, stage: turn.stage, prompt, cwd: projectDirectory(job), environment: Object.fromEntries(Object.entries(environment).filter((entry): entry is [string, string] => entry[1] !== undefined)), role } };\n}\n\nfunction repair(job: Job, message: string): Partial<Job> {\n return {\n stage: 'build', status: (job.attempts[job.stage] ?? 0) >= job.config.maxAttempts ? 'failed' : 'waiting',\n ...invalidateVerification(), turn: null, feedback: message, error: message,\n nextAt: Date.now() + job.config.retryDelayMs,\n };\n}\n\nexport async function nextTurn(store: Store, id: string, options: TurnOptions = {}): Promise<HostAction> {\n store.acquire();\n try {\n let job = store.get(id);\n assertTurnPermission(job, options);\n if (job.turn) {\n if (job.status !== 'running' || job.stage !== job.turn.stage || contextDigest(job) !== job.turn.contextDigest) throw new Error('Active host turn context changed; abandon its token before requesting another turn');\n if (deadlineExpired(job)) {\n const claimed = job.turn;\n job = store.transition(id, current => {\n assertTurnPermission(current, options);\n if (current.turn?.id !== claimed.id || contextDigest(current) !== claimed.contextDigest) throw new Error('Host turn changed while checking its deadline; inspect the current task');\n return { turn: null, status: 'failed', error: 'Task wall-clock limit reached; the expired host turn cannot resume' };\n });\n return { job, action: 'done' };\n }\n return hostAction(store, job);\n }\n if (job.groups.length && !job.manualRecovery) return { job, action: 'step' };\n if (['failed', 'ready', 'built'].includes(job.status)) return { job, action: 'done' };\n const eligible = ['queued', 'waiting'].includes(job.status) || (job.status === 'blocked' && job.blockedReason?.kind === 'prerequisite');\n if (!eligible || job.nextAt > Date.now() || job.manualRecovery) return { job, action: 'wait' };\n if (!['research', 'build', 'review'].includes(job.stage)) return { job, action: 'step' };\n if (deadlineExpired(job) || job.hostTurns >= job.config.maxHostTurns || (job.attempts[job.stage] ?? 0) >= job.config.maxAttempts) {\n job = store.transition(id, current => {\n assertTurnPermission(current, options);\n return { status: 'failed', error: 'Host turn, stage attempt or task wall-clock limit reached; no further host work will start' };\n });\n return { job, action: 'done' };\n }\n try {\n if (job.stage === 'review') requireReviewProof(job);\n prepareWorkspace(store, job);\n mkdirSync(projectDirectory(job), { recursive: true, mode: 0o700 });\n } catch (cause) {\n const error = toError(cause);\n job = store.update(id, error.code === 'SETUP_REQUIRED' || job.stage !== 'review'\n ? { status: 'blocked', error: error.message }\n : repair(job, error.message));\n return { job, action: 'wait' };\n }\n job = store.transition(id, current => {\n assertTurnPermission(current, options);\n const eligible = ['queued', 'waiting'].includes(current.status) || (current.status === 'blocked' && current.blockedReason?.kind === 'prerequisite');\n if (current.turn || contextDigest(current) !== contextDigest(job) || current.nextAt > Date.now() || !eligible || current.groups.length || current.manualRecovery) throw new Error('Task changed before the host turn could be claimed');\n if (deadlineExpired(current) || current.hostTurns >= current.config.maxHostTurns || (current.attempts[current.stage] ?? 0) >= current.config.maxAttempts) return { status: 'failed', error: 'Host turn, stage attempt or task wall-clock limit reached; no further host work will start' };\n if (current.stage === 'review') requireReviewProof(current);\n const turn = { id: randomUUID(), stage: current.stage as HostStage, createdAt: Date.now(), contextDigest: contextDigest(current) };\n return { turn, hostTurns: current.hostTurns + 1, attempts: { ...current.attempts, [current.stage]: (current.attempts[current.stage] ?? 0) + 1 }, status: 'running', blockedReason: null, error: null };\n });\n return job.turn ? hostAction(store, job) : { job, action: 'done' };\n } finally { store.release(); }\n}\n\nexport type QueueTurn =\n | HostAction\n | { action: 'idle'; nextAt: number | null; pendingErrors: Array<{ id: string; error: string }>; summary: QueueSummary };\n\nexport type QueueSummary = { total: number; built: number; failed: number; blocked: number; waiting: number; queued: number; running: number };\n\n/**\n * Pick the earliest-due actionable task in the whole queue for a host loop:\n * the first job (ordered by priority lane, then next_at, then insertion) whose\n * `next` returns a host turn or a deterministic step. Jobs that are deferred, stopped or still\n * owned by another execution are skipped; jobs whose persisted turn context no\n * longer matches are surfaced in `pendingErrors` instead of silently blocking\n * the queue. `idle` reports the earliest future due time plus a status summary\n * so the host can audit whether the queue is truly finished or merely blocked,\n * and knows when to wake again. Does not hold the queue worker lock across\n * calls; each host claim stays transactional inside `nextTurn`.\n */\nexport async function nextQueueTurn(store: Store, options: TurnOptions = {}): Promise<QueueTurn> {\n const pendingErrors: Array<{ id: string; error: string }> = [];\n // Priority lanes order the scan (P0 > P1 > P2); within a lane, earliest due\n // time wins, then insertion order. Priority never overrides eligibility:\n // a deferred P0 job is skipped and the scan continues to the next safe action.\n const rank = (job: Job): number => job.spec.priority === 'P0' ? 0 : job.spec.priority === 'P2' ? 2 : 1;\n const jobs = [...store.list()].sort((left, right) => rank(left) - rank(right) || left.nextAt - right.nextAt);\n for (const job of jobs) {\n try {\n const action = await nextTurn(store, job.id, options);\n if (action.action === 'host' || action.action === 'step') return action;\n } catch (cause) {\n pendingErrors.push({ id: job.id, error: toError(cause).message });\n }\n }\n const summary: QueueSummary = { total: jobs.length, built: 0, failed: 0, blocked: 0, waiting: 0, queued: 0, running: 0 };\n for (const job of jobs) {\n const status = job.status;\n if (status === 'built' || status === 'failed' || status === 'blocked' || status === 'waiting' || status === 'queued' || status === 'running') summary[status] += 1;\n }\n const due = jobs.map(job => job.nextAt).filter(nextAt => nextAt > Date.now());\n return { action: 'idle', nextAt: due.length ? Math.min(...due) : null, pendingErrors, summary };\n}\n\nexport function completeTurn(store: Store, id: string, turnId: string, result?: unknown, options: TurnOptions = {}): Job {\n return store.transition(id, job => {\n assertTurnPermission(job, options);\n if (!job.turn || job.turn.id !== turnId || job.turn.stage !== job.stage || job.status !== 'running') throw new Error('Stale, replayed or wrong-phase host turn; use next to inspect the active token');\n if (contextDigest(job) !== job.turn.contextDigest) throw new Error('Host turn context changed; abandon this stale token before continuing');\n if (job.groups.length || job.manualRecovery) throw new Error('Command recovery must finish before completing a host turn');\n if (deadlineExpired(job)) return { turn: null, status: 'failed', error: 'Task wall-clock limit reached; the expired host result was not accepted' };\n let patch: Partial<Job>;\n if (job.stage === 'research') {\n const research = parseResearch(JSON.stringify(result), job.spec.channel);\n patch = research.viable ? { stage: 'build', research } : { status: 'failed', research, error: 'Research rejected this product; no replacement product will be attempted' };\n } else if (job.stage === 'build') {\n if (result !== undefined) throw new Error('Build completion accepts no result payload; actual deterministic verification is required');\n assertProject(projectDirectory(job), job.spec);\n patch = { ...invalidateVerification(), stage: job.config.obfuscation ? 'obfuscate' : 'verify' };\n } else {\n const review = ReviewSchema.parse(result);\n if (!job.spec.acceptance.every(requirement => review.acceptanceEvidence.some(item => item.requirement === requirement))) throw new Error('Review verdict must cover each acceptance requirement with concrete evidence');\n try { requireReviewProof(job); }\n catch (cause) { return repair(job, toError(cause).message); }\n if (!review.approved || review.findings.length) return { ...repair(job, `Independent review rejected the artifact: ${JSON.stringify(review)}`), review };\n patch = { stage: 'package', review };\n }\n store.event(id, { completedTurn: turnId, stage: job.stage });\n return { status: 'queued', nextAt: Date.now(), error: null, turn: null, ...patch };\n });\n}\n\nexport function abandonTurn(store: Store, id: string, turnId: string, options: TurnOptions = {}): Job {\n return store.transition(id, job => {\n assertTurnPermission(job, options);\n if (!job.turn || job.turn.id !== turnId) throw new Error('Stale or replayed host turn; no active claim was abandoned');\n if (job.groups.length || job.manualRecovery) throw new Error('Command recovery must finish before abandoning a host turn');\n store.event(id, { abandonedTurn: turnId, stage: job.turn.stage });\n return { turn: null, status: 'queued', nextAt: Date.now(), error: null };\n });\n}\n\nfunction next(store: Store, job: Job, stage: Stage, extra: Partial<Job> = {}): Job {\n return store.update(job.id, { stage, status: 'queued', nextAt: Date.now(), error: null, groups: [], ...extra });\n}\n\nexport async function executeStep(store: Store, job: Job, { signal }: { signal?: AbortSignal } = {}): Promise<Job> {\n const config = job.config;\n if (['research', 'build', 'review'].includes(job.stage) || job.turn) throw new Error(`Stage ${job.stage} belongs to a native host turn; use next and complete`);\n if (signal?.aborted) return store.update(job.id, { status: 'waiting', nextAt: Date.now(), error: 'Worker was interrupted before this stage started' });\n if (!config.allowLocalExecution) return store.update(job.id, { status: 'blocked', error: config.executionWarning ?? 'Local execution is disabled. Explicitly enable allowLocalExecution only for trusted deterministic commands in a dedicated account or VM.' });\n if (deadlineExpired(job)) return store.update(job.id, { status: 'failed', error: 'Task wall-clock limit reached; no further work will start' });\n const attemptNumber = (job.attempts[job.stage] ?? 0) + 1;\n let attempts = { ...job.attempts };\n let attemptCharged = false;\n const developerEnv = job.spec.framework === 'flutter' ? flutterEnvironment(config, job.workspace, executionEnvironment(config)) : executionEnvironment(config);\n const verifierEnv = job.spec.framework === 'flutter' ? flutterEnvironment(config, job.workspace, executionEnvironment(config), true) : developerEnv;\n const environment = ['verify', 'package'].includes(job.stage) ? verifierEnv : developerEnv;\n const logPath = join(config.stateDir, 'logs', job.id, `${job.stage}-${attemptNumber}-${Date.now()}.log`);\n store.update(job.id, { logs: [...job.logs, logPath] });\n const readableFiles = new Set<string>();\n const trackedRun = async (argv: string[], options: RunOptions = {}, capabilities: IsolationCapabilities = {}): Promise<RunResult> => {\n let pid: number | undefined;\n let isolated: IsolatedCommand | undefined;\n try {\n const effectiveEnv = options.env ?? environment;\n if (job.spec.framework === 'mygo') validateMyGoCommand(config, argv);\n const command = effectiveEnv.FLUTTER_ROOT && ['flutter', 'dart'].includes(argv[0]) ? [join(effectiveEnv.FLUTTER_ROOT, 'bin', argv[0]), ...argv.slice(1)] : argv;\n const cwd = options.cwd ?? projectDirectory(job);\n if (config.isolation && ['obfuscate', 'verify', 'package'].includes(job.stage)) {\n isolated = prepareIsolatedCommand(command, {\n config, workspace: job.workspace, cwd, env: effectiveEnv,\n readableFiles: [...readableFiles, ...(capabilities.readableFiles ?? [])],\n writableDirectories: capabilities.writableDirectories,\n });\n }\n const result = await run(isolated?.argv ?? command, {\n timeoutMs: config.timeoutMs, signal, logPath, ...options, cwd, env: isolated?.env ?? effectiveEnv,\n onSpawn: (value, metadata) => {\n pid = value;\n const current = store.get(job.id);\n store.update(job.id, { groups: [...current.groups, value], commands: { ...current.commands, [value]: metadata }, recoveryStage: job.stage });\n options.onSpawn?.(value, metadata);\n },\n });\n if (pid && processGroupAlive(pid)) {\n try { process.kill(process.platform === 'win32' ? pid : -pid, 'SIGTERM'); } catch {}\n throw new Error('Command left background processes; termination was requested and replay will wait for the owned group to exit');\n }\n return result;\n } finally {\n try {\n const current = store.get(job.id);\n const groups = current.groups.filter(processGroupAlive);\n const commands = Object.fromEntries(Object.entries(current.commands ?? {}).filter(([pid]) => groups.includes(Number(pid))));\n store.update(job.id, { groups, commands, recoveryStage: groups.length ? current.recoveryStage ?? job.stage : undefined });\n } finally { isolated?.cleanup(); }\n }\n };\n const exec: Run = (argv, options) => trackedRun(argv, options);\n const utilityExec: Run = (argv, options) => {\n if (!config.isolation) return trackedRun(argv, options);\n if (argv[0] !== '/usr/bin/plutil') throw Object.assign(new Error('Unexpected isolated export utility'), { code: 'SETUP_REQUIRED' });\n const file = resolve(options?.cwd ?? projectDirectory(job), argv[argv.length - 1]!);\n const actual = canonicalPath(file), state = canonicalPath(config.stateDir), directory = dirname(actual);\n const within = (root: string, target: string): boolean => {\n const path = relative(root, target);\n return path === '' || path !== '..' && !path.startsWith(`..${sep}`) && !isAbsolute(path);\n };\n if (within(job.workspace, file) && !within(job.workspace, actual)\n && !config.isolation.readOnlyPaths.some(root => within(root, actual))) throw Object.assign(new Error('Workspace export options cannot grant access to an unapproved external file'), { code: 'SETUP_REQUIRED' });\n const snapshot = dirname(directory) === state && basename(directory).startsWith('export-options-') && basename(actual) === 'ExportOptions.plist';\n if (within(state, actual) && !snapshot || within(canonicalPath(config.workspaceRoot), actual) && !within(job.workspace, actual)\n || config.configPath && actual === canonicalPath(config.configPath)) throw Object.assign(new Error('Export utility cannot read protected control state or another task'), { code: 'SETUP_REQUIRED' });\n const writing = argv[1] === '-convert' && argv[2] === 'xml1';\n if (writing && !snapshot) throw Object.assign(new Error('Export utility writes require a harness-owned snapshot'), { code: 'SETUP_REQUIRED' });\n return trackedRun([...argv.slice(0, -1), actual], options, {\n readableFiles: within(job.workspace, actual) ? [] : [actual],\n writableDirectories: writing ? [directory] : [],\n });\n };\n const removeArtifact = async (output: string): Promise<void> => {\n if (!config.isolation) { rmSync(output, { recursive: true, force: true }); return; }\n const result = await exec(['/bin/rm', '-rf', '--', output]);\n if (result.code !== 0) throw Object.assign(new Error(`Isolated artifact cleanup was denied: ${result.stderr || result.stdout}`), { code: 'SETUP_REQUIRED' });\n };\n try {\n validateJobConfig(job.spec, config);\n if (job.spec.framework === 'mygo') validateMyGoPackaging(config);\n prepareWorkspace(store, job);\n mkdirSync(projectDirectory(job), { recursive: true, mode: 0o700 });\n if (job.spec.framework === 'mygo') {\n Object.assign(developerEnv, {\n GOENV: 'off', GOTOOLCHAIN: 'local', GOFLAGS: '-mod=readonly',\n GOWORK: closestOwnedGoWorkspace(job.workspace, job.spec.project?.directory) ?? 'off',\n GOCACHE: developerEnv.GOCACHE ?? join(config.stateDir, 'verification-cache', 'go-build'),\n GOMODCACHE: developerEnv.GOMODCACHE ?? join(config.stateDir, 'verification-cache', 'go-mod'),\n });\n for (const key of ['MYGO_UPDATER_PRIVATE_KEY', 'MYGO_WINDOWS_CERTIFICATE_PASSWORD', 'MYGO_CLI_BINARY', 'MYGO_LDFLAGS', 'MYGO_GENERATE', 'MYGO_INSPECTOR']) delete developerEnv[key];\n }\n if (job.stage === 'verify' || job.stage === 'package') {\n await checkPrerequisites(config.verification.prerequisites ?? [], { cwd: projectDirectory(job), env: environment, run: exec, signal });\n }\n if ((job.attempts[job.stage] ?? 0) >= config.maxAttempts) return store.update(job.id, { status: 'failed', error: `Attempt limit reached at ${job.stage}` });\n if (job.spec.framework === 'flutter' && config.toolchain && ['verify', 'package'].includes(job.stage)) {\n const toolchain = await prepareFlutter(job, { run: exec, env: developerEnv, signal });\n if (toolchain) store.update(job.id, { toolchain });\n }\n attempts = { ...attempts, [job.stage]: attemptNumber };\n store.update(job.id, { attempts });\n attemptCharged = true;\n if (job.stage === 'verify') {\n if (job.spec.framework === 'flutter' && config.toolchain) {\n const dependencies = await exec(['flutter', 'pub', 'get']);\n if (dependencies.code !== 0) throw new Error(`Verification dependency resolution failed: ${dependencies.stderr.slice(-4000)}`);\n }\n const before = sourceDigest(job.workspace, true, job.spec.framework, job.spec.project?.directory);\n const dependenciesBefore = dependencyDigest(job.workspace, job.spec.framework, job.spec.project?.directory);\n for (const argv of [...config.verification.checks, ...config.verification.runtime]) {\n const result = await exec(expandArgv(argv, executionEnvironment(config)));\n if (result.code !== 0) throw new Error(`Verification failed (${result.code}) ${JSON.stringify(argv)}:\\n${result.stderr.slice(-5000)}\\n${result.stdout.slice(-5000)}`);\n }\n if (sourceDigest(job.workspace, true, job.spec.framework, job.spec.project?.directory) !== before) throw new Error('Verification changed source files; the new revision must be verified again');\n if (dependencyDigest(job.workspace, job.spec.framework, job.spec.project?.directory) !== dependenciesBefore) throw new Error('Verification changed dependency resolution; the new resolution must be verified again');\n const screenshotDigest = job.spec.screenshotsDir ? sourceDigest(inside(projectDirectory(job), job.spec.screenshotsDir), false) : null;\n return next(store, job, 'review', { verifiedDigest: before, verifiedDependencyDigest: dependenciesBefore, screenshotDigest, verifiedAt: new Date().toISOString() });\n }\n if (job.stage === 'obfuscate') {\n const obfuscation = job.config.obfuscation;\n if (!obfuscation) throw Object.assign(new Error('Obfuscation stage requires config.obfuscation'), { code: 'SETUP_REQUIRED' });\n const obfuscationBase = { digest: sourceDigest(job.workspace, true, job.spec.framework, job.spec.project?.directory), path: projectDirectory(job) };\n let configPath = obfuscation.configPath;\n let snapshot: string | undefined;\n if (!configPath) {\n // Inline rules are materialized as a harness-owned snapshot file; the\n // obfuscator validates them at run time, and the snapshot never becomes\n // part of the verified source.\n const directory = join(config.stateDir, 'obfuscation');\n mkdirSync(directory, { recursive: true, mode: 0o700 });\n snapshot = join(directory, `${job.id}-${Date.now()}.json`);\n writeFileSync(snapshot, `${JSON.stringify(obfuscation.options ?? {}, null, 2)}\\n`, { mode: 0o600 });\n configPath = snapshot;\n }\n try {\n const expanded = expandArgv(obfuscation.command, environment);\n // The default command resolves to the private obfuscator bundled inside this package, so it\n // works for global installs, local dependency installs and the macOS sandbox alike.\n const bundled = fileURLToPath(new URL('./vendor/obfuscator/dist/cli.js', import.meta.url));\n const resolved = expanded[0] === 'obfuscator' && existsSync(bundled) ? [process.execPath, bundled, ...expanded.slice(1)] : expanded;\n const argv = [\n ...resolved,\n '--project', projectDirectory(job),\n '--config', configPath!,\n '--framework', job.spec.framework,\n ...(obfuscation.seed ? ['--seed', obfuscation.seed] : []),\n ];\n const result = await trackedRun(argv, {}, { readableFiles: [configPath!] });\n if (result.code !== 0) throw new Error(`Obfuscation failed (${result.code}) ${JSON.stringify(argv)}:\\n${result.stderr.slice(-5000)}\\n${result.stdout.slice(-5000)}`);\n let report: Job['obfuscationReport'];\n try {\n const parsed: unknown = JSON.parse(result.stdout);\n if (parsed && typeof parsed === 'object') {\n const value = parsed as Record<string, unknown>;\n const skipped = value.skipped && typeof value.skipped === 'object' ? value.skipped as Record<string, unknown> : {};\n if (Number.isSafeInteger(value.changedFiles) && value.transforms && typeof value.transforms === 'object' && !Array.isArray(value.transforms)) {\n report = {\n changedFiles: value.changedFiles as number,\n transforms: Object.fromEntries(Object.entries(value.transforms).filter(([key, count]) => typeof key === 'string' && Number.isSafeInteger(count)) as Array<[string, number]>),\n skipped: { generated: Number.isSafeInteger(skipped.generated) ? skipped.generated as number : 0, unsupported: Number.isSafeInteger(skipped.unsupported) ? skipped.unsupported as number : 0 },\n };\n }\n }\n } catch { /* report stays undefined */ }\n // The bundled obfuscator always prints a typed report; a custom command may not.\n if (!report && resolved[0] === process.execPath && resolved[1] === bundled) throw new Error('Bundled obfuscator produced no valid report; the transformed workspace cannot be evidenced');\n const obfuscationDigest = sourceDigest(job.workspace, true, job.spec.framework, job.spec.project?.directory);\n return next(store, job, 'verify', { obfuscationBase, obfuscationDigest, ...(report ? { obfuscationReport: report } : {}) });\n } finally {\n if (snapshot) rmSync(snapshot, { force: true });\n }\n }\n if (job.stage === 'package') {\n requireReviewProof(job);\n if (!job.review?.approved || job.review.findings.length) throw new Error('Packaging requires an approved host review');\n const target = config.packageTarget;\n const project = projectDirectory(job);\n const profile = config.packaging;\n if (job.cloudBuildPending) throw Object.assign(new Error('A previous cloud build may have remote effects. Reconcile it with the provider before creating a new task; this build will not be replayed.'), { code: 'SETUP_REQUIRED' });\n if (['ios', 'macos'].includes(job.spec.platform) && profile?.provider !== 'cloud' && process.platform !== 'darwin') throw Object.assign(new Error(`Local ${job.spec.platform} packaging requires a macOS worker`), { code: 'SETUP_REQUIRED' });\n let path: string;\n store.update(job.id, { artifact: null, ipaPath: null, archiveDigest: null });\n if (profile) {\n const output = artifactOutputPath(project, profile.artifactPath);\n const outputRelative = relative(job.workspace, output).split(sep).join('/');\n let generated = isGeneratedPath(profile.artifactPath, job.spec.framework);\n if (!generated) for (const module of generatedModulePaths(job.workspace, job.spec.framework, job.spec.project?.directory)) if (outputRelative.startsWith(`${module}/`)) { generated = true; break; }\n if (!generated || !/(?:^|\\/)(?:build|dist|unpackage)(?:\\/|$)/.test(profile.artifactPath) || /(?:^|\\/)(?:node_modules|\\.git|\\.gradle|\\.factory-cache|Pods)(?:\\/|$)/.test(profile.artifactPath)) throw Object.assign(new Error('packaging.artifactPath must name an exact generated build/dist/unpackage artifact, never source or dependency caches'), { code: 'SETUP_REQUIRED' });\n if (!output.endsWith(target === 'simulator' || target === 'app' ? '.app' : `.${target}`)) throw Object.assign(new Error(`packaging.artifactPath must end in ${target === 'simulator' || target === 'app' ? '.app' : `.${target}`}`), { code: 'SETUP_REQUIRED' });\n const prepared = await prepareNativeExportCommands(profile.commands.map(argv => expandArgv(argv, executionEnvironment(config))), project, config.stateDir, utilityExec);\n try {\n for (const file of prepared.readableFiles) readableFiles.add(file);\n await removeArtifact(output);\n if (profile.provider === 'cloud') store.update(job.id, { cloudBuildPending: true });\n for (const argv of prepared.commands) {\n const result = await exec(argv);\n if (result.code !== 0) throw new Error(`Packaging failed (${result.code}) ${JSON.stringify(argv)}:\\n${result.stderr.slice(-5000)}\\n${result.stdout.slice(-5000)}`);\n }\n path = artifactOutputPath(project, profile.artifactPath);\n } finally {\n for (const file of prepared.readableFiles) readableFiles.delete(file);\n prepared.cleanup();\n }\n } else {\n const output = artifactOutputPath(project, target === 'ipa' ? 'build/ios/ipa' : target === 'simulator' ? 'build/ios/iphonesimulator' : target === 'apk' ? 'build/app/outputs/flutter-apk' : 'build/app/outputs/bundle/release');\n if (target === 'ipa' && !config.apple?.exportOptionsPlist) throw Object.assign(new Error('Configure apple.exportOptionsPlist and valid local signing before IPA packaging'), { code: 'SETUP_REQUIRED' });\n if (target === 'ipa' && !job.spec.apple?.buildNumber) throw Object.assign(new Error('apple.buildNumber is required for IPA signing'), { code: 'SETUP_REQUIRED' });\n let exportOptions: { directory: string; path: string } | undefined;\n try {\n if (target === 'ipa') {\n exportOptions = await prepareExportOptions(config.apple!.exportOptionsPlist!, config.stateDir, utilityExec);\n readableFiles.add(exportOptions.path);\n }\n await removeArtifact(output);\n const argv = target === 'ipa'\n ? ['flutter', 'build', 'ipa', '--release', '--build-name', job.spec.version, '--build-number', job.spec.apple!.buildNumber!, '--export-options-plist', exportOptions!.path]\n : target === 'simulator' ? ['flutter', 'build', 'ios', '--simulator', '--debug', '--no-pub']\n : ['flutter', 'build', target === 'apk' ? 'apk' : 'appbundle', '--release', '--no-pub', '--build-name', job.spec.version];\n const built = await exec(argv);\n if (built.code !== 0) throw new Error(`${job.spec.framework} ${target} build failed: ${built.stderr.slice(-5000)}`);\n } finally {\n if (exportOptions) {\n readableFiles.delete(exportOptions.path);\n rmSync(exportOptions.directory, { recursive: true, force: true });\n }\n }\n const products = readdirSync(output).filter(name => name.endsWith(target === 'simulator' ? '.app' : `.${target}`));\n if (products.length !== 1) throw new Error(`Expected exactly one ${target} artifact in ${relative(job.workspace, output)}`);\n path = artifactOutputPath(project, join(relative(project, output), products[0]));\n }\n requireReviewProof(job);\n const stat = lstatSync(path);\n const bundle = target === 'simulator' || target === 'app';\n if (stat.isSymbolicLink() || (bundle ? !stat.isDirectory() || readdirSync(path).length === 0 : !stat.isFile() || stat.size === 0)) throw new Error('Packaging did not produce a nonempty regular artifact of the requested kind');\n if (target === 'app' || target === 'dmg') await validateMacOSArtifact(path, target, exec);\n const digest = bundle ? sourceDigest(path, false) : createHash('sha256').update(readFileSync(path)).digest('hex');\n const artifact = { kind: target === 'simulator' ? 'ios-simulator' as const : target === 'app' ? 'macos-app' as const : target, path, digest, createdAt: new Date().toISOString() };\n return store.update(job.id, { status: 'built', artifact, cloudBuildPending: false, error: null });\n }\n throw new Error(`Unknown task stage ${job.stage}`);\n } catch (cause) {\n const error = toError(cause);\n if (store.get(job.id).cloudBuildPending) return store.update(job.id, { status: 'blocked', blockedReason: null, error: `Cloud build outcome requires provider reconciliation; automatic replay is forbidden. ${error.message}` });\n if (error.code === 'PROCESS_CLEANUP_BLOCKED') return store.update(job.id, { status: 'blocked', blockedReason: null, manualRecovery: error.message, error: error.message });\n if (signal?.aborted) return store.update(job.id, { status: 'waiting', attempts: { ...attempts, [job.stage]: job.attempts[job.stage] ?? 0 }, nextAt: Date.now(), error: error.message });\n if (error.code === 'PREREQUISITE_FAILED' && error.prerequisite) return store.update(job.id, { status: 'blocked', blockedReason: { kind: 'prerequisite', stage: job.stage, prerequisite: error.prerequisite }, attempts: { ...job.attempts }, nextAt: Date.now() + config.pollMs, error: error.message });\n if (!attemptCharged) return store.update(job.id, { status: 'blocked', blockedReason: null, attempts: { ...job.attempts }, nextAt: Date.now(), error: error.message });\n const blocked = (error.code === 'ENOENT' && error.syscall?.startsWith('spawn')) || /SETUP_REQUIRED|UNSUPPORTED|PROCESS_CLEANUP_BLOCKED/.test(error.code ?? '');\n if (blocked) return store.update(job.id, { status: 'blocked', error: error.message });\n const charged = attempts[job.stage] ?? 0;\n const exhausted = error.code === 'BUDGET' || charged >= config.maxAttempts;\n if (job.stage === 'verify' || (job.stage === 'package' && error.code === 'EVIDENCE_CHANGED')) return store.update(job.id, { ...repair({ ...job, attempts }, error.message), status: exhausted ? 'failed' : 'waiting', nextAt: Date.now() + config.retryDelayMs * charged });\n return store.update(job.id, { status: exhausted ? 'failed' : 'waiting', error: error.message, feedback: error.message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33
|
]);
|
|
34
|
+
const PrioritySchema = z.enum([
|
|
35
|
+
"P0",
|
|
36
|
+
"P1",
|
|
37
|
+
"P2"
|
|
38
|
+
]);
|
|
34
39
|
const PackageTargetSchema = z.enum([
|
|
35
40
|
"simulator",
|
|
36
41
|
"ipa",
|
|
@@ -69,6 +74,7 @@ const SpecObject = z.strictObject({
|
|
|
69
74
|
platform: PlatformSchema,
|
|
70
75
|
channel: ChannelSchema.default("local"),
|
|
71
76
|
version: text.default("1.0.0"),
|
|
77
|
+
priority: PrioritySchema.default("P1"),
|
|
72
78
|
project: z.strictObject({
|
|
73
79
|
sourceDir: text.optional(),
|
|
74
80
|
directory: text.refine((value) => relativeProjectPath(value, true), "project.directory must be a relative in-root directory without traversal").default(".")
|
|
@@ -78,6 +84,7 @@ const SpecObject = z.strictObject({
|
|
|
78
84
|
acceptance: z.array(text).min(1),
|
|
79
85
|
constraints: z.array(text).optional(),
|
|
80
86
|
apple: AppleSpecSchema.optional(),
|
|
87
|
+
authorEmail: z.string().email().optional(),
|
|
81
88
|
hiddenFeatures: z.literal(false).optional(),
|
|
82
89
|
reviewBypass: z.literal(false).optional()
|
|
83
90
|
});
|
|
@@ -129,8 +136,50 @@ const RequirementSchema = SpecObject.extend({ baseJobId: z.uuid().optional() }).
|
|
|
129
136
|
});
|
|
130
137
|
const ObfuscationConfigSchema = z.strictObject({
|
|
131
138
|
command: z.array(command.element).min(1).default(["obfuscator"]),
|
|
132
|
-
|
|
139
|
+
/** Obfuscator rules file resolved against the factory config directory; must be a regular file. */
|
|
140
|
+
configPath: text.optional(),
|
|
141
|
+
/** Inline obfuscator rules (same shape as the rules file); validated by the bundled obfuscator at run time. */
|
|
142
|
+
options: z.record(z.string(), z.unknown()).optional(),
|
|
133
143
|
seed: text.optional()
|
|
144
|
+
}).superRefine((value, context) => {
|
|
145
|
+
if (!value.configPath && !value.options) context.addIssue({
|
|
146
|
+
code: "custom",
|
|
147
|
+
path: [],
|
|
148
|
+
message: "obfuscation needs configPath or inline options; set one of them"
|
|
149
|
+
});
|
|
150
|
+
if (value.configPath && value.options) context.addIssue({
|
|
151
|
+
code: "custom",
|
|
152
|
+
path: [],
|
|
153
|
+
message: "obfuscation accepts configPath or inline options, not both"
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
/**
|
|
157
|
+
* Advisory role assignments per host stage. Role names are free-form so teams
|
|
158
|
+
* can add any missing agent (e.g. security-review, performance-analyst); the
|
|
159
|
+
* host adopts every returned role via its native delegation. Roles never
|
|
160
|
+
* change stage eligibility, budgets or evidence gates.
|
|
161
|
+
*/
|
|
162
|
+
const RolesConfigSchema = z.strictObject({
|
|
163
|
+
research: z.array(text).default(["product-analyst"]),
|
|
164
|
+
build: z.array(text).default(["developer"]),
|
|
165
|
+
review: z.array(text).default([
|
|
166
|
+
"architect-review",
|
|
167
|
+
"qa-engineer",
|
|
168
|
+
"acceptance-reviewer"
|
|
169
|
+
])
|
|
170
|
+
});
|
|
171
|
+
const NotifyEmailSchema = z.strictObject({
|
|
172
|
+
from: z.string().email(),
|
|
173
|
+
to: z.string().email(),
|
|
174
|
+
smtpHost: text,
|
|
175
|
+
smtpPort: z.number().int().positive().default(465),
|
|
176
|
+
secure: z.boolean().default(true),
|
|
177
|
+
user: text.optional(),
|
|
178
|
+
/** Environment variable name holding the SMTP password; the value is never stored or printed. */
|
|
179
|
+
passwordEnv: z.string().regex(/^[A-Z][A-Z0-9_]*$/).optional(),
|
|
180
|
+
timeoutMs: z.number().int().positive().default(15e3),
|
|
181
|
+
subject: text.optional(),
|
|
182
|
+
body: text.optional()
|
|
134
183
|
});
|
|
135
184
|
const ConfigSchema = z.strictObject({
|
|
136
185
|
configPath: text.optional(),
|
|
@@ -164,6 +213,8 @@ const ConfigSchema = z.strictObject({
|
|
|
164
213
|
packageTarget: PackageTargetSchema,
|
|
165
214
|
executionWarning: text.optional(),
|
|
166
215
|
obfuscation: ObfuscationConfigSchema.optional(),
|
|
216
|
+
notify: z.strictObject({ email: NotifyEmailSchema }).optional(),
|
|
217
|
+
roles: RolesConfigSchema.optional(),
|
|
167
218
|
packaging: z.strictObject({
|
|
168
219
|
commands: z.array(command).min(1),
|
|
169
220
|
artifactPath: text.refine((value) => relativeProjectPath(value), "artifactPath must be an exact project-relative file or directory without traversal or wildcards"),
|
|
@@ -334,11 +385,15 @@ const JobSchema = z.object({
|
|
|
334
385
|
ipaPath: text.nullable().optional(),
|
|
335
386
|
archiveDigest: text.nullable().optional(),
|
|
336
387
|
artifact: ArtifactSchema.nullable().optional(),
|
|
388
|
+
notifiedAt: text.nullable().optional(),
|
|
389
|
+
notifiedTo: text.nullable().optional(),
|
|
390
|
+
notifyError: text.nullable().optional(),
|
|
391
|
+
notifySendingAt: text.nullable().optional(),
|
|
337
392
|
externalChecks: z.unknown().optional()
|
|
338
393
|
}).passthrough();
|
|
339
394
|
function toError(value) {
|
|
340
395
|
return value instanceof Error ? value : new Error(String(value));
|
|
341
396
|
}
|
|
342
|
-
export { AppleSpecSchema, ArtifactSchema, ChannelSchema, CommandMetadataSchema, ConfigSchema, FrameworkSchema, HostStageSchema, HostTurnSchema, InboxEntrySchema, JobSchema, ObfuscationConfigSchema, PackageTargetSchema, PlatformSchema, PrerequisiteSchema, ProcessIdentitySchema, RequirementSchema, ResearchSchema, ReviewSchema, SpecSchema, StageSchema, StatusSchema, ToolchainSchema, toError, validateJobConfig };
|
|
397
|
+
export { AppleSpecSchema, ArtifactSchema, ChannelSchema, CommandMetadataSchema, ConfigSchema, FrameworkSchema, HostStageSchema, HostTurnSchema, InboxEntrySchema, JobSchema, NotifyEmailSchema, ObfuscationConfigSchema, PackageTargetSchema, PlatformSchema, PrerequisiteSchema, PrioritySchema, ProcessIdentitySchema, RequirementSchema, ResearchSchema, ReviewSchema, RolesConfigSchema, SpecSchema, StageSchema, StatusSchema, ToolchainSchema, toError, validateJobConfig };
|
|
343
398
|
|
|
344
399
|
//# sourceMappingURL=schemas.js.map
|
package/dist/schemas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","names":[],"sources":["../src/schemas.ts"],"sourcesContent":["import { z } from 'zod';\nimport { dirname, isAbsolute, resolve, win32 } from 'node:path';\nimport { lstatSync } from 'node:fs';\nimport { AppleReceiptSchema } from './apple-types.js';\nimport { validateMyGoPackaging } from './mygo-build.js';\n\nconst text = z.string().min(1).refine(value => value.trim().length > 0 && !value.includes('\\0'), 'Expected non-empty text without NUL characters');\nconst count = z.number().int().nonnegative().safe();\nconst positive = z.number().positive().finite();\nconst command = z.array(text).min(1);\n\nfunction relativeProjectPath(value: string, allowRoot = false): boolean {\n if (allowRoot && value === '.') return true;\n return !isAbsolute(value) && !win32.isAbsolute(value) && !/[\\\\:*?\\[\\]]/.test(value)\n && value.split('/').every(part => part !== '' && part !== '.' && part !== '..');\n}\n\nexport const FrameworkSchema = z.enum(['flutter', 'android-java', 'swift', 'react-native', 'expo', 'uni-app', 'mygo']);\nexport type Framework = z.infer<typeof FrameworkSchema>;\nexport const PlatformSchema = z.enum(['ios', 'android', 'macos']);\nexport type Platform = z.infer<typeof PlatformSchema>;\nexport const ChannelSchema = z.enum(['local', 'app-store', 'google-play']);\nexport type Channel = z.infer<typeof ChannelSchema>;\nexport const PackageTargetSchema = z.enum(['simulator', 'ipa', 'apk', 'aab', 'app', 'dmg']);\nexport type PackageTarget = z.infer<typeof PackageTargetSchema>;\nexport const AppleSpecSchema = z.strictObject({\n appId: text.optional(), bundleId: text.optional(), buildNumber: text.optional(), locale: text.optional(),\n description: text.optional(), keywords: text.optional(), supportUrl: text.optional(), privacyPolicyUrl: text.optional(), reviewNotes: text.optional(),\n copyright: text.optional(), whatsNew: text.optional(), storefrontCountry: text.optional(), manualSetupConfirmed: z.boolean().optional(),\n contact: z.strictObject({ firstName: text.optional(), lastName: text.optional(), email: text.optional(), phone: text.optional() }).optional(),\n});\nexport type AppleSpec = z.infer<typeof AppleSpecSchema>;\nconst SpecObject = z.strictObject({\n id: text.regex(/^[a-z][a-z0-9-]{1,62}$/), name: text, purpose: text, audience: text,\n framework: FrameworkSchema, platform: PlatformSchema, channel: ChannelSchema.default('local'), version: text.default('1.0.0'),\n project: z.strictObject({ sourceDir: text.optional(), directory: text.refine(value => relativeProjectPath(value, true), 'project.directory must be a relative in-root directory without traversal').default('.') }).optional(),\n screenshotsDir: text.optional(), differentiators: z.array(text).min(1), acceptance: z.array(text).min(1),\n constraints: z.array(text).optional(), apple: AppleSpecSchema.optional(),\n hiddenFeatures: z.literal(false).optional(), reviewBypass: z.literal(false).optional(),\n});\nfunction refineSpec(value: z.infer<typeof SpecObject>, context: z.RefinementCtx): void {\n if (value.framework === 'android-java' && value.platform !== 'android') context.addIssue({ code: 'custom', path: ['platform'], message: 'android-java requires platform=android' });\n if (value.framework === 'swift' && value.platform !== 'ios') context.addIssue({ code: 'custom', path: ['platform'], message: 'swift requires platform=ios' });\n if (value.framework === 'mygo' && value.platform !== 'macos') context.addIssue({ code: 'custom', path: ['platform'], message: 'mygo requires platform=macos' });\n if (value.platform === 'macos' && value.framework !== 'mygo') context.addIssue({ code: 'custom', path: ['framework'], message: 'macos currently requires framework=mygo' });\n if (value.platform === 'macos' && value.channel !== 'local') context.addIssue({ code: 'custom', path: ['channel'], message: 'macos currently supports local delivery only' });\n if (value.channel === 'app-store' && value.platform !== 'ios') context.addIssue({ code: 'custom', path: ['channel'], message: 'app-store requires platform=ios' });\n if (value.channel === 'google-play' && value.platform !== 'android') context.addIssue({ code: 'custom', path: ['channel'], message: 'google-play requires platform=android' });\n}\nexport const SpecSchema = SpecObject.superRefine(refineSpec);\nexport type Spec = z.infer<typeof SpecSchema>;\nexport const RequirementSchema = SpecObject.extend({ baseJobId: z.uuid().optional() }).superRefine((value, context) => {\n refineSpec(value, context);\n if (value.baseJobId && value.project?.sourceDir) context.addIssue({ code: 'custom', path: ['project', 'sourceDir'], message: 'project.sourceDir and baseJobId are mutually exclusive' });\n});\n\nexport const ObfuscationConfigSchema = z.strictObject({\n command: z.array(command.element).min(1).default(['obfuscator']),\n configPath: text,\n seed: text.optional(),\n});\nexport type ObfuscationConfig = z.infer<typeof ObfuscationConfigSchema>;\n\nexport const ConfigSchema = z.strictObject({\n configPath: text.optional(), stateDir: text, workspaceRoot: text,\n allowLocalExecution: z.boolean().default(false), allowCloudBuild: z.boolean().default(false),\n executionEnv: z.array(text.regex(/^[A-Z][A-Z0-9_]*$/).refine(value => !/^(ASC_|APPLE_|FASTLANE_|MATCH_)/.test(value), 'Publisher credentials must not be passed to host or verification tools')).default([]),\n isolation: z.strictObject({ mode: z.literal('macos-sandbox'), readOnlyPaths: z.array(text).default([]), network: z.enum(['deny', 'allow']).default('deny') }).optional(),\n timeoutMs: positive.default(900000), maxAttempts: positive.int().default(3), maxHostTurns: positive.int().default(16), maxJobHours: positive.default(24),\n retryDelayMs: positive.default(30000), pollMs: positive.default(300000),\n inbox: z.strictObject({ directory: text, pollMs: positive.default(2000) }).optional(),\n verification: z.strictObject({ prerequisites: z.array(command).default([]), checks: z.array(command).min(1), runtime: z.array(command).min(1) }),\n toolchain: z.strictObject({ flutterSdk: text }).optional(),\n apple: z.strictObject({ exportOptionsPlist: text.optional() }).optional(),\n packageTarget: PackageTargetSchema, executionWarning: text.optional(),\n obfuscation: ObfuscationConfigSchema.optional(),\n packaging: z.strictObject({ commands: z.array(command).min(1), artifactPath: text.refine(value => relativeProjectPath(value), 'artifactPath must be an exact project-relative file or directory without traversal or wildcards'), provider: z.enum(['local', 'cloud']).default('local') }).optional(),\n}).superRefine((value, context) => {\n if (value.packaging?.provider === 'cloud' && !value.allowCloudBuild) context.addIssue({ code: 'custom', path: ['allowCloudBuild'], message: 'Cloud packaging requires explicit allowCloudBuild=true' });\n});\nexport type Config = z.infer<typeof ConfigSchema>;\nexport function validateJobConfig(spec: Spec, config: Config): void {\n const targets: Record<Platform, readonly Config['packageTarget'][]> = { ios: ['simulator', 'ipa'], android: ['apk', 'aab'], macos: ['app', 'dmg'] };\n if (!targets[spec.platform].includes(config.packageTarget)) throw new Error(`packageTarget=${config.packageTarget} does not match platform=${spec.platform}`);\n if (spec.channel === 'google-play' && config.packageTarget !== 'aab') throw new Error('Google Play requires packageTarget=aab');\n if (config.toolchain && spec.framework !== 'flutter') throw new Error('toolchain.flutterSdk is only supported for framework=flutter');\n if (spec.framework !== 'flutter' && !config.packaging) throw new Error(`${spec.framework} requires owner-configured packaging.commands and packaging.artifactPath`);\n if (config.packaging?.provider === 'cloud' && !config.allowCloudBuild) throw new Error('Cloud packaging requires explicit allowCloudBuild=true');\n if (spec.platform === 'macos' && (config.allowCloudBuild || config.packaging?.provider === 'cloud')) throw new Error('macos currently supports local build-only delivery; notarization and uploads are not part of this tool');\n if (spec.framework === 'mygo') validateMyGoPackaging(config, spec.screenshotsDir);\n}\nexport const StageSchema = z.enum(['research', 'build', 'obfuscate', 'verify', 'review', 'package']);\nexport type Stage = z.infer<typeof StageSchema>;\nexport const StatusSchema = z.enum(['queued', 'running', 'waiting', 'blocked', 'failed', 'ready', 'built']);\nexport type Status = z.infer<typeof StatusSchema>;\nexport const ToolchainSchema = z.strictObject({ source: text, frameworkRevision: text, engineRevision: text, ready: z.boolean() });\nexport type Toolchain = z.infer<typeof ToolchainSchema>;\nexport const ProcessIdentitySchema = z.strictObject({ token: text });\nexport type ProcessIdentity = z.infer<typeof ProcessIdentitySchema>;\nexport const CommandMetadataSchema = z.strictObject({ deadline: z.number().finite(), identity: ProcessIdentitySchema, termAt: z.number().finite().optional(), killAt: z.number().finite().optional() });\nexport type CommandMetadata = z.infer<typeof CommandMetadataSchema>;\nexport const PrerequisiteSchema = z.strictObject({ argv: z.array(text).optional(), reason: text, path: text.optional() });\nexport type Prerequisite = z.infer<typeof PrerequisiteSchema>;\nexport const ResearchSchema = z.strictObject({\n viable: z.boolean(), distinctness: text, risks: z.array(text).optional(), plan: z.array(text).min(1),\n});\nexport type Research = z.infer<typeof ResearchSchema>;\nexport const ReviewSchema = z.strictObject({ approved: z.boolean(), findings: z.array(text), acceptanceEvidence: z.array(z.strictObject({ requirement: text, evidence: text })) });\nexport type Review = z.infer<typeof ReviewSchema>;\nexport const ArtifactSchema = z.strictObject({ kind: z.enum(['ios-simulator', 'ipa', 'apk', 'aab', 'macos-app', 'dmg']), path: text, digest: text.regex(/^[a-f0-9]{64}$/), createdAt: z.iso.datetime() });\nexport type Artifact = z.infer<typeof ArtifactSchema>;\nexport const InboxEntrySchema = z.strictObject({\n source: text, digest: text.nullable(), status: z.enum(['accepted', 'error']), jobId: text.nullable(),\n error: z.string().nullable(), observedAt: z.number().finite(),\n});\nexport type InboxEntry = z.infer<typeof InboxEntrySchema>;\nexport const HostStageSchema = z.enum(['research', 'build', 'review']);\nexport type HostStage = z.infer<typeof HostStageSchema>;\nexport const HostTurnSchema = z.strictObject({\n id: z.uuid(), stage: HostStageSchema, createdAt: z.number().finite(), contextDigest: text.regex(/^[a-f0-9]{64}$/),\n});\nexport type HostTurn = z.infer<typeof HostTurnSchema>;\nexport const JobSchema = z.object({\n id: text, spec: SpecSchema, requestSpec: SpecSchema.nullable(), requestSpecError: text.nullable().default(null), config: ConfigSchema, stage: StageSchema, status: StatusSchema,\n createdAt: z.number().finite(), updatedAt: z.number().finite(), nextAt: z.number().finite(),\n attempts: z.partialRecord(StageSchema, count), hostTurns: count, turn: HostTurnSchema.nullable().optional(), groups: z.array(z.number().int()),\n commands: z.record(z.string(), CommandMetadataSchema).default({}), receipt: AppleReceiptSchema, logs: z.array(text), workspace: text,\n baseJobId: z.uuid().optional(), baseDigest: text.regex(/^[a-f0-9]{64}$/).optional(), basePrepared: z.boolean().optional(),\n automaticBase: z.literal(true).optional(),\n sourceDirectory: text.refine(isAbsolute, 'sourceDirectory must be absolute').optional(), importDigest: text.regex(/^[a-f0-9]{64}$/).optional(), importPrepared: z.boolean().optional(), cloudBuildPending: z.boolean().optional(),\n recoveryStage: StageSchema.optional(),\n blockedReason: z.strictObject({ kind: z.literal('prerequisite'), stage: StageSchema, prerequisite: PrerequisiteSchema }).nullable().optional(),\n manualRecovery: z.string().nullable().optional(), error: z.string().nullable().optional(), feedback: z.string().optional(),\n research: ResearchSchema.optional(), policyEvidence: z.strictObject({ url: z.url(), fetchedAt: text, sha256: text }).optional(),\n toolchain: ToolchainSchema.optional(), verifiedDigest: text.nullable().optional(), verifiedDependencyDigest: text.regex(/^[a-f0-9]{64}$/).nullable().optional(), screenshotDigest: text.nullable().optional(), verifiedAt: text.optional(),\n obfuscationBase: z.strictObject({ digest: text.regex(/^[a-f0-9]{64}$/), path: text }).optional(),\n obfuscationDigest: text.regex(/^[a-f0-9]{64}$/).optional(),\n obfuscationReport: z.strictObject({ changedFiles: count, transforms: z.record(text, count), skipped: z.strictObject({ generated: count, unsupported: count }) }).optional(),\n review: ReviewSchema.nullable().optional(), ipaPath: text.nullable().optional(), archiveDigest: text.nullable().optional(), artifact: ArtifactSchema.nullable().optional(),\n externalChecks: z.unknown().optional(),\n}).passthrough();\nexport type Job = z.infer<typeof JobSchema>;\n\nexport type FactoryError = Error & { code?: string; syscall?: string; prerequisite?: Prerequisite; httpStatus?: number | null; outcome?: string; transient?: boolean };\nexport function toError(value: unknown): FactoryError {\n return value instanceof Error ? value : new Error(String(value));\n}\n"],"mappings":";;;;;;AAMA,MAAM,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAO,UAAS,MAAM,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,SAAS,IAAI,GAAG,gDAAgD;AACjJ,MAAM,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,KAAK;AAClD,MAAM,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO;AAC9C,MAAM,UAAU,EAAE,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC;AAEnC,SAAS,oBAAoB,OAAe,YAAY,OAAgB;CACtE,IAAI,aAAa,UAAU,KAAK,OAAO;CACvC,OAAO,CAAC,WAAW,KAAK,KAAK,CA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AW;EAAM,QAAQ;CAAK,CAAC,CAAC,CAAC,SAAS;CAC9H,WAAW,gBAAgB,SAAS;CAAG,gBAAgB,KAAK,SAAS,CAAC,CAAC,SAAS;CAAG,0BAA0B,KAAK,MAAM,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CAAG,kBAAkB,KAAK,SAAS,CAAC,CAAC,SAAS;CAAG,YAAY,KAAK,SAAS;CACzO,iBAAiB,EAAE,aAAa;EAAE,QAAQ,KAAK,MAAM,gBAAgB;EAAG,MAAM;CAAK,CAAC,CAAC,CAAC,SAAS;CAC/F,mBAAmB,KAAK,MAAM,gBAAgB,CAAC,CAAC,SAAS;CACzD,mBAAmB,EAAE,aAAa;EAAE,cAAc;EAAO,YAAY,EAAE,OAAO,MAAM,KAAK;EAAG,SAAS,EAAE,aAAa;GAAE,WAAW;GAAO,aAAa;EAAM,CAAC;CAAE,CAAC,CAAC,CAAC,SAAS;CAC1K,QAAQ,aAAa,SAAS,CAAC,CAAC,SAAS;CAAG,SAAS,KAAK,SAAS,CAAC,CAAC,SAAS;CAAG,eAAe,KAAK,SAAS,CAAC,CAAC,SAAS;CAAG,UAAU,eAAe,SAAS,CAAC,CAAC,SAAS;CACzK,gBAAgB,EAAE,QAAQ,CAAC,CAAC,SAAS;AACvC,CAAC,CAAC,CAAC,YAAY;AAIf,SAAgB,QAAQ,OAA8B;CACpD,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;AACjE"}
|
|
1
|
+
{"version":3,"file":"schemas.js","names":[],"sources":["../src/schemas.ts"],"sourcesContent":["import { z } from 'zod';\nimport { dirname, isAbsolute, resolve, win32 } from 'node:path';\nimport { lstatSync } from 'node:fs';\nimport { AppleReceiptSchema } from './apple-types.js';\nimport { validateMyGoPackaging } from './mygo-build.js';\n\nconst text = z.string().min(1).refine(value => value.trim().length > 0 && !value.includes('\\0'), 'Expected non-empty text without NUL characters');\nconst count = z.number().int().nonnegative().safe();\nconst positive = z.number().positive().finite();\nconst command = z.array(text).min(1);\n\nfunction relativeProjectPath(value: string, allowRoot = false): boolean {\n if (allowRoot && value === '.') return true;\n return !isAbsolute(value) && !win32.isAbsolute(value) && !/[\\\\:*?\\[\\]]/.test(value)\n && value.split('/').every(part => part !== '' && part !== '.' && part !== '..');\n}\n\nexport const FrameworkSchema = z.enum(['flutter', 'android-java', 'swift', 'react-native', 'expo', 'uni-app', 'mygo']);\nexport type Framework = z.infer<typeof FrameworkSchema>;\nexport const PlatformSchema = z.enum(['ios', 'android', 'macos']);\nexport type Platform = z.infer<typeof PlatformSchema>;\nexport const ChannelSchema = z.enum(['local', 'app-store', 'google-play']);\nexport type Channel = z.infer<typeof ChannelSchema>;\nexport const PrioritySchema = z.enum(['P0', 'P1', 'P2']);\nexport type Priority = z.infer<typeof PrioritySchema>;\nexport const PackageTargetSchema = z.enum(['simulator', 'ipa', 'apk', 'aab', 'app', 'dmg']);\nexport type PackageTarget = z.infer<typeof PackageTargetSchema>;\nexport const AppleSpecSchema = z.strictObject({\n appId: text.optional(), bundleId: text.optional(), buildNumber: text.optional(), locale: text.optional(),\n description: text.optional(), keywords: text.optional(), supportUrl: text.optional(), privacyPolicyUrl: text.optional(), reviewNotes: text.optional(),\n copyright: text.optional(), whatsNew: text.optional(), storefrontCountry: text.optional(), manualSetupConfirmed: z.boolean().optional(),\n contact: z.strictObject({ firstName: text.optional(), lastName: text.optional(), email: text.optional(), phone: text.optional() }).optional(),\n});\nexport type AppleSpec = z.infer<typeof AppleSpecSchema>;\nconst SpecObject = z.strictObject({\n id: text.regex(/^[a-z][a-z0-9-]{1,62}$/), name: text, purpose: text, audience: text,\n framework: FrameworkSchema, platform: PlatformSchema, channel: ChannelSchema.default('local'), version: text.default('1.0.0'),\n priority: PrioritySchema.default('P1'),\n project: z.strictObject({ sourceDir: text.optional(), directory: text.refine(value => relativeProjectPath(value, true), 'project.directory must be a relative in-root directory without traversal').default('.') }).optional(),\n screenshotsDir: text.optional(), differentiators: z.array(text).min(1), acceptance: z.array(text).min(1),\n constraints: z.array(text).optional(), apple: AppleSpecSchema.optional(),\n authorEmail: z.string().email().optional(),\n hiddenFeatures: z.literal(false).optional(), reviewBypass: z.literal(false).optional(),\n});\nfunction refineSpec(value: z.infer<typeof SpecObject>, context: z.RefinementCtx): void {\n if (value.framework === 'android-java' && value.platform !== 'android') context.addIssue({ code: 'custom', path: ['platform'], message: 'android-java requires platform=android' });\n if (value.framework === 'swift' && value.platform !== 'ios') context.addIssue({ code: 'custom', path: ['platform'], message: 'swift requires platform=ios' });\n if (value.framework === 'mygo' && value.platform !== 'macos') context.addIssue({ code: 'custom', path: ['platform'], message: 'mygo requires platform=macos' });\n if (value.platform === 'macos' && value.framework !== 'mygo') context.addIssue({ code: 'custom', path: ['framework'], message: 'macos currently requires framework=mygo' });\n if (value.platform === 'macos' && value.channel !== 'local') context.addIssue({ code: 'custom', path: ['channel'], message: 'macos currently supports local delivery only' });\n if (value.channel === 'app-store' && value.platform !== 'ios') context.addIssue({ code: 'custom', path: ['channel'], message: 'app-store requires platform=ios' });\n if (value.channel === 'google-play' && value.platform !== 'android') context.addIssue({ code: 'custom', path: ['channel'], message: 'google-play requires platform=android' });\n}\nexport const SpecSchema = SpecObject.superRefine(refineSpec);\nexport type Spec = z.infer<typeof SpecSchema>;\nexport const RequirementSchema = SpecObject.extend({ baseJobId: z.uuid().optional() }).superRefine((value, context) => {\n refineSpec(value, context);\n if (value.baseJobId && value.project?.sourceDir) context.addIssue({ code: 'custom', path: ['project', 'sourceDir'], message: 'project.sourceDir and baseJobId are mutually exclusive' });\n});\n\nexport const ObfuscationConfigSchema = z.strictObject({\n command: z.array(command.element).min(1).default(['obfuscator']),\n /** Obfuscator rules file resolved against the factory config directory; must be a regular file. */\n configPath: text.optional(),\n /** Inline obfuscator rules (same shape as the rules file); validated by the bundled obfuscator at run time. */\n options: z.record(z.string(), z.unknown()).optional(),\n seed: text.optional(),\n}).superRefine((value, context) => {\n if (!value.configPath && !value.options) context.addIssue({ code: 'custom', path: [], message: 'obfuscation needs configPath or inline options; set one of them' });\n if (value.configPath && value.options) context.addIssue({ code: 'custom', path: [], message: 'obfuscation accepts configPath or inline options, not both' });\n});\nexport type ObfuscationConfig = z.infer<typeof ObfuscationConfigSchema>;\n\n/**\n * Advisory role assignments per host stage. Role names are free-form so teams\n * can add any missing agent (e.g. security-review, performance-analyst); the\n * host adopts every returned role via its native delegation. Roles never\n * change stage eligibility, budgets or evidence gates.\n */\nexport const RolesConfigSchema = z.strictObject({\n research: z.array(text).default(['product-analyst']),\n build: z.array(text).default(['developer']),\n review: z.array(text).default(['architect-review', 'qa-engineer', 'acceptance-reviewer']),\n});\nexport type RolesConfig = z.infer<typeof RolesConfigSchema>;\n\nexport const NotifyEmailSchema = z.strictObject({\n from: z.string().email(),\n to: z.string().email(),\n smtpHost: text,\n smtpPort: z.number().int().positive().default(465),\n secure: z.boolean().default(true),\n user: text.optional(),\n /** Environment variable name holding the SMTP password; the value is never stored or printed. */\n passwordEnv: z.string().regex(/^[A-Z][A-Z0-9_]*$/).optional(),\n timeoutMs: z.number().int().positive().default(15000),\n subject: text.optional(),\n body: text.optional(),\n});\nexport type NotifyEmail = z.infer<typeof NotifyEmailSchema>;\n\nexport const ConfigSchema = z.strictObject({\n configPath: text.optional(), stateDir: text, workspaceRoot: text,\n allowLocalExecution: z.boolean().default(false), allowCloudBuild: z.boolean().default(false),\n executionEnv: z.array(text.regex(/^[A-Z][A-Z0-9_]*$/).refine(value => !/^(ASC_|APPLE_|FASTLANE_|MATCH_)/.test(value), 'Publisher credentials must not be passed to host or verification tools')).default([]),\n isolation: z.strictObject({ mode: z.literal('macos-sandbox'), readOnlyPaths: z.array(text).default([]), network: z.enum(['deny', 'allow']).default('deny') }).optional(),\n timeoutMs: positive.default(900000), maxAttempts: positive.int().default(3), maxHostTurns: positive.int().default(16), maxJobHours: positive.default(24),\n retryDelayMs: positive.default(30000), pollMs: positive.default(300000),\n inbox: z.strictObject({ directory: text, pollMs: positive.default(2000) }).optional(),\n verification: z.strictObject({ prerequisites: z.array(command).default([]), checks: z.array(command).min(1), runtime: z.array(command).min(1) }),\n toolchain: z.strictObject({ flutterSdk: text }).optional(),\n apple: z.strictObject({ exportOptionsPlist: text.optional() }).optional(),\n packageTarget: PackageTargetSchema, executionWarning: text.optional(),\n obfuscation: ObfuscationConfigSchema.optional(),\n notify: z.strictObject({ email: NotifyEmailSchema }).optional(),\n roles: RolesConfigSchema.optional(),\n packaging: z.strictObject({ commands: z.array(command).min(1), artifactPath: text.refine(value => relativeProjectPath(value), 'artifactPath must be an exact project-relative file or directory without traversal or wildcards'), provider: z.enum(['local', 'cloud']).default('local') }).optional(),\n}).superRefine((value, context) => {\n if (value.packaging?.provider === 'cloud' && !value.allowCloudBuild) context.addIssue({ code: 'custom', path: ['allowCloudBuild'], message: 'Cloud packaging requires explicit allowCloudBuild=true' });\n});\nexport type Config = z.infer<typeof ConfigSchema>;\nexport function validateJobConfig(spec: Spec, config: Config): void {\n const targets: Record<Platform, readonly Config['packageTarget'][]> = { ios: ['simulator', 'ipa'], android: ['apk', 'aab'], macos: ['app', 'dmg'] };\n if (!targets[spec.platform].includes(config.packageTarget)) throw new Error(`packageTarget=${config.packageTarget} does not match platform=${spec.platform}`);\n if (spec.channel === 'google-play' && config.packageTarget !== 'aab') throw new Error('Google Play requires packageTarget=aab');\n if (config.toolchain && spec.framework !== 'flutter') throw new Error('toolchain.flutterSdk is only supported for framework=flutter');\n if (spec.framework !== 'flutter' && !config.packaging) throw new Error(`${spec.framework} requires owner-configured packaging.commands and packaging.artifactPath`);\n if (config.packaging?.provider === 'cloud' && !config.allowCloudBuild) throw new Error('Cloud packaging requires explicit allowCloudBuild=true');\n if (spec.platform === 'macos' && (config.allowCloudBuild || config.packaging?.provider === 'cloud')) throw new Error('macos currently supports local build-only delivery; notarization and uploads are not part of this tool');\n if (spec.framework === 'mygo') validateMyGoPackaging(config, spec.screenshotsDir);\n}\nexport const StageSchema = z.enum(['research', 'build', 'obfuscate', 'verify', 'review', 'package']);\nexport type Stage = z.infer<typeof StageSchema>;\nexport const StatusSchema = z.enum(['queued', 'running', 'waiting', 'blocked', 'failed', 'ready', 'built']);\nexport type Status = z.infer<typeof StatusSchema>;\nexport const ToolchainSchema = z.strictObject({ source: text, frameworkRevision: text, engineRevision: text, ready: z.boolean() });\nexport type Toolchain = z.infer<typeof ToolchainSchema>;\nexport const ProcessIdentitySchema = z.strictObject({ token: text });\nexport type ProcessIdentity = z.infer<typeof ProcessIdentitySchema>;\nexport const CommandMetadataSchema = z.strictObject({ deadline: z.number().finite(), identity: ProcessIdentitySchema, termAt: z.number().finite().optional(), killAt: z.number().finite().optional() });\nexport type CommandMetadata = z.infer<typeof CommandMetadataSchema>;\nexport const PrerequisiteSchema = z.strictObject({ argv: z.array(text).optional(), reason: text, path: text.optional() });\nexport type Prerequisite = z.infer<typeof PrerequisiteSchema>;\nexport const ResearchSchema = z.strictObject({\n viable: z.boolean(), distinctness: text, risks: z.array(text).optional(), plan: z.array(text).min(1),\n});\nexport type Research = z.infer<typeof ResearchSchema>;\nexport const ReviewSchema = z.strictObject({ approved: z.boolean(), findings: z.array(text), acceptanceEvidence: z.array(z.strictObject({ requirement: text, evidence: text })) });\nexport type Review = z.infer<typeof ReviewSchema>;\nexport const ArtifactSchema = z.strictObject({ kind: z.enum(['ios-simulator', 'ipa', 'apk', 'aab', 'macos-app', 'dmg']), path: text, digest: text.regex(/^[a-f0-9]{64}$/), createdAt: z.iso.datetime() });\nexport type Artifact = z.infer<typeof ArtifactSchema>;\nexport const InboxEntrySchema = z.strictObject({\n source: text, digest: text.nullable(), status: z.enum(['accepted', 'error']), jobId: text.nullable(),\n error: z.string().nullable(), observedAt: z.number().finite(),\n});\nexport type InboxEntry = z.infer<typeof InboxEntrySchema>;\nexport const HostStageSchema = z.enum(['research', 'build', 'review']);\nexport type HostStage = z.infer<typeof HostStageSchema>;\nexport const HostTurnSchema = z.strictObject({\n id: z.uuid(), stage: HostStageSchema, createdAt: z.number().finite(), contextDigest: text.regex(/^[a-f0-9]{64}$/),\n});\nexport type HostTurn = z.infer<typeof HostTurnSchema>;\nexport const JobSchema = z.object({\n id: text, spec: SpecSchema, requestSpec: SpecSchema.nullable(), requestSpecError: text.nullable().default(null), config: ConfigSchema, stage: StageSchema, status: StatusSchema,\n createdAt: z.number().finite(), updatedAt: z.number().finite(), nextAt: z.number().finite(),\n attempts: z.partialRecord(StageSchema, count), hostTurns: count, turn: HostTurnSchema.nullable().optional(), groups: z.array(z.number().int()),\n commands: z.record(z.string(), CommandMetadataSchema).default({}), receipt: AppleReceiptSchema, logs: z.array(text), workspace: text,\n baseJobId: z.uuid().optional(), baseDigest: text.regex(/^[a-f0-9]{64}$/).optional(), basePrepared: z.boolean().optional(),\n automaticBase: z.literal(true).optional(),\n sourceDirectory: text.refine(isAbsolute, 'sourceDirectory must be absolute').optional(), importDigest: text.regex(/^[a-f0-9]{64}$/).optional(), importPrepared: z.boolean().optional(), cloudBuildPending: z.boolean().optional(),\n recoveryStage: StageSchema.optional(),\n blockedReason: z.strictObject({ kind: z.literal('prerequisite'), stage: StageSchema, prerequisite: PrerequisiteSchema }).nullable().optional(),\n manualRecovery: z.string().nullable().optional(), error: z.string().nullable().optional(), feedback: z.string().optional(),\n research: ResearchSchema.optional(), policyEvidence: z.strictObject({ url: z.url(), fetchedAt: text, sha256: text }).optional(),\n toolchain: ToolchainSchema.optional(), verifiedDigest: text.nullable().optional(), verifiedDependencyDigest: text.regex(/^[a-f0-9]{64}$/).nullable().optional(), screenshotDigest: text.nullable().optional(), verifiedAt: text.optional(),\n obfuscationBase: z.strictObject({ digest: text.regex(/^[a-f0-9]{64}$/), path: text }).optional(),\n obfuscationDigest: text.regex(/^[a-f0-9]{64}$/).optional(),\n obfuscationReport: z.strictObject({ changedFiles: count, transforms: z.record(text, count), skipped: z.strictObject({ generated: count, unsupported: count }) }).optional(),\n review: ReviewSchema.nullable().optional(), ipaPath: text.nullable().optional(), archiveDigest: text.nullable().optional(), artifact: ArtifactSchema.nullable().optional(),\n notifiedAt: text.nullable().optional(), notifiedTo: text.nullable().optional(), notifyError: text.nullable().optional(), notifySendingAt: text.nullable().optional(),\n externalChecks: z.unknown().optional(),\n}).passthrough();\nexport type Job = z.infer<typeof JobSchema>;\n\nexport type FactoryError = Error & { code?: string; syscall?: string; prerequisite?: Prerequisite; httpStatus?: number | null; outcome?: string; transient?: boolean };\nexport function toError(value: unknown): FactoryError {\n return value instanceof Error ? value : new Error(String(value));\n}\n"],"mappings":";;;;;;AAMA,MAAM,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAO,UAAS,MAAM,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,SAAS,IAAI,GAAG,gDAAgD;AACjJ,MAAM,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,KAAK;AAClD,MAAM,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO;AAC9C,MAAM,UAAU,EAAE,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC;AAEnC,SAAS,oBAAoB,OAAe,YAAY,OAAgB;CACtE,IAAI,aAAa,UAAU,KAAK,OAAO;CACvC,OAAO,CAAC,WAAW,KAAK,KAAK,CAAC,MAAM,WAAW,KAAK,KAAK,CAAC,cAAc,KAAK,KAAK,KAC7E,MAAM,MAAM,GAAG,CAAC,CAAC,OAAM,SAAQ,SAAS,MAAM,SAAS,OAAO,SAAS,IAAI;AAClF;AAEA,MAAa,kBAAkB,EAAE,KAAK;CAAC;CAAW;CAAgB;CAAS;CAAgB;CAAQ;CAAW;AAAM,CAAC;AAErH,MAAa,iBAAiB,EAAE,KAAK;CAAC;CAAO;CAAW;AAAO,CAAC;AAEhE,MAAa,gBAAgB,EAAE,KAAK;CAAC;CAAS;CAAa;AAAa,CAAC;AAEzE,MAAa,iBAAiB,EAAE,KAAK;CAAC;CAAM;CAAM;AAA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