feat(coding-agent/tools): added examples to coding-agent tools

- Added `examples` support to `StringEnum` schemas and propagated it to tool metadata.
- Added concise descriptions and example values across coding-agent tool schemas for clearer guidance.
- Documented the new StringEnum examples capability in `packages/ai/CHANGELOG.md`.
- Cast `real` to `HASHLINE_BIGRAMS` elements in `staleBigramFor` test setup.
This commit is contained in:
can1357
2026-04-26 01:03:21 +02:00
parent 778054c742
commit e89b3cf7e8
33 changed files with 294 additions and 257 deletions
+8 -9
View File
@@ -42,20 +42,19 @@ async function saveBashOriginalArtifact(session: ToolSession, originalText: stri
}
const bashSchemaBase = Type.Object({
command: Type.String({ description: "Command to execute" }),
command: Type.String({ description: "command to execute", examples: ["ls -la", "echo hi"] }),
env: Type.Optional(
Type.Record(Type.String({ pattern: BASH_ENV_NAME_PATTERN.source }), Type.String(), {
description:
"Additional environment variables passed to the command and rendered inline as shell assignments; prefer this for multiline or quote-heavy content",
description: "extra env vars",
}),
),
timeout: Type.Optional(Type.Number({ description: "Timeout in seconds", default: 300 })),
cwd: Type.Optional(Type.String({ description: "Working directory (default: cwd)" })),
head: Type.Optional(Type.Number({ description: "Return only first N lines of output" })),
tail: Type.Optional(Type.Number({ description: "Return only last N lines of output" })),
timeout: Type.Optional(Type.Number({ description: "timeout in seconds", default: 300 })),
cwd: Type.Optional(Type.String({ description: "working directory", examples: ["src/", "/tmp"] })),
head: Type.Optional(Type.Number({ description: "first n lines of output" })),
tail: Type.Optional(Type.Number({ description: "last n lines of output" })),
pty: Type.Optional(
Type.Boolean({
description: "Run in PTY mode when command needs a real terminal (e.g. sudo/ssh/top/less); default: false",
description: "run in pty mode",
}),
),
});
@@ -64,7 +63,7 @@ const bashSchemaWithAsync = Type.Object({
...bashSchemaBase.properties,
async: Type.Optional(
Type.Boolean({
description: "Run in background; returns immediately with a job ID. Result delivered as follow-up.",
description: "run in background",
}),
),
});