Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

@effect/ai-anthropic: text_editor_20250728 insert decodes `new_str`, but the API sends `insert_text`

オープン 初心者向け
#10,106 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
75/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
ai

調査の方向性

packages/ai/anthropic/src/AnthropicTool.ts の TextEditorInsertCommand 付近を読み、同じファイル内の古い挿入スキーマと比較してください。提供された Schema.decodeUnknownExit の再現例を使って不一致を確認してください。API 形式の挿入呼び出しが正常にデコードされ、ツールハンドラーが受け取れる状態になれば完了です。

索引モデルが issue の本文から書いたものです。

説明

What happens

TextEditorInsertCommand in packages/ai/anthropic/src/AnthropicTool.ts (line 1881 on main), which TextEditor_20250728's parameters use, declares the inserted text as new_str:

export const TextEditorInsertCommand = Schema.Struct({
  command: Schema.Literal("insert"),
  path: Schema.String,
  insert_line: Schema.Int,
  /**
   * The text to insert.
   */
  new_str: Schema.String
})

The Messages API sends an insert call as path, insert_line and insert_text. So every insert the model makes fails to decode as the tool's parameters, and the handler never runs. The model gets a parameter error back instead. The older insert schema in the same file (line 1553) already uses insert_text.

Repro

With @effect/[email protected] and [email protected]:

import { Schema } from "effect"
import { TextEditorInsertCommand } from "@effect/ai-anthropic/AnthropicTool"

// The arguments the Messages API sends for an insert with text_editor_20250728
const call = { command: "insert", path: "a.md", insert_line: 0, insert_text: "x" }
console.log(String(Schema.decodeUnknownExit(TextEditorInsertCommand)(call)))
// Failure(Cause([Fail(SchemaError(Missing key
//   at ["new_str"]))]))

We hit it in a real run with Claude Opus: each insert came back to the model as a validation error until we patched the field.

Fix

Rename the field to insert_text in src/AnthropicTool.ts. We've run that patch (the src, dist .js and .d.ts) against the live API, and inserts apply.

Versions: 4.0.0 through 4.1.0, and main.

主要言語
TypeScript
スター
16.7k
フォーク
808
平均マージ
11時間 11分
マージ済み PR(30日)
840

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Effect-TS/effect のほかの issue

Effect-TS/effect の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。