Skip to content

Commit e507249

Browse files
anandgupta42claude
andcommitted
refactor: consume answer-commit-conjunction through its namespace projection
Add the `AnswerCommitConjunction` self-reexport and import it in `answer-commit.ts` and the unit test, per the module-shape rule in `packages/opencode/AGENTS.md`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 215b068 commit e507249

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎packages/opencode/src/altimate/tools/answer-commit-conjunction.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,5 @@ export function conjunctionRejection(
131131
const fields = `${names.length} field${names.length === 1 ? "" : "s"}`
132132
return `${CONJUNCTION_REJECTION_MARKER} the request appears to ask for ${count} items, but this commit has ${fields} (${JSON.stringify(names)}). The request also asks for ${joins.map((join) => `"${join}"`).join(", ")}. Call answer_commit again with each requested item as its own field, named after it. If the request asks for fewer items, recommit unchanged; the next commit is accepted.`
133133
}
134+
135+
export * as AnswerCommitConjunction from "./answer-commit-conjunction"

‎packages/opencode/src/altimate/tools/answer-commit.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Effect, Option, Schema, SchemaIssue } from "effect"
44
import type { JSONSchema7 } from "@ai-sdk/provider"
55
import { Tool } from "../../tool/tool"
66
// altimate_change start — one-time conjunction review
7-
import { conjunctionRejection } from "./answer-commit-conjunction"
7+
import { AnswerCommitConjunction } from "./answer-commit-conjunction"
88
// altimate_change end
99

1010
/** Maximum rendered answer length, including Markdown and basis, before the model echoes it. */
@@ -308,7 +308,7 @@ export const AnswerCommitTool = Tool.define(
308308
yield* ctx.ask({ permission: "answer_commit", patterns: ["*"], always: ["*"], metadata: {} })
309309
const output = renderAnswer(args)
310310
// altimate_change start — one-time conjunction review of under-asked commits
311-
const rejection = conjunctionRejection(args, ctx.messages ?? [], ctx.sessionID)
311+
const rejection = AnswerCommitConjunction.conjunctionRejection(args, ctx.messages ?? [], ctx.sessionID)
312312
if (rejection) {
313313
const rejected: Tool.ExecuteResult = {
314314
title: "Answer not committed",

‎packages/opencode/test/altimate/tools/answer-commit-conjunction.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { describe, expect, test } from "bun:test"
22
import { RunBudget } from "../../../src/altimate/run-budget"
33
import { begin, downgradeEffort } from "../../../src/altimate/session/run-budget-effort"
44
import { AnswerCommitTool, renderAnswer } from "../../../src/altimate/tools/answer-commit"
5-
import { CONJUNCTION_REJECTION_MARKER, requestedItems } from "../../../src/altimate/tools/answer-commit-conjunction"
5+
import { AnswerCommitConjunction } from "../../../src/altimate/tools/answer-commit-conjunction"
6+
const { CONJUNCTION_REJECTION_MARKER, requestedItems } = AnswerCommitConjunction
67
import type { Tool } from "../../../src/tool/tool"
78
import { initTool } from "../tool-fixture"
89

0 commit comments

Comments
 (0)