Skip to content

@pgege/kaboo-runtime


Class: InMemoryGrantStore

Defined in: src/stores/memory-grants.ts:29

Process-memory GrantStore: remembered approvals last until the process restarts. Suited to local development and tests; use PostgresGrantStore (or your own store) when decisions must survive.

Example

import { createKabooRunner, InMemoryGrantStore, InMemoryThreadStore } from "@pgege/kaboo-runtime";

const runner = createKabooRunner(new InMemoryThreadStore(), {
  accessPolicy: { ownerOf: (threadId) => threadId.split(":")[0] ?? null },
  approvals: { grants: new InMemoryGrantStore() },
});

Implements

Constructors

Constructor

new InMemoryGrantStore(): InMemoryGrantStore

Returns

InMemoryGrantStore

Methods

list()

list(query): Promise\<ToolGrant[]>

Defined in: src/stores/memory-grants.ts:32

The grants a run may use: the owner's "always" grants and the thread's own.

Parameters

query

GrantQuery

Returns

Promise\<ToolGrant[]>

Implementation of

GrantStore.list


listForOwner()

listForOwner(ownerId): Promise\<ToolGrant[]>

Defined in: src/stores/memory-grants.ts:54

Every grant the owner holds, for a settings page.

Parameters

ownerId

string

Returns

Promise\<ToolGrant[]>

Implementation of

GrantStore.listForOwner


revoke()

revoke(ownerId, id): Promise\<void>

Defined in: src/stores/memory-grants.ts:50

Revoke one of the owner's grants. A grant owned by someone else is left alone.

Parameters

ownerId

string

id

string

Returns

Promise\<void>

Implementation of

GrantStore.revoke


save()

save(grant): Promise\<ToolGrant>

Defined in: src/stores/memory-grants.ts:41

Save a grant, replacing an identical one (same owner, agent, thread, tool, subject).

Parameters

grant

NewToolGrant

Returns

Promise\<ToolGrant>

Implementation of

GrantStore.save