[Bug] Compiler drops unary-plus numeric defaults

オープン
#116 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

@BichengWang がすでに取り組んでいます。

2026年11月29日 から。

  • #117 @BichengWang による — オープン

評価

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

調査の方向性

Start by locating extractNumberValue() and tracing how it handles numeric literal signs during compilation; the issue says unary minus works while unary plus is omitted. Reproduce with the YAML snippet through @agentscript/parser, Dialect().parse(), and compile(), then check the three defaults in output.agent_version.state_variables. Done means unary-plus values are preserved in object properties, list elements, and configuration parameter extraction; linked PR #117 is already open.

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

説明

Description

The compiler silently omits numeric defaults with an explicit unary +. In nested objects it drops the property; in lists it drops the element and changes the remaining positions.

Steps to Reproduce

  1. Check out salesforce/agentscript main at c3f8249a99ec908a6b61d1125945691447267e90 and build the workspace dependencies.
  2. Parse the snippet below with @agentscript/parser, then pass the mapping to new Dialect().parse(mapping, AgentforceSchema) and compile the resulting value with compile().
  3. Inspect output.agent_version.state_variables.

Expected Behavior

The defaults are 1, {"positive": 1, "negative": -2}, and [1, -2, 0] respectively. A unary plus on a numeric literal should preserve its value.

Actual Behavior

count has no default, payload.default is {"negative": -2}, and values.default is [-2]. Parser/schema diagnostics, the default Agentforce lint rules, and compiler diagnostics are all empty for this example.

Environment

  • Node.js: 22.20.0
  • pnpm: 10.34.6
  • OS: macOS, arm64
  • Compiler: workspace version 3.38.4 at the commit above

Minimal Reproduction

config:
    developer_name: "SignedDefaults"
variables:
    count: mutable number = +1
    payload: mutable object = {"positive": +1, "negative": -2}
    values: mutable list[number] = [+1, -2, +0]
start_agent main:
    description: "Entry point"
    reasoning:
        instructions: ->
            | Values: {[email protected]}, {[email protected]}, {[email protected]}

Additional Context

extractNumberValue() handles unary minus but not unary plus. The parser and type inference recognize both numeric signs. This also affects numeric extraction in configuration parameters; it is separate from the empty-object and None defects in #101 and #103.

主要言語
TypeScript
スター
279
フォーク
55
平均マージ
1日 12時間
マージ済み PR(30日)
7

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

salesforce/agentscript のほかの issue

salesforce/agentscript の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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