@cirtium/acent-connect 1.1.3 → 1.1.5
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-runners.mjs +139 -74
- package/acent/scripts/bridge.mjs +178 -47
- package/acent/scripts/hook.mjs +11 -0
- package/acent/skills/acent-bridge/SKILL.md +18 -6
- 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
|
}
|
|
@@ -12,7 +12,7 @@ export function modelFamily(model) {
|
|
|
12
12
|
const value = model?.toLowerCase() ?? ""
|
|
13
13
|
if (/^(?:openai[/:])?(?:gpt[- ]|o[134](?:[- ]|$))/.test(value)) return "gpt"
|
|
14
14
|
if (
|
|
15
|
-
/^(?:anthropic[/:])?(?:claude[- ]|sonnet
|
|
15
|
+
/^(?:anthropic[/:])?(?:claude[- ]|(?:sonnet|opus|haiku|fable|mythos)(?:[- ]|$))/.test(
|
|
16
16
|
value
|
|
17
17
|
)
|
|
18
18
|
)
|
|
@@ -492,20 +492,107 @@ export async function discoverBridgeTarget(
|
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
+
function reportedModel(value) {
|
|
496
|
+
const name = typeof value === "string" ? value.trim() : ""
|
|
497
|
+
if (/^[\p{L}\p{N}][\p{L}\p{N}\p{M}_ .:/()+-]{0,199}$/u.test(name) &&
|
|
498
|
+
!/^(?:auto|default|unknown)$/i.test(name))
|
|
499
|
+
return name
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
function bridgeEvents(stdout) {
|
|
503
|
+
return (stdout ?? "").split("\n").flatMap((line) => {
|
|
504
|
+
try {
|
|
505
|
+
const event = JSON.parse(line)
|
|
506
|
+
return event && typeof event === "object" ? [event] : []
|
|
507
|
+
} catch {
|
|
508
|
+
return []
|
|
509
|
+
}
|
|
510
|
+
})
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
async function executeCodex({ cwd, model, prompt, readOnly }, options, run) {
|
|
514
|
+
let threadId
|
|
515
|
+
let summary
|
|
516
|
+
let usage
|
|
517
|
+
let actualModel
|
|
518
|
+
let completed = false
|
|
519
|
+
let error
|
|
520
|
+
const result = await runHost("Codex", ["app-server"], {
|
|
521
|
+
...options,
|
|
522
|
+
initialize: {
|
|
523
|
+
id: 1,
|
|
524
|
+
method: "initialize",
|
|
525
|
+
params: { clientInfo: { name: "acent", version: "1.0" } },
|
|
526
|
+
},
|
|
527
|
+
onLine(event, send) {
|
|
528
|
+
if (!event || typeof event !== "object") return
|
|
529
|
+
if (event.method && event.id !== undefined) {
|
|
530
|
+
send({ id: event.id, error: { code: -32601, message: "Unsupported request" } })
|
|
531
|
+
return
|
|
532
|
+
}
|
|
533
|
+
if ([1, 2, 3].includes(event.id) && event.error) {
|
|
534
|
+
error = event.error.message || "Codex could not start the turn."
|
|
535
|
+
send(null)
|
|
536
|
+
return
|
|
537
|
+
}
|
|
538
|
+
if (event.id === 1) {
|
|
539
|
+
send({ method: "initialized" })
|
|
540
|
+
send({
|
|
541
|
+
id: 2,
|
|
542
|
+
method: "thread/start",
|
|
543
|
+
params: {
|
|
544
|
+
cwd,
|
|
545
|
+
model,
|
|
546
|
+
sandbox: readOnly ? "read-only" : "workspace-write",
|
|
547
|
+
approvalPolicy: "never",
|
|
548
|
+
},
|
|
549
|
+
})
|
|
550
|
+
return
|
|
551
|
+
}
|
|
552
|
+
if (event.id === 2) {
|
|
553
|
+
threadId = event.result?.thread?.id
|
|
554
|
+
if (!threadId) {
|
|
555
|
+
error = "Codex did not report a thread ID."
|
|
556
|
+
send(null)
|
|
557
|
+
return
|
|
558
|
+
}
|
|
559
|
+
actualModel = reportedModel(event.result.model)
|
|
560
|
+
send({
|
|
561
|
+
id: 3,
|
|
562
|
+
method: "turn/start",
|
|
563
|
+
params: { threadId, input: [{ type: "text", text: prompt, text_elements: [] }] },
|
|
564
|
+
})
|
|
565
|
+
return
|
|
566
|
+
}
|
|
567
|
+
if (!threadId || event.params?.threadId !== threadId) return
|
|
568
|
+
const { item, turn, toModel, tokenUsage } = event.params
|
|
569
|
+
if (event.method === "item/completed" && item?.type === "agentMessage")
|
|
570
|
+
summary = item.text
|
|
571
|
+
if (event.method === "thread/tokenUsage/updated")
|
|
572
|
+
usage = tokenUsage?.total
|
|
573
|
+
if (event.method === "model/rerouted")
|
|
574
|
+
actualModel = reportedModel(toModel) ?? actualModel
|
|
575
|
+
if (event.method === "turn/completed") {
|
|
576
|
+
completed = turn?.status === "completed"
|
|
577
|
+
if (!completed) error = turn?.error?.message || "Codex did not complete the turn."
|
|
578
|
+
send(null)
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
}, run)
|
|
582
|
+
return {
|
|
583
|
+
result,
|
|
584
|
+
summary,
|
|
585
|
+
usage,
|
|
586
|
+
actualModel: completed ? actualModel : undefined,
|
|
587
|
+
error: completed ? undefined : (error ?? "Codex did not report a completed turn."),
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
495
591
|
export async function executeBridgeTarget(
|
|
496
592
|
{ tool, model, readOnly, managedWorkspace, cwd, prompt, signal, onSpawn },
|
|
497
593
|
run = runProcess
|
|
498
594
|
) {
|
|
499
595
|
const args = {
|
|
500
|
-
Codex: [
|
|
501
|
-
"exec",
|
|
502
|
-
"--json",
|
|
503
|
-
"--sandbox",
|
|
504
|
-
readOnly ? "read-only" : "workspace-write",
|
|
505
|
-
...(model ? ["-m", model] : []),
|
|
506
|
-
"--",
|
|
507
|
-
"-",
|
|
508
|
-
],
|
|
509
596
|
"Claude Code": [
|
|
510
597
|
"-p",
|
|
511
598
|
"--output-format",
|
|
@@ -517,7 +604,7 @@ export async function executeBridgeTarget(
|
|
|
517
604
|
],
|
|
518
605
|
Cursor: [
|
|
519
606
|
"--output-format",
|
|
520
|
-
"json",
|
|
607
|
+
"stream-json",
|
|
521
608
|
...(managedWorkspace ? ["--trust"] : []),
|
|
522
609
|
...(readOnly ? ["--mode=ask"] : []),
|
|
523
610
|
...(model ? ["--model", model] : []),
|
|
@@ -534,50 +621,38 @@ export async function executeBridgeTarget(
|
|
|
534
621
|
prompt,
|
|
535
622
|
],
|
|
536
623
|
}[tool]
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
)
|
|
624
|
+
const options = {
|
|
625
|
+
cwd,
|
|
626
|
+
signal,
|
|
627
|
+
onSpawn,
|
|
628
|
+
processGroup: true,
|
|
629
|
+
env: { ...bridgeGitEnvironment(), ACENT_BRIDGE_WORKER: "1" },
|
|
630
|
+
input: tool === "Claude Code" ? prompt : undefined,
|
|
631
|
+
timeout: 10 * 60 * 1000,
|
|
632
|
+
maxBytes: 8 * 1024 * 1024,
|
|
633
|
+
}
|
|
634
|
+
const codex = tool === "Codex"
|
|
635
|
+
? await executeCodex({ cwd, model, prompt, readOnly }, options, run)
|
|
636
|
+
: undefined
|
|
637
|
+
const result = codex?.result ?? await runHost(tool, args, options, run)
|
|
552
638
|
let summary
|
|
553
639
|
let error
|
|
554
640
|
let usage
|
|
555
641
|
let actualModel
|
|
556
642
|
let rateLimitResetAt
|
|
557
|
-
if (
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
return []
|
|
563
|
-
}
|
|
564
|
-
})
|
|
565
|
-
if (tool === "Codex") {
|
|
566
|
-
const turn = events.findLast((event) => event.type === "turn.completed")
|
|
567
|
-
summary = events.findLast((event) => event.item?.type === "agent_message")
|
|
568
|
-
?.item.text
|
|
569
|
-
error = events.findLast((event) => event.type === "turn.failed")?.error
|
|
570
|
-
?.message
|
|
571
|
-
if (!turn && !error) error = "Codex did not report a completed turn."
|
|
572
|
-
usage = turn?.usage
|
|
573
|
-
} else {
|
|
643
|
+
if (codex) {
|
|
644
|
+
({ summary, error, usage, actualModel } = codex)
|
|
645
|
+
} else {
|
|
646
|
+
const events = bridgeEvents(result.stdout)
|
|
647
|
+
if (tool === "Claude Code") {
|
|
574
648
|
const terminal = events.findLast((event) => event.type === "result")
|
|
575
649
|
summary = terminal?.result
|
|
576
650
|
usage = terminal?.usage
|
|
577
|
-
actualModel = events.findLast(
|
|
578
|
-
(event) =>
|
|
579
|
-
event.
|
|
580
|
-
|
|
651
|
+
actualModel = reportedModel(events.findLast(
|
|
652
|
+
(event) => event.type === "assistant" &&
|
|
653
|
+
!event.parent_tool_use_id && !event.is_api_error_message &&
|
|
654
|
+
reportedModel(event.message?.model)
|
|
655
|
+
)?.message.model)
|
|
581
656
|
const limit = events.findLast(
|
|
582
657
|
(event) =>
|
|
583
658
|
event.type === "rate_limit_event" &&
|
|
@@ -597,35 +672,27 @@ export async function executeBridgeTarget(
|
|
|
597
672
|
summary ||
|
|
598
673
|
"Claude Code did not report a completed turn."
|
|
599
674
|
}
|
|
600
|
-
}
|
|
601
|
-
} else {
|
|
602
|
-
try {
|
|
675
|
+
} else {
|
|
603
676
|
const event =
|
|
604
677
|
tool === "Antigravity"
|
|
605
|
-
? result
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
} catch {
|
|
611
|
-
return []
|
|
612
|
-
}
|
|
613
|
-
})
|
|
614
|
-
.findLast((item) => item.event === "result")
|
|
615
|
-
: JSON.parse(result.stdout)
|
|
616
|
-
if (!event) throw new Error("Missing final CLI result")
|
|
678
|
+
? events.findLast((item) => item.event === "result")
|
|
679
|
+
: events.findLast((item) => item.type === "result")
|
|
680
|
+
const initModel = tool === "Antigravity"
|
|
681
|
+
? events.find((item) => item.event === "init")?.init?.model
|
|
682
|
+
: events.find((item) => item.type === "system" && item.subtype === "init")?.model
|
|
617
683
|
const payload =
|
|
618
|
-
typeof event
|
|
684
|
+
typeof event?.result === "object" && event.result ? event.result : event
|
|
619
685
|
summary =
|
|
620
|
-
payload
|
|
621
|
-
(typeof payload
|
|
622
|
-
usage = payload
|
|
623
|
-
|
|
624
|
-
|
|
686
|
+
payload?.response ??
|
|
687
|
+
(typeof payload?.result === "string" ? payload.result : undefined)
|
|
688
|
+
usage = payload?.usage
|
|
689
|
+
actualModel =
|
|
690
|
+
reportedModel(payload?.model) ?? reportedModel(event?.model) ?? reportedModel(initModel)
|
|
625
691
|
if (
|
|
626
|
-
event
|
|
627
|
-
payload
|
|
628
|
-
|
|
692
|
+
event?.is_error ||
|
|
693
|
+
payload?.is_error ||
|
|
694
|
+
(payload?.status && !/^success$/i.test(payload.status)) ||
|
|
695
|
+
(event?.subtype && event.subtype !== "success")
|
|
629
696
|
) {
|
|
630
697
|
error =
|
|
631
698
|
payload.error ||
|
|
@@ -633,8 +700,6 @@ export async function executeBridgeTarget(
|
|
|
633
700
|
payload.status ||
|
|
634
701
|
"Agent returned an error."
|
|
635
702
|
}
|
|
636
|
-
} catch {
|
|
637
|
-
// A non-JSON response cannot verify that a delegated turn completed.
|
|
638
703
|
}
|
|
639
704
|
}
|
|
640
705
|
const diagnostics = [
|
|
@@ -700,7 +765,7 @@ export async function executeBridgeTarget(
|
|
|
700
765
|
!error && typeof summary === "string"
|
|
701
766
|
? summary.slice(0, 16000)
|
|
702
767
|
: undefined,
|
|
703
|
-
actualModel,
|
|
768
|
+
actualModel: failure ? undefined : actualModel,
|
|
704
769
|
rateLimitResetAt,
|
|
705
770
|
...(Object.keys(tokens).length ? { tokens } : {}),
|
|
706
771
|
}
|
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,17 +292,19 @@ 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
|
-
"
|
|
295
|
-
"
|
|
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.",
|
|
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.",
|
|
296
308
|
"End the Bridge report with a final conclusion stating whether the patch was applied or is awaiting application, which material findings or checks remain, and the recommended next action when needed. For read-only work, conclude with the result and any remaining uncertainty.",
|
|
297
309
|
].join(" ")
|
|
298
310
|
|
|
@@ -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",
|
|
@@ -792,6 +916,7 @@ export function createBridge({
|
|
|
792
916
|
attempt,
|
|
793
917
|
startedAt: lease.startedAt,
|
|
794
918
|
finishedAt: undefined,
|
|
919
|
+
actualModel: undefined,
|
|
795
920
|
lastRunTokens: undefined,
|
|
796
921
|
lastRunErrorCode: undefined,
|
|
797
922
|
remainingQuota: undefined,
|
|
@@ -1027,7 +1152,7 @@ export function createBridge({
|
|
|
1027
1152
|
|
|
1028
1153
|
async function integrate(folder, projectDir, coordination, ids, apply, captureEvidence) {
|
|
1029
1154
|
if (!safeIds(ids) || (apply !== undefined && typeof apply !== "boolean"))
|
|
1030
|
-
throw new Error("Select one to
|
|
1155
|
+
throw new Error("Select one to eight completed Bridge task IDs.")
|
|
1031
1156
|
return withWorkspaceLock(coordination, async () => {
|
|
1032
1157
|
const receiptPath = join(
|
|
1033
1158
|
projectDir,
|
|
@@ -1113,7 +1238,7 @@ export function createBridge({
|
|
|
1113
1238
|
ids,
|
|
1114
1239
|
paths,
|
|
1115
1240
|
nextAction:
|
|
1116
|
-
"
|
|
1241
|
+
"Start independent reviews of the integrated changes and run integration checks while those reviews are running.",
|
|
1117
1242
|
}
|
|
1118
1243
|
}
|
|
1119
1244
|
if (
|
|
@@ -1193,6 +1318,7 @@ export function createBridge({
|
|
|
1193
1318
|
createHash("sha256").update(folder).digest("hex")
|
|
1194
1319
|
)
|
|
1195
1320
|
await collect(join(root, "bridge"), projectDir)
|
|
1321
|
+
watchQueue(folder, projectDir, coordination, loadSettings, settings.projectKey)
|
|
1196
1322
|
if (name === "acent_bridge_settings") {
|
|
1197
1323
|
if (Object.keys(args).length)
|
|
1198
1324
|
throw new Error("Change Bridge settings from the project in Acent.")
|
|
@@ -1258,15 +1384,19 @@ export function createBridge({
|
|
|
1258
1384
|
job.requestSignature = createHash("sha256")
|
|
1259
1385
|
.update(JSON.stringify(job))
|
|
1260
1386
|
.digest("hex")
|
|
1261
|
-
|
|
1387
|
+
const result = await start(
|
|
1262
1388
|
job,
|
|
1263
1389
|
folder,
|
|
1264
1390
|
projectDir,
|
|
1265
1391
|
coordination,
|
|
1266
1392
|
true,
|
|
1267
1393
|
snapshot && (await snapshot()),
|
|
1268
|
-
settings.captureEvidence
|
|
1394
|
+
settings.captureEvidence,
|
|
1395
|
+
"submit"
|
|
1269
1396
|
)
|
|
1397
|
+
if (result.status === "queued")
|
|
1398
|
+
watchQueue(folder, projectDir, coordination, loadSettings, settings.projectKey, true)
|
|
1399
|
+
return result
|
|
1270
1400
|
},
|
|
1271
1401
|
readRepairPatch: (id) =>
|
|
1272
1402
|
readFile(join(projectDir, id, "changes.patch"), "utf8"),
|
|
@@ -1276,14 +1406,7 @@ export function createBridge({
|
|
|
1276
1406
|
leases(coordination).then((entries) =>
|
|
1277
1407
|
entries.some(({ preparing }) => preparing)
|
|
1278
1408
|
),
|
|
1279
|
-
cancelJob:
|
|
1280
|
-
const jobDir = join(projectDir, id)
|
|
1281
|
-
const job = await readJson(join(jobDir, "job.json"), null)
|
|
1282
|
-
if (job && taskState(job) === "running")
|
|
1283
|
-
await writeJson(join(jobDir, "cancel.json"), {
|
|
1284
|
-
attempt: job.attempt,
|
|
1285
|
-
})
|
|
1286
|
-
},
|
|
1409
|
+
cancelJob: (id) => cancelJob(projectDir, coordination, id),
|
|
1287
1410
|
})
|
|
1288
1411
|
if (name === "acent_bridge_integrate")
|
|
1289
1412
|
return integrate(folder, projectDir, coordination, args.ids, args.apply, settings.captureEvidence)
|
|
@@ -1299,20 +1422,15 @@ export function createBridge({
|
|
|
1299
1422
|
return result
|
|
1300
1423
|
}
|
|
1301
1424
|
if (name === "acent_bridge_activity") {
|
|
1302
|
-
const
|
|
1303
|
-
if (error.code === "ENOENT") return []
|
|
1304
|
-
throw error
|
|
1305
|
-
})
|
|
1306
|
-
const records = await Promise.all(
|
|
1307
|
-
entries
|
|
1308
|
-
.filter((id) => taskId.test(id))
|
|
1309
|
-
.map((id) => readJson(join(projectDir, id, "job.json"), null))
|
|
1310
|
-
)
|
|
1425
|
+
const records = await projectJobs(projectDir)
|
|
1311
1426
|
return {
|
|
1427
|
+
baseLimit: baseParallel,
|
|
1312
1428
|
limit: maxParallel,
|
|
1313
1429
|
tasks: records
|
|
1314
1430
|
.filter(Boolean)
|
|
1315
|
-
.sort((left, right) =>
|
|
1431
|
+
.sort((left, right) =>
|
|
1432
|
+
(right.startedAt ?? right.queuedAt ?? 0) - (left.startedAt ?? left.queuedAt ?? 0)
|
|
1433
|
+
)
|
|
1316
1434
|
.slice(0, 24)
|
|
1317
1435
|
.map((job) => ({
|
|
1318
1436
|
id: job.id,
|
|
@@ -1320,6 +1438,7 @@ export function createBridge({
|
|
|
1320
1438
|
task: job.task.slice(0, 200),
|
|
1321
1439
|
tool: job.tool,
|
|
1322
1440
|
model: job.model,
|
|
1441
|
+
actualModel: job.actualModel,
|
|
1323
1442
|
status: taskState(job),
|
|
1324
1443
|
phase: job.phase,
|
|
1325
1444
|
paths: job.paths,
|
|
@@ -1338,6 +1457,15 @@ export function createBridge({
|
|
|
1338
1457
|
"Provide a task and acceptance criteria, up to 12,000 characters each."
|
|
1339
1458
|
)
|
|
1340
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
|
+
}
|
|
1341
1469
|
const paths = args.paths ?? []
|
|
1342
1470
|
const readPaths = args.readPaths ?? []
|
|
1343
1471
|
const dependsOn = args.dependsOn ?? []
|
|
@@ -1356,7 +1484,7 @@ export function createBridge({
|
|
|
1356
1484
|
!Array.isArray(dependsOn) ||
|
|
1357
1485
|
(dependsOn.length > 0 && !safeIds(dependsOn))
|
|
1358
1486
|
)
|
|
1359
|
-
throw new Error("Use up to
|
|
1487
|
+
throw new Error("Use up to eight distinct dependency task IDs.")
|
|
1360
1488
|
if (
|
|
1361
1489
|
args.requestId !== undefined &&
|
|
1362
1490
|
(typeof args.requestId !== "string" || !taskId.test(args.requestId))
|
|
@@ -1416,7 +1544,13 @@ export function createBridge({
|
|
|
1416
1544
|
: available
|
|
1417
1545
|
if (!reviewOnly(job.kind) && !paths.length)
|
|
1418
1546
|
return { status: "write_scope_required" }
|
|
1419
|
-
|
|
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
|
|
1420
1554
|
}
|
|
1421
1555
|
|
|
1422
1556
|
if (typeof args.id !== "string" || !taskId.test(args.id))
|
|
@@ -1426,12 +1560,9 @@ export function createBridge({
|
|
|
1426
1560
|
const job = await readJson(record, null)
|
|
1427
1561
|
if (!job) throw new Error("Bridge task not found for this project.")
|
|
1428
1562
|
job.status = taskState(job)
|
|
1429
|
-
if (name === "acent_bridge_cancel")
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
return { id: job.id, status: "cancelling" }
|
|
1433
|
-
}
|
|
1434
|
-
if (job.status === "running")
|
|
1563
|
+
if (name === "acent_bridge_cancel")
|
|
1564
|
+
return cancelJob(projectDir, coordination, job.id)
|
|
1565
|
+
if (["queued", "running"].includes(job.status))
|
|
1435
1566
|
return {
|
|
1436
1567
|
id: job.id,
|
|
1437
1568
|
status: job.status,
|
package/acent/scripts/hook.mjs
CHANGED
|
@@ -23,6 +23,17 @@ try {
|
|
|
23
23
|
const session = payload.session_id || payload.conversation_id || payload.conversationId
|
|
24
24
|
if (typeof session !== "string" || !session.trim())
|
|
25
25
|
throw new Error("Hook is missing a conversation identifier")
|
|
26
|
+
// The host delivers this context to the turn that made the Bridge call.
|
|
27
|
+
if (process.argv.includes("Codex") &&
|
|
28
|
+
payload.hook_event_name === "PostToolUse" &&
|
|
29
|
+
/^mcp__acent__acent_bridge_[a-z_]+$/.test(payload.tool_name ?? "") &&
|
|
30
|
+
typeof payload.model === "string" && /^[\w][\w.:/-]{0,159}$/.test(payload.model) &&
|
|
31
|
+
!/^(?:auto|default|unknown)$/i.test(payload.model)) {
|
|
32
|
+
process.stdout.write(JSON.stringify({ hookSpecificOutput: {
|
|
33
|
+
hookEventName: "PostToolUse",
|
|
34
|
+
additionalContext: `Codex reports ${payload.model} as the coordinating model for this turn. Use it for this turn's direct-work row in the Acent Bridge report.`,
|
|
35
|
+
} }) + "\n")
|
|
36
|
+
}
|
|
26
37
|
await main(["collect", ...process.argv.slice(2),
|
|
27
38
|
...(folder ? ["--folder", folder] : ["--general"])], text)
|
|
28
39
|
|
|
@@ -7,25 +7,37 @@ 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.
|
|
26
28
|
|
|
29
|
+
## Review when only the coordinator can access a source
|
|
30
|
+
|
|
31
|
+
- When a database, provider dashboard, deployment log, or connector is available only to the coordinator, keep its checks with the coordinator and delegate the parts that can be independently reviewed using source code, migrations, local tests, or sanitized evidence. Follow the project's automatic setting and candidate selection rules.
|
|
32
|
+
- In `acent_bridge_start.context`, provide the minimum evidence the delegate needs, such as the environment, when the check ran, the condition checked, and the observed result or relevant counts. Omit credentials, personal data, raw logs, and customer or payment identifiers. If the delegate requests more evidence, answer its context question with `acent_bridge_continue`.
|
|
33
|
+
- In `task` and `acceptance`, identify what the delegate should check independently and what evidence came from the coordinator. Ask the delegate to test the reported conclusion against the code and to identify what could invalidate it. The delegate should report direct observations, conclusions based on supplied evidence, and checks that remain unverified.
|
|
34
|
+
|
|
35
|
+
For a payment review, the coordinator can report that a sandbox purchase produced one monthly credit grant after replay. The delegate can independently review whether the migration and worker preserve that result when the same payment arrives through overlapping retry paths.
|
|
36
|
+
|
|
27
37
|
## Report Bridge results
|
|
28
38
|
|
|
29
|
-
1.
|
|
30
|
-
2.
|
|
39
|
+
1. 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 `**Acent Bridge** · <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.
|
|
40
|
+
2. Use one row per distinct task, review, or check. Keep relevant earlier rounds and replacement reviewers visible. Use `reviewResult` and `reviewResults` to distinguish findings, no findings in the reviewed scope, unclassified output, failed or blocked reviews, and reviews that did not run. Mark `checksNotRun` as not run and report other unavailable tools with their observed reasons. Preserve findings reported by a single reviewer. Say whether each material finding was reproduced, fixed and rechecked, or still needs verification. 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.
|
|
31
41
|
3. End with a final conclusion stating whether the patch was applied or is awaiting application, which material findings or checks remain, and the recommended next action when one is needed. For read-only work, conclude with the result and any remaining uncertainty.
|
|
42
|
+
|
|
43
|
+
When the coordinator and delegate verify different parts of a result, name the observer for each material piece of evidence and identify any check that remains unverified.
|
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.1.
|
|
5
|
+
"version": "1.1.5",
|
|
6
6
|
"description": "Recall past work, trace code changes, revisit decisions, and resume tasks with Acent.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Cirtium"
|