mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 09:37:41 +00:00
feat: add exec approvals editor in control ui and mac app
This commit is contained in:
72
src/gateway/protocol/schema/exec-approvals.ts
Normal file
72
src/gateway/protocol/schema/exec-approvals.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
export const ExecApprovalsAllowlistEntrySchema = Type.Object(
|
||||
{
|
||||
pattern: Type.String(),
|
||||
lastUsedAt: Type.Optional(Type.Integer({ minimum: 0 })),
|
||||
lastUsedCommand: Type.Optional(Type.String()),
|
||||
lastResolvedPath: Type.Optional(Type.String()),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const ExecApprovalsDefaultsSchema = Type.Object(
|
||||
{
|
||||
security: Type.Optional(Type.String()),
|
||||
ask: Type.Optional(Type.String()),
|
||||
askFallback: Type.Optional(Type.String()),
|
||||
autoAllowSkills: Type.Optional(Type.Boolean()),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const ExecApprovalsAgentSchema = Type.Object(
|
||||
{
|
||||
security: Type.Optional(Type.String()),
|
||||
ask: Type.Optional(Type.String()),
|
||||
askFallback: Type.Optional(Type.String()),
|
||||
autoAllowSkills: Type.Optional(Type.Boolean()),
|
||||
allowlist: Type.Optional(Type.Array(ExecApprovalsAllowlistEntrySchema)),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const ExecApprovalsFileSchema = Type.Object(
|
||||
{
|
||||
version: Type.Literal(1),
|
||||
socket: Type.Optional(
|
||||
Type.Object(
|
||||
{
|
||||
path: Type.Optional(Type.String()),
|
||||
token: Type.Optional(Type.String()),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
),
|
||||
),
|
||||
defaults: Type.Optional(ExecApprovalsDefaultsSchema),
|
||||
agents: Type.Optional(Type.Record(Type.String(), ExecApprovalsAgentSchema)),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const ExecApprovalsSnapshotSchema = Type.Object(
|
||||
{
|
||||
path: NonEmptyString,
|
||||
exists: Type.Boolean(),
|
||||
hash: NonEmptyString,
|
||||
file: ExecApprovalsFileSchema,
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const ExecApprovalsGetParamsSchema = Type.Object({}, { additionalProperties: false });
|
||||
|
||||
export const ExecApprovalsSetParamsSchema = Type.Object(
|
||||
{
|
||||
file: ExecApprovalsFileSchema,
|
||||
baseHash: Type.Optional(NonEmptyString),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
Reference in New Issue
Block a user