mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 18:30:39 +09:00
Scaffold agent permissions, approval comments, and hiring governance types
Add pending_approval agent status, permissions jsonb column, and AgentPermissions type with canCreateAgents flag. Add approval_comments table and ApprovalComment type. Extend approval statuses with revision_requested. Add validators for permission updates, approval revision requests, resubmission, and approval comments. Add requireBoardApprovalForNewAgents to company update schema. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9f250acf43
commit
e0a878f4eb
13 changed files with 131 additions and 2 deletions
|
|
@ -5,6 +5,10 @@ import {
|
|||
AGENT_STATUSES,
|
||||
} from "../constants.js";
|
||||
|
||||
export const agentPermissionsSchema = z.object({
|
||||
canCreateAgents: z.boolean().optional().default(false),
|
||||
});
|
||||
|
||||
export const createAgentSchema = z.object({
|
||||
name: z.string().min(1),
|
||||
role: z.enum(AGENT_ROLES).optional().default("general"),
|
||||
|
|
@ -15,6 +19,7 @@ export const createAgentSchema = z.object({
|
|||
adapterConfig: z.record(z.unknown()).optional().default({}),
|
||||
runtimeConfig: z.record(z.unknown()).optional().default({}),
|
||||
budgetMonthlyCents: z.number().int().nonnegative().optional().default(0),
|
||||
permissions: agentPermissionsSchema.optional(),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
});
|
||||
|
||||
|
|
@ -44,3 +49,9 @@ export const wakeAgentSchema = z.object({
|
|||
});
|
||||
|
||||
export type WakeAgent = z.infer<typeof wakeAgentSchema>;
|
||||
|
||||
export const updateAgentPermissionsSchema = z.object({
|
||||
canCreateAgents: z.boolean(),
|
||||
});
|
||||
|
||||
export type UpdateAgentPermissions = z.infer<typeof updateAgentPermissionsSchema>;
|
||||
|
|
|
|||
|
|
@ -15,3 +15,22 @@ export const resolveApprovalSchema = z.object({
|
|||
});
|
||||
|
||||
export type ResolveApproval = z.infer<typeof resolveApprovalSchema>;
|
||||
|
||||
export const requestApprovalRevisionSchema = z.object({
|
||||
decisionNote: z.string().optional().nullable(),
|
||||
decidedByUserId: z.string().optional().default("board"),
|
||||
});
|
||||
|
||||
export type RequestApprovalRevision = z.infer<typeof requestApprovalRevisionSchema>;
|
||||
|
||||
export const resubmitApprovalSchema = z.object({
|
||||
payload: z.record(z.unknown()).optional(),
|
||||
});
|
||||
|
||||
export type ResubmitApproval = z.infer<typeof resubmitApprovalSchema>;
|
||||
|
||||
export const addApprovalCommentSchema = z.object({
|
||||
body: z.string().min(1),
|
||||
});
|
||||
|
||||
export type AddApprovalComment = z.infer<typeof addApprovalCommentSchema>;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ export const updateCompanySchema = createCompanySchema
|
|||
.extend({
|
||||
status: z.enum(COMPANY_STATUSES).optional(),
|
||||
spentMonthlyCents: z.number().int().nonnegative().optional(),
|
||||
requireBoardApprovalForNewAgents: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export type UpdateCompany = z.infer<typeof updateCompanySchema>;
|
||||
|
|
|
|||
|
|
@ -10,10 +10,13 @@ export {
|
|||
updateAgentSchema,
|
||||
createAgentKeySchema,
|
||||
wakeAgentSchema,
|
||||
agentPermissionsSchema,
|
||||
updateAgentPermissionsSchema,
|
||||
type CreateAgent,
|
||||
type UpdateAgent,
|
||||
type CreateAgentKey,
|
||||
type WakeAgent,
|
||||
type UpdateAgentPermissions,
|
||||
} from "./agent.js";
|
||||
|
||||
export {
|
||||
|
|
@ -44,8 +47,14 @@ export {
|
|||
export {
|
||||
createApprovalSchema,
|
||||
resolveApprovalSchema,
|
||||
requestApprovalRevisionSchema,
|
||||
resubmitApprovalSchema,
|
||||
addApprovalCommentSchema,
|
||||
type CreateApproval,
|
||||
type ResolveApproval,
|
||||
type RequestApprovalRevision,
|
||||
type ResubmitApproval,
|
||||
type AddApprovalComment,
|
||||
} from "./approval.js";
|
||||
|
||||
export {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue