MCPcopy Create free account
hub / github.com/HKUDS/AgentSpace / parseExternalInputActor

Function parseExternalInputActor

packages/daemon/src/task-context.ts:301–323  ·  view source on GitHub ↗
(input: unknown)

Source from the content-addressed store, hash-verified

299}
300
301function parseExternalInputActor(input: unknown): ParsedExternalInputActor | undefined {
302 if (!input || typeof input !== "object") {
303 return undefined;
304 }
305 const value = input as Record<string, unknown>;
306 if (value.actorType !== "user" && value.actorType !== "external_guest") {
307 return undefined;
308 }
309 return {
310 actorType: value.actorType,
311 ...(typeof value.userId === "string" ? { userId: value.userId } : {}),
312 ...(typeof value.externalActorReference === "string" ? { externalActorReference: value.externalActorReference } : {}),
313 ...(typeof value.externalGuestPermissionProfile === "string" ? { externalGuestPermissionProfile: value.externalGuestPermissionProfile } : {}),
314 ...(Array.isArray(value.externalGuestRequireIdentityFor)
315 ? {
316 externalGuestRequireIdentityFor: value.externalGuestRequireIdentityFor
317 .filter((item): item is string => typeof item === "string" && item.trim().length > 0),
318 }
319 : {}),
320 ...(typeof value.agentId === "string" ? { agentId: value.agentId } : {}),
321 ...(typeof value.botBindingId === "string" ? { botBindingId: value.botBindingId } : {}),
322 };
323}
324
325function parseWorkspaceDataPolicyDecision(input: unknown): WorkspaceDataPolicyDecision | undefined {
326 if (!input || typeof input !== "object") {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected