mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-13 07:12:00 +01:00
Add eleven sparse incoming and outgoing restrictions, human CLI/API administration, shared mutation enforcement, and pending-delivery checks. Preserve existing defaults, agent settings, and existing authorization boundaries. Co-Authored-By: Paperclip <noreply@paperclip.ing>
18 lines
574 B
TypeScript
18 lines
574 B
TypeScript
import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
|
export interface PluginInteractionOrigin {
|
|
companyId: string;
|
|
agentId: string;
|
|
runId?: string | null;
|
|
}
|
|
|
|
const origins = new AsyncLocalStorage<Readonly<PluginInteractionOrigin> | undefined>();
|
|
|
|
export function withPluginInteractionOrigin<T>(origin: PluginInteractionOrigin | undefined, fn: () => T): T {
|
|
return origins.run(origin ? Object.freeze({ ...origin }) : undefined, fn);
|
|
}
|
|
|
|
export function currentPluginInteractionOrigin(): Readonly<PluginInteractionOrigin> | undefined {
|
|
return origins.getStore();
|
|
}
|