Skip to main content

Interface: AmnesiaProviderApi

Defined in: provider-api.ts:62

Multi-scope orchestration object exposed via React Context. Application code should prefer the React hooks (useAmnesia, useAmnesiaFocusClaim, useAmnesiaScopes) instead of consuming this directly.

Properties

claim

claim: (scopeId) => void

Defined in: provider-api.ts:87

Mark scopeId as the active claimant. Lazily creates the scope. Pass the default scope id to clear an existing claim.

Parameters

ParameterType
scopeIdstring

Returns

void


clear

clear: (scopeId?) => void

Defined in: provider-api.ts:101

Synchronously clear past + future. With no argument, every registered scope is cleared. With a scopeId, only that scope is cleared (lazily creating it if it does not yet exist, so a subsequent getScope call sees a consistent empty store).

Parameters

ParameterType
scopeId?string

Returns

void


getActiveScopeId

getActiveScopeId: () => string

Defined in: provider-api.ts:75

Currently active scope id. When no claim is held, returns the default scope id.

Returns

string


getScope

getScope: (scopeId) => Amnesia

Defined in: provider-api.ts:64

Look up a scope by id, lazily creating it on first request.

Parameters

ParameterType
scopeIdstring

Returns

Amnesia


getScopeIds

getScopeIds: () => readonly string[]

Defined in: provider-api.ts:69

Snapshot of the currently registered scope ids in insertion order.

Returns

readonly string[]


release

release: (scopeId) => void

Defined in: provider-api.ts:93

If scopeId is the active claimant, drop the claim and fall back to default. No-op otherwise.

Parameters

ParameterType
scopeIdstring

Returns

void


subscribeActive

subscribeActive: (listener) => () => void

Defined in: provider-api.ts:78

Subscribe to active-scope changes.

Parameters

ParameterType
listener() => void

Returns

() => void


subscribeScopeIds

subscribeScopeIds: (listener) => () => void

Defined in: provider-api.ts:81

Subscribe to scope-id set changes (scope creation only in v0).

Parameters

ParameterType
listener() => void

Returns

() => void