Skip to content

Commit c4cba6e

Browse files
Kamehameyaclaude
authored andcommitted
additional bug fixes identified
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9d26361 commit c4cba6e

151 files changed

Lines changed: 18182 additions & 10460 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@agentscript/ui",
33
"private": true,
44
"version": "2.0.0",
5+
"license": "Apache-2.0",
56
"type": "module",
67
"scripts": {
78
"dev": "vite",

dialect/agentfabric/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@agentscript/agentfabric-dialect",
3-
"version": "0.1.10",
3+
"version": "0.1.13",
44
"description": "AgentFabric dialect — schema, lint rules, compiler, and dialect config",
55
"type": "module",
66
"main": "dist/index.js",

dialect/agentfabric/src/lint/passes/index.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,34 @@ import {
1717
unreachableCodePass,
1818
emptyBlockPass,
1919
expressionValidationPass,
20+
spreadContextPass,
2021
} from '@agentscript/language';
2122
import { agentFabricSemanticPass } from './agentfabric-semantic.js';
2223
import { suppressActionsNamespaceUndefinedReferencePass } from './suppress-tools-namespace-undefined-reference.js';
24+
import type { ExpressionValidationOptions } from '@agentscript/language/lint';
25+
import { AgentFabricSchemaInfo } from '../../schema.js';
26+
27+
const expressionOptions: ExpressionValidationOptions = {
28+
functions: new Set([
29+
'len',
30+
'max',
31+
'min',
32+
'uuid',
33+
'now',
34+
'strip',
35+
'startswith',
36+
'endswith',
37+
'abs',
38+
'round',
39+
'sum',
40+
'parse_json',
41+
'capitalize',
42+
'join',
43+
'split',
44+
'splitlines',
45+
]),
46+
namespacedFunctions: AgentFabricSchemaInfo.namespacedFunctions,
47+
};
2348

2449
/** All AgentFabric lint passes in engine execution order. */
2550
export function defaultRules(): LintPass[] {
@@ -33,7 +58,8 @@ export function defaultRules(): LintPass[] {
3358
positionIndexPass(),
3459
unreachableCodePass(),
3560
emptyBlockPass(),
36-
expressionValidationPass(),
61+
expressionValidationPass(expressionOptions),
62+
spreadContextPass(),
3763
agentFabricSemanticPass(),
3864
// Validation
3965
undefinedReferencePass(),

dialect/agentfabric/src/schema.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,17 @@ export const AgentFabricSchemaInfo: SchemaInfo = {
501501
globalScopes: {
502502
request: new Set(['payload', 'interface', 'headers']),
503503
},
504+
namespacedFunctions: {
505+
a2a: new Set([
506+
'task',
507+
'message',
508+
'textPart',
509+
'parts',
510+
'dataPart',
511+
'filePart',
512+
'artifact',
513+
]),
514+
},
504515
};
505516

506517
export const agentFabricSchemaContext: SchemaContext = createSchemaContext(

dialect/agentfabric/src/tests/lint.test.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,42 @@ echo done:
437437
).toBe(false);
438438
});
439439

440+
it('does not accept A2A global calls with @', () => {
441+
const source = `
442+
echo successResponse:
443+
kind: "a2a:response"
444+
task: @a2a.task({ state: "completed", message: @a2a.message()})
445+
`;
446+
const result = parseAndLintSource(source);
447+
expect(
448+
result.diagnostics.filter(
449+
d =>
450+
d.code === 'namespace-function-call' &&
451+
d.message.includes('Only direct namespace function calls are allowed')
452+
).length
453+
).toBe(2);
454+
});
455+
456+
it('allows namespaced A2A helper calls in expression fields (a2a.message, a2a.textPart, …)', () => {
457+
const source = `
458+
echo out:
459+
kind: "a2a:response"
460+
message: a2a.message(a2a.textPart("hello"))
461+
`;
462+
const result = parseAndLintSource(source);
463+
expect(result.diagnostics.length).toBe(0);
464+
});
465+
466+
it('allows namespaced A2A helper calls when assigning value to variable', () => {
467+
const source = `
468+
executor step:
469+
do: ->
470+
set @variables.t = a2a.task({ state: "completed" })
471+
`;
472+
const result = parseAndLintSource(source);
473+
expect(result.diagnostics.length).toBe(0);
474+
});
475+
440476
it('accepts generator prompt in procedure form', () => {
441477
const source = `
442478
config:

dialect/agentfabric/src/tests/resources/agentfabric-customer-support-network.yaml

Lines changed: 15 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ unifiedAgentSpec:
7272
data-type: string
7373
description: ""
7474
default: ""
75-
- name: output_response
76-
label: output_response
77-
data-type: string
78-
description: ""
79-
default: ""
8075
initial-node: set_context
8176
nodes:
8277
- name: general_response
@@ -86,6 +81,7 @@ unifiedAgentSpec:
8681
llm:
8782
ref: openai_gpt4
8883
configuration:
84+
max_output_tokens: "1024"
8985
model: gpt-4o
9086
on-init: null
9187
system-prompt: >-
@@ -168,14 +164,15 @@ unifiedAgentSpec:
168164
enabled: true
169165
after-reasoning:
170166
- type: handoff
171-
target: set_output_response_from_general_agent
167+
target: send_response
172168
- name: technical_handler
173169
label: null
174170
description: Handles technical support issues using knowledge-base tools.
175171
type: agent
176172
llm:
177173
ref: openai_gpt4
178174
configuration:
175+
max_output_tokens: "1024"
179176
model: gpt-4o
180177
on-init: null
181178
system-prompt: >-
@@ -200,15 +197,15 @@ unifiedAgentSpec:
200197
enabled: true
201198
after-reasoning:
202199
- type: handoff
203-
target: set_output_response_from_technical_agent
200+
target: send_response
204201
- name: analyze_request
205202
label: null
206203
description: null
207204
type: agent
208205
llm:
209-
ref: openai_gpt4
206+
ref: gemini_2_5_flash
210207
configuration:
211-
model: gpt-4o
208+
model: gemini-2.5-flash
212209
output-structure-ref: os_analyze_request
213210
on-init: null
214211
system-prompt: >-
@@ -231,7 +228,7 @@ unifiedAgentSpec:
231228
- type: action
232229
ref: IdentityAction
233230
state-updates:
234-
- requestTimestamp: '"2026-03-06T10:23:24.371729+00:00"'
231+
- requestTimestamp: 'now()'
235232
- customerMessage: state.request.payload.message
236233
on-init:
237234
- ref: IdentityAction
@@ -255,48 +252,6 @@ unifiedAgentSpec:
255252
state-updates:
256253
- outputs: add(state.outputs, "billing_handler", result["result"])
257254
on-init: null
258-
on-exit:
259-
- type: handoff
260-
target: set_output_response_from_billing_agent
261-
add-tool-result-to-chat-history: false
262-
output-template: null
263-
- name: set_output_response_from_billing_agent
264-
type: action
265-
label: null
266-
tools:
267-
- type: action
268-
ref: IdentityAction
269-
state-updates:
270-
- output_response: state.outputs['billing_handler']
271-
on-init: null
272-
on-exit:
273-
- type: handoff
274-
target: send_response
275-
add-tool-result-to-chat-history: false
276-
output-template: null
277-
- name: set_output_response_from_technical_agent
278-
type: action
279-
label: null
280-
tools:
281-
- type: action
282-
ref: IdentityAction
283-
state-updates:
284-
- output_response: system.node_outputs['technical_handler']
285-
on-init: null
286-
on-exit:
287-
- type: handoff
288-
target: send_response
289-
add-tool-result-to-chat-history: false
290-
output-template: null
291-
- name: set_output_response_from_general_agent
292-
type: action
293-
label: null
294-
tools:
295-
- type: action
296-
ref: IdentityAction
297-
state-updates:
298-
- output_response: system.node_outputs['general_response']
299-
on-init: null
300255
on-exit:
301256
- type: handoff
302257
target: send_response
@@ -311,7 +266,6 @@ unifiedAgentSpec:
311266
state-updates:
312267
- customerMessage: '""'
313268
- requestTimestamp: '""'
314-
- output_response: '""'
315269
on-init: null
316270
on-exit: null
317271
add-tool-result-to-chat-history: false
@@ -324,12 +278,10 @@ unifiedAgentSpec:
324278
on-exit:
325279
- type: handoff
326280
target: billing_handler
327-
enabled: template::{{system.node_outputs['analyze_request'].category ==
328-
"billing"}}
281+
enabled: "system.node_outputs['analyze_request'].category == \"billing\""
329282
- type: handoff
330283
target: technical_handler
331-
enabled: template::{{system.node_outputs['analyze_request'].category ==
332-
"technical"}}
284+
enabled: "system.node_outputs['analyze_request'].category == \"technical\""
333285
- type: handoff
334286
target: general_response
335287
add-tool-result-to-chat-history: false
@@ -340,7 +292,7 @@ unifiedAgentSpec:
340292
tools:
341293
- ref: IdentityAction
342294
state-updates:
343-
- __send_response_value: template::{"state":"completed","message":{"kind":"text","role":"agent","parts":[{"kind":"text","text":"{{state.output_response}}"}]}}
295+
- __send_response_value: "a2a_task(state=\"completed\", message=a2a_message(parts=[a2a_textPart(state._node_input)]))"
344296
- outputs: add(state.outputs, "send_response", state.__send_response_value)
345297
on-init: null
346298
on-exit:
@@ -354,6 +306,11 @@ llmProviders:
354306
metadata:
355307
platform: openai
356308
connection: openai_connection
309+
- name: gemini_2_5_flash
310+
description: "LLM provider: gemini_2_5_flash"
311+
metadata:
312+
platform: gemini
313+
connection: gemini_connection
357314
invokableClients:
358315
- name: search_articles-client
359316
type: mcp_tool

dialect/agentfabric/src/tests/resources/agentfabric-customer-support-netwrok.agent

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@ config:
77
agent_name: "customer-support-flow"
88
label: "Customer Support Workflow"
99
description: "Handles customer support requests with intelligent routing."
10-
default_llm: @llm.openai_gpt4
10+
default_llm: @llm.gemini_2_5_flash
1111

1212
llm:
1313
openai_gpt4:
1414
target: "llm://openai_connection"
1515
kind: "openai"
1616
model: "gpt-4o"
17+
max_output_tokens: 1024
18+
gemini_2_5_flash:
19+
target: "llm://gemini_connection"
20+
kind: "gemini"
21+
model: "gemini-2.5-flash"
1722

1823
action_definitions:
1924
search_articles:
@@ -33,22 +38,22 @@ action_definitions:
3338
variables:
3439
requestTimestamp: mutable string = ""
3540
customerMessage: mutable string = ""
36-
output_response: mutable string = ""
3741

3842
trigger customerSupportTrigger:
43+
kind: "a2a"
3944
target: "brokers://customer-support-flow/a2a"
4045
on_message: ->
4146
transition to @executor.set_context
4247

4348
executor set_context:
4449
do: ->
45-
set @variables.requestTimestamp = "2026-03-06T10:23:24.371729+00:00"
50+
set @variables.requestTimestamp = now()
4651
set @variables.customerMessage = @request.payload.message
4752
on_exit: ->
4853
transition to @generator.analyze_request
4954

5055
generator analyze_request:
51-
llm: @llm.openai_gpt4
56+
llm: @llm.gemini_2_5_flash
5257
prompt: ->
5358
| Analyze the following customer support request and categorize it as one of: 'billing', 'technical', 'general'. Also extract key entities and sentiment.
5459
|
@@ -96,7 +101,7 @@ executor billing_handler:
96101
run @actions.billing_agent
97102
with message = @variables.customerMessage
98103
on_exit: ->
99-
transition to @executor.set_output_response_from_billing_agent
104+
transition to @echo.send_response
100105

101106
subagent technical_handler:
102107
description: "Handles technical support issues using knowledge-base tools."
@@ -112,7 +117,7 @@ subagent technical_handler:
112117
kb_search: @actions.search_articles
113118
kb_get_article: @actions.get_article
114119
on_exit: ->
115-
transition to @executor.set_output_response_from_technical_agent
120+
transition to @echo.send_response
116121

117122
orchestrator general_response:
118123
description: "Handles general customer support responses and routing."
@@ -128,35 +133,24 @@ orchestrator general_response:
128133
kb_search: @actions.search_articles
129134
kb_get_article: @actions.get_article
130135
billing_delegate: @actions.billing_agent
131-
on_exit: ->
132-
transition to @executor.set_output_response_from_general_agent
133-
134-
executor set_output_response_from_billing_agent:
135-
do: ->
136-
set @variables.output_response = @executor.billing_handler.output
137-
on_exit: ->
138-
transition to @echo.send_response
139-
140-
executor set_output_response_from_technical_agent:
141-
do: ->
142-
set @variables.output_response = @subagent.technical_handler.output
143-
on_exit: ->
144-
transition to @echo.send_response
145-
146-
executor set_output_response_from_general_agent:
147-
do: ->
148-
set @variables.output_response = @orchestrator.general_response.output
149136
on_exit: ->
150137
transition to @echo.send_response
151138

152139
echo send_response:
153140
kind: "a2a:response"
154-
message: "{!@variables.output_response}"
141+
task: a2a.task({
142+
state: "completed",
143+
message: a2a.message({
144+
parts: [
145+
a2a.textPart(@variables.output_response)
146+
]
147+
})
148+
}
149+
)
155150
on_exit: ->
156151
transition to @executor.cleanup
157152

158153
executor cleanup:
159154
do: ->
160155
set @variables.customerMessage = ""
161-
set @variables.requestTimestamp = ""
162-
set @variables.output_response = ""
156+
set @variables.requestTimestamp = ""

0 commit comments

Comments
 (0)