@really-knows-ai/foundry 3.8.0 → 3.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,8 +51,16 @@ function verifyStageToken(token, secret, stage, cycle, agent) {
51
51
  }
52
52
 
53
53
  function checkTokenAgentBinding(payload, agent) {
54
- if (!payload.model || !agent || payload.model === agent) return { payload };
55
- return { error: `foundry_stage_begin: token is scoped to subagent '${payload.model}', not '${agent}'. Dispatch forge via task(), not inline.` };
54
+ // Token has no model scope allow (legacy or test tokens)
55
+ if (!payload.model) return { payload };
56
+ // Unknown agent — allow (test environments, edge cases)
57
+ if (!agent) return { payload };
58
+ // Main Foundry agent cannot use subagent-scoped tokens
59
+ if (agent === 'foundry') {
60
+ return { error: `foundry_stage_begin: token is scoped to subagent '${payload.model}'. Dispatch forge via task(), not inline.` };
61
+ }
62
+ // Subagent — allow (model-specific or default foundry-forge/foundry-appraise)
63
+ return { payload };
56
64
  }
57
65
 
58
66
  async function executeStageBegin(args, context, pending) {
package/dist/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.8.1] - 2026-05-27
4
+
5
+ ### Fixed
6
+
7
+ - Token agent binding now only blocks the main Foundry agent (`context.agent === "foundry"`) from using subagent-scoped tokens. Subagents always pass regardless of exact agent identifier format. The previous exact-match check caused legitimate forge subagents to fail with a "bad signature" error because OpenCode's internal agent identifier format differs from the token's `model` field.
8
+
3
9
  ## [3.8.0] - 2026-05-27
4
10
 
5
11
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@really-knows-ai/foundry",
3
- "version": "3.8.0",
3
+ "version": "3.8.1",
4
4
  "description": "A skill-driven framework for governed artefact generation with AI coding tools. Define your own artefact types, laws, and flows — Foundry handles the forge → quench → appraise pipeline with deterministic routing, quality gates, and iterative refinement.",
5
5
  "type": "module",
6
6
  "main": "dist/.opencode/plugins/foundry.js",