mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 05:11:36 +00:00
refactor(auto-reply): share cleared exec fields
This commit is contained in:
@@ -1,5 +1,22 @@
|
|||||||
import type { InlineDirectives } from "./directive-handling.js";
|
import type { InlineDirectives } from "./directive-handling.js";
|
||||||
|
|
||||||
|
const CLEARED_EXEC_FIELDS = {
|
||||||
|
hasExecDirective: false,
|
||||||
|
execHost: undefined,
|
||||||
|
execSecurity: undefined,
|
||||||
|
execAsk: undefined,
|
||||||
|
execNode: undefined,
|
||||||
|
rawExecHost: undefined,
|
||||||
|
rawExecSecurity: undefined,
|
||||||
|
rawExecAsk: undefined,
|
||||||
|
rawExecNode: undefined,
|
||||||
|
hasExecOptions: false,
|
||||||
|
invalidExecHost: false,
|
||||||
|
invalidExecSecurity: false,
|
||||||
|
invalidExecAsk: false,
|
||||||
|
invalidExecNode: false,
|
||||||
|
} satisfies Partial<InlineDirectives>;
|
||||||
|
|
||||||
export function clearInlineDirectives(cleaned: string): InlineDirectives {
|
export function clearInlineDirectives(cleaned: string): InlineDirectives {
|
||||||
return {
|
return {
|
||||||
cleaned,
|
cleaned,
|
||||||
@@ -15,20 +32,7 @@ export function clearInlineDirectives(cleaned: string): InlineDirectives {
|
|||||||
hasElevatedDirective: false,
|
hasElevatedDirective: false,
|
||||||
elevatedLevel: undefined,
|
elevatedLevel: undefined,
|
||||||
rawElevatedLevel: undefined,
|
rawElevatedLevel: undefined,
|
||||||
hasExecDirective: false,
|
...CLEARED_EXEC_FIELDS,
|
||||||
execHost: undefined,
|
|
||||||
execSecurity: undefined,
|
|
||||||
execAsk: undefined,
|
|
||||||
execNode: undefined,
|
|
||||||
rawExecHost: undefined,
|
|
||||||
rawExecSecurity: undefined,
|
|
||||||
rawExecAsk: undefined,
|
|
||||||
rawExecNode: undefined,
|
|
||||||
hasExecOptions: false,
|
|
||||||
invalidExecHost: false,
|
|
||||||
invalidExecSecurity: false,
|
|
||||||
invalidExecAsk: false,
|
|
||||||
invalidExecNode: false,
|
|
||||||
hasStatusDirective: false,
|
hasStatusDirective: false,
|
||||||
hasModelDirective: false,
|
hasModelDirective: false,
|
||||||
rawModelDirective: undefined,
|
rawModelDirective: undefined,
|
||||||
@@ -49,19 +53,6 @@ export function clearInlineDirectives(cleaned: string): InlineDirectives {
|
|||||||
export function clearExecInlineDirectives(directives: InlineDirectives): InlineDirectives {
|
export function clearExecInlineDirectives(directives: InlineDirectives): InlineDirectives {
|
||||||
return {
|
return {
|
||||||
...directives,
|
...directives,
|
||||||
hasExecDirective: false,
|
...CLEARED_EXEC_FIELDS,
|
||||||
execHost: undefined,
|
|
||||||
execSecurity: undefined,
|
|
||||||
execAsk: undefined,
|
|
||||||
execNode: undefined,
|
|
||||||
rawExecHost: undefined,
|
|
||||||
rawExecSecurity: undefined,
|
|
||||||
rawExecAsk: undefined,
|
|
||||||
rawExecNode: undefined,
|
|
||||||
hasExecOptions: false,
|
|
||||||
invalidExecHost: false,
|
|
||||||
invalidExecSecurity: false,
|
|
||||||
invalidExecAsk: false,
|
|
||||||
invalidExecNode: false,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user