@defrex/autobuild 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -13
- package/SPEC.md +249 -15
- package/bin/ab-dispatch-generation.ts +11 -2
- package/docs/accounts.md +130 -0
- package/docs/agent-runtimes.md +4 -4
- package/docs/answering-blocked-builds.md +4 -1
- package/docs/architecture.md +224 -12
- package/docs/build-store.md +3 -41
- package/docs/builds.md +2 -0
- package/docs/cli.md +14 -0
- package/docs/configuration-overview.md +117 -0
- package/docs/configuration.md +266 -141
- package/docs/dispatcher-hosting.md +18 -33
- package/docs/intake.md +2 -0
- package/docs/integration-tree.md +16 -5
- package/docs/merge-policy.md +1 -3
- package/docs/operating.md +1 -2
- package/docs/operator-api.md +144 -53
- package/docs/operator-surfaces.md +32 -20
- package/docs/overview.md +1 -1
- package/docs/plugin-authoring.md +27 -1
- package/docs/remote-store-protocol.md +259 -91
- package/docs/remote-ticket-protocol.md +29 -49
- package/docs/restacking.md +45 -0
- package/docs/seams.md +8 -8
- package/docs/setup.md +34 -129
- package/docs/spec-standard.md +4 -2
- package/docs/ticket-dependencies.md +8 -0
- package/docs/ticket-sources.md +18 -0
- package/docs/troubleshooting.md +7 -11
- package/docs/upgrading.md +1 -1
- package/docs/workspaces.md +4 -4
- package/package.json +14 -5
- package/packages/core/src/accounts/chatgpt-oauth.ts +216 -0
- package/packages/core/src/accounts/chatgpt-state.ts +41 -0
- package/packages/core/src/accounts/local-credentials.ts +194 -0
- package/packages/core/src/accounts/local-inference.ts +106 -0
- package/packages/core/src/accounts/local-owner.ts +123 -0
- package/packages/core/src/accounts/sensitive.ts +2 -0
- package/packages/core/src/cli/accounts.ts +147 -0
- package/packages/core/src/cli/binary.ts +3 -1
- package/packages/core/src/cli/connect.ts +3 -3
- package/packages/core/src/cli/dispatch-frontend.ts +1 -0
- package/packages/core/src/cli/dispatch-handoff.ts +125 -44
- package/packages/core/src/cli/dispatch-launch-contract.ts +187 -0
- package/packages/core/src/cli/dispatch-launcher.ts +54 -21
- package/packages/core/src/cli/dispatch-preflight.ts +6 -1
- package/packages/core/src/cli/dispatch-repository-feed.ts +107 -26
- package/packages/core/src/cli/dispatch.ts +135 -27
- package/packages/core/src/cli/dispatcher-liveness.ts +6 -1
- package/packages/core/src/cli/forge-clear.ts +30 -0
- package/packages/core/src/cli/help.ts +17 -0
- package/packages/core/src/cli/init-readiness-remote.ts +22 -1
- package/packages/core/src/cli/init-readiness-shared.ts +5 -1
- package/packages/core/src/cli/init-validation.ts +160 -18
- package/packages/core/src/cli/main.ts +72 -0
- package/packages/core/src/cli/publication-settlement.ts +4 -1
- package/packages/core/src/cli/secrets.ts +173 -0
- package/packages/core/src/cli/store-opening.ts +11 -1
- package/packages/core/src/cli/upgrade-agent.ts +9 -1
- package/packages/core/src/cli/watch.ts +12 -14
- package/packages/core/src/config/accounts.ts +101 -0
- package/packages/core/src/config/live.ts +14 -1
- package/packages/core/src/config/roles.ts +54 -3
- package/packages/core/src/config/schema.ts +60 -0
- package/packages/core/src/events/catalog.ts +1 -0
- package/packages/core/src/events/compatibility.ts +2 -1
- package/packages/core/src/events/forge-degradation-policy.ts +11 -0
- package/packages/core/src/events/payloads.ts +13 -0
- package/packages/core/src/events/policy.ts +9 -0
- package/packages/core/src/events/repository.ts +75 -2
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +278 -0
- package/packages/core/src/kernel/change-presence.ts +74 -8
- package/packages/core/src/kernel/engine.ts +8 -0
- package/packages/core/src/kernel/generators/node-restack-log.ts +14 -0
- package/packages/core/src/kernel/node-polling.ts +40 -7
- package/packages/core/src/kernel/node-restack-demand.ts +74 -0
- package/packages/core/src/kernel/node-restack-state.ts +5 -1
- package/packages/core/src/kernel/node-restack-transaction.ts +33 -1
- package/packages/core/src/kernel/read-facts.ts +6 -0
- package/packages/core/src/kernel/reducer-registry.ts +3 -0
- package/packages/core/src/kernel/reducer.ts +4 -1
- package/packages/core/src/kernel/ticket-preparation.ts +66 -0
- package/packages/core/src/operator/annotations.ts +6 -0
- package/packages/core/src/operator/control.ts +20 -0
- package/packages/core/src/operator/index.ts +4 -0
- package/packages/core/src/operator/protocol.ts +6 -0
- package/packages/core/src/operator/registry.ts +42 -1
- package/packages/core/src/operator/tickets.ts +25 -4
- package/packages/core/src/plugins/manifest.ts +2 -1
- package/packages/core/src/ports/runner/account-env.ts +139 -0
- package/packages/core/src/ports/runner/chatgpt-provider.ts +85 -0
- package/packages/core/src/ports/runner/claude.ts +70 -42
- package/packages/core/src/ports/runner/codex.ts +63 -31
- package/packages/core/src/ports/runner/one-shot.ts +2 -0
- package/packages/core/src/ports/runner/provider-error.ts +5 -0
- package/packages/core/src/ports/runner/routing.ts +35 -4
- package/packages/core/src/ports/tickets/contract.ts +58 -0
- package/packages/core/src/ports/tickets/tree.ts +1 -1
- package/packages/core/src/ports/types.ts +28 -7
- package/packages/core/src/ports/workspace/account-policy.ts +72 -0
- package/packages/core/src/ports/workspace/build-execution.ts +6 -1
- package/packages/core/src/ports/workspace/builtin-capabilities.ts +1 -0
- package/packages/core/src/ports/workspace/create.ts +2 -0
- package/packages/core/src/ports/workspace/git-worktree.ts +6 -1
- package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -0
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +125 -35
- package/packages/core/src/processes/build-runner.ts +32 -1
- package/packages/core/src/processes/dispatcher.ts +493 -121
- package/packages/core/src/processes/execution-no-progress.ts +1 -0
- package/packages/core/src/processes/execution-settlement.ts +21 -3
- package/packages/core/src/processes/harvest-runner.ts +68 -8
- package/packages/core/src/processes/harvest.ts +11 -16
- package/packages/core/src/processes/repo-view.ts +3 -0
- package/packages/core/src/project-secrets.ts +105 -0
- package/packages/core/src/secret-name.ts +41 -0
- package/packages/core/src/store/account-redaction.ts +156 -0
- package/packages/core/src/store/artifact-meta.ts +7 -0
- package/packages/core/src/store/contract.ts +60 -1
- package/packages/core/src/store/memory.ts +4 -0
- package/packages/core/src/store/reducer-value-shapes.json +7389 -6647
- package/packages/core/src/store/reducer-value-validation.ts +106 -6
- package/packages/core/src/store/remote/client.ts +85 -50
- package/packages/core/src/store/remote/compatibility.ts +57 -0
- package/packages/core/src/store/remote/index.ts +6 -0
- package/packages/core/src/store/remote/protocol.ts +8 -1
- package/packages/core/src/store/remote/released-reducer-values/1.2.0.json +8129 -0
- package/packages/core/src/store/remote/version.ts +4 -0
- package/packages/core/src/store/repo-state-events.ts +4 -2
- package/packages/core/src/store/snapshots.ts +16 -3
- package/packages/core/src/store/types.ts +2 -0
- package/packages/core/src/testing/dispatch-read-budget.ts +266 -5
- package/packages/core/src/testing/index.ts +2 -1
- package/packages/core/src/testing/reduced-read-budget.ts +560 -5
- package/skills/guide/SKILL.md +164 -37
- package/skills/guide/references/accounts.md +130 -0
- package/skills/guide/references/integration-tree.md +16 -5
- package/skills/guide/references/merge-policy.md +1 -3
- package/skills/guide/references/operator-api.md +144 -53
- package/skills/guide/references/plugin-authoring.md +27 -1
- package/skills/guide/references/remote-store-protocol.md +259 -91
- package/skills/guide/references/remote-ticket-protocol.md +29 -49
- package/skills/guide/references/restacking.md +45 -0
- package/skills/guide/references/setup.md +34 -129
- package/skills/guide/references/spec-standard.md +4 -2
- package/skills/guide/references/ticket-dependencies.md +8 -0
- package/skills/harvest/SKILL.md +3 -1
- package/skills/harvest-review/SKILL.md +3 -1
- package/skills/operate/SKILL.md +26 -11
- package/skills/reconcile/SKILL.md +6 -0
- package/skills/spec/SKILL.md +1 -1
- package/skills/tickets/SKILL.md +10 -5
- package/templates/hosted-service/package.json +2 -2
- package/docs/hosted-dispatcher-cutover-validation.md +0 -178
- package/docs/hosted-dispatcher.md +0 -278
- package/docs/hosted-service.md +0 -304
- package/docs/mcp.md +0 -150
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { LocalCredentials } from '../accounts/local-credentials'
|
|
2
|
+
import { LocalAccountOwner } from '../accounts/local-owner'
|
|
3
|
+
import { abSecrets } from './secrets'
|
|
4
|
+
import type { ProjectSecretMetadata } from '../project-secrets'
|
|
5
|
+
import { accountRemedy } from '../config/accounts'
|
|
1
6
|
import { createForge } from '../ports/forge/create'
|
|
2
7
|
import {
|
|
3
8
|
inspectForgeReadiness,
|
|
@@ -73,15 +78,17 @@ function effectiveTargets(
|
|
|
73
78
|
): Array<{ runtime: string; models: string[] }> {
|
|
74
79
|
// Preserve eager registry/model/argument validation, but probe only routes
|
|
75
80
|
// the pipeline can consume rather than every declared role table.
|
|
76
|
-
createRuntimeResolver(runtimes, config.roles, config.policy.sessionBudgetSeconds)
|
|
77
|
-
return effectiveRuntimeReferences(config).
|
|
81
|
+
createRuntimeResolver(runtimes, config.roles, config.policy.sessionBudgetSeconds, config.accounts)
|
|
82
|
+
return effectiveRuntimeReferences(config).flatMap((group) => {
|
|
83
|
+
const selected = Object.keys(config.accounts).length ? group.legacyAuthentication : group
|
|
84
|
+
if (selected === undefined) return []
|
|
78
85
|
const defaultModel = runtimes[group.runtime]?.defaultModel
|
|
79
86
|
return {
|
|
80
87
|
runtime: group.runtime,
|
|
81
88
|
models: [
|
|
82
89
|
...new Set([
|
|
83
|
-
...
|
|
84
|
-
...(
|
|
90
|
+
...selected.models,
|
|
91
|
+
...(selected.usesRuntimeDefaultModel && defaultModel !== undefined ? [defaultModel] : []),
|
|
85
92
|
]),
|
|
86
93
|
].sort(),
|
|
87
94
|
}
|
|
@@ -124,10 +131,10 @@ export async function runGuestReadinessProbe(opts: {
|
|
|
124
131
|
// check detail now see `[REDACTED]` there. Providers without a
|
|
125
132
|
// `guestEnvNames`/`configSchema` declaration fall back to the name-heuristic
|
|
126
133
|
// redaction only.
|
|
127
|
-
const redact = createReadinessRedactor(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
)
|
|
134
|
+
const redact = createReadinessRedactor(opts.env, [
|
|
135
|
+
...(providerConfig !== undefined ? (builtinCaps?.guestEnvNames?.(providerConfig) ?? []) : []),
|
|
136
|
+
...Object.values(config.accounts).map((account) => account.credentialEnv),
|
|
137
|
+
])
|
|
131
138
|
try {
|
|
132
139
|
const setup = config.commands.setup
|
|
133
140
|
if (opts.signal?.aborted) throw opts.signal.reason ?? new Error('validation cancelled')
|
|
@@ -221,6 +228,57 @@ export async function runGuestReadinessProbe(opts: {
|
|
|
221
228
|
: `fix workspace.config.runtimeProvisioning.${runtime}${preflightOnly ? '.preflight' : ''} and expose API credential names in workspace.config.environmentVariables`
|
|
222
229
|
|
|
223
230
|
try {
|
|
231
|
+
for (const [name, descriptor] of Object.entries(config.accounts)) {
|
|
232
|
+
checks.push({
|
|
233
|
+
name: `credential ${JSON.stringify(name)}`,
|
|
234
|
+
status: opts.env[descriptor.credentialEnv] ? 'pass' : 'warning',
|
|
235
|
+
detail: `${descriptor.credentialEnv} is ${opts.env[descriptor.credentialEnv] ? 'present' : 'absent'}${!opts.env[descriptor.credentialEnv] && descriptor.kind === 'claude-subscription' ? '; run claude setup-token for remote use' : ''}`,
|
|
236
|
+
})
|
|
237
|
+
const account = { name, descriptor }
|
|
238
|
+
const runtime = descriptor.kind === 'chatgpt-subscription' ? 'codex' : 'claude'
|
|
239
|
+
if (
|
|
240
|
+
descriptor.kind === 'chatgpt-subscription' &&
|
|
241
|
+
(JSON.parse(opts.env.AB_CHATGPT_HOSTED_READINESS ?? '[]') as string[]).includes(name)
|
|
242
|
+
) {
|
|
243
|
+
checks.push({
|
|
244
|
+
name: `account ${JSON.stringify(name)}`,
|
|
245
|
+
status: 'pass',
|
|
246
|
+
detail: 'Hosted metadata readiness only; the first hosted build is the live check',
|
|
247
|
+
})
|
|
248
|
+
continue
|
|
249
|
+
}
|
|
250
|
+
const completion = runtimes[runtime]?.oneShot
|
|
251
|
+
try {
|
|
252
|
+
if (!completion) throw new Error(`${runtime} runtime has no model probe capability`)
|
|
253
|
+
await completion.complete({
|
|
254
|
+
prompt: 'Reply only OK.',
|
|
255
|
+
cwd: opts.repo,
|
|
256
|
+
env: Object.fromEntries(
|
|
257
|
+
Object.entries(opts.env).filter(
|
|
258
|
+
(entry): entry is [string, string] => entry[1] !== undefined,
|
|
259
|
+
),
|
|
260
|
+
),
|
|
261
|
+
account,
|
|
262
|
+
model:
|
|
263
|
+
descriptor.kind === 'kimi-code' ? 'kimi-for-coding' : runtimes[runtime]?.defaultModel,
|
|
264
|
+
signal: AbortSignal.any([
|
|
265
|
+
AbortSignal.timeout(30_000),
|
|
266
|
+
...(opts.signal ? [opts.signal] : []),
|
|
267
|
+
]),
|
|
268
|
+
})
|
|
269
|
+
checks.push({
|
|
270
|
+
name: `account ${JSON.stringify(name)}`,
|
|
271
|
+
status: 'pass',
|
|
272
|
+
detail: `minimal ${runtime} model request succeeded`,
|
|
273
|
+
})
|
|
274
|
+
} catch (error) {
|
|
275
|
+
checks.push({
|
|
276
|
+
name: `account ${JSON.stringify(name)}`,
|
|
277
|
+
status: 'fail',
|
|
278
|
+
detail: `${redact(error)}; ${accountRemedy(account)}`,
|
|
279
|
+
})
|
|
280
|
+
}
|
|
281
|
+
}
|
|
224
282
|
for (const target of effectiveTargets(config, runtimes)) {
|
|
225
283
|
if (opts.signal?.aborted) throw opts.signal.reason ?? new Error('validation cancelled')
|
|
226
284
|
const probe = runtimes[target.runtime]?.initUsable
|
|
@@ -378,7 +436,8 @@ function hostPreflight(config: Config, env: Record<string, string | undefined>):
|
|
|
378
436
|
throw new Error('ticket source "linear" requires LINEAR_API_KEY')
|
|
379
437
|
}
|
|
380
438
|
|
|
381
|
-
|
|
439
|
+
async function validateInitReadinessInner(opts: {
|
|
440
|
+
resolvedRepo?: string
|
|
382
441
|
targetRepo: string
|
|
383
442
|
env: Record<string, string | undefined>
|
|
384
443
|
/** The raw launcher process environment, alongside the dotenv-augmented
|
|
@@ -396,7 +455,7 @@ export async function validateInitReadiness(opts: {
|
|
|
396
455
|
}): Promise<InitValidationReport> {
|
|
397
456
|
const exec = opts.exec ?? spawnExec
|
|
398
457
|
if (opts.signal?.aborted) throw opts.signal.reason ?? new Error('validation cancelled')
|
|
399
|
-
const repo = await resolveMainRepo(opts.targetRepo, exec)
|
|
458
|
+
const repo = opts.resolvedRepo ?? (await resolveMainRepo(opts.targetRepo, exec))
|
|
400
459
|
const configPath = join(repo, 'autobuild.toml')
|
|
401
460
|
const configBytes = await readFile(configPath, 'utf8')
|
|
402
461
|
const config = await loadConfig(configPath)
|
|
@@ -432,10 +491,10 @@ export async function validateInitReadiness(opts: {
|
|
|
432
491
|
builtinCaps?.configSchema !== undefined
|
|
433
492
|
? builtinCaps.configSchema.parse(config.workspace.config)
|
|
434
493
|
: undefined
|
|
435
|
-
let redact = createReadinessRedactor(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
)
|
|
494
|
+
let redact = createReadinessRedactor(opts.env, [
|
|
495
|
+
...(providerConfig !== undefined ? (builtinCaps?.guestEnvNames?.(providerConfig) ?? []) : []),
|
|
496
|
+
...Object.values(config.accounts).map((account) => account.credentialEnv),
|
|
497
|
+
])
|
|
439
498
|
let caps: WorkspaceProviderCapabilities | undefined
|
|
440
499
|
let assigneeLine: string | undefined
|
|
441
500
|
let forgeChecks: ForgeReadinessCheck[] = readinessChecks(
|
|
@@ -480,10 +539,12 @@ export async function validateInitReadiness(opts: {
|
|
|
480
539
|
if (caps?.configSchema !== undefined)
|
|
481
540
|
providerConfig = caps.configSchema.parse(config.workspace.config)
|
|
482
541
|
if (caps?.guestEnvNames !== undefined)
|
|
483
|
-
redact = createReadinessRedactor(
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
542
|
+
redact = createReadinessRedactor(opts.env, [
|
|
543
|
+
...caps.guestEnvNames(
|
|
544
|
+
providerConfig !== undefined ? providerConfig : config.workspace.config,
|
|
545
|
+
),
|
|
546
|
+
...Object.values(config.accounts).map((account) => account.credentialEnv),
|
|
547
|
+
])
|
|
487
548
|
// Registry-aware process-env-only check: a declared name present in the
|
|
488
549
|
// dotenv-augmented `env` but absent from the raw launcher map fails here,
|
|
489
550
|
// so plugin-declared requirements and non-CLI callers are covered too
|
|
@@ -635,6 +696,7 @@ export async function validateInitReadiness(opts: {
|
|
|
635
696
|
exec,
|
|
636
697
|
redact,
|
|
637
698
|
runtimeReferences: effectiveRuntimeReferences(config),
|
|
699
|
+
accounts: config.accounts,
|
|
638
700
|
stdout: opts.stdout ?? (() => {}),
|
|
639
701
|
...(opts.signal !== undefined ? { signal: opts.signal } : {}),
|
|
640
702
|
...(opts.vercelFacade !== undefined ? { facade: opts.vercelFacade } : {}),
|
|
@@ -691,3 +753,83 @@ export async function validateInitReadiness(opts: {
|
|
|
691
753
|
})),
|
|
692
754
|
}
|
|
693
755
|
}
|
|
756
|
+
|
|
757
|
+
/** Validation consumes the current owner's access value, never its refresh token. */
|
|
758
|
+
export async function validateInitReadiness(
|
|
759
|
+
opts: Parameters<typeof validateInitReadinessInner>[0],
|
|
760
|
+
): Promise<InitValidationReport> {
|
|
761
|
+
const exec = opts.exec ?? spawnExec
|
|
762
|
+
const repo = await resolveMainRepo(opts.targetRepo, exec)
|
|
763
|
+
const config = await loadConfig(join(repo, 'autobuild.toml'))
|
|
764
|
+
const accounts = Object.entries(config.accounts).filter(
|
|
765
|
+
([, a]) => a.kind === 'chatgpt-subscription',
|
|
766
|
+
)
|
|
767
|
+
if (!accounts.length) return validateInitReadinessInner({ ...opts, resolvedRepo: repo })
|
|
768
|
+
const credentials = new LocalCredentials(join(repo, '.autobuild'))
|
|
769
|
+
const owner = new LocalAccountOwner(credentials)
|
|
770
|
+
const claimed: string[] = []
|
|
771
|
+
const env = { ...opts.env }
|
|
772
|
+
const checks: InitValidationReport['checks'] = []
|
|
773
|
+
try {
|
|
774
|
+
const service = opts.env.AB_STORE?.trim() || config.store?.url
|
|
775
|
+
let metadata: ProjectSecretMetadata[] | undefined
|
|
776
|
+
if (
|
|
777
|
+
service &&
|
|
778
|
+
isRemoteStoreRef(service) &&
|
|
779
|
+
accounts.some(([name]) => !credentials.load(name))
|
|
780
|
+
) {
|
|
781
|
+
await abSecrets('list', undefined, {
|
|
782
|
+
cwd: repo,
|
|
783
|
+
env: opts.env,
|
|
784
|
+
exec,
|
|
785
|
+
json: true,
|
|
786
|
+
print: (text) => {
|
|
787
|
+
metadata = JSON.parse(text).secrets
|
|
788
|
+
},
|
|
789
|
+
})
|
|
790
|
+
}
|
|
791
|
+
for (const [name, descriptor] of accounts) {
|
|
792
|
+
const record = credentials.load(name)
|
|
793
|
+
if (record) {
|
|
794
|
+
if (!record.owner) {
|
|
795
|
+
owner.claim(name)
|
|
796
|
+
claimed.push(name)
|
|
797
|
+
await owner.tick({ [name]: descriptor })
|
|
798
|
+
}
|
|
799
|
+
const current = credentials.load(name)!
|
|
800
|
+
if (current.status !== 'ready' || current.state.expiresAt <= Date.now())
|
|
801
|
+
throw new Error(`account ${JSON.stringify(name)}: sign in again with ab accounts login`)
|
|
802
|
+
env[descriptor.credentialEnv] = current.state.accessToken
|
|
803
|
+
} else {
|
|
804
|
+
const entry = metadata?.find(
|
|
805
|
+
(s) => s.name === descriptor.credentialEnv && s.kind === 'chatgpt-subscription',
|
|
806
|
+
)
|
|
807
|
+
const ready = entry?.status === 'ready' && entry.failureCode === null
|
|
808
|
+
checks.push({
|
|
809
|
+
name: `account ${JSON.stringify(name)}`,
|
|
810
|
+
status: ready ? 'pass' : 'fail',
|
|
811
|
+
detail: entry
|
|
812
|
+
? `Hosted credential ${entry.status}; owner ${entry.owner}; set ${entry.setAt}; ${entry.warnings?.join(', ') || 'no refresh-window warning'}. The first hosted build is the live check.`
|
|
813
|
+
: `Credential absent; run ab accounts login ${JSON.stringify(name)} ${service && isRemoteStoreRef(service) ? '--project' : '--local'}`,
|
|
814
|
+
})
|
|
815
|
+
if (!ready)
|
|
816
|
+
return {
|
|
817
|
+
provider: config.workspace.provider,
|
|
818
|
+
context:
|
|
819
|
+
config.workspace.provider === 'git-worktree' ? 'local worktree' : 'Vercel Sandbox',
|
|
820
|
+
checks,
|
|
821
|
+
exitCode: 1,
|
|
822
|
+
}
|
|
823
|
+
env.AB_CHATGPT_HOSTED_READINESS = JSON.stringify([
|
|
824
|
+
...(JSON.parse(env.AB_CHATGPT_HOSTED_READINESS ?? '[]') as string[]),
|
|
825
|
+
name,
|
|
826
|
+
])
|
|
827
|
+
env[descriptor.credentialEnv] = 'autobuild-hosted-metadata-only'
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
const report = await validateInitReadinessInner({ ...opts, env, resolvedRepo: repo })
|
|
831
|
+
return { ...report, checks: [...checks, ...report.checks] }
|
|
832
|
+
} finally {
|
|
833
|
+
for (const name of claimed) owner.release(name)
|
|
834
|
+
}
|
|
835
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { abForgeClear } from './forge-clear'
|
|
2
|
+
import { abAccountsLogin } from './accounts'
|
|
3
|
+
import { abSecrets } from './secrets'
|
|
1
4
|
import { currentTicketRef } from '../kernel/ticket-migrations'
|
|
2
5
|
import { upgradeFollowup } from './upgrade-followup'
|
|
3
6
|
import { parseDispatchArgs } from './dispatch-args'
|
|
@@ -106,6 +109,8 @@ export const SESSIONLESS_COMMANDS = new Set([
|
|
|
106
109
|
'init',
|
|
107
110
|
'connect',
|
|
108
111
|
'disconnect',
|
|
112
|
+
'secrets',
|
|
113
|
+
'accounts',
|
|
109
114
|
'upgrade',
|
|
110
115
|
'update',
|
|
111
116
|
'ticket',
|
|
@@ -488,6 +493,46 @@ async function dispatch(argv: string[], deps: SessionlessCliDeps): Promise<numbe
|
|
|
488
493
|
|
|
489
494
|
// init and upgrade run OUTSIDE build sessions (§16.3): they operate on a
|
|
490
495
|
// repo, not a build, so they route before any store/env requirement.
|
|
496
|
+
case 'accounts': {
|
|
497
|
+
const usage = 'usage: ab accounts login NAME [--local|--project]'
|
|
498
|
+
const parsed = parseArgs(rest, { local: 'boolean', project: 'boolean' }, usage)
|
|
499
|
+
if (
|
|
500
|
+
parsed.positionals.length !== 2 ||
|
|
501
|
+
parsed.positionals[0] !== 'login' ||
|
|
502
|
+
(parsed.flags.get('local') && parsed.flags.get('project'))
|
|
503
|
+
)
|
|
504
|
+
throw new Error(usage)
|
|
505
|
+
await abAccountsLogin(parsed.positionals[1]!, {
|
|
506
|
+
cwd: deps.workspacePath,
|
|
507
|
+
env: deps.processEnv ?? process.env,
|
|
508
|
+
exec: deps.exec ?? spawnExec,
|
|
509
|
+
print: stdout,
|
|
510
|
+
...(deps.signal ? { signal: deps.signal } : {}),
|
|
511
|
+
...(parsed.flags.get('local')
|
|
512
|
+
? { destination: 'local' as const }
|
|
513
|
+
: parsed.flags.get('project')
|
|
514
|
+
? { destination: 'project' as const }
|
|
515
|
+
: {}),
|
|
516
|
+
})
|
|
517
|
+
return 0
|
|
518
|
+
}
|
|
519
|
+
case 'secrets': {
|
|
520
|
+
const parsed = parseArgs(
|
|
521
|
+
rest,
|
|
522
|
+
{ json: 'boolean' },
|
|
523
|
+
'usage: ab secrets list [--json] | set NAME | remove NAME',
|
|
524
|
+
)
|
|
525
|
+
if (parsed.positionals.length > 2)
|
|
526
|
+
throw new Error('Secrets values must be supplied through stdin')
|
|
527
|
+
await abSecrets(parsed.positionals[0], parsed.positionals[1], {
|
|
528
|
+
cwd: deps.workspacePath,
|
|
529
|
+
env: deps.processEnv ?? process.env,
|
|
530
|
+
exec: deps.exec ?? spawnExec,
|
|
531
|
+
print: stdout,
|
|
532
|
+
json: parsed.flags.get('json') === true,
|
|
533
|
+
})
|
|
534
|
+
return 0
|
|
535
|
+
}
|
|
491
536
|
case 'connect':
|
|
492
537
|
case 'disconnect': {
|
|
493
538
|
const usage = command === 'connect' ? 'usage: ab connect [url]' : 'usage: ab disconnect'
|
|
@@ -768,6 +813,33 @@ async function dispatch(argv: string[], deps: SessionlessCliDeps): Promise<numbe
|
|
|
768
813
|
case 'repository': {
|
|
769
814
|
const usage = 'usage: ab repository status [--json] [--store <ref>] (§8.2)'
|
|
770
815
|
const [sub, ...more] = rest
|
|
816
|
+
if (sub === 'forge-clear') {
|
|
817
|
+
const clearUsage =
|
|
818
|
+
'usage: ab repository forge-clear --forge <name> --reason <text> [--json] [--store <ref>]'
|
|
819
|
+
const parsed = parseArgs(
|
|
820
|
+
more,
|
|
821
|
+
{ forge: 'value', reason: 'value', json: 'boolean', store: 'value' },
|
|
822
|
+
clearUsage,
|
|
823
|
+
)
|
|
824
|
+
const forge = stringFlag(parsed, 'forge')
|
|
825
|
+
const reason = stringFlag(parsed, 'reason')
|
|
826
|
+
if (parsed.positionals.length || !forge?.trim() || !reason?.trim())
|
|
827
|
+
throw new Error(clearUsage)
|
|
828
|
+
if (!deps.exec) throw new Error('repository forge-clear requires an exec seam')
|
|
829
|
+
const storeRef = stringFlag(parsed, 'store')
|
|
830
|
+
await abForgeClear({
|
|
831
|
+
targetRepo: deps.workspacePath,
|
|
832
|
+
env: deps.processEnv ?? {},
|
|
833
|
+
exec: deps.exec,
|
|
834
|
+
stdout,
|
|
835
|
+
forge,
|
|
836
|
+
reason,
|
|
837
|
+
json: parsed.flags.has('json'),
|
|
838
|
+
...(storeRef !== undefined ? { storeRef } : {}),
|
|
839
|
+
...(deps.openStore !== undefined ? { openStore: deps.openStore } : {}),
|
|
840
|
+
})
|
|
841
|
+
return 0
|
|
842
|
+
}
|
|
771
843
|
if (sub !== 'status') throw new Error(usage)
|
|
772
844
|
const parsed = parseArgs(more, { json: 'boolean', store: 'value' }, usage)
|
|
773
845
|
if (parsed.positionals.length > 0) throw new Error(usage)
|
|
@@ -18,6 +18,9 @@ export interface PublicationSettlementDeps {
|
|
|
18
18
|
publication?: WorkspacePublication
|
|
19
19
|
forge: Forge
|
|
20
20
|
workspacePath: string
|
|
21
|
+
/** Origin-mode dispatchers have no checkout, and possibly no host git:
|
|
22
|
+
* their `workspacePath` is a scratch root, never a ref cache to confirm. */
|
|
23
|
+
checkoutless?: boolean
|
|
21
24
|
exec: Exec
|
|
22
25
|
ids: IdSource
|
|
23
26
|
runId: string
|
|
@@ -34,7 +37,7 @@ async function confirmDispatcherCache(
|
|
|
34
37
|
branch: string,
|
|
35
38
|
sha: string,
|
|
36
39
|
) {
|
|
37
|
-
if (!deps.forge.confirmPublication) return
|
|
40
|
+
if (deps.checkoutless || !deps.forge.confirmPublication) return
|
|
38
41
|
try {
|
|
39
42
|
if (!(await stat(deps.workspacePath)).isDirectory()) return
|
|
40
43
|
} catch (error) {
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { SECRET_NAME_EXPLANATION } from '../secret-name'
|
|
2
|
+
import { connectedProject } from './connect'
|
|
3
|
+
import { ProjectCredentials } from './project-credentials'
|
|
4
|
+
import type { Exec } from '../ports/workspace/git-worktree'
|
|
5
|
+
import { decodeSecretMetadata, validateSecretName, validateSecretValue } from '../project-secrets'
|
|
6
|
+
import {
|
|
7
|
+
AUTOBUILD_VERSION,
|
|
8
|
+
AUTOBUILD_VERSION_HEADER,
|
|
9
|
+
REMOTE_STORE_PROTOCOL_VERSION,
|
|
10
|
+
REMOTE_STORE_PROTOCOL_VERSION_HEADER,
|
|
11
|
+
} from '../store/remote/version'
|
|
12
|
+
/** Raw mode disables terminal echo before listening. Restore the exact prior state on every exit. */
|
|
13
|
+
export async function readSecretInput(
|
|
14
|
+
input: NodeJS.ReadStream = process.stdin,
|
|
15
|
+
prompt: (s: string) => void = (s) => {
|
|
16
|
+
process.stderr.write(s)
|
|
17
|
+
},
|
|
18
|
+
): Promise<string> {
|
|
19
|
+
if (!input.isTTY) {
|
|
20
|
+
const chunks: Buffer[] = []
|
|
21
|
+
let size = 0
|
|
22
|
+
for await (const chunk of input) {
|
|
23
|
+
const b = Buffer.from(chunk)
|
|
24
|
+
size += b.length
|
|
25
|
+
if (size > 65538) throw new Error('Secret input too large')
|
|
26
|
+
chunks.push(b)
|
|
27
|
+
}
|
|
28
|
+
return Buffer.concat(chunks)
|
|
29
|
+
.toString()
|
|
30
|
+
.replace(/\r?\n$/, '')
|
|
31
|
+
}
|
|
32
|
+
const wasPaused = input.isPaused()
|
|
33
|
+
const wasRaw = input.isRaw
|
|
34
|
+
input.setRawMode(true)
|
|
35
|
+
try {
|
|
36
|
+
prompt('Secret value: ')
|
|
37
|
+
} catch {
|
|
38
|
+
input.setRawMode(wasRaw)
|
|
39
|
+
throw new Error('Secret input failed')
|
|
40
|
+
}
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
let value = ''
|
|
43
|
+
const finish = (error?: Error) => {
|
|
44
|
+
input.off('data', data)
|
|
45
|
+
input.off('end', end)
|
|
46
|
+
input.off('error', failed)
|
|
47
|
+
process.off('SIGINT', cancel)
|
|
48
|
+
input.setRawMode(wasRaw)
|
|
49
|
+
if (wasPaused) input.pause()
|
|
50
|
+
else input.resume()
|
|
51
|
+
prompt('\n')
|
|
52
|
+
if (error) reject(error)
|
|
53
|
+
else resolve(value)
|
|
54
|
+
}
|
|
55
|
+
const cancel = () => finish(new Error('Secret input cancelled'))
|
|
56
|
+
const end = () => finish(new Error('Secret input ended'))
|
|
57
|
+
const failed = () => finish(new Error('Secret input failed'))
|
|
58
|
+
const data = (chunk: Buffer) => {
|
|
59
|
+
for (const c of chunk.toString()) {
|
|
60
|
+
if (c === '\x03') {
|
|
61
|
+
cancel()
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
if (c === '\x04') {
|
|
65
|
+
end()
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
if (c === '\r' || c === '\n') {
|
|
69
|
+
finish()
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
if (c === '\x7f' || c === '\b') value = value.slice(0, -1)
|
|
73
|
+
else value += c
|
|
74
|
+
if (Buffer.byteLength(value) > 65536) {
|
|
75
|
+
finish(new Error('Secret input too large'))
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
input.on('data', data)
|
|
81
|
+
input.once('end', end)
|
|
82
|
+
input.once('error', failed)
|
|
83
|
+
process.once('SIGINT', cancel)
|
|
84
|
+
input.resume()
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
export async function abSecrets(
|
|
88
|
+
operation: string | undefined,
|
|
89
|
+
name: string | undefined,
|
|
90
|
+
opts: {
|
|
91
|
+
cwd: string
|
|
92
|
+
env: Record<string, string | undefined>
|
|
93
|
+
exec: Exec
|
|
94
|
+
print: (s: string) => void
|
|
95
|
+
json?: boolean
|
|
96
|
+
readValue?: () => Promise<string>
|
|
97
|
+
fetch?: (input: string, init?: RequestInit) => Promise<Response>
|
|
98
|
+
},
|
|
99
|
+
): Promise<void> {
|
|
100
|
+
if (
|
|
101
|
+
!['list', 'set', 'remove'].includes(operation ?? '') ||
|
|
102
|
+
(operation === 'list' ? name !== undefined : name === undefined)
|
|
103
|
+
)
|
|
104
|
+
throw new Error('usage: ab secrets list [--json] | set NAME | remove NAME')
|
|
105
|
+
if (name !== undefined) {
|
|
106
|
+
try {
|
|
107
|
+
validateSecretName(name)
|
|
108
|
+
} catch {
|
|
109
|
+
throw new Error(SECRET_NAME_EXPLANATION)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const project = await connectedProject(opts)
|
|
113
|
+
if (!project.service) throw new Error('No connected build service; run ab connect <url>')
|
|
114
|
+
const credential = new ProjectCredentials(opts.env).load(project.service, project.repo)
|
|
115
|
+
if (!credential) throw new Error('Missing saved project credential; run ab connect')
|
|
116
|
+
const body: Record<string, unknown> = { version: 1, repo: project.repo, name }
|
|
117
|
+
if (operation === 'set') {
|
|
118
|
+
const value = await (opts.readValue ?? readSecretInput)()
|
|
119
|
+
validateSecretValue(value)
|
|
120
|
+
body.value = value
|
|
121
|
+
}
|
|
122
|
+
let response: Response
|
|
123
|
+
try {
|
|
124
|
+
response = await (opts.fetch ?? fetch)(
|
|
125
|
+
`${project.service}/secrets/v1/${operation}${operation === 'list' ? `?repo=${encodeURIComponent(project.repo)}` : ''}`,
|
|
126
|
+
{
|
|
127
|
+
method: operation === 'list' ? 'GET' : 'POST',
|
|
128
|
+
headers: {
|
|
129
|
+
'content-type': 'application/json',
|
|
130
|
+
authorization: `Bearer ${credential.token}`,
|
|
131
|
+
[AUTOBUILD_VERSION_HEADER]: AUTOBUILD_VERSION,
|
|
132
|
+
[REMOTE_STORE_PROTOCOL_VERSION_HEADER]: REMOTE_STORE_PROTOCOL_VERSION,
|
|
133
|
+
},
|
|
134
|
+
...(operation === 'list' ? {} : { body: JSON.stringify(body) }),
|
|
135
|
+
signal: AbortSignal.timeout(15000),
|
|
136
|
+
redirect: 'error',
|
|
137
|
+
},
|
|
138
|
+
)
|
|
139
|
+
} catch {
|
|
140
|
+
throw new Error('Project secrets request failed')
|
|
141
|
+
}
|
|
142
|
+
if (!response.ok) throw new Error(`Project secrets request refused (${response.status})`)
|
|
143
|
+
try {
|
|
144
|
+
const result = await response.json()
|
|
145
|
+
if (
|
|
146
|
+
!result ||
|
|
147
|
+
typeof result !== 'object' ||
|
|
148
|
+
Object.keys(result).length !== 2 ||
|
|
149
|
+
result.version !== 1
|
|
150
|
+
)
|
|
151
|
+
throw new Error()
|
|
152
|
+
if (operation === 'list') {
|
|
153
|
+
if (!Array.isArray(result.secrets)) throw new Error()
|
|
154
|
+
const secrets: ReturnType<typeof decodeSecretMetadata>[] =
|
|
155
|
+
result.secrets.map(decodeSecretMetadata)
|
|
156
|
+
opts.print(
|
|
157
|
+
opts.json
|
|
158
|
+
? JSON.stringify({ version: 1, secrets })
|
|
159
|
+
: secrets
|
|
160
|
+
.map(
|
|
161
|
+
(s) =>
|
|
162
|
+
`${s.name}\t${s.status}\t${s.owner}\t${s.setAt}\t${s.fingerprint}\t${s.lastSuppliedAt ?? 'never supplied'}${s.warnings?.length ? `\t${s.warnings.join(', ')}` : ''}`,
|
|
163
|
+
)
|
|
164
|
+
.join('\n') || 'No project secrets.',
|
|
165
|
+
)
|
|
166
|
+
} else {
|
|
167
|
+
if (result.ok !== true) throw new Error()
|
|
168
|
+
opts.print(`Secret ${operation === 'set' ? 'saved' : 'removed'}.`)
|
|
169
|
+
}
|
|
170
|
+
} catch {
|
|
171
|
+
throw new Error('Invalid project secrets response')
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AccountRedactor, redactAccountStore } from '../store/account-redaction'
|
|
1
2
|
import { untilDeadline } from './watch-lifetime'
|
|
2
3
|
/**
|
|
3
4
|
* Production BuildStore composition for CLI commands.
|
|
@@ -35,10 +36,19 @@ function optionalToken(value: string | undefined): string | undefined {
|
|
|
35
36
|
* and does not import the HTTP adapter. */
|
|
36
37
|
export const openProductionStore: StoreOpener = (ref, token) => {
|
|
37
38
|
const forwardedToken = optionalToken(token)
|
|
38
|
-
|
|
39
|
+
const store = resolveStore(ref, {
|
|
39
40
|
remoteFactory: (url, remoteToken) => new RemoteBuildStore({ url, token: remoteToken }),
|
|
40
41
|
...(forwardedToken !== undefined ? { token: forwardedToken } : {}),
|
|
41
42
|
})
|
|
43
|
+
const raw = process.env.AB_ACCOUNT_CREDENTIAL_ENVS
|
|
44
|
+
if (!raw) return store
|
|
45
|
+
const names: unknown = JSON.parse(raw)
|
|
46
|
+
if (!Array.isArray(names) || !names.every((name) => typeof name === 'string'))
|
|
47
|
+
throw new Error('Invalid account credential variable inventory')
|
|
48
|
+
return redactAccountStore(
|
|
49
|
+
store,
|
|
50
|
+
new AccountRedactor(() => names.map((name) => process.env[name])),
|
|
51
|
+
)
|
|
42
52
|
}
|
|
43
53
|
|
|
44
54
|
/** Apply validated ambient authority to a selected Store handle. Remote
|
|
@@ -87,6 +87,7 @@ export function upgradeConflictPrompt(input: {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
interface ResolvedCompletion {
|
|
90
|
+
account?: import('../config/accounts').SelectedAccount
|
|
90
91
|
oneShot: OneShotCompletion
|
|
91
92
|
model?: string
|
|
92
93
|
args: readonly string[]
|
|
@@ -110,7 +111,12 @@ export function createUpgradeAgentResolver(opts: UpgradeAgentResolverOpts): Reso
|
|
|
110
111
|
repoRoot: opts.targetRepo,
|
|
111
112
|
env: opts.env,
|
|
112
113
|
})
|
|
113
|
-
const selected = createRuntimeResolver(
|
|
114
|
+
const selected = createRuntimeResolver(
|
|
115
|
+
runtimes,
|
|
116
|
+
config.roles,
|
|
117
|
+
config.policy.sessionBudgetSeconds,
|
|
118
|
+
config.accounts,
|
|
119
|
+
).resolve(UPGRADE_ROLE)
|
|
114
120
|
const oneShot = runtimes[selected.runtime]?.oneShot
|
|
115
121
|
if (oneShot === undefined) {
|
|
116
122
|
throw new Error(
|
|
@@ -122,6 +128,7 @@ export function createUpgradeAgentResolver(opts: UpgradeAgentResolverOpts): Reso
|
|
|
122
128
|
oneShot,
|
|
123
129
|
...(selected.model !== undefined ? { model: selected.model } : {}),
|
|
124
130
|
args: selected.args,
|
|
131
|
+
account: selected.account,
|
|
125
132
|
}
|
|
126
133
|
})()
|
|
127
134
|
return resolved
|
|
@@ -167,6 +174,7 @@ export function createUpgradeAgentResolver(opts: UpgradeAgentResolverOpts): Reso
|
|
|
167
174
|
signal: controller.signal,
|
|
168
175
|
...(selected.model !== undefined ? { model: selected.model } : {}),
|
|
169
176
|
args: selected.args,
|
|
177
|
+
account: selected.account,
|
|
170
178
|
}),
|
|
171
179
|
stopped,
|
|
172
180
|
])
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReducerValueIncompatibilityError } from '../store/remote/compatibility'
|
|
1
2
|
import { WatchLifetime } from './watch-lifetime'
|
|
2
3
|
import { hostname } from 'node:os'
|
|
3
4
|
import { randomUUID } from 'node:crypto'
|
|
@@ -8,7 +9,7 @@ import { readDispatchUpgrade, readBuildDigests } from '../store/reduced-reads'
|
|
|
8
9
|
import { readBuildStreamSeed, readRepositoryAttention } from '../store/reduced-reads'
|
|
9
10
|
import { buildStreamSeedReducer, type BuildStreamSeed } from '../kernel/read-facts'
|
|
10
11
|
import { historicalBuildState, historicalRepositoryAttention } from './historical-build-state'
|
|
11
|
-
import {
|
|
12
|
+
import { readDispatcherRunFacts } from '../store/reduced-reads'
|
|
12
13
|
import { projectDispatcherLiveness } from '../kernel/dispatcher-liveness'
|
|
13
14
|
import type { RepositoryRecord } from '../store/types'
|
|
14
15
|
/**
|
|
@@ -731,7 +732,6 @@ export async function abWatch(opts: AbWatchOpts): Promise<void> {
|
|
|
731
732
|
const deliveredAttention = new Set(resumedCursor?.deliveredAttention ?? [])
|
|
732
733
|
let repositoryAttention = new RepositoryAttention()
|
|
733
734
|
let attentionInitialized = false
|
|
734
|
-
let livenessEvents: RepositoryEvent[] = []
|
|
735
735
|
const observedOwners = new Map<string, RepositoryRecord>()
|
|
736
736
|
const streams = new Map<string, Stream>()
|
|
737
737
|
// Every stream's position — matching or not, delivered or baselined —
|
|
@@ -823,7 +823,6 @@ export async function abWatch(opts: AbWatchOpts): Promise<void> {
|
|
|
823
823
|
const checkLiveness = async (): Promise<void> => {
|
|
824
824
|
if (!followRepository || stop) return
|
|
825
825
|
if ((await store.getRepo(repo)) === null) return
|
|
826
|
-
livenessEvents = (await readDispatcherLiveness(store, repo, now())).events
|
|
827
826
|
// Sample metadata after the journal. Recheck both immediately before
|
|
828
827
|
// reporting: a failed read is infrastructure, never evidence of death.
|
|
829
828
|
const record = await store.getRepo(repo)
|
|
@@ -837,25 +836,23 @@ export async function abWatch(opts: AbWatchOpts): Promise<void> {
|
|
|
837
836
|
Date.parse(owner.lease.expiresAt) > now().getTime()
|
|
838
837
|
)
|
|
839
838
|
continue
|
|
840
|
-
livenessEvents = (await readDispatcherLiveness(store, repo, now())).events
|
|
841
839
|
const current = await store.getRepo(repo)
|
|
842
840
|
if (current?.lease?.holder === id) {
|
|
843
841
|
observedOwners.set(id, current)
|
|
844
842
|
if (Date.parse(current.lease.expiresAt) > now().getTime()) continue
|
|
845
843
|
}
|
|
844
|
+
const facts = (await readDispatcherRunFacts(store, repo, id)).value
|
|
845
|
+
if (facts.stop) {
|
|
846
|
+
observedOwners.delete(id)
|
|
847
|
+
continue
|
|
848
|
+
}
|
|
846
849
|
const evidence = projectDispatcherLiveness(
|
|
847
850
|
current?.lease?.holder === id ? current : owner,
|
|
848
|
-
|
|
851
|
+
[facts.start, facts.latestStart, facts.stop, facts.tick, facts.runtime].filter(
|
|
852
|
+
(event): event is RepositoryEvent => event !== undefined,
|
|
853
|
+
),
|
|
849
854
|
now(),
|
|
850
855
|
)
|
|
851
|
-
if (
|
|
852
|
-
livenessEvents.some(
|
|
853
|
-
(e) => e.type === 'dispatcher.run-stopped' && e.payload.run === id,
|
|
854
|
-
)
|
|
855
|
-
) {
|
|
856
|
-
observedOwners.delete(id)
|
|
857
|
-
continue
|
|
858
|
-
}
|
|
859
856
|
// Only a validated takeover proves transfer; intent or release alone
|
|
860
857
|
// must still report a predecessor whose successor never arrives.
|
|
861
858
|
upgrade ??= await readDispatchUpgrade(store, repo)
|
|
@@ -1038,7 +1035,8 @@ export async function abWatch(opts: AbWatchOpts): Promise<void> {
|
|
|
1038
1035
|
if (!stop) checkPersistence()
|
|
1039
1036
|
} else attentionInitialized = true
|
|
1040
1037
|
return true
|
|
1041
|
-
} catch {
|
|
1038
|
+
} catch (error) {
|
|
1039
|
+
if (error instanceof ReducerValueIncompatibilityError) throw error
|
|
1042
1040
|
return false
|
|
1043
1041
|
}
|
|
1044
1042
|
}
|