Skip to content

Commit 2abacae

Browse files
committed
fix: address config and skill review feedback
1 parent 4dca502 commit 2abacae

16 files changed

Lines changed: 255 additions & 74 deletions

.github/setup-workspace.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ echo "Replacing path dependencies with crates.io versions..."
99

1010
# core/Cargo.toml — internal crate deps
1111
sed -i.bak \
12+
-e 's|a3s-common = { version = "0.1.1", path = "../../common" }|a3s-common = "0.1.1"|' \
1213
-e 's|a3s-common = { version = "0.1", path = "../../common" }|a3s-common = "0.1.1"|' \
1314
-e 's|a3s-memory = { version = "0.1.1", path = "../../memory" }|a3s-memory = "0.1.1"|' \
1415
-e 's|a3s-lane = { version = "0.4", path = "../../lane" }|a3s-lane = "0.4"|' \

Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ default_model = "anthropic/claude-sonnet-4-20250514"
7878
7979
providers "anthropic" {
8080
apiKey = env("ANTHROPIC_API_KEY")
81+
82+
models "claude-sonnet-4-20250514" {
83+
limit = {
84+
context = 200000
85+
output = 8192
86+
}
87+
}
8188
}
8289
```
8390

@@ -1267,6 +1274,13 @@ default_model = "anthropic/claude-sonnet-4-20250514"
12671274
12681275
providers "anthropic" {
12691276
apiKey = env("ANTHROPIC_API_KEY")
1277+
1278+
models "claude-sonnet-4-20250514" {
1279+
limit = {
1280+
context = 200000
1281+
output = 8192
1282+
}
1283+
}
12701284
}
12711285
12721286
skill_dirs = ["./skills"]
@@ -1279,6 +1293,10 @@ ahp = {
12791293
}
12801294
```
12811295

1296+
Model token limits use the `limit = { context = ..., output = ... }` object as the canonical ACL shape.
1297+
The flat `maxTokens` and `contextTokens` fields are accepted only as deprecated
1298+
migration aliases and emit warnings.
1299+
12821300
---
12831301

12841302
## Development

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ path = "src/lib.rs"
1313

1414
[dependencies]
1515
# Internal crates
16-
a3s-common = { version = "0.1.1" }
16+
a3s-common = { version = "0.1.1", path = "../../common" }
1717
a3s-memory = { version = "0.1.1", path = "../../memory" }
1818
a3s-lane = { version = "0.4", path = "../../lane" }
1919
a3s-search = { version = "1.2.3", path = "../../search", default-features = false, features = ["lightpanda"] }

core/skills/code-review.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
name: code-review
33
description: Review code for best practices, bugs, and improvements
4+
allowed-tools: "grep(*), glob(*), read(*)"
45
kind: instruction
56
tags:
67
- review

core/skills/code-search.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
name: code-search
33
description: Search codebase for patterns, functions, or types
4+
allowed-tools: "grep(*), glob(*), read(*)"
45
kind: instruction
56
tags:
67
- search

core/skills/explain-code.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
name: explain-code
33
description: Explain how code works in clear, simple terms
4+
allowed-tools: "grep(*), glob(*), read(*)"
45
kind: instruction
56
tags:
67
- explain

core/skills/find-bugs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
name: find-bugs
33
description: Identify potential bugs, vulnerabilities, and code smells
4+
allowed-tools: "grep(*), glob(*), read(*)"
45
kind: instruction
56
tags:
67
- bugs

