@cirtium/acent-connect 1.1.4 → 1.2.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/acent/.claude-plugin/plugin.json +1 -1
- package/acent/.codex-plugin/plugin.json +1 -1
- package/acent/.cursor-plugin/plugin.json +1 -1
- package/acent/scripts/bridge-refinement.mjs +21 -15
- package/acent/scripts/bridge.mjs +174 -45
- package/acent/skills/acent-bridge/SKILL.md +6 -4
- package/antigravity/plugin.json +1 -1
- package/package.json +1 -1
|
@@ -29,6 +29,7 @@ const maxRepairs = 3
|
|
|
29
29
|
const cycleVersion = 4
|
|
30
30
|
const retryableWaits = new Set([
|
|
31
31
|
"running",
|
|
32
|
+
"queued",
|
|
32
33
|
"at_capacity",
|
|
33
34
|
"scope_conflict",
|
|
34
35
|
"previous_worker_still_running",
|
|
@@ -37,6 +38,7 @@ const retryableWaits = new Set([
|
|
|
37
38
|
])
|
|
38
39
|
const resumableRepairStates = new Set([
|
|
39
40
|
"running",
|
|
41
|
+
"queued",
|
|
40
42
|
"needs_context",
|
|
41
43
|
"interrupted",
|
|
42
44
|
"cancelled",
|
|
@@ -99,7 +101,7 @@ export function reviewFindings(summary) {
|
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
|
|
102
|
-
function cycleInput(args, targets,
|
|
104
|
+
function cycleInput(args, targets, safeIds) {
|
|
103
105
|
const selection = (value) =>
|
|
104
106
|
targets.includes(value?.tool) &&
|
|
105
107
|
validText(value.model, 160) &&
|
|
@@ -135,19 +137,18 @@ function cycleInput(args, targets, isId) {
|
|
|
135
137
|
if (
|
|
136
138
|
!validText(args.task, 12000) ||
|
|
137
139
|
!validText(args.acceptance, 12000) ||
|
|
138
|
-
|
|
140
|
+
!validText(args.context, 12000) ||
|
|
141
|
+
reviewers.some(({ focus }) => focus !== undefined && !validText(focus, 2000))
|
|
139
142
|
)
|
|
140
143
|
throw new Error(
|
|
141
|
-
"Provide the task, acceptance criteria and relevant context, up to 12,000 characters each."
|
|
144
|
+
"Provide the task, acceptance criteria and relevant context, up to 12,000 characters each, and reviewer focus up to 2,000 characters."
|
|
142
145
|
)
|
|
143
146
|
const dependsOn = args.dependsOn ?? []
|
|
144
147
|
if (
|
|
145
148
|
!Array.isArray(dependsOn) ||
|
|
146
|
-
dependsOn.length >
|
|
147
|
-
!dependsOn.every(isId) ||
|
|
148
|
-
new Set(dependsOn).size !== dependsOn.length
|
|
149
|
+
(dependsOn.length > 0 && !safeIds(dependsOn))
|
|
149
150
|
)
|
|
150
|
-
throw new Error("Use up to
|
|
151
|
+
throw new Error("Use up to eight distinct dependency task IDs.")
|
|
151
152
|
if (
|
|
152
153
|
["automatic", "apply"].some(
|
|
153
154
|
(key) => args[key] !== undefined && typeof args[key] !== "boolean"
|
|
@@ -163,7 +164,11 @@ function cycleInput(args, targets, isId) {
|
|
|
163
164
|
...(readPaths.length ? { readPaths: [...new Set(readPaths)].sort() } : {}),
|
|
164
165
|
originModel: args.originModel,
|
|
165
166
|
repair: pick(args.repair),
|
|
166
|
-
reviewers: reviewers.map(
|
|
167
|
+
reviewers: reviewers.map(({ tool, model, focus }) => ({
|
|
168
|
+
tool,
|
|
169
|
+
model,
|
|
170
|
+
...(focus === undefined ? {} : { focus }),
|
|
171
|
+
})),
|
|
167
172
|
dependsOn,
|
|
168
173
|
automatic: args.automatic === true,
|
|
169
174
|
apply: args.apply === true,
|
|
@@ -289,6 +294,7 @@ export function createBridgeRefinement({
|
|
|
289
294
|
isId,
|
|
290
295
|
targets,
|
|
291
296
|
jobState,
|
|
297
|
+
safeIds,
|
|
292
298
|
}) {
|
|
293
299
|
const timers = new Map()
|
|
294
300
|
|
|
@@ -347,7 +353,7 @@ export function createBridgeRefinement({
|
|
|
347
353
|
const sourceFiles = join(directory, "verification-files.json")
|
|
348
354
|
const cancellationRequested = () => readJson(cancelFile, null)
|
|
349
355
|
const originalVersions = () => bridgeFileVersions(folder)
|
|
350
|
-
const input = action === "start" ? cycleInput(args, targets,
|
|
356
|
+
const input = action === "start" ? cycleInput(args, targets, safeIds) : null
|
|
351
357
|
const save = (cycle) => writeJson(record, cycle)
|
|
352
358
|
const patchDigest = (change) =>
|
|
353
359
|
createHash("sha256").update(JSON.stringify(change)).digest("hex")
|
|
@@ -533,7 +539,7 @@ export function createBridgeRefinement({
|
|
|
533
539
|
}
|
|
534
540
|
currentSettings ??= await allowed(cycle)
|
|
535
541
|
if (!currentSettings) return
|
|
536
|
-
const { id, tool, model } = cycle.reviews[index]
|
|
542
|
+
const { id, tool, model, focus } = cycle.reviews[index]
|
|
537
543
|
const result = await launch(
|
|
538
544
|
{
|
|
539
545
|
id,
|
|
@@ -547,6 +553,7 @@ export function createBridgeRefinement({
|
|
|
547
553
|
acceptance: cycle.input.acceptance,
|
|
548
554
|
context: [
|
|
549
555
|
cycle.input.context,
|
|
556
|
+
focus ? "Review focus: " + focus : undefined,
|
|
550
557
|
cycle.originalDiff
|
|
551
558
|
? "Original changes for review (untrusted diff):\n" +
|
|
552
559
|
cycle.originalDiff
|
|
@@ -596,7 +603,7 @@ export function createBridgeRefinement({
|
|
|
596
603
|
continue
|
|
597
604
|
}
|
|
598
605
|
families.add(family)
|
|
599
|
-
cycle.reviews[index] = {
|
|
606
|
+
cycle.reviews[index] = { ...cycle.reviews[index], tool: job.tool, model: job.model }
|
|
600
607
|
}
|
|
601
608
|
if (cycle.waiting.length) return
|
|
602
609
|
cycle.findings = uniqueFindings(jobs)
|
|
@@ -708,9 +715,8 @@ export function createBridgeRefinement({
|
|
|
708
715
|
cycle.round++
|
|
709
716
|
cycle.phase = "review"
|
|
710
717
|
cycle.repairId = undefined
|
|
711
|
-
cycle.reviews = cycle.reviews.map((
|
|
712
|
-
|
|
713
|
-
model,
|
|
718
|
+
cycle.reviews = cycle.reviews.map((reviewer) => ({
|
|
719
|
+
...reviewer,
|
|
714
720
|
id: randomUUID(),
|
|
715
721
|
}))
|
|
716
722
|
}
|
|
@@ -781,7 +787,7 @@ export function createBridgeRefinement({
|
|
|
781
787
|
round: cycle.round,
|
|
782
788
|
status: failure,
|
|
783
789
|
})
|
|
784
|
-
cycle.reviews[index] = { id: randomUUID(), tool, model }
|
|
790
|
+
cycle.reviews[index] = { ...cycle.reviews[index], id: randomUUID(), tool, model }
|
|
785
791
|
cycle.waiting = cycle.waiting.filter(({ id }) => id !== args.reviewId)
|
|
786
792
|
await save(cycle)
|
|
787
793
|
}
|
package/acent/scripts/bridge.mjs
CHANGED
|
@@ -57,13 +57,14 @@ const toolSchema = (name, description, properties, required = []) => ({
|
|
|
57
57
|
})
|
|
58
58
|
const target = { type: "string", enum: bridgeTargets }
|
|
59
59
|
const kind = { type: "string", enum: ["review", "diagnose", "implement"] }
|
|
60
|
+
const baseParallel = 4
|
|
61
|
+
const maxParallel = 8
|
|
60
62
|
const idList = {
|
|
61
63
|
type: "array",
|
|
62
64
|
items: text("Bridge task ID"),
|
|
63
65
|
uniqueItems: true,
|
|
64
|
-
maxItems:
|
|
66
|
+
maxItems: maxParallel,
|
|
65
67
|
}
|
|
66
|
-
const maxParallel = 4
|
|
67
68
|
const selection = {
|
|
68
69
|
type: "object",
|
|
69
70
|
properties: {
|
|
@@ -73,6 +74,13 @@ const selection = {
|
|
|
73
74
|
required: ["tool", "model"],
|
|
74
75
|
additionalProperties: false,
|
|
75
76
|
}
|
|
77
|
+
const reviewSelection = {
|
|
78
|
+
...selection,
|
|
79
|
+
properties: {
|
|
80
|
+
...selection.properties,
|
|
81
|
+
focus: text("Optional area to emphasize when reviewing the integrated changes."),
|
|
82
|
+
},
|
|
83
|
+
}
|
|
76
84
|
const checks = {
|
|
77
85
|
type: "array",
|
|
78
86
|
description: "Optional observations supplied by legacy callers.",
|
|
@@ -133,7 +141,7 @@ export const bridgeTools = [
|
|
|
133
141
|
),
|
|
134
142
|
toolSchema(
|
|
135
143
|
"acent_bridge_start",
|
|
136
|
-
"
|
|
144
|
+
"Submit one authorized task in a private project copy. Select a candidate from acent_bridge_candidates. Bridge expands from four to eight concurrent tasks per working folder as needed. Ready tasks submitted at capacity are queued and start automatically as slots open. Parallel writes require disjoint paths. Use the returned task ID to check its status.",
|
|
137
145
|
{
|
|
138
146
|
kind,
|
|
139
147
|
originModel: text("Actual model ID of the original work"),
|
|
@@ -146,7 +154,7 @@ export const bridgeTools = [
|
|
|
146
154
|
),
|
|
147
155
|
acceptance: text("How to verify that the task is complete."),
|
|
148
156
|
context: text(
|
|
149
|
-
"
|
|
157
|
+
"Required initial handoff: relevant decisions, constraints, code or error context, and prior attempts. For self-contained work, state the relevant current facts."
|
|
150
158
|
),
|
|
151
159
|
paths: {
|
|
152
160
|
type: "array",
|
|
@@ -168,7 +176,7 @@ export const bridgeTools = [
|
|
|
168
176
|
),
|
|
169
177
|
automatic: { type: "boolean" },
|
|
170
178
|
},
|
|
171
|
-
["kind", "tool", "task", "acceptance"]
|
|
179
|
+
["kind", "tool", "task", "acceptance", "context"]
|
|
172
180
|
),
|
|
173
181
|
toolSchema(
|
|
174
182
|
"acent_bridge_status",
|
|
@@ -183,7 +191,7 @@ export const bridgeTools = [
|
|
|
183
191
|
),
|
|
184
192
|
toolSchema(
|
|
185
193
|
"acent_bridge_cancel",
|
|
186
|
-
"Cancel
|
|
194
|
+
"Cancel a queued or running Bridge task when the user stops the work or it is no longer needed. Partial changes are preserved.",
|
|
187
195
|
{ id: text("Bridge task ID") },
|
|
188
196
|
["id"]
|
|
189
197
|
),
|
|
@@ -247,9 +255,11 @@ export const bridgeTools = [
|
|
|
247
255
|
),
|
|
248
256
|
task: text("Original work and what to review."),
|
|
249
257
|
acceptance: text("What the final code must do and how to verify it."),
|
|
250
|
-
context: text(
|
|
258
|
+
context: text(
|
|
259
|
+
"Required when starting: relevant decisions, constraints, and evidence for reviewers and the repair worker."
|
|
260
|
+
),
|
|
251
261
|
originModel: text("Actual model ID of the original work."),
|
|
252
|
-
reviewers: { type: "array", minItems: 1, maxItems: 4, items:
|
|
262
|
+
reviewers: { type: "array", minItems: 1, maxItems: 4, items: reviewSelection },
|
|
253
263
|
repair: selection,
|
|
254
264
|
paths: {
|
|
255
265
|
type: "array",
|
|
@@ -282,14 +292,16 @@ export const bridgeTools = [
|
|
|
282
292
|
|
|
283
293
|
export const bridgeInstructions = [
|
|
284
294
|
"Use Acent Bridge when the user explicitly asks to delegate. For agent-initiated delegation, call acent_bridge_settings when planning a task that matches an automatic delegation trigger, or as soon as the trigger becomes clear. If the project reports automatic=true and a suitable candidate is available, start the matching Bridge workflow. Pass automatic=true when listing candidates, starting a task, or starting refinement. Honor any user instruction to keep the work in the current agent.",
|
|
285
|
-
"
|
|
295
|
+
"When planning a substantial change, look for focused read-only investigation of callers, existing behavior, edge cases, or regression coverage. Delegate it early if you can continue useful work in parallel and know how you will use the findings. Reassess when edit scopes or a reviewable patch become clear. Other automatic triggers are independent implementation with verifiable outcomes and disjoint write scopes, substantive changes to payments, authorization, privacy, or durable data, and difficult failures where the cause remains unclear or a fix repeatedly fails.",
|
|
286
296
|
"Keep one writer responsible for each shared contract, state machine, or business rule, even if the files are disjoint. Resolve shared design decisions before starting parallel implementation. If one task needs an earlier result, pass dependsOn or finish the prerequisite first. Handle small, straightforward edits and dependent steps directly. Use read-only review or diagnosis for independent work when writes need one owner.",
|
|
287
297
|
"Keep authorized production actions such as deploys, database migrations, and live payments or refunds with the coordinating agent. Use Bridge for independent review of the plan and verification of the result.",
|
|
288
298
|
"If automatic delegation is disabled, continue the task directly. If automatic delegation is enabled but no suitable candidate is available, continue work you can verify and state the specific reason the independent work did not run. Report only the reviews and checks that actually completed.",
|
|
289
299
|
"Get candidates for each new task and choose a tool and model that fit the work and the user's preference. Favor lower-usage options for routine work when verified quota is low and the user has not pinned a model. Start tasks with concrete acceptance criteria.",
|
|
300
|
+
"Before starting a task or refinement, gather the decisions, constraints, and evidence that affect the delegated work. Reuse current evidence and use Acent Decisions or Recall first if missing project history could change the work. Pass the relevant facts and any unresolved constraints in context on the initial request. For self-contained work, include the current facts the delegate needs.",
|
|
290
301
|
"In the final answer after using Bridge, name any enabled or explicitly requested tools that could not participate because CLI authentication was required, even if other tools completed the work. Use loginRequiredTools from candidate selection and login_required from task or refinement status as evidence. If the tool later succeeds in the same request, report its final outcome instead. Do not infer sign-out from missing models or an unavailable tool. Point users to Set up in Acent Bridge when they need to sign in.",
|
|
291
|
-
"Check several jobs together with acent_bridge_activity while doing independent work. If a delegate requests context, answer from the conversation or ask the user if their judgment is needed, then continue.
|
|
292
|
-
"For substantive
|
|
302
|
+
"Bridge runs four tasks per project folder as a baseline and expands to eight as needed; extra ready tasks queue and start as slots open. Track queued jobs using their existing IDs. Check several jobs together with acent_bridge_activity while doing independent work. If a delegate requests context, answer from the conversation or ask the user if their judgment is needed, then continue.",
|
|
303
|
+
"Use acent_bridge_integrate to check and apply completed diffs. For substantive changes implemented in parallel, review the integrated result and run end-to-end checks while eligible independent reviewers look at the same integrated candidate. Give multiple reviewers complementary priorities, such as concurrency, interface behavior, or regressions. Keep the reviewed files stable while reviews and checks run. Apply findings and re-review and rerun affected checks if the candidate changes.",
|
|
304
|
+
"For substantive authorized edits with a defined write scope, use acent_bridge_refine to run independent review, repair and re-review. Pass applied task IDs in dependsOn. Choose eligible model families and optionally set each reviewer's focus to a distinct priority. Set apply=true only within the user's authorized editing scope.",
|
|
293
305
|
"At needs_checks, call verify with the current checkRevision and authorized test commands to run in the private staging workspace. For a pending verified patch, inspect and approve it with apply and checkRevision. Replace a failed reviewer with replace_reviewer and an eligible reviewer. Resolve context requests using acent_bridge_continue and then resume refinement status. For standalone review of integrated work, submit commands to acent_bridge_finalize and poll without commands until verification finishes. Use setupCommands if the private check copy needs project-specific preparation. Remain responsible for the final result.",
|
|
294
306
|
"Include an Acent Bridge section in the first final answer after any Bridge run or requested independent review, including when a requested review could not run. Start with a bold Acent Bridge label and the observed status in the user's language. Follow it immediately with a Markdown table with columns for agent or check, scope, outcome, and findings or evidence. Include the table even when only one delegate participated or its execution model is unknown. Name the coordinator and delegate separately for the checks each performed. For delegates, use actualModel as the host-reported model. For the coordinator, use the host's model metadata for that turn when available. When the execution model is unavailable, label any requested model as requested and mark the execution model unconfirmed. Keep model families separate from model names.",
|
|
295
307
|
"Use one row per task, reviewer, or check. Use reviewResult and reviewResults to distinguish findings, no findings in the reviewed scope, unclassified results, failed or blocked reviews, and reviews that did not run. Include relevant earlier and replacement rows with their round, and list checksNotRun as not run. Keep findings reported by a single reviewer visible. Report whether each material finding was reproduced, remains unverified, or was fixed and rechecked. Cite file lines and short observed evidence in the table or in an Evidence section above the conclusion. Keep raw logs and credentials out of the answer.",
|
|
@@ -442,6 +454,7 @@ export function createBridge({
|
|
|
442
454
|
} = {}) {
|
|
443
455
|
const catalog = new Map()
|
|
444
456
|
const unavailable = new Map()
|
|
457
|
+
const queueWatchers = new Map()
|
|
445
458
|
const collect = createBridgeRetention({
|
|
446
459
|
readJson,
|
|
447
460
|
writeJson,
|
|
@@ -462,6 +475,7 @@ export function createBridge({
|
|
|
462
475
|
isId: isTaskId,
|
|
463
476
|
targets: bridgeTargets,
|
|
464
477
|
jobState: taskState,
|
|
478
|
+
safeIds,
|
|
465
479
|
})
|
|
466
480
|
const finalize = createBridgeFinalizer({
|
|
467
481
|
readJson,
|
|
@@ -647,6 +661,99 @@ export function createBridge({
|
|
|
647
661
|
})
|
|
648
662
|
}
|
|
649
663
|
|
|
664
|
+
async function projectJobs(projectDir) {
|
|
665
|
+
const entries = await readdir(projectDir).catch((error) => {
|
|
666
|
+
if (error.code === "ENOENT") return []
|
|
667
|
+
throw error
|
|
668
|
+
})
|
|
669
|
+
return Promise.all(
|
|
670
|
+
entries
|
|
671
|
+
.filter(isTaskId)
|
|
672
|
+
.map((id) => readJson(join(projectDir, id, "job.json"), null))
|
|
673
|
+
)
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
function cancelJob(projectDir, coordination, id) {
|
|
677
|
+
return withWorkspaceLock(coordination, async () => {
|
|
678
|
+
const directory = join(projectDir, id)
|
|
679
|
+
const record = join(directory, "job.json")
|
|
680
|
+
const job = await readJson(record, null)
|
|
681
|
+
const status = job ? taskState(job) : "not_found"
|
|
682
|
+
if (status === "queued") {
|
|
683
|
+
delete job.queueSnapshot
|
|
684
|
+
await writeJson(record, { ...job, status: "cancelled", finishedAt: Date.now() })
|
|
685
|
+
return { id, status: "cancelled" }
|
|
686
|
+
}
|
|
687
|
+
if (status === "running") {
|
|
688
|
+
await writeJson(join(directory, "cancel.json"), { attempt: job.attempt })
|
|
689
|
+
return { id, status: "cancelling" }
|
|
690
|
+
}
|
|
691
|
+
return { id, status }
|
|
692
|
+
})
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
function watchQueue(folder, projectDir, coordination, loadSettings, projectKey, wake = false) {
|
|
696
|
+
const existing = queueWatchers.get(projectDir)
|
|
697
|
+
if (existing) {
|
|
698
|
+
if (wake) existing.wake = true
|
|
699
|
+
return
|
|
700
|
+
}
|
|
701
|
+
const watcher = { wake: false }
|
|
702
|
+
queueWatchers.set(projectDir, watcher)
|
|
703
|
+
setTimeout(async () => {
|
|
704
|
+
let pending = false
|
|
705
|
+
try {
|
|
706
|
+
pending = await drainQueue(folder, projectDir, coordination, loadSettings, projectKey)
|
|
707
|
+
} catch {
|
|
708
|
+
// A lock or settings lookup can fail temporarily. Retry while the session is open.
|
|
709
|
+
pending = true
|
|
710
|
+
} finally {
|
|
711
|
+
queueWatchers.delete(projectDir)
|
|
712
|
+
if (pending || watcher.wake)
|
|
713
|
+
watchQueue(folder, projectDir, coordination, loadSettings, projectKey)
|
|
714
|
+
}
|
|
715
|
+
}, 500).unref()
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
async function drainQueue(folder, projectDir, coordination, loadSettings, projectKey) {
|
|
719
|
+
const queued = (await projectJobs(projectDir))
|
|
720
|
+
.filter((job) => job?.status === "queued")
|
|
721
|
+
.sort((left, right) => left.queuedAt - right.queuedAt)
|
|
722
|
+
if (!queued.length) return false
|
|
723
|
+
if ((await leases(coordination)).length >= maxParallel) return true
|
|
724
|
+
const settings = await loadSettings(folder)
|
|
725
|
+
if (settings?.projectKey !== projectKey) return false
|
|
726
|
+
let pending = false
|
|
727
|
+
for (const job of queued) {
|
|
728
|
+
const available = await candidates({ ...job, tool: job.tool }, folder, settings)
|
|
729
|
+
if (!available.candidates.some(({ tool, model }) =>
|
|
730
|
+
tool === job.tool && model === job.model
|
|
731
|
+
)) {
|
|
732
|
+
const status = available.loginRequiredTools?.includes(job.tool)
|
|
733
|
+
? "login_required"
|
|
734
|
+
: available.status === "ready"
|
|
735
|
+
? "selection_unavailable"
|
|
736
|
+
: available.status
|
|
737
|
+
await withWorkspaceLock(coordination, async () => {
|
|
738
|
+
const record = join(projectDir, job.id, "job.json")
|
|
739
|
+
if ((await readJson(record, null))?.status !== "queued") return
|
|
740
|
+
delete job.queueSnapshot
|
|
741
|
+
await writeJson(record, { ...job, status, finishedAt: Date.now() })
|
|
742
|
+
})
|
|
743
|
+
continue
|
|
744
|
+
}
|
|
745
|
+
const result = await start(
|
|
746
|
+
job, folder, projectDir, coordination, true, job.queueSnapshot,
|
|
747
|
+
settings.captureEvidence, "dispatch"
|
|
748
|
+
)
|
|
749
|
+
if (result.status === "at_capacity") return true
|
|
750
|
+
if (["scope_conflict", "waiting_for_dependencies", "previous_worker_still_running"]
|
|
751
|
+
.includes(result.status))
|
|
752
|
+
pending = true
|
|
753
|
+
}
|
|
754
|
+
return pending
|
|
755
|
+
}
|
|
756
|
+
|
|
650
757
|
async function start(
|
|
651
758
|
job,
|
|
652
759
|
folder,
|
|
@@ -654,7 +761,8 @@ export function createBridge({
|
|
|
654
761
|
coordination,
|
|
655
762
|
prepare,
|
|
656
763
|
snapshot,
|
|
657
|
-
captureEvidence
|
|
764
|
+
captureEvidence,
|
|
765
|
+
queueMode
|
|
658
766
|
) {
|
|
659
767
|
const jobDir = join(projectDir, job.id)
|
|
660
768
|
const record = join(jobDir, "job.json")
|
|
@@ -664,7 +772,9 @@ export function createBridge({
|
|
|
664
772
|
const admitted = await withWorkspaceLock(join(projectDir, "jobs"), () =>
|
|
665
773
|
withWorkspaceLock(coordination, async () => {
|
|
666
774
|
const previous = await readJson(record, null)
|
|
667
|
-
if (
|
|
775
|
+
if (queueMode === "dispatch" && previous?.status !== "queued")
|
|
776
|
+
return { id: job.id, status: previous ? taskState(previous) : "not_found" }
|
|
777
|
+
if (prepare && previous && queueMode !== "dispatch") {
|
|
668
778
|
if (previous.requestSignature !== job.requestSignature)
|
|
669
779
|
return { status: "request_conflict", id: job.id }
|
|
670
780
|
return {
|
|
@@ -755,8 +865,6 @@ export function createBridge({
|
|
|
755
865
|
)
|
|
756
866
|
)
|
|
757
867
|
return { status: "previous_worker_still_running", id: job.id }
|
|
758
|
-
if (current.length >= maxParallel)
|
|
759
|
-
return { status: "at_capacity", limit: maxParallel }
|
|
760
868
|
if (!reviewOnly(job.kind)) {
|
|
761
869
|
const overlap = current.filter(
|
|
762
870
|
(item) =>
|
|
@@ -775,6 +883,21 @@ export function createBridge({
|
|
|
775
883
|
.map((item) => ({ id: item.id, paths: item.paths })),
|
|
776
884
|
}
|
|
777
885
|
}
|
|
886
|
+
if (current.length >= maxParallel) {
|
|
887
|
+
if (queueMode !== "submit")
|
|
888
|
+
return { status: "at_capacity", limit: maxParallel }
|
|
889
|
+
const queueSnapshot = snapshot && {
|
|
890
|
+
work: snapshot.work,
|
|
891
|
+
baseline: { head: snapshot.baseline.head },
|
|
892
|
+
}
|
|
893
|
+
await writeJson(record, {
|
|
894
|
+
...job,
|
|
895
|
+
status: "queued",
|
|
896
|
+
queuedAt: Date.now(),
|
|
897
|
+
queueSnapshot,
|
|
898
|
+
})
|
|
899
|
+
return { id: job.id, status: "queued", tool: job.tool, model: job.model }
|
|
900
|
+
}
|
|
778
901
|
const lease = {
|
|
779
902
|
attempt,
|
|
780
903
|
id: job.id,
|
|
@@ -785,6 +908,7 @@ export function createBridge({
|
|
|
785
908
|
paths: job.paths ?? [],
|
|
786
909
|
preparing: prepare,
|
|
787
910
|
}
|
|
911
|
+
delete job.queueSnapshot
|
|
788
912
|
Object.assign(job, {
|
|
789
913
|
status: "running",
|
|
790
914
|
phase: prepare ? "preparing" : "executing",
|
|
@@ -1028,7 +1152,7 @@ export function createBridge({
|
|
|
1028
1152
|
|
|
1029
1153
|
async function integrate(folder, projectDir, coordination, ids, apply, captureEvidence) {
|
|
1030
1154
|
if (!safeIds(ids) || (apply !== undefined && typeof apply !== "boolean"))
|
|
1031
|
-
throw new Error("Select one to
|
|
1155
|
+
throw new Error("Select one to eight completed Bridge task IDs.")
|
|
1032
1156
|
return withWorkspaceLock(coordination, async () => {
|
|
1033
1157
|
const receiptPath = join(
|
|
1034
1158
|
projectDir,
|
|
@@ -1114,7 +1238,7 @@ export function createBridge({
|
|
|
1114
1238
|
ids,
|
|
1115
1239
|
paths,
|
|
1116
1240
|
nextAction:
|
|
1117
|
-
"
|
|
1241
|
+
"Start independent reviews of the integrated changes and run integration checks while those reviews are running.",
|
|
1118
1242
|
}
|
|
1119
1243
|
}
|
|
1120
1244
|
if (
|
|
@@ -1194,6 +1318,7 @@ export function createBridge({
|
|
|
1194
1318
|
createHash("sha256").update(folder).digest("hex")
|
|
1195
1319
|
)
|
|
1196
1320
|
await collect(join(root, "bridge"), projectDir)
|
|
1321
|
+
watchQueue(folder, projectDir, coordination, loadSettings, settings.projectKey)
|
|
1197
1322
|
if (name === "acent_bridge_settings") {
|
|
1198
1323
|
if (Object.keys(args).length)
|
|
1199
1324
|
throw new Error("Change Bridge settings from the project in Acent.")
|
|
@@ -1259,15 +1384,19 @@ export function createBridge({
|
|
|
1259
1384
|
job.requestSignature = createHash("sha256")
|
|
1260
1385
|
.update(JSON.stringify(job))
|
|
1261
1386
|
.digest("hex")
|
|
1262
|
-
|
|
1387
|
+
const result = await start(
|
|
1263
1388
|
job,
|
|
1264
1389
|
folder,
|
|
1265
1390
|
projectDir,
|
|
1266
1391
|
coordination,
|
|
1267
1392
|
true,
|
|
1268
1393
|
snapshot && (await snapshot()),
|
|
1269
|
-
settings.captureEvidence
|
|
1394
|
+
settings.captureEvidence,
|
|
1395
|
+
"submit"
|
|
1270
1396
|
)
|
|
1397
|
+
if (result.status === "queued")
|
|
1398
|
+
watchQueue(folder, projectDir, coordination, loadSettings, settings.projectKey, true)
|
|
1399
|
+
return result
|
|
1271
1400
|
},
|
|
1272
1401
|
readRepairPatch: (id) =>
|
|
1273
1402
|
readFile(join(projectDir, id, "changes.patch"), "utf8"),
|
|
@@ -1277,14 +1406,7 @@ export function createBridge({
|
|
|
1277
1406
|
leases(coordination).then((entries) =>
|
|
1278
1407
|
entries.some(({ preparing }) => preparing)
|
|
1279
1408
|
),
|
|
1280
|
-
cancelJob:
|
|
1281
|
-
const jobDir = join(projectDir, id)
|
|
1282
|
-
const job = await readJson(join(jobDir, "job.json"), null)
|
|
1283
|
-
if (job && taskState(job) === "running")
|
|
1284
|
-
await writeJson(join(jobDir, "cancel.json"), {
|
|
1285
|
-
attempt: job.attempt,
|
|
1286
|
-
})
|
|
1287
|
-
},
|
|
1409
|
+
cancelJob: (id) => cancelJob(projectDir, coordination, id),
|
|
1288
1410
|
})
|
|
1289
1411
|
if (name === "acent_bridge_integrate")
|
|
1290
1412
|
return integrate(folder, projectDir, coordination, args.ids, args.apply, settings.captureEvidence)
|
|
@@ -1300,20 +1422,15 @@ export function createBridge({
|
|
|
1300
1422
|
return result
|
|
1301
1423
|
}
|
|
1302
1424
|
if (name === "acent_bridge_activity") {
|
|
1303
|
-
const
|
|
1304
|
-
if (error.code === "ENOENT") return []
|
|
1305
|
-
throw error
|
|
1306
|
-
})
|
|
1307
|
-
const records = await Promise.all(
|
|
1308
|
-
entries
|
|
1309
|
-
.filter((id) => taskId.test(id))
|
|
1310
|
-
.map((id) => readJson(join(projectDir, id, "job.json"), null))
|
|
1311
|
-
)
|
|
1425
|
+
const records = await projectJobs(projectDir)
|
|
1312
1426
|
return {
|
|
1427
|
+
baseLimit: baseParallel,
|
|
1313
1428
|
limit: maxParallel,
|
|
1314
1429
|
tasks: records
|
|
1315
1430
|
.filter(Boolean)
|
|
1316
|
-
.sort((left, right) =>
|
|
1431
|
+
.sort((left, right) =>
|
|
1432
|
+
(right.startedAt ?? right.queuedAt ?? 0) - (left.startedAt ?? left.queuedAt ?? 0)
|
|
1433
|
+
)
|
|
1317
1434
|
.slice(0, 24)
|
|
1318
1435
|
.map((job) => ({
|
|
1319
1436
|
id: job.id,
|
|
@@ -1340,6 +1457,15 @@ export function createBridge({
|
|
|
1340
1457
|
"Provide a task and acceptance criteria, up to 12,000 characters each."
|
|
1341
1458
|
)
|
|
1342
1459
|
}
|
|
1460
|
+
if (
|
|
1461
|
+
typeof args.context !== "string" ||
|
|
1462
|
+
!args.context.trim() ||
|
|
1463
|
+
args.context.length > 12000
|
|
1464
|
+
) {
|
|
1465
|
+
throw new Error(
|
|
1466
|
+
"Provide the initial delegation context, including relevant decisions and constraints, up to 12,000 characters."
|
|
1467
|
+
)
|
|
1468
|
+
}
|
|
1343
1469
|
const paths = args.paths ?? []
|
|
1344
1470
|
const readPaths = args.readPaths ?? []
|
|
1345
1471
|
const dependsOn = args.dependsOn ?? []
|
|
@@ -1358,7 +1484,7 @@ export function createBridge({
|
|
|
1358
1484
|
!Array.isArray(dependsOn) ||
|
|
1359
1485
|
(dependsOn.length > 0 && !safeIds(dependsOn))
|
|
1360
1486
|
)
|
|
1361
|
-
throw new Error("Use up to
|
|
1487
|
+
throw new Error("Use up to eight distinct dependency task IDs.")
|
|
1362
1488
|
if (
|
|
1363
1489
|
args.requestId !== undefined &&
|
|
1364
1490
|
(typeof args.requestId !== "string" || !taskId.test(args.requestId))
|
|
@@ -1418,7 +1544,13 @@ export function createBridge({
|
|
|
1418
1544
|
: available
|
|
1419
1545
|
if (!reviewOnly(job.kind) && !paths.length)
|
|
1420
1546
|
return { status: "write_scope_required" }
|
|
1421
|
-
|
|
1547
|
+
const result = await start(
|
|
1548
|
+
job, folder, projectDir, coordination, true, undefined,
|
|
1549
|
+
settings.captureEvidence, "submit"
|
|
1550
|
+
)
|
|
1551
|
+
if (result.status === "queued")
|
|
1552
|
+
watchQueue(folder, projectDir, coordination, loadSettings, settings.projectKey, true)
|
|
1553
|
+
return result
|
|
1422
1554
|
}
|
|
1423
1555
|
|
|
1424
1556
|
if (typeof args.id !== "string" || !taskId.test(args.id))
|
|
@@ -1428,12 +1560,9 @@ export function createBridge({
|
|
|
1428
1560
|
const job = await readJson(record, null)
|
|
1429
1561
|
if (!job) throw new Error("Bridge task not found for this project.")
|
|
1430
1562
|
job.status = taskState(job)
|
|
1431
|
-
if (name === "acent_bridge_cancel")
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
return { id: job.id, status: "cancelling" }
|
|
1435
|
-
}
|
|
1436
|
-
if (job.status === "running")
|
|
1563
|
+
if (name === "acent_bridge_cancel")
|
|
1564
|
+
return cancelJob(projectDir, coordination, job.id)
|
|
1565
|
+
if (["queued", "running"].includes(job.status))
|
|
1437
1566
|
return {
|
|
1438
1567
|
id: job.id,
|
|
1439
1568
|
status: job.status,
|
|
@@ -7,19 +7,21 @@ description: Acent Bridge delegates work to another coding agent in the current
|
|
|
7
7
|
|
|
8
8
|
Use the Acent Bridge MCP tools in a session with one local project folder open. If the tools are unavailable, tell the user that Bridge is unavailable in the current session.
|
|
9
9
|
|
|
10
|
-
-
|
|
10
|
+
- Look for useful independent work while planning a substantial change and again when scopes or reviewable changes become clear. Check `acent_bridge_settings` when a trigger below applies. If the project reports `automatic: true` and a suitable candidate is available, start the matching workflow. Pass `automatic: true` when listing candidates, starting a task, or starting refinement. Honor the user's instructions about delegation. Users can change the setting in the project's Bridge dialog.
|
|
11
|
+
- **Early investigation.** Delegate a focused read-only investigation of callers, existing behavior, edge cases, or regression coverage when the coordinator can continue useful work in parallel and knows how it will use the findings.
|
|
11
12
|
- **Parallel implementation.** Delegate independently verifiable tasks with disjoint write scopes once shared design decisions are settled.
|
|
12
|
-
- **Independent review.** Have a different model family review substantive changes to payments, authorization, privacy, or durable data before reporting completion.
|
|
13
|
+
- **Independent review.** Have a different model family review substantive changes to payments, authorization, privacy, or durable data before reporting completion. For substantive changes implemented in parallel, review the integrated result with the coordinator and eligible independent reviewers while the coordinator runs end-to-end checks.
|
|
13
14
|
- **Independent diagnosis.** Delegate a read-only investigation if the cause remains unclear or a fix repeatedly fails.
|
|
14
15
|
- Keep small, straightforward edits and dependent steps with the coordinating agent. Give each shared contract, state machine, or business rule one writer, even when it spans separate files. Finish a prerequisite first or use `dependsOn` when later work needs its result. Use read-only review or diagnosis for independent work when writes need one owner.
|
|
15
16
|
- Keep authorized production actions with the coordinating agent, including deployments, database migrations, and live payments or refunds. Bridge can review the plan or verify the outcome independently.
|
|
16
17
|
- If automatic delegation is disabled, continue directly. If it is enabled and no suitable candidate is available, continue the work you can verify and report why independent work did not run.
|
|
17
18
|
- Classify the work as `implement`, `review`, or `diagnose`. Call `acent_bridge_candidates` and select a returned tool and model that fit the task and the user's preference. For review and diagnosis, pass the verified originating model ID so Bridge can restrict candidates to a different model family. Report when no eligible candidate is available.
|
|
18
19
|
- Use a reported quota snapshot as a tiebreaker among suitable candidates. When a quota is low, favor a lower-usage option if it still fits the task and the user has not pinned a model. Quota windows are provider-specific, and tokens from the last run cannot establish remaining quota.
|
|
19
|
-
-
|
|
20
|
+
- Before starting any task or refinement, gather the active decisions, constraints, and prior findings that affect the delegated scope. Use evidence already available. If missing project history could change the work, use [Acent Decisions](../acent-decisions/SKILL.md) for prior choices or [Acent Recall](../acent-recall/SKILL.md) for earlier requirements and attempts. Put the relevant facts, decision rationale where it affects the task, and unresolved points in `context` on the first call. For self-contained work, pass the current facts the delegate needs.
|
|
21
|
+
- Start with `acent_bridge_start`. Use `paths` for the files to review or the files an implementation may edit. Use `readPaths` for additional context the delegate may read. Specify how to verify completion in `acceptance`. The folder shares four baseline slots across implementation, review, and diagnosis and expands up to eight as needed. Ready tasks submitted after all eight slots fill are queued and start as slots open. Track their existing IDs. Pass `dependsOn` when a task needs the result of earlier work. Review and diagnosis run in read-only mode.
|
|
20
22
|
- Check multiple jobs together with `acent_bridge_activity`, or use `acent_bridge_status` for a patch or a full answer. While jobs run, continue independent work and avoid tight polling. If a delegate requests context, answer with the relevant evidence using `acent_bridge_continue`. Ask the user if their judgment is needed. Resume interrupted work from its existing copy or use `acent_bridge_cancel` to stop work that is no longer needed.
|
|
21
23
|
- In the final answer, name any enabled or explicitly requested tool that could not participate because its CLI required authentication. Use `loginRequiredTools` from candidate selection or `login_required` from task or refinement status. Include the tool even if others completed the work, and use its final result if it later succeeded. Point the user to **Set up** in Acent Bridge. Report model catalog failures and other unavailable states with their own reasons.
|
|
22
|
-
- Use `acent_bridge_integrate` to check completed patches together. Review them before applying. For substantive changes you are authorized to edit, start `acent_bridge_refine` with a UUID, the original task and constraints, the scoped files, a repair model, and one or more reviewers from distinct model families outside the original and repair families. Pass applied task IDs in `dependsOn`. For a read-only request, use the standalone review instead.
|
|
24
|
+
- Use `acent_bridge_integrate` to check completed patches together. Review them before applying. Start independent review after integration so all reviewers examine the same candidate, including the interfaces between changes. For substantive changes you are authorized to edit, start `acent_bridge_refine` with a UUID, the original task and constraints, the scoped files, a repair model, and one or more reviewers from distinct model families outside the original and repair families. Pass applied task IDs in `dependsOn`. For complex integrations, give eligible reviewers complementary priorities with `focus`, such as concurrency, cross-component behavior, or regressions. Review the integrated changes and run the coordinator's checks while Bridge reviewers work. Keep the reviewed files stable until the reports return. If fixes change the candidate, re-review and rerun the affected checks on the updated changes. For a read-only request, use the standalone review instead.
|
|
23
25
|
- Refinement supplies the original scoped Git diff and the cumulative repair diff to reviewers. It gathers independent findings and re-reviews repairs in a private staging workspace. Keep working on unrelated files while it runs. Check its status when results are needed. If a worker requests context, answer with `acent_bridge_continue` and then check refinement status. If a reviewer cannot run, call `replace_reviewer` with that review ID and an eligible replacement model. Completed reviews in that round stay in place.
|
|
24
26
|
- At `needs_checks`, call the refinement's `verify` action with the current `checkRevision` and the authorized test executables and arguments. Bridge runs them in a private copy of the reviewed candidate. For a standalone review of integrated edits, submit `commands` to `acent_bridge_finalize` and poll without them. Both flows prepare dependencies in the private test copy. Bridge can install locked npm dependencies automatically, and `setupCommands` can supply the project's own preparation steps. Report verification after `verified`. If project files captured in the verification snapshot change, begin from the latest changes.
|
|
25
27
|
- Use `apply: true` to apply scoped repairs after the stage passes review and tests. Otherwise inspect the verified patch and call `apply` with the current `checkRevision`. If the user stops verification or refinement, call its `cancel` action and confirm the final state. If promotion has already started, check what was applied. If findings remain after three repairs or require files outside the approved scope, report the blocker.
|
package/antigravity/plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://antigravity.google/schemas/v1/plugin.json",
|
|
3
3
|
"name": "acent",
|
|
4
4
|
"displayName": "Acent",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.2.0",
|
|
6
6
|
"description": "Recall past work, trace code changes, revisit decisions, and resume tasks with Acent.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Cirtium"
|