Experimenting with https://expr-lang.org/. Just a draft implementation to start a feasibility discussion and mostly to check where and how might be useful in practice.
Name: At syntax
Description: Add the ability for users to use at (@) to direct message an agent
Type: context
Share Input Filter: At syntax filter
Name: At syntax filter
Description: Translates @name command into "Call tool name with command"
!sys.interp.expr
// INPUT - variant
let input = INPUT == nil || len(INPUT) == 0 ? "" : trim(INPUT);
!(input startsWith '@') || len(input) < 2 ? input :
let parts = split(input[1:], " ") | map(trim(#)) | filter(len(#) > 0);
len(parts) == 1
? "Call the tool \"" + parts[0] + "\" with defaultPromptParameter as empty"
: "Call the tool \"" + parts[0] + "\" with defaultPromptParameter as exactly \"" + join(parts[1:], " ") + "\""
- https://github.com/gptscript-ai/context/tree/main/available-agents
```go
Name: Available Agents
Description: List the agents that are available in the current context
Context: sys.context
Type: context
#!sys.interp.expr
// GPTSCRIPT_CONTEXT
let agents = GPTSCRIPT_CONTEXT.AgentGroup | filter(.ToolID != GPTSCRIPT_CONTEXT.CurrentAgent().ToolID) | map({"\t" + .Named + " " + GPTSCRIPT_CONTEXT.Program.ToolSet[.ToolID].Description});
len(agents) == 0 ? "" : "You have the following (" + string(len(agents)) + ") agent(s) available to you:\n" + join(agents, "\n")
I plan to check and try to convert more scripts and tools to get a better understanding, but please feel free to propose stuff that you would like me to check.
Experimenting with https://expr-lang.org/. Just a draft implementation to start a feasibility discussion and mostly to check where and how might be useful in practice.
Right now I just converted some stuff from https://github.com/gptscript-ai/context :
Note: For testing, I'm using only builtin stuff language-definition. Things can be improved by exposing additional custom data/functions/types.
Share Input Filter: At syntax filter
Name: At syntax filter Description: Translates @name command into "Call tool name with command"
!sys.interp.expr
// INPUT - variant let input = INPUT == nil || len(INPUT) == 0 ? "" : trim(INPUT); !(input startsWith '@') || len(input) < 2 ? input : let parts = split(input[1:], " ") | map(trim(#)) | filter(len(#) > 0); len(parts) == 1 ? "Call the tool \"" + parts[0] + "\" with defaultPromptParameter as empty" : "Call the tool \"" + parts[0] + "\" with defaultPromptParameter as exactly \"" + join(parts[1:], " ") + "\""
I plan to check and try to convert more scripts and tools to get a better understanding, but please feel free to propose stuff that you would like me to check.