@buffcore/cli 0.8.47 → 0.8.49
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 +52 -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-serial.d.ts +6 -2
- package/dist/commands/change-merge-serial.js +5 -1
- package/dist/commands/change-merge.d.ts +2 -2
- package/dist/commands/change.js +3 -0
- package/dist/commands/check-skills.d.ts +16 -0
- package/dist/commands/check-skills.en.d.ts +14 -0
- package/dist/commands/check-skills.en.js +14 -0
- package/dist/commands/check-skills.es.d.ts +2 -0
- package/dist/commands/check-skills.es.js +14 -0
- package/dist/commands/check-skills.js +146 -0
- package/dist/commands/check.js +5 -0
- package/dist/commands/dev.d.ts +9 -2
- package/dist/commands/dev.js +24 -5
- package/dist/commands/extension/config-text.d.ts +2 -0
- package/dist/commands/extension/config-text.js +2 -0
- package/dist/commands/extension/index.js +14 -2
- package/dist/commands/extension/new.d.ts +16 -0
- package/dist/commands/extension/new.js +52 -0
- package/dist/commands/extension/pack-files.d.ts +23 -0
- package/dist/commands/extension/pack-files.js +78 -0
- package/dist/commands/extension/pack-scan.d.ts +24 -0
- package/dist/commands/extension/pack-scan.js +131 -0
- package/dist/commands/extension/pack.d.ts +48 -0
- package/dist/commands/extension/pack.js +142 -0
- package/dist/commands/extension/share-text.d.ts +3 -0
- package/dist/commands/extension/share-text.js +6 -0
- package/dist/commands/extension/share.en.d.ts +32 -0
- package/dist/commands/extension/share.en.js +32 -0
- package/dist/commands/extension/share.es.d.ts +2 -0
- package/dist/commands/extension/share.es.js +32 -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/prototype/comp-record.d.ts +5 -0
- package/dist/commands/prototype/comp-record.js +22 -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.d.ts +1 -0
- 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/ui/agents-route.js +2 -0
- 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 +7 -2
- package/dist/commands/ui/approve.js +2 -4
- package/dist/commands/ui/autopilot-records.d.ts +2 -0
- package/dist/commands/ui/autopilot-records.js +5 -0
- package/dist/commands/ui/brand-approval.js +5 -1
- package/dist/commands/ui/chat/permissions.js +1 -1
- package/dist/commands/ui/chat/routes.js +4 -0
- package/dist/commands/ui/comp-approval.d.ts +14 -2
- package/dist/commands/ui/comp-approval.js +45 -8
- package/dist/commands/ui/index.d.ts +1 -0
- package/dist/commands/ui/level-route.js +3 -0
- 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 +17 -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/outside-merge.d.ts +13 -0
- package/dist/commands/ui/outside-merge.js +84 -0
- package/dist/commands/ui/outside.d.ts +7 -4
- package/dist/commands/ui/outside.js +3 -0
- package/dist/commands/ui/plan-extensions.d.ts +34 -0
- package/dist/commands/ui/plan-extensions.en.d.ts +4 -0
- package/dist/commands/ui/plan-extensions.en.js +4 -0
- package/dist/commands/ui/plan-extensions.es.d.ts +2 -0
- package/dist/commands/ui/plan-extensions.es.js +4 -0
- package/dist/commands/ui/plan-extensions.js +86 -0
- package/dist/commands/ui/plan-files.js +9 -3
- 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 +6 -0
- package/dist/commands/ui/real-file.d.ts +11 -0
- package/dist/commands/ui/real-file.js +84 -0
- package/dist/commands/ui/save-route.js +4 -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 +8 -0
- package/dist/commands/ui/studio-versions.js +19 -3
- package/dist/commands/ui/studio.en.d.ts +2 -0
- package/dist/commands/ui/studio.en.js +2 -0
- package/dist/commands/ui/studio.es.d.ts +2 -0
- package/dist/commands/ui/studio.es.js +2 -0
- package/dist/commands/upgrade.js +1 -1
- package/dist/ui/page.js +91 -91
- package/docs/EXTENSIONS.md +6 -0
- package/docs/PROTOTYPE.md +13 -0
- package/docs/WORKBENCH.md +55 -2
- package/package.json +11 -11
- package/skills/ape-add-ai-purpose/SKILL.md +1 -1
- package/skills/ape-add-event/SKILL.md +1 -1
- package/skills/ape-add-extension/SKILL.md +5 -1
- package/skills/ape-add-feature/SKILL.md +1 -1
- package/skills/ape-add-generator/SKILL.md +1 -1
- package/skills/ape-add-module/SKILL.md +1 -1
- package/skills/ape-add-route/SKILL.md +3 -1
- package/skills/ape-add-service/SKILL.md +1 -1
- package/skills/ape-add-translations/SKILL.md +2 -2
- package/skills/ape-admin-screen/SKILL.md +1 -1
- package/skills/ape-app-screen/SKILL.md +1 -1
- package/skills/ape-critique/SKILL.md +11 -32
- package/skills/ape-critique/references/after.md +15 -0
- package/skills/ape-critique/references/spacing-pass.md +20 -0
- package/skills/ape-deploy/SKILL.md +8 -3
- package/skills/ape-design-system/SKILL.md +15 -15
- package/skills/ape-design-system/references/by-hand.md +7 -0
- package/skills/ape-design-system/references/reference-study.md +11 -0
- package/skills/ape-diagnose/SKILL.md +24 -0
- package/skills/ape-migration/SKILL.md +1 -1
- package/skills/ape-plan-change/SKILL.md +37 -31
- package/skills/ape-plan-change/references/change-file-fields.md +5 -0
- package/skills/ape-plan-change/references/extensions.md +25 -0
- package/skills/ape-plan-change/references/finishing.md +3 -0
- package/skills/ape-plan-change/references/fix-from-error.md +3 -0
- package/skills/ape-plan-change/references/refactor.md +9 -0
- package/skills/ape-plan-change/references/structure.md +19 -0
- package/skills/ape-prototype/SKILL.md +13 -23
- package/skills/ape-prototype/references/comp.md +3 -0
- package/skills/ape-prototype/references/scope-and-export.md +5 -0
- package/skills/ape-prototype/references/snapshot.md +3 -0
- package/skills/ape-prototype/references/structure.md +11 -0
- package/skills/ape-prototype/references/working-app.md +7 -0
- package/skills/ape-request/SKILL.md +1 -1
- package/skills/ape-upgrade/SKILL.md +4 -1
- package/templates/product/package.json +1 -1
|
@@ -5,7 +5,11 @@ export const es = {
|
|
|
5
5
|
'ui.merge.config': 'La configuración de integración del anfitrión entra en conflicto o su tiempo límite no es un entero de 1 a 30000 milisegundos.',
|
|
6
6
|
'ui.merge.stopped': 'La última integración de este cambio terminó sin respuesta (el estudio se detuvo). Vuelve a integrar.',
|
|
7
7
|
'ui.merge.pending': 'Esperando a que el anfitrión integre el cambio.',
|
|
8
|
-
'ui.merge.since': 'Esperando a que el anfitrión integre el cambio. Solicitado {at}.',
|
|
8
|
+
'ui.merge.since': 'Esperando a que el anfitrión integre el cambio. Solicitado {at}, hace {hours, plural, =0 {{minutes, plural, one {# minuto} other {# minutos}}} one {# hora} other {# horas}}.',
|
|
9
|
+
'ui.merge.settleRefused': 'El anfitrión no pudo resolver esta solicitud de integración. Motivo: {code}.',
|
|
10
|
+
'ui.merge.settleHeld': 'Las integraciones de Autopilot están en pausa, así que el anfitrión no pudo resolver esta solicitud.',
|
|
11
|
+
'ui.merge.withdrawn': 'Se retiró la solicitud de integración. El cambio se puede volver a integrar.',
|
|
12
|
+
'ui.merge.notWithdrawn': 'No hay ninguna solicitud de integración que retirar, o main ya contiene el cambio.',
|
|
9
13
|
'ui.merge.refused': 'El anfitrión no integró este cambio. Motivo: {code}.',
|
|
10
14
|
'ui.merge.error': 'No se pudo confirmar la integración del anfitrión. Revisa el resultado antes de continuar.',
|
|
11
15
|
'ui.merge.timeout': 'El anfitrión no respondió a tiempo. Revisa el resultado antes de continuar.',
|
|
@@ -14,7 +14,10 @@ const reserved = {
|
|
|
14
14
|
merge_not_observed: 'ui.merge.unobserved',
|
|
15
15
|
merge_record_failed: 'ui.merge.record',
|
|
16
16
|
merge_publication_lock: 'ui.merge.publicationLock',
|
|
17
|
+
merge_settle_invalid: 'ui.merge.settleRefused',
|
|
18
|
+
merge_settle_unknown: 'ui.merge.settleRefused',
|
|
17
19
|
};
|
|
20
|
+
export const reservedCode = (code) => Object.hasOwn(reserved, code) || code === mergeHeldCode;
|
|
18
21
|
export const mergeHeldCode = 'autopilot_merge_held';
|
|
19
22
|
export const mergeMessage = (code) => mergeT(Object.hasOwn(reserved, code) ? reserved[code] : 'ui.merge.refused', {
|
|
20
23
|
code,
|
|
@@ -102,8 +105,7 @@ function validated(value, head) {
|
|
|
102
105
|
const parsed = answerSchema.safeParse(value);
|
|
103
106
|
if (!parsed.success || (parsed.data.status === 'merged' && parsed.data.head !== head))
|
|
104
107
|
return refused('merge_authority_invalid');
|
|
105
|
-
if (parsed.data.status === 'not_merged' &&
|
|
106
|
-
(Object.hasOwn(reserved, parsed.data.code) || parsed.data.code === mergeHeldCode))
|
|
108
|
+
if (parsed.data.status === 'not_merged' && reservedCode(parsed.data.code))
|
|
107
109
|
return refused('merge_authority_invalid');
|
|
108
110
|
return parsed.data;
|
|
109
111
|
}
|
|
@@ -125,7 +127,7 @@ export function immutableFacts(facts) {
|
|
|
125
127
|
});
|
|
126
128
|
}
|
|
127
129
|
/** One bounded call, with late settlements consumed and no fallback or retry. */
|
|
128
|
-
export async function callMerge(context, facts, publication, signal, current = () => true) {
|
|
130
|
+
export async function callMerge(context, facts, publication, signal, current = () => true, claim) {
|
|
129
131
|
try {
|
|
130
132
|
if (signal?.aborted)
|
|
131
133
|
return refused('merge_authority_error');
|
|
@@ -133,6 +135,7 @@ export async function callMerge(context, facts, publication, signal, current = (
|
|
|
133
135
|
...immutableFacts(facts),
|
|
134
136
|
viewer: context.viewer,
|
|
135
137
|
...(context.agent ? { agent: context.agent } : {}),
|
|
138
|
+
...(claim ? { claim } : {}),
|
|
136
139
|
};
|
|
137
140
|
if (!current())
|
|
138
141
|
return refused('merge_artifact_changed');
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Under the publication lock the caller holds: withdraw each waiting Autopilot claim (of the named
|
|
3
|
+
* changes, or all) whose head main does not hold, so a host's later settle of it is unknown. A
|
|
4
|
+
* head main already holds is a merge, left for the next read to record. A Git that cannot say
|
|
5
|
+
* withdraws: Autopilot never keeps a claim it cannot judge.
|
|
6
|
+
*/
|
|
7
|
+
export declare function withdrawWaiting(root: string, changes?: readonly string[]): Promise<number>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { readRecord } from './autopilot-records.js';
|
|
2
|
+
import { mainHas } from './merge-observed.js';
|
|
3
|
+
import { closeRecord, withdraw } from './merge-record.js';
|
|
4
|
+
/**
|
|
5
|
+
* Under the publication lock the caller holds: withdraw each waiting Autopilot claim (of the named
|
|
6
|
+
* changes, or all) whose head main does not hold, so a host's later settle of it is unknown. A
|
|
7
|
+
* head main already holds is a merge, left for the next read to record. A Git that cannot say
|
|
8
|
+
* withdraws: Autopilot never keeps a claim it cannot judge.
|
|
9
|
+
*/
|
|
10
|
+
export async function withdrawWaiting(root, changes) {
|
|
11
|
+
let count = 0;
|
|
12
|
+
for (const pending of readRecord(root)?.pending ?? []) {
|
|
13
|
+
if (!pending.automatic || (changes && !changes.includes(pending.change)))
|
|
14
|
+
continue;
|
|
15
|
+
if (await mainHas(root, pending.head).catch(() => false))
|
|
16
|
+
continue;
|
|
17
|
+
if (await closeRecord(root, withdraw(pending, undefined)))
|
|
18
|
+
count++;
|
|
19
|
+
}
|
|
20
|
+
return count;
|
|
21
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
1
|
+
import { createHash, randomBytes, randomUUID } from 'node:crypto';
|
|
2
2
|
import { defaultMergeTools, locked } from '../change-merge.js';
|
|
3
3
|
import { readRecord, updateRecord, } from './autopilot-records.js';
|
|
4
4
|
import { mergeRefusal, mergeWaiting, } from './merge-authority.js';
|
|
@@ -74,6 +74,8 @@ const alreadyMerged = (root, facts) => isAncestor(root, facts.head, facts.base);
|
|
|
74
74
|
async function requestMerge(root, authority, facts, signal, saw, current, artifact, previous, holdFile, checkMain) {
|
|
75
75
|
if (await alreadyMerged(root, facts))
|
|
76
76
|
return mergeWaiting();
|
|
77
|
+
// Autopilot's ask names itself to the host with a secret; the record keeps only its hash.
|
|
78
|
+
const secret = holdFile ? randomBytes(32).toString('base64url') : undefined;
|
|
77
79
|
const claim = {
|
|
78
80
|
change: facts.change,
|
|
79
81
|
head: facts.head,
|
|
@@ -82,14 +84,17 @@ async function requestMerge(root, authority, facts, signal, saw, current, artifa
|
|
|
82
84
|
// The base this merge verified, not a fresh read: a host merge landing meanwhile must not become
|
|
83
85
|
// the claim's main, or the wait could never be observed (currentMerge checks main again).
|
|
84
86
|
main: facts.base,
|
|
85
|
-
...(
|
|
87
|
+
...(secret && {
|
|
88
|
+
automatic: true,
|
|
89
|
+
claimHash: createHash('sha256').update(secret).digest('hex'),
|
|
90
|
+
}),
|
|
86
91
|
};
|
|
87
92
|
if (holdFile && mergeHeld(holdFile))
|
|
88
93
|
return heldMerge(facts.head);
|
|
89
94
|
if (!updateRecord(root, ask(saw, claim)))
|
|
90
95
|
return mergeWaiting();
|
|
91
96
|
const { answer, withdrawn, publicationRefusal } = current()
|
|
92
|
-
? await askHost(authority, facts, signal, () => current() && artifact() && current() && !(holdFile && mergeHeld(holdFile)), holdFile ? { root, path: holdFile, claim } : undefined, current, checkMain)
|
|
97
|
+
? await askHost(authority, facts, signal, () => current() && artifact() && current() && !(holdFile && mergeHeld(holdFile)), holdFile && secret ? { root, path: holdFile, claim, secret } : undefined, current, checkMain)
|
|
93
98
|
: { answer: { status: 'not_merged', code: 'merge_artifact_changed' } };
|
|
94
99
|
if (withdrawn && answer.status !== 'merged') {
|
|
95
100
|
try {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { mergeHoldName } from './merge-hold-name.ts';
|
|
1
2
|
export declare const heldMerge: (head?: string) => {
|
|
2
3
|
ok: false;
|
|
3
4
|
reason: 'held';
|
|
@@ -5,7 +6,7 @@ export declare const heldMerge: (head?: string) => {
|
|
|
5
6
|
detail: string;
|
|
6
7
|
head: string | undefined;
|
|
7
8
|
};
|
|
8
|
-
export
|
|
9
|
+
export { mergeHoldName };
|
|
9
10
|
/** Both local and hosted Autopilot run the actual write inside this gate. */
|
|
10
11
|
export declare function publishAutomatic<T>(path: string, head: string, current: () => boolean, write: () => Promise<T> | T): Promise<T | {
|
|
11
12
|
ok: false;
|
|
@@ -28,6 +29,10 @@ export declare class MergePublicationLockError extends Error {
|
|
|
28
29
|
}
|
|
29
30
|
/** Order the switch write against an in-flight ref transaction, never against the merge checks. */
|
|
30
31
|
export declare function mergePublication<T>(path: string, action: () => Promise<T> | T): Promise<T>;
|
|
32
|
+
/**
|
|
33
|
+
* Turning the hold on withdraws, under the same lock, the waiting Autopilot claims of every product
|
|
34
|
+
* root this process has seen for the file (a settle also refuses a hold written after its ask).
|
|
35
|
+
*/
|
|
31
36
|
export declare function writeMergeHold(path: string, held: boolean): Promise<void>;
|
|
32
37
|
/** Release can come from another studio. Wait without holding the merge or turn reservation. */
|
|
33
38
|
export declare function waitForMergeHold(root: string, signal: AbortSignal, blocked: () => boolean): Promise<boolean>;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import { lstatSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { dirname, join } from 'node:path';
|
|
3
|
+
import { dirname, join, resolve } from 'node:path';
|
|
4
4
|
import { setTimeout } from 'node:timers/promises';
|
|
5
5
|
import { t } from '../change-merge.en.js';
|
|
6
6
|
import { lockText, mergeLockName, reclaimDeadLock } from '../change-merge-lock.js';
|
|
7
7
|
import { hostGit, hostGitSync, localGitEnv } from '../safe-git.js';
|
|
8
8
|
import { autoT } from './autopilot-person.js';
|
|
9
9
|
import { mergeHeldCode, mergeMessage } from './merge-authority.js';
|
|
10
|
+
import { withdrawWaiting } from './merge-claims.js';
|
|
10
11
|
import { mergeEvent } from './merge-events.js';
|
|
12
|
+
import { mergeHoldName } from './merge-hold-name.js';
|
|
11
13
|
export const heldMerge = (head) => ({
|
|
12
14
|
ok: false,
|
|
13
15
|
reason: 'held',
|
|
@@ -15,7 +17,7 @@ export const heldMerge = (head) => ({
|
|
|
15
17
|
detail: autoT('auto.mergeHeld'),
|
|
16
18
|
head,
|
|
17
19
|
});
|
|
18
|
-
export
|
|
20
|
+
export { mergeHoldName };
|
|
19
21
|
/** Both local and hosted Autopilot run the actual write inside this gate. */
|
|
20
22
|
export function publishAutomatic(path, head, current, write) {
|
|
21
23
|
return mergePublication(path, () => {
|
|
@@ -26,6 +28,15 @@ export function publishAutomatic(path, head, current, write) {
|
|
|
26
28
|
return write();
|
|
27
29
|
});
|
|
28
30
|
}
|
|
31
|
+
/** Each product root seen per hold file: turning the hold on withdraws their waiting claims. */
|
|
32
|
+
const holdRoots = new Map();
|
|
33
|
+
function known(root, common) {
|
|
34
|
+
const path = join(common, mergeHoldName);
|
|
35
|
+
const roots = holdRoots.get(resolve(path)) ?? new Set();
|
|
36
|
+
roots.add(resolve(root));
|
|
37
|
+
holdRoots.set(resolve(path), roots);
|
|
38
|
+
return path;
|
|
39
|
+
}
|
|
29
40
|
export function mergeHoldPath(root) {
|
|
30
41
|
try {
|
|
31
42
|
const common = hostGitSync(root, ['rev-parse', '--path-format=absolute', '--git-common-dir'], {
|
|
@@ -33,7 +44,7 @@ export function mergeHoldPath(root) {
|
|
|
33
44
|
env: localGitEnv,
|
|
34
45
|
}).trim();
|
|
35
46
|
if (common)
|
|
36
|
-
return
|
|
47
|
+
return known(root, common);
|
|
37
48
|
}
|
|
38
49
|
catch {
|
|
39
50
|
// Git did not identify the repository. Its state cannot grant permission to merge.
|
|
@@ -47,7 +58,7 @@ export async function mergeHoldPathAsync(root) {
|
|
|
47
58
|
env: localGitEnv,
|
|
48
59
|
})).trim();
|
|
49
60
|
if (common)
|
|
50
|
-
return
|
|
61
|
+
return known(root, common);
|
|
51
62
|
}
|
|
52
63
|
catch {
|
|
53
64
|
// Git did not identify the repository. Its state cannot grant permission to merge.
|
|
@@ -140,8 +151,12 @@ export async function mergePublication(path, action) {
|
|
|
140
151
|
await releasePublication(lock, owner);
|
|
141
152
|
}
|
|
142
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Turning the hold on withdraws, under the same lock, the waiting Autopilot claims of every product
|
|
156
|
+
* root this process has seen for the file (a settle also refuses a hold written after its ask).
|
|
157
|
+
*/
|
|
143
158
|
export async function writeMergeHold(path, held) {
|
|
144
|
-
await mergePublication(path, () => {
|
|
159
|
+
await mergePublication(path, async () => {
|
|
145
160
|
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
146
161
|
try {
|
|
147
162
|
writeFileSync(temporary, held ? 'on\n' : 'off\n', { flag: 'wx', mode: 0o600 });
|
|
@@ -152,6 +167,9 @@ export async function writeMergeHold(path, held) {
|
|
|
152
167
|
finally {
|
|
153
168
|
rmSync(temporary, { force: true });
|
|
154
169
|
}
|
|
170
|
+
if (held)
|
|
171
|
+
for (const root of holdRoots.get(resolve(path)) ?? [])
|
|
172
|
+
await withdrawWaiting(root).catch(() => 0);
|
|
155
173
|
});
|
|
156
174
|
}
|
|
157
175
|
/** Release can come from another studio. Wait without holding the merge or turn reservation. */
|
|
@@ -6,6 +6,7 @@ export declare function askHost(authority: MergeContext, facts: MergeFacts, sign
|
|
|
6
6
|
root: string;
|
|
7
7
|
path: string;
|
|
8
8
|
claim: PendingMerge;
|
|
9
|
+
secret: string;
|
|
9
10
|
} | undefined, permitted?: () => boolean, checkMain?: MainPublicationCheck): Promise<{
|
|
10
11
|
answer: import("./merge-authority.ts").HostMergeAnswer;
|
|
11
12
|
withdrawn?: undefined;
|
|
@@ -6,7 +6,7 @@ import { closeRecord, rememberPublication, withdraw } from './merge-record.js';
|
|
|
6
6
|
export async function askHost(authority, facts, signal, current, automatic, permitted = () => true, checkMain) {
|
|
7
7
|
if (!automatic)
|
|
8
8
|
return { answer: await callMerge(authority, facts, 'person', signal, current) };
|
|
9
|
-
const { root, path, claim } = automatic;
|
|
9
|
+
const { root, path, claim, secret } = automatic;
|
|
10
10
|
const hold = new AbortController();
|
|
11
11
|
let waiting = true;
|
|
12
12
|
let eligible = true;
|
|
@@ -56,7 +56,7 @@ export async function askHost(authority, facts, signal, current, automatic, perm
|
|
|
56
56
|
const timer = setInterval(inspect, 50);
|
|
57
57
|
try {
|
|
58
58
|
const ends = signal ? AbortSignal.any([signal, hold.signal]) : hold.signal;
|
|
59
|
-
const answer = await callMerge(authority, facts, publish, ends, current);
|
|
59
|
+
const answer = await callMerge(authority, facts, publish, ends, current, secret);
|
|
60
60
|
inspect();
|
|
61
61
|
eligible = answer.status === 'pending' && !publicationRefusal;
|
|
62
62
|
return {
|
|
@@ -18,6 +18,8 @@ export declare const asksAgain: (pending: PendingMerge, timeout: number, now?: n
|
|
|
18
18
|
* file holds now and returns undefined (no write) when they differ, so a stale caller does nothing.
|
|
19
19
|
*/
|
|
20
20
|
export declare const ask: (saw: PendingMerge | undefined, claim: PendingMerge) => (record: StudioRecord) => StudioRecord | undefined;
|
|
21
|
+
/** A queued automatic result is observable only after its guarded write returned success. */
|
|
22
|
+
export declare const published: (claim: PendingMerge) => (record: StudioRecord) => StudioRecord | undefined;
|
|
21
23
|
export declare const hostPublished: (claim: PendingMerge) => boolean;
|
|
22
24
|
export declare function rememberPublication(root: string, claim: PendingMerge): Promise<void>;
|
|
23
25
|
/** Ends the wait this claim started and keeps what became of it; never touches another head's. */
|
|
@@ -44,7 +44,7 @@ export const ask = (saw, claim) => (record) => same(record.pending.find((entry)
|
|
|
44
44
|
}
|
|
45
45
|
: undefined;
|
|
46
46
|
/** A queued automatic result is observable only after its guarded write returned success. */
|
|
47
|
-
const published = (claim) => (record) => record.pending.some((entry) => same(entry, claim))
|
|
47
|
+
export const published = (claim) => (record) => record.pending.some((entry) => same(entry, claim))
|
|
48
48
|
? {
|
|
49
49
|
...record,
|
|
50
50
|
pending: record.pending.map((entry) => same(entry, claim) ? { ...entry, published: true } : entry),
|
|
@@ -6,12 +6,13 @@ import { sweepAfterMerge } from '../worktree-sweep.js';
|
|
|
6
6
|
import { hostMergeAuthority } from './approval-artifact.js';
|
|
7
7
|
import { authorityFor, authorityMessage } from './approval-authority.js';
|
|
8
8
|
import { catchUpOne } from './catch-up.js';
|
|
9
|
-
import { mergeContext, mergeWaiting } from './merge-authority.js';
|
|
9
|
+
import { mergeContext, mergeT, mergeWaiting } from './merge-authority.js';
|
|
10
10
|
import { delegatedTools, waitingMerge } from './merge-delegation.js';
|
|
11
11
|
import { factsChanged } from './merge-events.js';
|
|
12
12
|
import { MergePublicationLockError } from './merge-hold.js';
|
|
13
13
|
import { mergePreviewRoutes } from './merge-preview-route.js';
|
|
14
14
|
import { beginLocalMerge, endLocalMerge } from './merge-record.js';
|
|
15
|
+
import { withdrawMerge } from './merge-withdraw.js';
|
|
15
16
|
import { checkAfterMerge } from './post-merge.js';
|
|
16
17
|
import { identityEnv } from './save-git.js';
|
|
17
18
|
import { mergeView } from './snapshot-view.js';
|
|
@@ -29,6 +30,21 @@ export function mergeRoutes(root) {
|
|
|
29
30
|
return [
|
|
30
31
|
personMergeRoute(root),
|
|
31
32
|
...mergePreviewRoutes(root),
|
|
33
|
+
{
|
|
34
|
+
// A person ends a wait the host never answered, so it cannot hold Autopilot for good.
|
|
35
|
+
method: 'POST',
|
|
36
|
+
path: '/api/merge/withdraw',
|
|
37
|
+
right: 'build',
|
|
38
|
+
handle: async ({ body }) => {
|
|
39
|
+
const parsed = mergeBody.safeParse(await body());
|
|
40
|
+
if (!parsed.success)
|
|
41
|
+
return { status: 400, body: { error: t('change.merge.invalid') } };
|
|
42
|
+
const done = await withdrawMerge(root, parsed.data.change).catch(() => false);
|
|
43
|
+
return done
|
|
44
|
+
? { status: 200, body: { ok: true, detail: mergeT('ui.merge.withdrawn') } }
|
|
45
|
+
: { status: 409, body: { ok: false, detail: mergeT('ui.merge.notWithdrawn') } };
|
|
46
|
+
},
|
|
47
|
+
},
|
|
32
48
|
{
|
|
33
49
|
method: 'POST',
|
|
34
50
|
path: '/api/worktree',
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host's later word on a queued Autopilot merge it answered `pending`. `claim` is the
|
|
3
|
+
* `HostMergeInput.claim` the host was given with that ask. The studio's record keeps only its
|
|
4
|
+
* SHA-256, so reading the record does not give it; it names that one ask, never another.
|
|
5
|
+
*/
|
|
6
|
+
export type HostMergeSettlement = Readonly<{
|
|
7
|
+
change: string;
|
|
8
|
+
head: string;
|
|
9
|
+
claim: string;
|
|
10
|
+
/** `check` writes nothing: whether a `merged` settle would pass the gate now (main aside). */
|
|
11
|
+
outcome: 'merged' | 'not_merged' | 'check';
|
|
12
|
+
code?: string;
|
|
13
|
+
}>;
|
|
14
|
+
export type HostMergeSettled = {
|
|
15
|
+
status: 'merged' | 'not_merged' | 'ready';
|
|
16
|
+
} | {
|
|
17
|
+
status: 'refused';
|
|
18
|
+
code: string;
|
|
19
|
+
detail: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Settles one waiting Autopilot claim from the host's own process; no HTTP route reaches it. It
|
|
23
|
+
* runs under the same publication gate as `publish`: a held repository, a level other than
|
|
24
|
+
* Autopilot, an edit of `plan/agents.md` or of the hold since the ask (which also withdraws the
|
|
25
|
+
* claim), another change's or head's claim, a withdrawn claim, a moved branch, or (for `merged`)
|
|
26
|
+
* a main without the exact head refuses; a record that cannot be written answers
|
|
27
|
+
* `merge_record_failed`, and a publication lock that stays busy `merge_publication_lock`. A claim
|
|
28
|
+
* that has ended is withdrawn by any settle, so Autopilot asks again. A `merged` settlement records what `publish` records; the studio's next
|
|
29
|
+
* read records the merge and starts its Snapshot, exactly as for a published claim. `check`
|
|
30
|
+
* answers `ready` when a `merged` settle would pass the gate now, and writes nothing.
|
|
31
|
+
*/
|
|
32
|
+
export declare function settleHostMerge(root: string, input: HostMergeSettlement): Promise<HostMergeSettled>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { createHash, timingSafeEqual } from 'node:crypto';
|
|
2
|
+
import { statSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { effectiveLevel, mainAgentsRoot } from '../agents-file.js';
|
|
6
|
+
import { readRecord } from './autopilot-records.js';
|
|
7
|
+
import { fullSha, mergeHeldCode, mergeT, refusalCode, reservedCode } from './merge-authority.js';
|
|
8
|
+
import { changeHead } from './merge-delegation.js';
|
|
9
|
+
import { MergePublicationLockError, mergeHoldPath, mergePublication, publishAutomatic, } from './merge-hold.js';
|
|
10
|
+
import { mainHas } from './merge-observed.js';
|
|
11
|
+
import { closeRecord, published, settle, withdraw } from './merge-record.js';
|
|
12
|
+
const settlement = z.strictObject({
|
|
13
|
+
change: z.string().regex(/^C-\d{3,}$/),
|
|
14
|
+
head: fullSha,
|
|
15
|
+
claim: z.string().min(1).max(200),
|
|
16
|
+
outcome: z.enum(['merged', 'not_merged', 'check']),
|
|
17
|
+
code: refusalCode.optional(),
|
|
18
|
+
});
|
|
19
|
+
/** The claim matches the ask's hash, compared in constant time. */
|
|
20
|
+
const claimed = (pending, claim) => {
|
|
21
|
+
if (!pending.claimHash)
|
|
22
|
+
return false;
|
|
23
|
+
const given = createHash('sha256').update(claim).digest();
|
|
24
|
+
return timingSafeEqual(given, Buffer.from(pending.claimHash, 'hex'));
|
|
25
|
+
};
|
|
26
|
+
const modified = (file) => {
|
|
27
|
+
try {
|
|
28
|
+
return statSync(file).mtimeMs;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (error.code === 'ENOENT')
|
|
32
|
+
return 0;
|
|
33
|
+
return Number.POSITIVE_INFINITY;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Any edit of `plan/agents.md` or of the hold since the ask ends the claim: the level may have left
|
|
38
|
+
* Autopilot and come back, or a person held merges meanwhile (an ask is never made while held).
|
|
39
|
+
*/
|
|
40
|
+
const ended = (root, path, askedAt) => {
|
|
41
|
+
const asked = Date.parse(askedAt);
|
|
42
|
+
let agents = Number.POSITIVE_INFINITY;
|
|
43
|
+
try {
|
|
44
|
+
agents = modified(join(mainAgentsRoot(root), 'plan/agents.md')) || agents;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// An unknown checkout ends the claim.
|
|
48
|
+
}
|
|
49
|
+
return agents > asked || modified(path) > asked;
|
|
50
|
+
};
|
|
51
|
+
const refused = (code) => ({
|
|
52
|
+
status: 'refused',
|
|
53
|
+
code,
|
|
54
|
+
detail: mergeT(code === mergeHeldCode ? 'ui.merge.settleHeld' : 'ui.merge.settleRefused', {
|
|
55
|
+
code,
|
|
56
|
+
}),
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* Settles one waiting Autopilot claim from the host's own process; no HTTP route reaches it. It
|
|
60
|
+
* runs under the same publication gate as `publish`: a held repository, a level other than
|
|
61
|
+
* Autopilot, an edit of `plan/agents.md` or of the hold since the ask (which also withdraws the
|
|
62
|
+
* claim), another change's or head's claim, a withdrawn claim, a moved branch, or (for `merged`)
|
|
63
|
+
* a main without the exact head refuses; a record that cannot be written answers
|
|
64
|
+
* `merge_record_failed`, and a publication lock that stays busy `merge_publication_lock`. A claim
|
|
65
|
+
* that has ended is withdrawn by any settle, so Autopilot asks again. A `merged` settlement records what `publish` records; the studio's next
|
|
66
|
+
* read records the merge and starts its Snapshot, exactly as for a published claim. `check`
|
|
67
|
+
* answers `ready` when a `merged` settle would pass the gate now, and writes nothing.
|
|
68
|
+
*/
|
|
69
|
+
export async function settleHostMerge(root, input) {
|
|
70
|
+
const parsed = settlement.safeParse(input);
|
|
71
|
+
if (!parsed.success ||
|
|
72
|
+
(parsed.data.outcome === 'not_merged') !== Boolean(parsed.data.code) ||
|
|
73
|
+
(parsed.data.code !== undefined && reservedCode(parsed.data.code)))
|
|
74
|
+
return refused('merge_settle_invalid');
|
|
75
|
+
const { change, head, claim, outcome, code } = parsed.data;
|
|
76
|
+
const path = mergeHoldPath(root);
|
|
77
|
+
if (!path)
|
|
78
|
+
return refused('merge_settle_unknown');
|
|
79
|
+
const pending = readRecord(root)?.pending.find((entry) => entry.change === change);
|
|
80
|
+
if (!pending?.automatic || pending.head !== head || !claimed(pending, claim))
|
|
81
|
+
return refused('merge_settle_unknown');
|
|
82
|
+
if ((await changeHead(root, change).catch(() => undefined)) !== head)
|
|
83
|
+
return refused('merge_settle_unknown');
|
|
84
|
+
// Read again under the lock: the claim still on file and Autopilot unchanged since the ask.
|
|
85
|
+
const onFile = () => readRecord(root)?.pending.some((entry) => entry.revision === pending.revision && entry.head === head) === true;
|
|
86
|
+
const stale = () => onFile() && (effectiveLevel(root) !== 'auto' || ended(root, path, pending.askedAt));
|
|
87
|
+
const current = () => effectiveLevel(root) === 'auto' && !ended(root, path, pending.askedAt) && onFile();
|
|
88
|
+
// A claim Autopilot no longer stands behind ends here, whatever the host asked: the merge, if
|
|
89
|
+
// any, stays Git's alone, and Autopilot asks again after its next turn.
|
|
90
|
+
const endStale = () => mergePublication(path, async () => {
|
|
91
|
+
if (stale())
|
|
92
|
+
await closeRecord(root, withdraw(pending, undefined));
|
|
93
|
+
}).catch(() => undefined);
|
|
94
|
+
try {
|
|
95
|
+
if (outcome !== 'not_merged') {
|
|
96
|
+
const result = await publishAutomatic(path, head, current, async () => {
|
|
97
|
+
if (outcome === 'check')
|
|
98
|
+
return { status: 'ready' };
|
|
99
|
+
if (!(await mainHas(root, head)))
|
|
100
|
+
return refused('merge_not_observed');
|
|
101
|
+
const recorded = await closeRecord(root, published(pending)).catch(() => false);
|
|
102
|
+
return recorded ? { status: 'merged' } : refused('merge_record_failed');
|
|
103
|
+
});
|
|
104
|
+
if ('status' in result)
|
|
105
|
+
return result;
|
|
106
|
+
await endStale();
|
|
107
|
+
return refused('code' in result && result.code ? result.code : 'merge_settle_unknown');
|
|
108
|
+
}
|
|
109
|
+
const result = await mergePublication(path, async () => {
|
|
110
|
+
if (!current() || (await mainHas(root, head)))
|
|
111
|
+
return undefined;
|
|
112
|
+
const at = new Date().toISOString();
|
|
113
|
+
const done = await closeRecord(root, settle(pending, {
|
|
114
|
+
change,
|
|
115
|
+
head,
|
|
116
|
+
at,
|
|
117
|
+
kind: 'refused',
|
|
118
|
+
code: code ?? 'merge_settle_invalid',
|
|
119
|
+
})).catch(() => false);
|
|
120
|
+
return done ? { status: 'not_merged' } : refused('merge_record_failed');
|
|
121
|
+
});
|
|
122
|
+
if (result)
|
|
123
|
+
return result;
|
|
124
|
+
await endStale();
|
|
125
|
+
return refused('merge_settle_unknown');
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
// The publication lock stayed busy: the host asks again later.
|
|
129
|
+
if (error instanceof MergePublicationLockError)
|
|
130
|
+
return refused('merge_publication_lock');
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -2,6 +2,11 @@ import type { StudioState, WorkFacts } from '@buffcore/contracts/workbench';
|
|
|
2
2
|
import { type StudioRecord } from './autopilot-records.ts';
|
|
3
3
|
import type { UiRequest } from './routes.ts';
|
|
4
4
|
type Merge = NonNullable<WorkFacts['merges']>[number];
|
|
5
|
+
/** How long a wait has lasted, in whole minutes under two hours and whole hours after. */
|
|
6
|
+
export declare const waited: (at: string, now?: number) => {
|
|
7
|
+
minutes: number;
|
|
8
|
+
hours: number;
|
|
9
|
+
};
|
|
5
10
|
/**
|
|
6
11
|
* What the host's merge of each change amounts to, from facts on disk only: nothing here is
|
|
7
12
|
* stored, so a read that is slow or out of order cannot leave a stale copy behind. With the ask's
|
|
@@ -9,6 +9,11 @@ import { checkAfterMerge } from './post-merge.js';
|
|
|
9
9
|
const language = () => /^es(?:[-_.]|$)/i.test(process.env.LC_ALL || process.env.LANG || '') ? 'es' : 'en';
|
|
10
10
|
// The server's own language and zone, and the long time style names the zone.
|
|
11
11
|
const shown = (at) => new Intl.DateTimeFormat(language(), { dateStyle: 'medium', timeStyle: 'long' }).format(new Date(at));
|
|
12
|
+
/** How long a wait has lasted, in whole minutes under two hours and whole hours after. */
|
|
13
|
+
export const waited = (at, now = Date.now()) => {
|
|
14
|
+
const minutes = Math.max(0, Math.floor((now - Date.parse(at)) / 60_000));
|
|
15
|
+
return { minutes, hours: minutes < 120 ? 0 : Math.floor(minutes / 60) };
|
|
16
|
+
};
|
|
12
17
|
/**
|
|
13
18
|
* Git's own "no" (a numeric exit code) is an answer; a Git that did not answer (a timeout, a
|
|
14
19
|
* failed spawn) throws, so the read is unknown rather than a quiet change.
|
|
@@ -44,10 +49,11 @@ export async function mergeEntries(root, record, timeout, run = studioRun) {
|
|
|
44
49
|
...(!merged && timeout !== undefined && asksAgain(pending, timeout)
|
|
45
50
|
? { again: true }
|
|
46
51
|
: {}),
|
|
52
|
+
...(!merged && pending.automatic ? { automatic: true } : {}),
|
|
47
53
|
at: pending.askedAt,
|
|
48
54
|
detail: merged
|
|
49
55
|
? mergeT('ui.merge.observed', { head: pending.head.slice(0, 12) })
|
|
50
|
-
: mergeT('ui.merge.since', { at: shown(pending.askedAt) }),
|
|
56
|
+
: mergeT('ui.merge.since', { at: shown(pending.askedAt), ...waited(pending.askedAt) }),
|
|
51
57
|
});
|
|
52
58
|
}
|
|
53
59
|
for (const done of record.outcomes) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** A person held, stopped or left Autopilot: its waiting claims end, under the publication lock. */
|
|
2
|
+
export declare function withdrawAutopilotClaims(root: string, changes?: readonly string[]): Promise<number>;
|
|
3
|
+
/** After a level write: a level other than Autopilot withdraws Autopilot's waiting claims. */
|
|
4
|
+
export declare function afterLevel(root: string): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* A person ends a wait the host never answered: only an Autopilot claim (a person's own wait is
|
|
7
|
+
* unchanged), and never a head main already holds. The change can then be merged again.
|
|
8
|
+
*/
|
|
9
|
+
export declare function withdrawMerge(root: string, change: string): Promise<boolean>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { effectiveLevel } from '../agents-file.js';
|
|
2
|
+
import { readRecord } from './autopilot-records.js';
|
|
3
|
+
import { withdrawWaiting } from './merge-claims.js';
|
|
4
|
+
import { mergeHoldPath, mergePublication } from './merge-hold.js';
|
|
5
|
+
/** A person held, stopped or left Autopilot: its waiting claims end, under the publication lock. */
|
|
6
|
+
export async function withdrawAutopilotClaims(root, changes) {
|
|
7
|
+
// The record first: it needs no git, and most saves have no Autopilot claim waiting.
|
|
8
|
+
if (!readRecord(root)?.pending.some((entry) => entry.automatic))
|
|
9
|
+
return 0;
|
|
10
|
+
const path = mergeHoldPath(root);
|
|
11
|
+
if (!path)
|
|
12
|
+
return 0;
|
|
13
|
+
return mergePublication(path, () => withdrawWaiting(root, changes));
|
|
14
|
+
}
|
|
15
|
+
/** After a level write: a level other than Autopilot withdraws Autopilot's waiting claims. */
|
|
16
|
+
export async function afterLevel(root) {
|
|
17
|
+
if (effectiveLevel(root) !== 'auto')
|
|
18
|
+
await withdrawAutopilotClaims(root).catch(() => 0);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A person ends a wait the host never answered: only an Autopilot claim (a person's own wait is
|
|
22
|
+
* unchanged), and never a head main already holds. The change can then be merged again.
|
|
23
|
+
*/
|
|
24
|
+
export async function withdrawMerge(root, change) {
|
|
25
|
+
const path = mergeHoldPath(root);
|
|
26
|
+
if (!path)
|
|
27
|
+
return false;
|
|
28
|
+
return mergePublication(path, async () => (await withdrawWaiting(root, [change])) > 0);
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type OutsideMergeReply, type Viewer } from '@buffcore/contracts/workbench';
|
|
2
|
+
import type { HostOutside } from './outside.ts';
|
|
3
|
+
import type { UiRoute } from './routes.ts';
|
|
4
|
+
/** After a timeout or a closed studio, the lock waits this many time limits for `act` to settle. */
|
|
5
|
+
export declare const HOLD_FACTOR = 4;
|
|
6
|
+
/**
|
|
7
|
+
* One call to the host's `act`, in the studio's one merge queue: it waits for no one and refuses
|
|
8
|
+
* while another merge holds the lock (as a studio merge does). The Autopilot merge hold stops only
|
|
9
|
+
* Autopilot, so it does not refuse a person's outside Merge, as it does not refuse an inside one.
|
|
10
|
+
*/
|
|
11
|
+
export declare function outsideMerge(root: string, outside: HostOutside, viewer: Readonly<Viewer>, change: string, stop?: AbortSignal): Promise<OutsideMergeReply>;
|
|
12
|
+
/** Person-only, like `/api/merge`: no MCP tool and no Autopilot path calls it. */
|
|
13
|
+
export declare function outsideMergeRoute(root: string): UiRoute;
|