@buffcore/cli 0.8.46 → 0.8.48
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/CHANGELOG.md +74 -0
- package/dist/commands/build/server-text.en.d.ts +5 -0
- package/dist/commands/build/server-text.en.js +5 -0
- package/dist/commands/build/server-text.js +5 -0
- package/dist/commands/build/server.d.ts +4 -0
- package/dist/commands/build/server.js +10 -1
- package/dist/commands/change-merge-remove.d.ts +9 -2
- package/dist/commands/change-merge-remove.js +27 -15
- package/dist/commands/change-merge.d.ts +2 -2
- package/dist/commands/design/check.d.ts +1 -1
- package/dist/commands/design/check.js +2 -1
- package/dist/commands/design/contract-size.d.ts +7 -0
- package/dist/commands/design/contract-size.js +47 -0
- package/dist/commands/design/tells.en.d.ts +2 -0
- package/dist/commands/design/tells.en.js +2 -0
- package/dist/commands/design/tells.es.js +2 -0
- package/dist/commands/dev.d.ts +9 -2
- package/dist/commands/dev.js +24 -5
- package/dist/commands/extension/places-approval.d.ts +4 -0
- package/dist/commands/hardening.d.ts +3 -0
- package/dist/commands/hardening.en.d.ts +3 -0
- package/dist/commands/hardening.en.js +3 -0
- package/dist/commands/hardening.es.d.ts +2 -0
- package/dist/commands/hardening.es.js +3 -0
- package/dist/commands/hardening.js +19 -0
- package/dist/commands/process-paths.d.ts +14 -0
- package/dist/commands/process-paths.js +90 -0
- package/dist/commands/prototype/ai-approval.d.ts +27 -0
- package/dist/commands/prototype/ai-approval.js +60 -0
- package/dist/commands/prototype/approver.d.ts +71 -0
- package/dist/commands/prototype/approver.js +168 -0
- package/dist/commands/prototype/comp-record.d.ts +5 -0
- package/dist/commands/prototype/comp-record.js +22 -0
- package/dist/commands/prototype/critique-gate.d.ts +14 -0
- package/dist/commands/prototype/critique-gate.js +48 -0
- package/dist/commands/prototype/fence.d.ts +1 -0
- package/dist/commands/prototype/fence.js +12 -0
- package/dist/commands/prototype/final-approval-grant.js +18 -0
- package/dist/commands/prototype/final-approval.js +4 -1
- package/dist/commands/prototype/index.js +3 -0
- package/dist/commands/prototype/layout-hints.d.ts +34 -0
- package/dist/commands/prototype/layout-hints.js +194 -0
- package/dist/commands/prototype/layout-measure.d.ts +39 -0
- package/dist/commands/prototype/layout-measure.js +97 -0
- package/dist/commands/prototype/layout-words.d.ts +2 -0
- package/dist/commands/prototype/layout-words.js +11 -0
- package/dist/commands/prototype/layout.en.d.ts +6 -0
- package/dist/commands/prototype/layout.en.js +7 -0
- package/dist/commands/prototype/load-location.js +2 -3
- package/dist/commands/prototype/messages.en.d.ts +14 -0
- package/dist/commands/prototype/messages.en.js +15 -1
- package/dist/commands/prototype/messages.js +15 -1
- package/dist/commands/prototype/milestone-versions.d.ts +4 -0
- package/dist/commands/prototype/prune-command.d.ts +5 -0
- package/dist/commands/prototype/prune-command.js +25 -0
- package/dist/commands/prototype/prune-words.d.ts +1 -0
- package/dist/commands/prototype/prune-words.js +7 -0
- package/dist/commands/prototype/prune.d.ts +16 -0
- package/dist/commands/prototype/prune.en.d.ts +9 -0
- package/dist/commands/prototype/prune.en.js +9 -0
- package/dist/commands/prototype/prune.es.d.ts +2 -0
- package/dist/commands/prototype/prune.es.js +9 -0
- package/dist/commands/prototype/prune.js +140 -0
- package/dist/commands/prototype/reopen-messages.d.ts +9 -0
- package/dist/commands/prototype/reopen-messages.js +19 -0
- package/dist/commands/prototype/report.d.ts +14 -0
- package/dist/commands/prototype/report.js +5 -1
- package/dist/commands/prototype/scene-layout.d.ts +17 -0
- package/dist/commands/prototype/scene-layout.js +57 -0
- package/dist/commands/prototype/scene-ready.js +8 -2
- package/dist/commands/prototype/scene.d.ts +15 -2
- package/dist/commands/prototype/scene.js +54 -42
- package/dist/commands/prototype/selector-answer.d.ts +43 -0
- package/dist/commands/prototype/selector-answer.js +73 -0
- package/dist/commands/prototype/selector-misses.d.ts +19 -0
- package/dist/commands/prototype/selector-misses.js +78 -0
- package/dist/commands/prototype/selector-prompt.d.ts +23 -0
- package/dist/commands/prototype/selector-prompt.js +32 -0
- package/dist/commands/prototype/selector-run.d.ts +13 -0
- package/dist/commands/prototype/selector-run.js +113 -0
- package/dist/commands/prototype/selector.d.ts +54 -0
- package/dist/commands/prototype/selector.js +96 -0
- package/dist/commands/prototype/snapshot-ancestor.js +2 -0
- package/dist/commands/prototype/snapshot-bundle.d.ts +17 -3
- package/dist/commands/prototype/snapshot-bundle.js +69 -7
- package/dist/commands/prototype/snapshot-check-files.d.ts +2 -0
- package/dist/commands/prototype/snapshot-check-files.js +41 -0
- package/dist/commands/prototype/snapshot-command.d.ts +2 -0
- package/dist/commands/prototype/snapshot-command.js +3 -0
- package/dist/commands/prototype/snapshot-completion.d.ts +4 -0
- package/dist/commands/prototype/snapshot-completion.js +30 -2
- package/dist/commands/prototype/snapshot-dependencies.d.ts +23 -2
- package/dist/commands/prototype/snapshot-dependencies.js +120 -14
- package/dist/commands/prototype/snapshot-hashes.d.ts +7 -0
- package/dist/commands/prototype/snapshot-hashes.js +28 -0
- package/dist/commands/prototype/snapshot-inputs.d.ts +15 -6
- package/dist/commands/prototype/snapshot-inputs.js +140 -197
- package/dist/commands/prototype/snapshot-matrix.d.ts +58 -0
- package/dist/commands/prototype/snapshot-matrix.js +95 -0
- package/dist/commands/prototype/snapshot-metro-inputs.d.ts +8 -0
- package/dist/commands/prototype/snapshot-metro-inputs.js +81 -0
- package/dist/commands/prototype/snapshot-owners.d.ts +6 -2
- package/dist/commands/prototype/snapshot-owners.js +12 -3
- package/dist/commands/prototype/snapshot-progress-entry.d.ts +14 -0
- package/dist/commands/prototype/snapshot-progress-entry.js +85 -0
- package/dist/commands/prototype/snapshot-progress.d.ts +19 -2
- package/dist/commands/prototype/snapshot-progress.js +54 -102
- package/dist/commands/prototype/snapshot-registry.d.ts +14 -0
- package/dist/commands/prototype/snapshot-registry.js +121 -0
- package/dist/commands/prototype/snapshot-report.d.ts +4 -0
- package/dist/commands/prototype/snapshot-report.js +77 -12
- package/dist/commands/prototype/snapshot-requests.d.ts +13 -3
- package/dist/commands/prototype/snapshot-requests.js +68 -30
- package/dist/commands/prototype/snapshot-reuse.d.ts +6 -1
- package/dist/commands/prototype/snapshot-reuse.js +17 -7
- package/dist/commands/prototype/snapshot-scene-inputs.d.ts +30 -0
- package/dist/commands/prototype/snapshot-scene-inputs.js +210 -0
- package/dist/commands/prototype/snapshot-served-inputs.d.ts +3 -0
- package/dist/commands/prototype/snapshot-served-inputs.js +12 -0
- package/dist/commands/prototype/snapshot-server-record.d.ts +26 -0
- package/dist/commands/prototype/snapshot-server-record.js +135 -0
- package/dist/commands/prototype/snapshot-servers.d.ts +3 -1
- package/dist/commands/prototype/snapshot-servers.js +50 -2
- package/dist/commands/prototype/snapshot-setup.d.ts +3 -1
- package/dist/commands/prototype/snapshot-setup.js +2 -1
- package/dist/commands/prototype/snapshot-surface-inputs.d.ts +23 -0
- package/dist/commands/prototype/snapshot-surface-inputs.js +161 -0
- package/dist/commands/prototype/snapshot-vite-inputs.d.ts +22 -0
- package/dist/commands/prototype/snapshot-vite-inputs.js +209 -0
- package/dist/commands/prototype/snapshot.d.ts +5 -0
- package/dist/commands/prototype/snapshot.js +72 -10
- package/dist/commands/prototype/version-commands.d.ts +4 -0
- package/dist/commands/prototype/version-commands.js +36 -8
- package/dist/commands/prototype/versions.d.ts +28 -2
- package/dist/commands/prototype/versions.js +25 -1
- package/dist/commands/prototype/vite-fs-path.d.ts +4 -0
- package/dist/commands/prototype/vite-fs-path.js +15 -0
- package/dist/commands/remove-links.d.ts +6 -0
- package/dist/commands/remove-links.js +17 -0
- package/dist/commands/server/build.d.ts +2 -1
- package/dist/commands/server/build.js +10 -2
- package/dist/commands/server/deploy-local.d.ts +3 -0
- package/dist/commands/server/deploy-local.js +9 -0
- package/dist/commands/server/deploy-plan.d.ts +5 -0
- package/dist/commands/server/deploy-plan.js +56 -0
- package/dist/commands/server/deploy-result.d.ts +7 -0
- package/dist/commands/server/deploy-result.js +1 -0
- package/dist/commands/server/deploy-script.d.ts +2 -0
- package/dist/commands/server/deploy-script.js +3 -2
- package/dist/commands/server/deploy.d.ts +9 -6
- package/dist/commands/server/deploy.js +39 -61
- package/dist/commands/server/files.d.ts +9 -1
- package/dist/commands/server/files.js +25 -5
- package/dist/commands/server/image.d.ts +4 -2
- package/dist/commands/server/image.js +6 -5
- package/dist/commands/server/setup.js +4 -0
- package/dist/commands/server/system-packages.d.ts +29 -0
- package/dist/commands/server/system-packages.js +103 -0
- package/dist/commands/services/compose.d.ts +1 -1
- package/dist/commands/services/compose.js +5 -3
- package/dist/commands/size-docs.d.ts +9 -0
- package/dist/commands/size-docs.en.d.ts +6 -0
- package/dist/commands/size-docs.en.js +6 -0
- package/dist/commands/size-docs.es.d.ts +2 -0
- package/dist/commands/size-docs.es.js +6 -0
- package/dist/commands/size-docs.js +28 -0
- package/dist/commands/size.d.ts +5 -2
- package/dist/commands/size.js +27 -9
- package/dist/commands/ui/agents-route.js +2 -0
- package/dist/commands/ui/approval-authority.d.ts +10 -2
- package/dist/commands/ui/approval-authority.en.d.ts +1 -0
- package/dist/commands/ui/approval-authority.en.js +1 -0
- package/dist/commands/ui/approval-authority.es.d.ts +1 -0
- package/dist/commands/ui/approval-authority.es.js +1 -0
- package/dist/commands/ui/approval-authority.js +8 -2
- package/dist/commands/ui/approve.js +2 -4
- package/dist/commands/ui/autopilot-ai-approve.d.ts +18 -0
- package/dist/commands/ui/autopilot-ai-approve.js +68 -0
- package/dist/commands/ui/autopilot-loop.js +5 -6
- package/dist/commands/ui/autopilot-merge.js +3 -0
- package/dist/commands/ui/autopilot-records.d.ts +2 -0
- package/dist/commands/ui/autopilot-records.js +5 -0
- package/dist/commands/ui/autopilot.en.d.ts +23 -0
- package/dist/commands/ui/autopilot.en.js +23 -0
- package/dist/commands/ui/autopilot.es.d.ts +23 -0
- package/dist/commands/ui/autopilot.es.js +23 -0
- package/dist/commands/ui/brand-approval.js +5 -1
- package/dist/commands/ui/chat/find.d.ts +2 -0
- package/dist/commands/ui/chat/find.js +13 -0
- package/dist/commands/ui/chat/fresh-codex.d.ts +39 -0
- package/dist/commands/ui/chat/fresh-codex.js +175 -0
- package/dist/commands/ui/chat/fresh-critique.js +13 -5
- package/dist/commands/ui/chat/fresh-launch.d.ts +19 -0
- package/dist/commands/ui/chat/fresh-launch.js +67 -11
- package/dist/commands/ui/chat/fresh-prompts.d.ts +2 -0
- package/dist/commands/ui/chat/fresh-prompts.js +2 -0
- package/dist/commands/ui/chat/fresh-secrets.d.ts +6 -0
- package/dist/commands/ui/chat/fresh-secrets.js +172 -0
- package/dist/commands/ui/chat/fresh.en.d.ts +1 -0
- package/dist/commands/ui/chat/fresh.en.js +2 -1
- package/dist/commands/ui/chat/fresh.es.d.ts +1 -0
- package/dist/commands/ui/chat/fresh.es.js +2 -1
- package/dist/commands/ui/chat/permissions.js +1 -1
- package/dist/commands/ui/chat/routes.js +4 -0
- package/dist/commands/ui/chat/worktree.js +25 -5
- package/dist/commands/ui/comp-approval.d.ts +14 -2
- package/dist/commands/ui/comp-approval.js +45 -8
- package/dist/commands/ui/index.js +3 -0
- package/dist/commands/ui/level-route.js +3 -0
- package/dist/commands/ui/loop-approve.d.ts +30 -1
- package/dist/commands/ui/loop-approve.js +2 -2
- package/dist/commands/ui/merge-authority.d.ts +4 -1
- package/dist/commands/ui/merge-authority.en.d.ts +4 -0
- package/dist/commands/ui/merge-authority.en.js +5 -1
- package/dist/commands/ui/merge-authority.es.d.ts +4 -0
- package/dist/commands/ui/merge-authority.es.js +5 -1
- package/dist/commands/ui/merge-authority.js +6 -3
- package/dist/commands/ui/merge-claims.d.ts +7 -0
- package/dist/commands/ui/merge-claims.js +21 -0
- package/dist/commands/ui/merge-delegation.js +8 -3
- package/dist/commands/ui/merge-hold-name.d.ts +5 -0
- package/dist/commands/ui/merge-hold-name.js +5 -0
- package/dist/commands/ui/merge-hold.d.ts +6 -1
- package/dist/commands/ui/merge-hold.js +23 -5
- package/dist/commands/ui/merge-publish-host.d.ts +1 -0
- package/dist/commands/ui/merge-publish-host.js +2 -2
- package/dist/commands/ui/merge-record.d.ts +2 -0
- package/dist/commands/ui/merge-record.js +1 -1
- package/dist/commands/ui/merge-route.js +20 -1
- package/dist/commands/ui/merge-settle.d.ts +32 -0
- package/dist/commands/ui/merge-settle.js +133 -0
- package/dist/commands/ui/merge-state.d.ts +5 -0
- package/dist/commands/ui/merge-state.js +7 -1
- package/dist/commands/ui/merge-withdraw.d.ts +9 -0
- package/dist/commands/ui/merge-withdraw.js +29 -0
- package/dist/commands/ui/places-change.d.ts +4 -0
- package/dist/commands/ui/plan-files.js +5 -2
- package/dist/commands/ui/plan-structure.js +5 -7
- package/dist/commands/ui/prototype-comp-route.d.ts +12 -3
- package/dist/commands/ui/prototype-comp-route.js +35 -17
- package/dist/commands/ui/prototype-main.d.ts +4 -0
- package/dist/commands/ui/real-file.d.ts +11 -0
- package/dist/commands/ui/real-file.js +84 -0
- package/dist/commands/ui/reopen-route.d.ts +117 -0
- package/dist/commands/ui/reopen-route.js +97 -0
- package/dist/commands/ui/save-route.d.ts +2 -0
- package/dist/commands/ui/save-route.js +8 -1
- package/dist/commands/ui/server.d.ts +1 -0
- package/dist/commands/ui/server.js +1 -0
- package/dist/commands/ui/studio-routes.js +2 -0
- package/dist/commands/ui/studio-state.d.ts +34 -0
- package/dist/commands/ui/studio-versions.d.ts +24 -0
- package/dist/commands/ui/studio-versions.js +19 -3
- package/dist/commands/ui/worktrees.d.ts +1 -1
- package/dist/commands/ui/worktrees.js +19 -3
- package/dist/commands/worktree-sweep.d.ts +45 -0
- package/dist/commands/worktree-sweep.js +188 -0
- package/dist/commands/worktrees-command.d.ts +32 -0
- package/dist/commands/worktrees-command.en.d.ts +25 -0
- package/dist/commands/worktrees-command.en.js +55 -0
- package/dist/commands/worktrees-command.js +96 -0
- package/dist/main.js +2 -0
- package/dist/ui/page.js +89 -89
- package/docs/PROTOTYPE.md +19 -3
- package/docs/WORKBENCH.md +41 -6
- package/package.json +11 -11
- package/skills/ape-critique/SKILL.md +41 -6
- package/skills/ape-deploy/SKILL.md +4 -2
- package/skills/ape-design-system/SKILL.md +3 -0
- package/skills/ape-plan-change/SKILL.md +6 -0
- package/skills/ape-prototype/SKILL.md +8 -4
|
@@ -36,4 +36,27 @@ export const en = {
|
|
|
36
36
|
'auto.merged': 'Merged {change}. To undo, copy: {command}',
|
|
37
37
|
'auto.revert': '{change} is on main, but no safe command to undo this kind of merge is known; look at main before continuing.',
|
|
38
38
|
'auto.failed': 'the action could not be confirmed. Check its result before continuing.',
|
|
39
|
+
'auto.ai.floor': 'this version waits for a person: its report did not draw the floor for every scene.',
|
|
40
|
+
'auto.ai.selector': 'this version waits for a person: its report does not say whether the selector ran.',
|
|
41
|
+
'auto.ai.checks': 'this version waits for a person: a check in its report did not pass.',
|
|
42
|
+
'auto.ai.critique': 'this version waits for a person: design/critique.md does not review this commit.',
|
|
43
|
+
'auto.ai.p0': 'this version waits for a person: the critique names a P0.',
|
|
44
|
+
'auto.ai.agreement': 'this version waits for a person: the second selector turn added looks that were not drawn, or did not answer.',
|
|
45
|
+
'auto.ai.agent': 'this version waits for a person: the approver runs only with Claude Code or Codex ({agent} is set for validation and has no read-only turn).',
|
|
46
|
+
'auto.ai.codex-sandbox': 'this version waits for a person: Codex’s elevated Windows sandbox is not set up (set it up once in Codex, then try again).',
|
|
47
|
+
'auto.ai.ci': 'this version waits for a person: no approver turn runs in tests or CI.',
|
|
48
|
+
'auto.ai.launch': 'this version waits for a person: the approver turn could not start.',
|
|
49
|
+
'auto.ai.failed': 'this version waits for a person: the approver turn failed.',
|
|
50
|
+
'auto.ai.timeout': 'this version waits for a person: the approver turn took longer than {seconds} seconds.',
|
|
51
|
+
'auto.ai.shape': 'this version waits for a person: the approver answered out of shape.',
|
|
52
|
+
'auto.ai.builder': 'this version waits for a person: the approver could not prove it is not the agent that built the change.',
|
|
53
|
+
'auto.ai.declined': 'this version waits for a person: the approver declined ({reason}).',
|
|
54
|
+
'auto.ai.critic': "this version waits for a person: the studio's critique turn for this report did not finish ({why}).",
|
|
55
|
+
'auto.ai.secret': 'this version waits for a person: the approver’s answer quoted a value from {file}, so it was dropped.',
|
|
56
|
+
'auto.ai.why.secret': 'its answer quoted a value from {file} and was dropped',
|
|
57
|
+
'auto.ai.why.ci': 'tests or CI',
|
|
58
|
+
'auto.ai.why.launch': 'it could not start',
|
|
59
|
+
'auto.ai.why.failed': 'it failed',
|
|
60
|
+
'auto.ai.why.timeout': 'it took too long',
|
|
61
|
+
'auto.ai.why.shape': 'its answer was out of shape',
|
|
39
62
|
};
|
|
@@ -36,4 +36,27 @@ export declare const es: {
|
|
|
36
36
|
'auto.merged': string;
|
|
37
37
|
'auto.revert': string;
|
|
38
38
|
'auto.failed': string;
|
|
39
|
+
'auto.ai.floor': string;
|
|
40
|
+
'auto.ai.selector': string;
|
|
41
|
+
'auto.ai.checks': string;
|
|
42
|
+
'auto.ai.critique': string;
|
|
43
|
+
'auto.ai.p0': string;
|
|
44
|
+
'auto.ai.agreement': string;
|
|
45
|
+
'auto.ai.agent': string;
|
|
46
|
+
'auto.ai.codex-sandbox': string;
|
|
47
|
+
'auto.ai.ci': string;
|
|
48
|
+
'auto.ai.launch': string;
|
|
49
|
+
'auto.ai.failed': string;
|
|
50
|
+
'auto.ai.timeout': string;
|
|
51
|
+
'auto.ai.shape': string;
|
|
52
|
+
'auto.ai.builder': string;
|
|
53
|
+
'auto.ai.declined': string;
|
|
54
|
+
'auto.ai.critic': string;
|
|
55
|
+
'auto.ai.secret': string;
|
|
56
|
+
'auto.ai.why.secret': string;
|
|
57
|
+
'auto.ai.why.ci': string;
|
|
58
|
+
'auto.ai.why.launch': string;
|
|
59
|
+
'auto.ai.why.failed': string;
|
|
60
|
+
'auto.ai.why.timeout': string;
|
|
61
|
+
'auto.ai.why.shape': string;
|
|
39
62
|
};
|
|
@@ -36,4 +36,27 @@ export const es = {
|
|
|
36
36
|
'auto.merged': 'Se integró {change}. Para deshacerlo, copia: {command}',
|
|
37
37
|
'auto.revert': '{change} está en main, pero no se conoce un comando seguro para deshacer este tipo de integración; revisa main antes de continuar.',
|
|
38
38
|
'auto.failed': 'no se pudo confirmar la acción. Comprueba su resultado antes de continuar.',
|
|
39
|
+
'auto.ai.floor': 'esta versión espera a una persona: su informe no dibujó el mínimo en cada escena.',
|
|
40
|
+
'auto.ai.selector': 'esta versión espera a una persona: su informe no dice si el selector se ejecutó.',
|
|
41
|
+
'auto.ai.checks': 'esta versión espera a una persona: una comprobación de su informe no pasó.',
|
|
42
|
+
'auto.ai.critique': 'esta versión espera a una persona: design/critique.md no revisa este commit.',
|
|
43
|
+
'auto.ai.p0': 'esta versión espera a una persona: la crítica señala un P0.',
|
|
44
|
+
'auto.ai.agreement': 'esta versión espera a una persona: el segundo turno del selector añadió aspectos que no se dibujaron, o no respondió.',
|
|
45
|
+
'auto.ai.agent': 'esta versión espera a una persona: el aprobador solo funciona con Claude Code o Codex ({agent} está elegido para validar y no tiene un turno de solo lectura).',
|
|
46
|
+
'auto.ai.codex-sandbox': 'esta versión espera a una persona: el sandbox elevado de Windows de Codex no está configurado (configúralo una vez en Codex y vuelve a intentarlo).',
|
|
47
|
+
'auto.ai.ci': 'esta versión espera a una persona: en pruebas o en CI no se ejecuta ningún turno de aprobación.',
|
|
48
|
+
'auto.ai.launch': 'esta versión espera a una persona: el turno de aprobación no pudo empezar.',
|
|
49
|
+
'auto.ai.failed': 'esta versión espera a una persona: el turno de aprobación falló.',
|
|
50
|
+
'auto.ai.timeout': 'esta versión espera a una persona: el turno de aprobación tardó más de {seconds} segundos.',
|
|
51
|
+
'auto.ai.shape': 'esta versión espera a una persona: la respuesta del aprobador no tiene la forma pedida.',
|
|
52
|
+
'auto.ai.builder': 'esta versión espera a una persona: el aprobador no pudo demostrar que no es el agente que hizo el cambio.',
|
|
53
|
+
'auto.ai.declined': 'esta versión espera a una persona: el aprobador la rechazó ({reason}).',
|
|
54
|
+
'auto.ai.critic': 'esta versión espera a una persona: el turno de crítica del estudio para este informe no terminó ({why}).',
|
|
55
|
+
'auto.ai.secret': 'esta versión espera a una persona: la respuesta del aprobador citaba un valor de {file}, así que se descartó.',
|
|
56
|
+
'auto.ai.why.secret': 'su respuesta citaba un valor de {file} y se descartó',
|
|
57
|
+
'auto.ai.why.ci': 'pruebas o CI',
|
|
58
|
+
'auto.ai.why.launch': 'no pudo empezar',
|
|
59
|
+
'auto.ai.why.failed': 'falló',
|
|
60
|
+
'auto.ai.why.timeout': 'tardó demasiado',
|
|
61
|
+
'auto.ai.why.shape': 'su respuesta no tenía la forma pedida',
|
|
39
62
|
};
|
|
@@ -7,6 +7,7 @@ import { ApprovalRefusal, approvalRule, signApproval } from '../approval-rules.j
|
|
|
7
7
|
import { loadTheme } from '../design/sources.js';
|
|
8
8
|
import { themeHash } from '../design/state.js';
|
|
9
9
|
import { themeSources } from '../design/theme-sources.js';
|
|
10
|
+
import { readInsideSync } from './real-file.js';
|
|
10
11
|
export class BrandChanged extends ApprovalRefusal {
|
|
11
12
|
}
|
|
12
13
|
/** The colors and the fingerprint a card must carry come from one resolved source snapshot. */
|
|
@@ -27,7 +28,10 @@ export async function brandPreview(root) {
|
|
|
27
28
|
export async function brandFingerprint(root, direction, snapshot) {
|
|
28
29
|
const sources = snapshot?.sources ?? themeSources(root);
|
|
29
30
|
const theme = snapshot?.theme ?? (await loadTheme(root, sources));
|
|
30
|
-
const
|
|
31
|
+
const read = readInsideSync(join(root, 'design', 'DESIGN.md'), [root]);
|
|
32
|
+
if (!read)
|
|
33
|
+
throw new Error('design/DESIGN.md');
|
|
34
|
+
const design = read.toString('utf8').replace(/\r\n/g, '\n');
|
|
31
35
|
const hash = createHash('sha256')
|
|
32
36
|
.update(JSON.stringify({ theme: themeHash(theme), design, sources: sources.files }))
|
|
33
37
|
.digest('hex');
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { FoundAgent } from '@buffcore/contracts/workbench';
|
|
2
2
|
import { type Start } from '../runner.ts';
|
|
3
|
+
/** The same check at once, for a fresh Codex turn (fresh-codex.ts): Codex's config only. */
|
|
4
|
+
export declare function codexElevated(): boolean;
|
|
3
5
|
/** Fixed CLI probes and Codex's config only, never sign-in files. */
|
|
4
6
|
export declare function findAgents(start?: Start, root?: string): Promise<FoundAgent[]>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
1
2
|
import { readFile } from 'node:fs/promises';
|
|
2
3
|
import { homedir } from 'node:os';
|
|
3
4
|
import { isAbsolute, join } from 'node:path';
|
|
@@ -105,6 +106,18 @@ async function codexSetup() {
|
|
|
105
106
|
return false;
|
|
106
107
|
}
|
|
107
108
|
}
|
|
109
|
+
/** The same check at once, for a fresh Codex turn (fresh-codex.ts): Codex's config only. */
|
|
110
|
+
export function codexElevated() {
|
|
111
|
+
const home = process.env.CODEX_HOME || join(homedir(), '.codex');
|
|
112
|
+
if (!isAbsolute(home))
|
|
113
|
+
return false;
|
|
114
|
+
try {
|
|
115
|
+
return elevated(readFileSync(join(home, 'config.toml'), 'utf8'));
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
108
121
|
/** Fixed CLI probes and Codex's config only, never sign-in files. */
|
|
109
122
|
export function findAgents(start, root = findRoot()) {
|
|
110
123
|
const launch = start ?? agentStart(root);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AgentEffort, AgentId } from '@buffcore/contracts/workbench';
|
|
2
|
+
/** The agents with a fresh read-only turn. OpenCode has none yet (see docs/PROTOTYPE.md). */
|
|
3
|
+
export declare const FRESH_AGENTS: readonly ['claude', 'codex'];
|
|
4
|
+
export type FreshAgent = (typeof FRESH_AGENTS)[number];
|
|
5
|
+
export declare const freshAgent: (id: AgentId | string) => id is FreshAgent;
|
|
6
|
+
/**
|
|
7
|
+
* Why the agent takes no fresh read-only turn in this folder, or undefined: an agent with none
|
|
8
|
+
* (`agent`), Codex whose project settings could widen it (`agent`, codexWidens), or Codex on Windows
|
|
9
|
+
* without its elevated sandbox, the studio's own readiness check (`codex-sandbox`).
|
|
10
|
+
*/
|
|
11
|
+
export declare function freshUnready(id: AgentId | string, folder: string): 'agent' | 'codex-sandbox' | undefined;
|
|
12
|
+
/** The agent takes a fresh read-only turn in this folder. */
|
|
13
|
+
export declare const freshReady: (id: AgentId | string, folder: string) => id is FreshAgent;
|
|
14
|
+
/**
|
|
15
|
+
* What a fresh turn still needs of them: where Codex keeps its sign-in, the sign-in a person set
|
|
16
|
+
* for Claude Code, and the certificate authorities a company network adds.
|
|
17
|
+
*/
|
|
18
|
+
export declare const FRESH_ALLOWED: string[];
|
|
19
|
+
/** The environment without the building turn's session; HOME and the rest pass. */
|
|
20
|
+
export declare const freshEnvironment: (env: NodeJS.ProcessEnv) => NodeJS.ProcessEnv;
|
|
21
|
+
/**
|
|
22
|
+
* Why the product's own Codex settings could widen a fresh turn, or undefined. `-s read-only` beats
|
|
23
|
+
* any sandbox or permission profile in them, but an MCP server runs outside Codex's sandbox and a
|
|
24
|
+
* hook runs a command of its own: a `.codex/config.toml` from the folder up with anything beyond
|
|
25
|
+
* the profile (`default_permissions`, `[permissions.*]`) and the studio's own `[mcp_servers.ape]`
|
|
26
|
+
* (turned off for the turn), or a `.codex/hooks.json`, up to the repository's root, gives no fresh
|
|
27
|
+
* Codex turn.
|
|
28
|
+
*/
|
|
29
|
+
export declare function codexWidens(folder: string): string | undefined;
|
|
30
|
+
export interface CodexFreshLaunch {
|
|
31
|
+
folder: string;
|
|
32
|
+
model?: string;
|
|
33
|
+
effort?: AgentEffort;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The read-only arguments for one fresh Codex turn; the prompt goes in on stdin. No trust for the
|
|
37
|
+
* folder, so a project setting Codex would load only for a trusted folder stays out too.
|
|
38
|
+
*/
|
|
39
|
+
export declare function freshCodexArgs(launch: CodexFreshLaunch): string[];
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// One fresh, read-only Codex turn (S3d): `codex exec` in a new, unsaved session (`--ephemeral`, never
|
|
2
|
+
// `resume`), the user's config and execpolicy rules left out (their MCP servers and allow rules could
|
|
3
|
+
// widen the turn; the sign-in in CODEX_HOME still holds), never asking, in Codex's own read-only
|
|
4
|
+
// sandbox (`-s read-only`: no writes and no network for any command). Codex refuses a sandbox mode
|
|
5
|
+
// override beside a permission profile one, and the sandbox mode wins over a profile in config, so the product's deny-read profile does not apply: secret files in
|
|
6
|
+
// the folder are readable to the turn (docs/WORKBENCH.md). Web search and the product's MCP server
|
|
7
|
+
// are off, and a product whose Codex settings could widen the turn gets none (codexWidens).
|
|
8
|
+
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
9
|
+
import { homedir } from 'node:os';
|
|
10
|
+
import { dirname, join, resolve } from 'node:path';
|
|
11
|
+
import { AGENT_DEFS } from './defs.js';
|
|
12
|
+
import { codexElevated } from './find.js';
|
|
13
|
+
import { turnOverrides } from './turn-overrides.js';
|
|
14
|
+
/** The agents with a fresh read-only turn. OpenCode has none yet (see docs/PROTOTYPE.md). */
|
|
15
|
+
export const FRESH_AGENTS = ['claude', 'codex'];
|
|
16
|
+
export const freshAgent = (id) => FRESH_AGENTS.includes(id);
|
|
17
|
+
/**
|
|
18
|
+
* Why the agent takes no fresh read-only turn in this folder, or undefined: an agent with none
|
|
19
|
+
* (`agent`), Codex whose project settings could widen it (`agent`, codexWidens), or Codex on Windows
|
|
20
|
+
* without its elevated sandbox, the studio's own readiness check (`codex-sandbox`).
|
|
21
|
+
*/
|
|
22
|
+
export function freshUnready(id, folder) {
|
|
23
|
+
if (!freshAgent(id))
|
|
24
|
+
return 'agent';
|
|
25
|
+
if (id !== 'codex')
|
|
26
|
+
return;
|
|
27
|
+
if (process.platform === 'win32' && !codexElevated())
|
|
28
|
+
return 'codex-sandbox';
|
|
29
|
+
if (codexWidens(folder))
|
|
30
|
+
return 'agent';
|
|
31
|
+
}
|
|
32
|
+
/** The agent takes a fresh read-only turn in this folder. */
|
|
33
|
+
export const freshReady = (id, folder) => !freshUnready(id, folder);
|
|
34
|
+
/** A building turn's own variables, by prefix: never handed to a fresh turn's process. */
|
|
35
|
+
const SESSION_PREFIXES = ['CODEX_', 'CLAUDE_CODE_', 'CLAUDECODE'];
|
|
36
|
+
/**
|
|
37
|
+
* What a fresh turn still needs of them: where Codex keeps its sign-in, the sign-in a person set
|
|
38
|
+
* for Claude Code, and the certificate authorities a company network adds.
|
|
39
|
+
*/
|
|
40
|
+
export const FRESH_ALLOWED = [
|
|
41
|
+
'CODEX_HOME',
|
|
42
|
+
'CODEX_CA_CERTIFICATE',
|
|
43
|
+
'CLAUDE_CODE_OAUTH_TOKEN',
|
|
44
|
+
'CLAUDE_CODE_USE_BEDROCK',
|
|
45
|
+
'CLAUDE_CODE_USE_VERTEX',
|
|
46
|
+
'CLAUDE_CODE_CLIENT_CERT',
|
|
47
|
+
'CLAUDE_CODE_CLIENT_KEY',
|
|
48
|
+
];
|
|
49
|
+
/** The environment without the building turn's session; HOME and the rest pass. */
|
|
50
|
+
export const freshEnvironment = (env) => Object.fromEntries(Object.entries(env).filter(([key]) => {
|
|
51
|
+
const name = key.toUpperCase();
|
|
52
|
+
if (FRESH_ALLOWED.includes(name))
|
|
53
|
+
return true;
|
|
54
|
+
return !SESSION_PREFIXES.some((prefix) => name.startsWith(prefix));
|
|
55
|
+
}));
|
|
56
|
+
/**
|
|
57
|
+
* Why the product's own Codex settings could widen a fresh turn, or undefined. `-s read-only` beats
|
|
58
|
+
* any sandbox or permission profile in them, but an MCP server runs outside Codex's sandbox and a
|
|
59
|
+
* hook runs a command of its own: a `.codex/config.toml` from the folder up with anything beyond
|
|
60
|
+
* the profile (`default_permissions`, `[permissions.*]`) and the studio's own `[mcp_servers.ape]`
|
|
61
|
+
* (turned off for the turn), or a `.codex/hooks.json`, up to the repository's root, gives no fresh
|
|
62
|
+
* Codex turn.
|
|
63
|
+
*/
|
|
64
|
+
export function codexWidens(folder) {
|
|
65
|
+
// Long, real paths on both sides: a short Windows name (ALPHAO~1) must still meet the home.
|
|
66
|
+
const real = (path) => {
|
|
67
|
+
try {
|
|
68
|
+
return realpathSync.native(path);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return resolve(path);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
for (const dir of projectDirs(real(folder), real(homedir()))) {
|
|
75
|
+
const config = join(dir, '.codex', 'config.toml');
|
|
76
|
+
// A skill may declare an MCP server Codex would start: a repository with skills gets no turn.
|
|
77
|
+
if (existsSync(join(dir, '.agents', 'skills')))
|
|
78
|
+
return join(dir, '.agents', 'skills');
|
|
79
|
+
for (const extra of ['hooks.json', 'agents'])
|
|
80
|
+
if (existsSync(join(dir, '.codex', extra)))
|
|
81
|
+
return join(dir, '.codex', extra);
|
|
82
|
+
if (existsSync(config)) {
|
|
83
|
+
let text;
|
|
84
|
+
try {
|
|
85
|
+
text = readFileSync(config, 'utf8');
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return config;
|
|
89
|
+
}
|
|
90
|
+
// A multi-line string could hide a table or a setting from this reading.
|
|
91
|
+
if (/"""|'''/.test(text))
|
|
92
|
+
return config;
|
|
93
|
+
let table = '';
|
|
94
|
+
for (const raw of text.split(/\r?\n/)) {
|
|
95
|
+
const line = raw.trim();
|
|
96
|
+
if (!line || line.startsWith('#'))
|
|
97
|
+
continue;
|
|
98
|
+
const header = /^\[\[?\s*([^\]]+?)\s*\]\]?\s*(?:#.*)?$/.exec(line);
|
|
99
|
+
if (header) {
|
|
100
|
+
table = header[1].replaceAll('"', '');
|
|
101
|
+
if (!/^permissions\.|^mcp_servers\.ape$/.test(table))
|
|
102
|
+
return config;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (!table && !/^default_permissions\s*=/.test(line))
|
|
106
|
+
return config;
|
|
107
|
+
if (table === 'mcp_servers.ape' && !/^(command|args)\s*=/.test(line))
|
|
108
|
+
return config;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The folders whose `.codex` Codex reads as the project's: from the folder up to the repository's
|
|
115
|
+
* root, or the folder alone outside a repository. Never the home, whose `.codex` is the user's own,
|
|
116
|
+
* which --ignore-user-config leaves out.
|
|
117
|
+
*/
|
|
118
|
+
function projectDirs(folder, home) {
|
|
119
|
+
const dirs = [];
|
|
120
|
+
for (let dir = folder;; dir = dirname(dir)) {
|
|
121
|
+
if (dir.toLowerCase() === home.toLowerCase())
|
|
122
|
+
break;
|
|
123
|
+
dirs.push(dir);
|
|
124
|
+
if (existsSync(join(dir, '.git')))
|
|
125
|
+
return dirs;
|
|
126
|
+
if (dirname(dir) === dir)
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
return folder.toLowerCase() === home.toLowerCase() ? [] : [folder];
|
|
130
|
+
}
|
|
131
|
+
/** Codex features that reach beyond its sandbox: apps, plugins, hooks, browsers, the computer. */
|
|
132
|
+
const OFF_FEATURES = [
|
|
133
|
+
'apps',
|
|
134
|
+
'plugins',
|
|
135
|
+
'hooks',
|
|
136
|
+
'browser_use',
|
|
137
|
+
'browser_use_external',
|
|
138
|
+
'computer_use',
|
|
139
|
+
'in_app_browser',
|
|
140
|
+
'remote_plugin',
|
|
141
|
+
'skill_mcp_dependency_install',
|
|
142
|
+
];
|
|
143
|
+
/** Codex's own sandbox: every command reads only, with no network. */
|
|
144
|
+
const SANDBOX = ['-s', 'read-only'];
|
|
145
|
+
/**
|
|
146
|
+
* The read-only arguments for one fresh Codex turn; the prompt goes in on stdin. No trust for the
|
|
147
|
+
* folder, so a project setting Codex would load only for a trusted folder stays out too.
|
|
148
|
+
*/
|
|
149
|
+
export function freshCodexArgs(launch) {
|
|
150
|
+
const turn = AGENT_DEFS.find((def) => def.id === 'codex')?.turn;
|
|
151
|
+
if (!turn)
|
|
152
|
+
throw new Error('codex has no headless turn');
|
|
153
|
+
const settings = [
|
|
154
|
+
'approval_policy="never"',
|
|
155
|
+
// On Windows only Codex's elevated sandbox, which the studio checks is set up, holds the turn.
|
|
156
|
+
...(process.platform === 'win32'
|
|
157
|
+
? ['allow_login_shell=false', 'windows.sandbox="elevated"']
|
|
158
|
+
: []),
|
|
159
|
+
'mcp_servers.ape.enabled=false',
|
|
160
|
+
'web_search="disabled"',
|
|
161
|
+
];
|
|
162
|
+
return [
|
|
163
|
+
'exec',
|
|
164
|
+
'--ephemeral',
|
|
165
|
+
'--ignore-user-config',
|
|
166
|
+
'--ignore-rules',
|
|
167
|
+
...SANDBOX,
|
|
168
|
+
// What reaches beyond the sandbox is off for the turn (names as `codex features list` shows).
|
|
169
|
+
...OFF_FEATURES.flatMap((feature) => ['--disable', feature]),
|
|
170
|
+
...settings.flatMap((value) => ['-c', value]),
|
|
171
|
+
...turnOverrides('codex', { model: launch.model, effort: launch.effort }).args,
|
|
172
|
+
'--json',
|
|
173
|
+
...turn.stdin,
|
|
174
|
+
];
|
|
175
|
+
}
|
|
@@ -6,8 +6,9 @@ import { mkdirSync, writeFileSync } from 'node:fs';
|
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
import { CRITIQUE_FILE } from '@buffcore/contracts/workbench';
|
|
8
8
|
import { factsChanged } from '../merge-events.js';
|
|
9
|
+
import { freshReady } from './fresh-codex.js';
|
|
9
10
|
import { runFresh, stopFresh } from './fresh-launch.js';
|
|
10
|
-
import { critiquePrompt, critiqueText } from './fresh-prompts.js';
|
|
11
|
+
import { critiquePrompt, critiqueText, secretNote } from './fresh-prompts.js';
|
|
11
12
|
import { passingFullReport } from './fresh-report.js';
|
|
12
13
|
import { hostLaunched } from './host-launched.js';
|
|
13
14
|
import { plainPath } from './store.js';
|
|
@@ -41,7 +42,8 @@ export class CritiqueTurns {
|
|
|
41
42
|
const key = keyOf(pending);
|
|
42
43
|
if (this.closed || (key && (this.store.critiqued(key) || this.run?.key === key)))
|
|
43
44
|
return false;
|
|
44
|
-
|
|
45
|
+
// An agent with no fresh read-only turn (OpenCode) leaves the critique to a person.
|
|
46
|
+
if (!freshReady(this.agent(), source.checkout))
|
|
45
47
|
return false;
|
|
46
48
|
if (this.run) {
|
|
47
49
|
this.queued = pending;
|
|
@@ -56,13 +58,16 @@ export class CritiqueTurns {
|
|
|
56
58
|
}
|
|
57
59
|
begin(pending, key) {
|
|
58
60
|
const settings = this.settings();
|
|
61
|
+
const agent = this.agent();
|
|
62
|
+
if (!freshReady(agent, pending.source.checkout))
|
|
63
|
+
return;
|
|
59
64
|
const choice = {
|
|
60
65
|
...(settings?.model?.validation ? { model: settings.model.validation } : {}),
|
|
61
66
|
...(settings?.effort?.validation ? { effort: settings.effort.validation } : {}),
|
|
62
67
|
};
|
|
63
68
|
const { source, report } = pending;
|
|
64
69
|
const record = {
|
|
65
|
-
agent
|
|
70
|
+
agent,
|
|
66
71
|
at: new Date().toISOString(),
|
|
67
72
|
...(source.change ? { change: source.change } : {}),
|
|
68
73
|
...(report ? { report } : {}),
|
|
@@ -71,12 +76,15 @@ export class CritiqueTurns {
|
|
|
71
76
|
const folder = source.checkout;
|
|
72
77
|
const prompt = critiquePrompt(report);
|
|
73
78
|
const host = hostLaunched(this.root);
|
|
74
|
-
const run = runFresh(this.start, { folder, prompt, checks: true, host, ...choice });
|
|
79
|
+
const run = runFresh(this.start, { agent, folder, prompt, checks: true, host, ...choice });
|
|
75
80
|
this.run = { ...run, key };
|
|
76
|
-
void run.result.then(({ text, seconds }) => {
|
|
81
|
+
void run.result.then(({ text, seconds, secret }) => {
|
|
77
82
|
this.run = undefined;
|
|
78
83
|
if (this.closed)
|
|
79
84
|
return;
|
|
85
|
+
// The file only, never the value: the answer itself is gone.
|
|
86
|
+
if (secret)
|
|
87
|
+
console.warn(secretNote(secret));
|
|
80
88
|
const body = text === undefined ? undefined : critiqueText(text);
|
|
81
89
|
const written = !!body && keep(() => writeCritique(folder, body));
|
|
82
90
|
if (written && key)
|
|
@@ -2,7 +2,14 @@ import type { ChildProcess } from 'node:child_process';
|
|
|
2
2
|
import type { AgentEffort } from '@buffcore/contracts/workbench';
|
|
3
3
|
import type { Start } from '../runner.ts';
|
|
4
4
|
import { stopTree } from '../runner.ts';
|
|
5
|
+
import { type FreshAgent } from './fresh-codex.ts';
|
|
6
|
+
/** This CLI's own bin, which a builder's package.json script cannot replace. */
|
|
7
|
+
export declare const OWN_BIN: string;
|
|
8
|
+
/** The Autopilot loop's critique (S4) runs the checks only through this CLI's own bin. */
|
|
9
|
+
export declare const LOOP_CHECKS: string[];
|
|
5
10
|
export interface FreshLaunch {
|
|
11
|
+
/** The agent that takes the turn; Claude Code when absent. */
|
|
12
|
+
agent?: FreshAgent;
|
|
6
13
|
/** The product folder the turn reads. */
|
|
7
14
|
folder: string;
|
|
8
15
|
prompt: string;
|
|
@@ -10,6 +17,12 @@ export interface FreshLaunch {
|
|
|
10
17
|
effort?: AgentEffort;
|
|
11
18
|
/** The critique may run the design and i18n checks; the review runs nothing. */
|
|
12
19
|
checks?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The Autopilot loop's critique turn (S4): its checks run only through this CLI's own bin, and it
|
|
22
|
+
* may not read design/critique.md, which the building agent can write. The studio's own critique
|
|
23
|
+
* keeps `pnpm ape` and its file, as before.
|
|
24
|
+
*/
|
|
25
|
+
loop?: boolean;
|
|
13
26
|
/** The person's home, whose Claude settings give their denies and sign-in (tests set it). */
|
|
14
27
|
home?: string;
|
|
15
28
|
/**
|
|
@@ -22,6 +35,10 @@ export interface FreshResult {
|
|
|
22
35
|
/** The agent's final answer; absent when the turn failed. */
|
|
23
36
|
text?: string;
|
|
24
37
|
seconds: number;
|
|
38
|
+
/** The new session the turn ran in, from its own lines (an approver proves it is not the builder). */
|
|
39
|
+
session?: string;
|
|
40
|
+
/** The secret file whose value the answer held: the answer was dropped (fresh-secrets.ts). */
|
|
41
|
+
secret?: string;
|
|
25
42
|
}
|
|
26
43
|
/** The read-only arguments for one fresh Claude turn. */
|
|
27
44
|
export declare function freshArgs(launch: FreshLaunch, settings: string): string[];
|
|
@@ -29,6 +46,8 @@ export declare function freshArgs(launch: FreshLaunch, settings: string): string
|
|
|
29
46
|
export interface FreshRun {
|
|
30
47
|
child?: ChildProcess;
|
|
31
48
|
result: Promise<FreshResult>;
|
|
49
|
+
/** Remove the turn's settings file now (once), for a stopped child that never closes. */
|
|
50
|
+
release?: () => void;
|
|
32
51
|
}
|
|
33
52
|
/** Start one fresh turn; its result never rejects (a failure has no text). */
|
|
34
53
|
export declare function runFresh(start: Start, launch: FreshLaunch): FreshRun;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
1
2
|
import { stopTree } from '../runner.js';
|
|
2
3
|
import { stdinInput } from './attachments.js';
|
|
3
4
|
import { secretReads } from './claude-permissions.js';
|
|
4
5
|
import { AGENT_DEFS } from './defs.js';
|
|
6
|
+
import { freshCodexArgs } from './fresh-codex.js';
|
|
7
|
+
import { leakedSecret } from './fresh-secrets.js';
|
|
5
8
|
import { openFreshSettings, settingDenies } from './fresh-settings.js';
|
|
6
9
|
import { scrubLaunchIds } from './launch-ids.js';
|
|
7
10
|
import { claudeAdapter } from './parse-claude.js';
|
|
11
|
+
import { codexAdapter } from './parse-codex.js';
|
|
8
12
|
import { COMMENT_PATH, PLANNING_SETTINGS } from './permissions.js';
|
|
9
13
|
import { PLANNING_LIMITS } from './planning-limits.js';
|
|
10
14
|
import { jsonLine } from './prompt.js';
|
|
@@ -15,6 +19,10 @@ import { turnOverrides } from './turn-overrides.js';
|
|
|
15
19
|
* redirection to a file matches. The review runs none.
|
|
16
20
|
*/
|
|
17
21
|
const CRITIQUE_CHECKS = ['pnpm ape design check', 'pnpm ape i18n check'];
|
|
22
|
+
/** This CLI's own bin, which a builder's package.json script cannot replace. */
|
|
23
|
+
export const OWN_BIN = fileURLToPath(new URL('../../../../bin/ape.mjs', import.meta.url));
|
|
24
|
+
/** The Autopilot loop's critique (S4) runs the checks only through this CLI's own bin. */
|
|
25
|
+
export const LOOP_CHECKS = [`node "${OWN_BIN}" design check`, `node "${OWN_BIN}" i18n check`];
|
|
18
26
|
/** Every tool that writes, runs or reaches out, or starts another agent; reads stay. */
|
|
19
27
|
const WRITES = ['Edit', 'Write', 'NotebookEdit', 'WebFetch', 'WebSearch', 'Task', 'Agent'];
|
|
20
28
|
/** The read-only arguments for one fresh Claude turn. */
|
|
@@ -23,7 +31,10 @@ export function freshArgs(launch, settings) {
|
|
|
23
31
|
if (!turn)
|
|
24
32
|
throw new Error('claude has no headless turn');
|
|
25
33
|
const checks = launch.checks
|
|
26
|
-
? CRITIQUE_CHECKS.flatMap((command) => [
|
|
34
|
+
? (launch.loop ? LOOP_CHECKS : CRITIQUE_CHECKS).flatMap((command) => [
|
|
35
|
+
`Bash(${command})`,
|
|
36
|
+
`PowerShell(${command})`,
|
|
37
|
+
])
|
|
27
38
|
: [];
|
|
28
39
|
return [
|
|
29
40
|
...turn.start,
|
|
@@ -42,6 +53,7 @@ export function freshArgs(launch, settings) {
|
|
|
42
53
|
...WRITES,
|
|
43
54
|
...(launch.checks ? [] : ['Bash', 'PowerShell']),
|
|
44
55
|
`Read(//**/${COMMENT_PATH}/**)`,
|
|
56
|
+
...(launch.loop ? ['Read(//**/design/critique.md)', 'Read(design/critique.md)'] : []),
|
|
45
57
|
...secretReads(launch.folder),
|
|
46
58
|
...PLANNING_LIMITS,
|
|
47
59
|
...(launch.host ? [] : settingDenies(launch.folder, launch.home)),
|
|
@@ -54,31 +66,48 @@ export function runFresh(start, launch) {
|
|
|
54
66
|
const started = Date.now();
|
|
55
67
|
const seconds = () => Math.max(0, Math.floor((Date.now() - started) / 1000));
|
|
56
68
|
// Hooks stay off through the inline JSON a 0.8.41 planning launch carried too.
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
69
|
+
const agent = launch.agent ?? 'claude';
|
|
70
|
+
const none = { value: PLANNING_SETTINGS, close: () => { } };
|
|
71
|
+
// A Codex turn carries its limits in its arguments; only Claude's need a settings file.
|
|
72
|
+
const settings = launch.host || agent !== 'claude' ? none : openFreshSettings(launch.home);
|
|
73
|
+
let args;
|
|
74
|
+
try {
|
|
75
|
+
// Codex's arguments name the folder's real path: a folder that is gone is no launch.
|
|
76
|
+
args = agent === 'codex' ? freshCodexArgs(launch) : freshArgs(launch, settings.value);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
settings.close();
|
|
80
|
+
return { result: Promise.resolve({ seconds: seconds() }) };
|
|
81
|
+
}
|
|
61
82
|
const allowed = launchArguments(args);
|
|
83
|
+
let released = false;
|
|
62
84
|
const release = () => {
|
|
85
|
+
if (released)
|
|
86
|
+
return;
|
|
87
|
+
released = true;
|
|
63
88
|
allowed();
|
|
64
89
|
settings.close();
|
|
65
90
|
};
|
|
66
91
|
let child;
|
|
67
92
|
try {
|
|
68
|
-
child = start({ program: 'pnpm', args: ['exec',
|
|
93
|
+
child = start({ program: 'pnpm', args: ['exec', agent, ...args], json: true }, launch.folder);
|
|
69
94
|
}
|
|
70
95
|
catch {
|
|
71
96
|
release();
|
|
72
97
|
return { result: Promise.resolve({ seconds: seconds() }) };
|
|
73
98
|
}
|
|
74
99
|
const result = new Promise((done) => {
|
|
75
|
-
const adapter = claudeAdapter();
|
|
100
|
+
const adapter = agent === 'codex' ? codexAdapter() : claudeAdapter();
|
|
101
|
+
let finished = agent === 'claude';
|
|
76
102
|
let pending = '';
|
|
77
103
|
let answer;
|
|
78
104
|
let last;
|
|
79
105
|
let failed = false;
|
|
106
|
+
let session;
|
|
80
107
|
const line = (text) => {
|
|
81
108
|
const record = jsonLine(text);
|
|
109
|
+
if (typeof record.session_id === 'string')
|
|
110
|
+
session ??= record.session_id;
|
|
82
111
|
if (record.type === 'result') {
|
|
83
112
|
if (record.is_error === true || record.subtype !== 'success')
|
|
84
113
|
failed = true;
|
|
@@ -90,8 +119,16 @@ export function runFresh(start, launch) {
|
|
|
90
119
|
last = event.text;
|
|
91
120
|
if (event.kind === 'error')
|
|
92
121
|
failed = true;
|
|
122
|
+
// Codex names its session on its first line and ends a finished turn with `done`.
|
|
123
|
+
if (event.kind === 'done') {
|
|
124
|
+
finished = true;
|
|
125
|
+
if (event.session)
|
|
126
|
+
session ??= event.session;
|
|
127
|
+
}
|
|
93
128
|
}
|
|
94
129
|
};
|
|
130
|
+
// Nothing reads the child's errors, but a full pipe would stall it: they are drained.
|
|
131
|
+
child.stderr?.resume();
|
|
95
132
|
child.stdout?.setEncoding('utf8');
|
|
96
133
|
child.stdout?.on('data', (chunk) => {
|
|
97
134
|
const lines = (pending + chunk).split('\n');
|
|
@@ -108,15 +145,34 @@ export function runFresh(start, launch) {
|
|
|
108
145
|
release();
|
|
109
146
|
if (pending.trim())
|
|
110
147
|
line(pending);
|
|
111
|
-
const
|
|
112
|
-
|
|
148
|
+
const said = failed || !finished || code !== 0 ? undefined : (answer ?? last);
|
|
149
|
+
// An answer that quotes a secret value is never kept, shown or passed on.
|
|
150
|
+
const secret = said?.trim() ? leakedSecret(launch.folder, said, launch.home) : undefined;
|
|
151
|
+
const text = secret ? undefined : said;
|
|
152
|
+
done({
|
|
153
|
+
...(text?.trim() ? { text: scrubLaunchIds(text) } : {}),
|
|
154
|
+
...(secret ? { secret } : {}),
|
|
155
|
+
...(session ? { session } : {}),
|
|
156
|
+
seconds: seconds(),
|
|
157
|
+
});
|
|
113
158
|
};
|
|
114
159
|
child.once('error', () => end(1));
|
|
115
160
|
child.once('close', (code) => end(code));
|
|
116
161
|
});
|
|
117
162
|
child.stdin?.on('error', () => { });
|
|
118
|
-
child.stdin?.end(stdinInput(
|
|
119
|
-
return { child, result };
|
|
163
|
+
child.stdin?.end(stdinInput(agent, launch.prompt + codexChecks(agent, launch.checks), []));
|
|
164
|
+
return { child, result, release };
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Codex's sandbox lets any command run that reads only, so its prompt names the same two checks as
|
|
168
|
+
* the loop's Claude critique, or none. The sandbox, not this line, keeps the turn read-only.
|
|
169
|
+
*/
|
|
170
|
+
function codexChecks(agent, checks) {
|
|
171
|
+
if (agent !== 'codex')
|
|
172
|
+
return '';
|
|
173
|
+
if (!checks)
|
|
174
|
+
return '\nRun no command.';
|
|
175
|
+
return `\nRun no command except these two checks, exactly: ${LOOP_CHECKS.map((check) => `\`${check}\``).join(' and ')}.`;
|
|
120
176
|
}
|
|
121
177
|
/** Stop a fresh turn's process tree. */
|
|
122
178
|
export function stopFresh(run, stop = stopTree) {
|
|
@@ -15,3 +15,5 @@ export declare function parseFindings(text: string): string[] | undefined;
|
|
|
15
15
|
* the skill's shape (a reply such as "I couldn't write the file" is not a critique).
|
|
16
16
|
*/
|
|
17
17
|
export declare function critiqueText(text: string): string | undefined;
|
|
18
|
+
/** Why a fresh turn's answer was dropped: the secret file it quoted, never the value. */
|
|
19
|
+
export declare const secretNote: (file: string) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The values one secret file holds: a JSON file's strings, else each line's value. */
|
|
2
|
+
export declare function valuesOf(text: string, file?: string): string[];
|
|
3
|
+
/** The main checkout of a linked worktree the folder lies in, read from Git's own files. */
|
|
4
|
+
export declare function mainCheckout(folder: string): string | undefined;
|
|
5
|
+
/** The secret file whose value the answer holds, or undefined. */
|
|
6
|
+
export declare function leakedSecret(folder: string, answer: string, home?: string): string | undefined;
|