core/src/agent.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -627,15 +627,13 @@ impl SessionCommand for ToolCommand {
627627
async fn execute(&self) -> Result<Value> {
628628
// Check skill-based tool permissions
629629
if let Some(registry) = &self.skill_registry {
630-
let instruction_skills = registry.by_kind(crate::skills::SkillKind::Instruction);
631-
632630
// If there are instruction skills with tool restrictions, check permissions
633-
let has_restrictions = instruction_skills.iter().any(|s| s.allowed_tools.is_some());
631+
let restricting_skills = registry.global_tool_restricting_skills();
634632

635-
if has_restrictions {
633+
if !restricting_skills.is_empty() {
636634
let mut allowed = false;
637635

638-
for skill in &instruction_skills {
636+
for skill in &restricting_skills {
639637
if skill.is_tool_allowed(&self.tool_name) {
640638
allowed = true;
641639
break;

core/src/config/loader.rs

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,22 @@ fn acl_usize_attr(block: &a3s_acl::Block, keys: &[&str]) -> Option<usize> {
5252
}
5353
}
5454

55-
fn acl_u32_attr(block: &a3s_acl::Block, keys: &[&str]) -> Option<u32> {
56-
acl_usize_attr(block, keys).map(|value| value.min(u32::MAX as usize) as u32)
55+
fn acl_u32(value: &a3s_acl::Value) -> Option<u32> {
56+
match value {
57+
a3s_acl::Value::Number(value) if *value >= 0.0 => {
58+
Some((*value as usize).min(u32::MAX as usize) as u32)
59+
}
60+
_ => None,
61+
}
62+
}
63+
64+
fn acl_object_u32_attr(value: &a3s_acl::Value, key: &str) -> Option<u32> {
65+
match value {
66+
a3s_acl::Value::Object(pairs) => pairs
67+
.iter()
68+
.find_map(|(candidate, value)| (candidate == key).then(|| acl_u32(value)).flatten()),
69+
_ => None,
70+
}
5771
}
5872

5973
fn acl_path_list_attr(block: &a3s_acl::Block, keys: &[&str]) -> Option<Vec<PathBuf>> {
@@ -280,52 +294,38 @@ impl CodeConfig {
280294
model.release_date = Some(release_date);
281295
}
282296
}
283-
"maxTokens" | "max_tokens" | "outputTokens"
284-
| "output_tokens" => {
285-
if let Some(output) = acl_u32_attr(
286-
model_block,
287-
&[
288-
"maxTokens",
289-
"max_tokens",
290-
"outputTokens",
291-
"output_tokens",
292-
],
293-
) {
297+
"maxTokens" => {
298+
tracing::warn!(
299+
provider = %provider.name,
300+
model = %model.id,
301+
field = "maxTokens",
302+
"Flat ACL model token limit fields are deprecated; use limit = {{ output = ..., context = ... }}"
303+
);
304+
if let Some(output) = acl_u32(value) {
294305
model.limit.output = output;
295306
}
296307
}
297-
"contextTokens" | "context_tokens" | "maxContextTokens"
298-
| "max_context_tokens" => {
299-
if let Some(context) = acl_u32_attr(
300-
model_block,
301-
&[
302-
"contextTokens",
303-
"context_tokens",
304-
"maxContextTokens",
305-
"max_context_tokens",
306-
],
307-
) {
308+
"contextTokens" => {
309+
tracing::warn!(
310+
provider = %provider.name,
311+
model = %model.id,
312+
field = "contextTokens",
313+
"Flat ACL model token limit fields are deprecated; use limit = {{ output = ..., context = ... }}"
314+
);
315+
if let Some(context) = acl_u32(value) {
308316
model.limit.context = context;
309317
}
310318
}
311-
_ => {}
312-
}
313-
}
314-
315-
for limit_block in &model_block.blocks {
316-
if limit_block.name == "limit" {
317-
if let Some(output) = acl_u32_attr(
318-
limit_block,
319-
&["output", "max_tokens", "output_tokens"],
320-
) {
321-
model.limit.output = output;
322-
}
323-
if let Some(context) = acl_u32_attr(
324-
limit_block,
325-
&["context", "context_tokens", "max_context_tokens"],
326-
) {
327-
model.limit.context = context;
319+
"limit" => {
320+
if let Some(output) = acl_object_u32_attr(value, "output") {
321+
model.limit.output = output;
322+
}
323+
if let Some(context) = acl_object_u32_attr(value, "context")
324+
{
325+
model.limit.context = context;
326+
}
328327
}
328+
_ => {}
329329
}
330330
}
331331

0 commit comments

Comments
 (0)