mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-27 02:44:50 +01:00
PAP-11957 scope Hermes task bridge credentials
This commit is contained in:
1 parent
f0e2bffe42
commit
73e5bd8f4e
22 files changed
+493
-78
No files matched your search
@@ -114,8 +114,45 @@ export const updateAgentInstructionsPathSchema = z.object({
|
||||
|
||||
export type UpdateAgentInstructionsPath = z.infer<typeof updateAgentInstructionsPathSchema>;
|
||||
|
||||
export const taskBridgeAgentKeyScopeSchema = z.object({
|
||||
kind: z.literal("task_bridge"),
|
||||
projectId: z.string().uuid().optional().nullable(),
|
||||
projectIds: z.array(z.string().uuid()).max(50).optional(),
|
||||
parentIssueId: z.string().uuid().optional().nullable(),
|
||||
parentIssueIds: z.array(z.string().uuid()).max(50).optional(),
|
||||
allowedAssigneeAgentIds: z.array(z.string().uuid()).max(50).optional(),
|
||||
}).strict().superRefine((value, ctx) => {
|
||||
const hasProjectBoundary = Boolean(value.projectId) || Boolean(value.projectIds?.length);
|
||||
const hasParentBoundary = Boolean(value.parentIssueId) || Boolean(value.parentIssueIds?.length);
|
||||
if (!hasProjectBoundary && !hasParentBoundary) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: "task_bridge keys require at least one project or parent issue boundary",
|
||||
path: ["projectId"],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export const standardAgentKeyScopeSchema = z.object({
|
||||
kind: z.literal("standard"),
|
||||
}).strict();
|
||||
|
||||
export const agentApiKeyScopeSchema = z.union([
|
||||
standardAgentKeyScopeSchema,
|
||||
taskBridgeAgentKeyScopeSchema,
|
||||
]);
|
||||
|
||||
export type AgentApiKeyScope = z.infer<typeof agentApiKeyScopeSchema>;
|
||||
export type TaskBridgeAgentKeyScope = z.infer<typeof taskBridgeAgentKeyScopeSchema>;
|
||||
|
||||
export function normalizeAgentApiKeyScope(value: unknown): AgentApiKeyScope {
|
||||
const parsed = agentApiKeyScopeSchema.safeParse(value);
|
||||
return parsed.success ? parsed.data : { kind: "standard" };
|
||||
}
|
||||
|
||||
export const createAgentKeySchema = z.object({
|
||||
name: z.string().min(1).default("default"),
|
||||
scope: agentApiKeyScopeSchema.optional().default({ kind: "standard" }),
|
||||
});
|
||||
|
||||
export type CreateAgentKey = z.infer<typeof createAgentKeySchema>;
|
||||
|
||||
@@ -207,6 +207,10 @@ export {
|
||||
updateAgentInstructionsBundleSchema,
|
||||
upsertAgentInstructionsFileSchema,
|
||||
updateAgentInstructionsPathSchema,
|
||||
agentApiKeyScopeSchema,
|
||||
normalizeAgentApiKeyScope,
|
||||
standardAgentKeyScopeSchema,
|
||||
taskBridgeAgentKeyScopeSchema,
|
||||
createAgentKeySchema,
|
||||
agentMineInboxQuerySchema,
|
||||
wakeAgentSchema,
|
||||
@@ -220,6 +224,8 @@ export {
|
||||
type UpdateAgentInstructionsBundle,
|
||||
type UpsertAgentInstructionsFile,
|
||||
type UpdateAgentInstructionsPath,
|
||||
type AgentApiKeyScope,
|
||||
type TaskBridgeAgentKeyScope,
|
||||
type CreateAgentKey,
|
||||
type AgentMineInboxQuery,
|
||||
type WakeAgent,
|
||||
|
||||
Reference in new issue
Block a user