@cirtium/acent-connect 1.1.3 → 1.1.4
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-runners.mjs +139 -74
- package/acent/scripts/bridge.mjs +4 -2
- package/acent/scripts/hook.mjs +11 -0
- package/acent/skills/acent-bridge/SKILL.md +12 -2
- package/antigravity/plugin.json +1 -1
- package/package.json +1 -1
|
@@ -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
|
@@ -291,8 +291,8 @@ export const bridgeInstructions = [
|
|
|
291
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. Use acent_bridge_integrate to check and apply completed diffs.",
|
|
292
292
|
"For substantive authorized edits with a defined write scope, use acent_bridge_refine to run independent review, repair and re-review. Select eligible models and set apply=true only within the user's authorized editing scope. Continue unrelated work while it runs.",
|
|
293
293
|
"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
|
-
"
|
|
294
|
+
"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
|
+
"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
296
|
"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
297
|
].join(" ")
|
|
298
298
|
|
|
@@ -792,6 +792,7 @@ export function createBridge({
|
|
|
792
792
|
attempt,
|
|
793
793
|
startedAt: lease.startedAt,
|
|
794
794
|
finishedAt: undefined,
|
|
795
|
+
actualModel: undefined,
|
|
795
796
|
lastRunTokens: undefined,
|
|
796
797
|
lastRunErrorCode: undefined,
|
|
797
798
|
remainingQuota: undefined,
|
|
@@ -1320,6 +1321,7 @@ export function createBridge({
|
|
|
1320
1321
|
task: job.task.slice(0, 200),
|
|
1321
1322
|
tool: job.tool,
|
|
1322
1323
|
model: job.model,
|
|
1324
|
+
actualModel: job.actualModel,
|
|
1323
1325
|
status: taskState(job),
|
|
1324
1326
|
phase: job.phase,
|
|
1325
1327
|
paths: job.paths,
|
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
|
|
|
@@ -24,8 +24,18 @@ Use the Acent Bridge MCP tools in a session with one local project folder open.
|
|
|
24
24
|
- 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
25
|
- 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
26
|
|
|
27
|
+
## Review when only the coordinator can access a source
|
|
28
|
+
|
|
29
|
+
- 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.
|
|
30
|
+
- 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`.
|
|
31
|
+
- 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.
|
|
32
|
+
|
|
33
|
+
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.
|
|
34
|
+
|
|
27
35
|
## Report Bridge results
|
|
28
36
|
|
|
29
|
-
1.
|
|
30
|
-
2.
|
|
37
|
+
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.
|
|
38
|
+
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
39
|
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.
|
|
40
|
+
|
|
41
|
+
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.4",
|
|
6
6
|
"description": "Recall past work, trace code changes, revisit decisions, and resume tasks with Acent.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Cirtium"
|