Manages the lifecycle of Generalized Mind Instances (GMIs).

Constructors

Methods

  • The GMI of a session: the one the session has, or a new one built for it. A session that a seat of a team a GMI launched holds (createAgencySeat()) is refused with PERMISSION_DENIED until the seat is released.

    Parameters

    • userId: string
    • sessionId: string
    • requestedPersonaId: string
    • Optional conversationIdInput: string
    • Optional preferredModelId: string
    • Optional preferredProviderId: string
    • Optional userApiKeys: Record<string, string>
    • Optional agencyOptions: GMIAgencyContextOptions
    • Optional turnOrganizationId: string

      The resolved organization of the turn the GMI is acquired for ('' for none). With a learning layer a new GMI's learner session is bound under it; a caller that cannot resolve it before the GMI is acquired leaves it out, and the learner session is bound at the GMI's first prepared turn.

    Returns Promise<{
        gmi: IGMI;
        conversationContext: ConversationContext;
    }>

  • Builds and registers the GMI of one seat of a team a GMI launched (launch_agency on the full runtime): the registered persona a personaId seat names, checked as a session's persona is (strict validation, the user's tier), or the definition the launch made for a temporary seat. The GMI has no cognitive memory and no retrieval augmentor (its input is a manager's or a sibling's text), a prompt engine and a statistical utility that make no model call, the tool view and provider manager the launch gives it, and, with the runtime's learning layer, no learner (a workflow seat's source): it still renders its persona's traits, and with the layer off it sends no personality section. It is registered under the seat session id, so its own tool calls resolve it; release() shuts it down and takes it out of the manager, and a handle released after the manager shut down leaves alone whatever holds the session since. Until then the session is the seat's: getOrCreateGMIForSession() refuses it with PERMISSION_DENIED, whatever persona the request names (a request whose GMI was being built when the seat took the session included, that GMI shut down unregistered), processUserFeedback() records nothing for it and cleanupInactiveGMIs() passes it by. shutdown() waits for a seat being built, as it waits for a session's GMI, and the build then fails with its GMI shut down.

    Parameters

    Returns Promise<{
        gmi: IGMI;
        personaId: string;
        release(): Promise<void>;
    }>

    Throws

    PERSONA_NOT_FOUND for an unknown persona; PERMISSION_DENIED for one the user's tier or strict validation refuses; INVALID_STATE for a session that already has a GMI; CONFIGURATION_ERROR (SYS_CONFIGURATION_ERROR) without agencySeatPromptEngineConfig; NOT_INITIALIZED when the manager is not, or shuts down while the seat is built.

    Throws

    GMI_INITIALIZATION_ERROR when the GMI does not initialize.

  • Routes user feedback to the GMI that serves the session; feedback that names the session of a seat of a launched team (createAgencySeat()) is not recorded. The payload is normalized first (see normalizeUserFeedback): a rating label decides the polarity, otherwise a numeric rating is read on the 1 to 5 scale. The GMI then records a trace entry and, when cognitive memory is configured, stores the feedback and any correction as memories of the user.

    Parameters

    • userId: string

      The user who sent the feedback.

    • sessionId: string

      The session the feedback refers to.

    • personaId: string

      The persona involved; used for logging only.

    • feedbackData: any

      Raw feedback, normally a UserFeedbackPayload.

    Returns Promise<void>

Properties

activeGMIs: Map<string, IGMI>
gmiSessionMap: Map<string, string>
managerId: string