mirror of
https://github.com/theniceboy/.config.git
synced 2026-04-16 08:45:55 +08:00
agent tracker update
This commit is contained in:
parent
0bfcb8d7c3
commit
ba2c8ef54e
2 changed files with 26 additions and 10 deletions
|
|
@ -5,6 +5,21 @@ type TurnState = {
|
|||
}
|
||||
|
||||
const states = new Map<string, TurnState>()
|
||||
const exploratoryTools = new Set([
|
||||
"bash",
|
||||
"read",
|
||||
"glob",
|
||||
"grep",
|
||||
"task",
|
||||
"question",
|
||||
"webfetch",
|
||||
"web_google_search",
|
||||
"web_website_fetch",
|
||||
"web_website_search",
|
||||
"web_website_outline",
|
||||
"web_website_extract_section",
|
||||
"web_website_extract_pricing",
|
||||
])
|
||||
|
||||
function sessionState(sessionID: string) {
|
||||
let state = states.get(sessionID)
|
||||
|
|
@ -24,6 +39,10 @@ function eventSessionID(event: any) {
|
|||
).trim()
|
||||
}
|
||||
|
||||
function isExploratoryTool(tool: string) {
|
||||
return exploratoryTools.has(tool)
|
||||
}
|
||||
|
||||
export const RequireWorkSummaryPlugin: Plugin = async () => {
|
||||
return {
|
||||
"chat.message": async (input: any) => {
|
||||
|
|
@ -34,14 +53,6 @@ export const RequireWorkSummaryPlugin: Plugin = async () => {
|
|||
sessionState(sessionID).summaryCalled = false
|
||||
},
|
||||
|
||||
"command.execute.before": async (input: any) => {
|
||||
const sessionID = String(input?.sessionID || "").trim()
|
||||
if (!sessionID) {
|
||||
return
|
||||
}
|
||||
sessionState(sessionID).summaryCalled = false
|
||||
},
|
||||
|
||||
"tool.execute.before": async (input: any) => {
|
||||
const sessionID = String(input?.sessionID || "").trim()
|
||||
if (!sessionID) {
|
||||
|
|
@ -58,9 +69,13 @@ export const RequireWorkSummaryPlugin: Plugin = async () => {
|
|||
return
|
||||
}
|
||||
|
||||
if (isExploratoryTool(tool)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!state.summaryCalled) {
|
||||
throw new Error(
|
||||
"Call set_work_summary first with a specific theme and next-step now label before using other tools.",
|
||||
"Exploration tools can run first, but call set_work_summary before edits or other committed actions.",
|
||||
)
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue