@happyvertical/smrt-personas 0.49.2 → 0.49.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { PromptOverrideCollection, PromptRegistry, definePrompt, resolvePrompt }
5
5
  import { instanceScopedSubscriber } from "@happyvertical/smrt-agents";
6
6
  import { PersonaMessagingService, SEND_MESSAGES_PERMISSION, messagingPrincipalFromPermissions } from "@happyvertical/smrt-messages";
7
7
  //#region src/__smrt-register__.ts
8
- ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-personas\",\"packageVersion\":\"0.49.2\",\"objects\":{\"@happyvertical/smrt-personas:AgentPersona\":{\"name\":\"agentpersona\",\"className\":\"AgentPersona\",\"qualifiedName\":\"@happyvertical/smrt-personas:AgentPersona\",\"collection\":\"agentpersonas\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/personas/src/agent-persona.ts\",\"packageName\":\"@happyvertical/smrt-personas\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"agentClass\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"contextType\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"contextId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"instructions\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"allowedTools\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"runAsUserId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-users:User\"},\"actsAsProfileId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-profiles:Profile\",\"_meta\":{\"nullable\":true}},\"memoryScope\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"priority\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"enabled\":{\"type\":\"boolean\",\"required\":false,\"_meta\":{}}},\"methods\":{\"getAllowedTools\":{\"name\":\"getAllowedTools\",\"async\":false,\"parameters\":[],\"returnType\":\"string[]\",\"isStatic\":false,\"isPublic\":true},\"setAllowedTools\":{\"name\":\"setAllowedTools\",\"async\":false,\"parameters\":[{\"name\":\"tools\",\"type\":\"string[]\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"agent_personas\",\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\",\"delete\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"conflictColumns\":[\"tenant_id\",\"agent_class\",\"name\"],\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"AgentPersona\",\"collectionExportName\":\"AgentPersonaCollection\",\"validationRules\":[{\"field\":\"runAsUserId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"}],\"schema\":{\"tableName\":\"agent_personas\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"agent_personas\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"agent_class\\\" TEXT,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"context_type\\\" TEXT,\\n \\\"context_id\\\" TEXT,\\n \\\"instructions\\\" TEXT,\\n \\\"allowed_tools\\\" TEXT,\\n \\\"run_as_user_id\\\" UUID NOT NULL,\\n \\\"acts_as_profile_id\\\" UUID,\\n \\\"memory_scope\\\" TEXT,\\n \\\"priority\\\" INTEGER DEFAULT 0,\\n \\\"enabled\\\" BOOLEAN\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"agent_class\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"context_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"context_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"instructions\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"allowed_tools\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"run_as_user_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"acts_as_profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"memory_scope\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"priority\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"enabled\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"agent_personas_tenant_id_agent_class_idx\",\"columns\":[\"tenant_id\",\"agent_class\",\"name\"],\"unique\":true},{\"name\":\"agent_personas_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"agent_personas_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"agent_personas_run_as_user_id_idx\",\"columns\":[\"run_as_user_id\"]},{\"name\":\"agent_personas_acts_as_profile_id_idx\",\"columns\":[\"acts_as_profile_id\"]}],\"version\":\"71e955ef\"}},\"@happyvertical/smrt-personas:AgentPersonaCollection\":{\"name\":\"agentpersonacollection\",\"className\":\"AgentPersonaCollection\",\"qualifiedName\":\"@happyvertical/smrt-personas:AgentPersonaCollection\",\"collection\":\"agentpersonas\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/personas/src/agent-persona.ts\",\"packageName\":\"@happyvertical/smrt-personas\",\"fields\":{},\"methods\":{\"byTenantAndClass\":{\"name\":\"byTenantAndClass\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"agentClass\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<AgentPersona[]>\",\"isStatic\":false,\"isPublic\":true},\"findActive\":{\"name\":\"findActive\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"agentClass\",\"type\":\"string\",\"optional\":false},{\"name\":\"context\",\"type\":\"object\",\"optional\":true,\"memberTypes\":[\"string | null\"]}],\"returnType\":\"Promise<AgentPersona[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"agent_personas\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"AgentPersona\",\"exportName\":\"AgentPersonaCollection\",\"collectionExportName\":\"AgentPersonaCollectionCollection\",\"schema\":{\"tableName\":\"agent_personas\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"agent_personas\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"agent_personas_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true},{\"name\":\"agent_personas_created_at_idx\",\"columns\":[\"created_at\"]}],\"version\":\"48e54c2f\"}},\"@happyvertical/smrt-personas:DirectiveProposal\":{\"name\":\"directiveproposal\",\"className\":\"DirectiveProposal\",\"qualifiedName\":\"@happyvertical/smrt-personas:DirectiveProposal\",\"collection\":\"directiveproposals\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/personas/src/directive-proposal.ts\",\"packageName\":\"@happyvertical/smrt-personas\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"personaId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"AgentPersona\",\"_meta\":{\"required\":true}},\"agentClass\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"promptKey\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"proposedInstructions\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"currentInstructions\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"rationale\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"evidence\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"status\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"fingerprint\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"confidence\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"proposedBy\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"reviewedBy\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"reviewedAt\":{\"type\":\"datetime\",\"required\":false,\"_meta\":{\"nullable\":true}},\"reviewNote\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"activatedOverrideId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}}},\"methods\":{\"getEvidence\":{\"name\":\"getEvidence\",\"async\":false,\"parameters\":[],\"returnType\":\"DirectiveEvidence\",\"isStatic\":false,\"isPublic\":true},\"setEvidence\":{\"name\":\"setEvidence\",\"async\":false,\"parameters\":[{\"name\":\"value\",\"type\":\"DirectiveEvidence\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"isPending\":{\"name\":\"isPending\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"directive_proposals\",\"api\":{\"include\":[\"list\",\"get\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"tenantScoped\":{\"mode\":\"required\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"DirectiveProposal\",\"collectionExportName\":\"DirectiveProposalCollection\",\"validationRules\":[{\"field\":\"personaId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"}],\"schema\":{\"tableName\":\"directive_proposals\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"directive_proposals\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"persona_id\\\" UUID NOT NULL,\\n \\\"agent_class\\\" TEXT,\\n \\\"prompt_key\\\" TEXT,\\n \\\"proposed_instructions\\\" TEXT,\\n \\\"current_instructions\\\" TEXT,\\n \\\"rationale\\\" TEXT,\\n \\\"evidence\\\" TEXT,\\n \\\"status\\\" TEXT,\\n \\\"fingerprint\\\" TEXT,\\n \\\"confidence\\\" REAL DEFAULT 0,\\n \\\"proposed_by\\\" TEXT,\\n \\\"reviewed_by\\\" TEXT,\\n \\\"reviewed_at\\\" TIMESTAMP,\\n \\\"review_note\\\" TEXT,\\n \\\"activated_override_id\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"persona_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false,\"foreignKey\":{\"table\":\"agent_personas\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"agent_class\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"prompt_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"proposed_instructions\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"current_instructions\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"rationale\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"evidence\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"fingerprint\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"confidence\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"proposed_by\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"reviewed_by\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"reviewed_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"review_note\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"activated_override_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"directive_proposals_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"directive_proposals_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"directive_proposals_persona_id_idx\",\"columns\":[\"persona_id\"]}],\"version\":\"96be8911\"}},\"@happyvertical/smrt-personas:DirectiveProposalCollection\":{\"name\":\"directiveproposalcollection\",\"className\":\"DirectiveProposalCollection\",\"qualifiedName\":\"@happyvertical/smrt-personas:DirectiveProposalCollection\",\"collection\":\"directiveproposals\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/personas/src/directive-proposal.ts\",\"packageName\":\"@happyvertical/smrt-personas\",\"fields\":{},\"methods\":{\"pending\":{\"name\":\"pending\",\"async\":true,\"parameters\":[{\"name\":\"options\",\"type\":\"object\",\"optional\":true,\"memberTypes\":[\"string\",\"number\"]}],\"returnType\":\"Promise<DirectiveProposal[]>\",\"isStatic\":false,\"isPublic\":true},\"findByFingerprint\":{\"name\":\"findByFingerprint\",\"async\":true,\"parameters\":[{\"name\":\"personaId\",\"type\":\"string\",\"optional\":false},{\"name\":\"fingerprint\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<DirectiveProposal[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"directive_proposals\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"DirectiveProposal\",\"exportName\":\"DirectiveProposalCollection\",\"collectionExportName\":\"DirectiveProposalCollectionCollection\",\"schema\":{\"tableName\":\"directive_proposals\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"directive_proposals\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"directive_proposals_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true},{\"name\":\"directive_proposals_created_at_idx\",\"columns\":[\"created_at\"]}],\"version\":\"f9669b44\"}},\"@happyvertical/smrt-personas:Feedback\":{\"name\":\"feedback\",\"className\":\"Feedback\",\"qualifiedName\":\"@happyvertical/smrt-personas:Feedback\",\"collection\":\"feedbacks\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/personas/src/feedback.ts\",\"packageName\":\"@happyvertical/smrt-personas\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"personaId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"AgentPersona\",\"_meta\":{\"required\":true}},\"agentClass\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"memoryScope\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"scope\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"key\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"signalType\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"source\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"correlationId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"required\":true}},\"correlationType\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"rating\":{\"type\":\"decimal\",\"required\":false,\"_meta\":{\"nullable\":true}},\"metric\":{\"type\":\"decimal\",\"required\":false,\"_meta\":{\"nullable\":true}},\"success\":{\"type\":\"boolean\",\"required\":false,\"_meta\":{\"nullable\":true}},\"correction\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"comment\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"actorId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"metadata\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"reinforcedAt\":{\"type\":\"datetime\",\"required\":false,\"_meta\":{\"nullable\":true}}},\"methods\":{\"isHuman\":{\"name\":\"isHuman\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"value\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"updateMetadata\":{\"name\":\"updateMetadata\",\"async\":false,\"parameters\":[{\"name\":\"patch\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getCorrectionValue\":{\"name\":\"getCorrectionValue\",\"async\":false,\"parameters\":[],\"returnType\":\"string | undefined\",\"isStatic\":false,\"isPublic\":true},\"toLearningOutcome\":{\"name\":\"toLearningOutcome\",\"async\":false,\"parameters\":[{\"name\":\"options\",\"type\":\"FeedbackOutcomeOptions\",\"optional\":true}],\"returnType\":\"LearningOutcome | null\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"agent_feedback\",\"api\":{\"include\":[\"list\",\"get\",\"create\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"tenantScoped\":{\"mode\":\"optional\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"Feedback\",\"collectionExportName\":\"FeedbackCollection\",\"validationRules\":[{\"field\":\"personaId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"correlationId\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"agent_feedback\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"agent_feedback\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"persona_id\\\" UUID NOT NULL,\\n \\\"agent_class\\\" TEXT,\\n \\\"memory_scope\\\" TEXT,\\n \\\"scope\\\" TEXT,\\n \\\"key\\\" TEXT,\\n \\\"signal_type\\\" TEXT,\\n \\\"source\\\" TEXT,\\n \\\"correlation_id\\\" TEXT NOT NULL,\\n \\\"correlation_type\\\" TEXT,\\n \\\"rating\\\" REAL,\\n \\\"metric\\\" REAL,\\n \\\"success\\\" BOOLEAN,\\n \\\"correction\\\" TEXT,\\n \\\"comment\\\" TEXT,\\n \\\"actor_id\\\" TEXT,\\n \\\"metadata\\\" TEXT,\\n \\\"reinforced_at\\\" TIMESTAMP\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"persona_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false,\"foreignKey\":{\"table\":\"agent_personas\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"agent_class\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"memory_scope\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"scope\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"signal_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"correlation_id\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false},\"correlation_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"rating\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false},\"metric\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false},\"success\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false},\"correction\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"comment\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"actor_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"reinforced_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"agent_feedback_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"agent_feedback_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"agent_feedback_persona_id_idx\",\"columns\":[\"persona_id\"]}],\"version\":\"91715a87\"}},\"@happyvertical/smrt-personas:FeedbackCollection\":{\"name\":\"feedbackcollection\",\"className\":\"FeedbackCollection\",\"qualifiedName\":\"@happyvertical/smrt-personas:FeedbackCollection\",\"collection\":\"feedbacks\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/personas/src/feedback.ts\",\"packageName\":\"@happyvertical/smrt-personas\",\"fields\":{},\"methods\":{\"forPersona\":{\"name\":\"forPersona\",\"async\":true,\"parameters\":[{\"name\":\"personaId\",\"type\":\"string\",\"optional\":false},{\"name\":\"options\",\"type\":\"object\",\"optional\":true,\"memberTypes\":[\"number\"]}],\"returnType\":\"Promise<Feedback[]>\",\"isStatic\":false,\"isPublic\":true},\"forScope\":{\"name\":\"forScope\",\"async\":true,\"parameters\":[{\"name\":\"memoryScope\",\"type\":\"string\",\"optional\":false},{\"name\":\"options\",\"type\":\"object\",\"optional\":true,\"memberTypes\":[\"number\"]}],\"returnType\":\"Promise<Feedback[]>\",\"isStatic\":false,\"isPublic\":true},\"byCorrelation\":{\"name\":\"byCorrelation\",\"async\":true,\"parameters\":[{\"name\":\"correlationId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Feedback[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"agent_feedback\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"Feedback\",\"exportName\":\"FeedbackCollection\",\"collectionExportName\":\"FeedbackCollectionCollection\",\"schema\":{\"tableName\":\"agent_feedback\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"agent_feedback\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"agent_feedback_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true},{\"name\":\"agent_feedback_created_at_idx\",\"columns\":[\"created_at\"]}],\"version\":\"c8bb487d\"}}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-agents\",\"@happyvertical/smrt-core\",\"@happyvertical/smrt-messages\",\"@happyvertical/smrt-prompts\",\"@happyvertical/smrt-tenancy\",\"@happyvertical/smrt-users\"]}"));
8
+ ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-personas\",\"packageVersion\":\"0.49.4\",\"objects\":{\"@happyvertical/smrt-personas:AgentPersona\":{\"name\":\"agentpersona\",\"className\":\"AgentPersona\",\"qualifiedName\":\"@happyvertical/smrt-personas:AgentPersona\",\"collection\":\"agentpersonas\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/personas/src/agent-persona.ts\",\"packageName\":\"@happyvertical/smrt-personas\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"agentClass\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"contextType\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"contextId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"instructions\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"allowedTools\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"runAsUserId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-users:User\"},\"actsAsProfileId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-profiles:Profile\",\"_meta\":{\"nullable\":true}},\"memoryScope\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"priority\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"enabled\":{\"type\":\"boolean\",\"required\":false,\"_meta\":{}}},\"methods\":{\"getAllowedTools\":{\"name\":\"getAllowedTools\",\"async\":false,\"parameters\":[],\"returnType\":\"string[]\",\"isStatic\":false,\"isPublic\":true},\"setAllowedTools\":{\"name\":\"setAllowedTools\",\"async\":false,\"parameters\":[{\"name\":\"tools\",\"type\":\"string[]\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"agent_personas\",\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\",\"delete\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"conflictColumns\":[\"tenant_id\",\"agent_class\",\"name\"],\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"AgentPersona\",\"collectionExportName\":\"AgentPersonaCollection\",\"validationRules\":[{\"field\":\"runAsUserId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"}],\"schema\":{\"tableName\":\"agent_personas\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"agent_personas\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"agent_class\\\" TEXT,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"context_type\\\" TEXT,\\n \\\"context_id\\\" TEXT,\\n \\\"instructions\\\" TEXT,\\n \\\"allowed_tools\\\" TEXT,\\n \\\"run_as_user_id\\\" UUID NOT NULL,\\n \\\"acts_as_profile_id\\\" UUID,\\n \\\"memory_scope\\\" TEXT,\\n \\\"priority\\\" INTEGER DEFAULT 0,\\n \\\"enabled\\\" BOOLEAN\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"agent_class\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"context_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"context_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"instructions\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"allowed_tools\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"run_as_user_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"acts_as_profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"memory_scope\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"priority\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"enabled\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"agent_personas_tenant_id_agent_class_idx\",\"columns\":[\"tenant_id\",\"agent_class\",\"name\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"agent_personas_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"agent_personas_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"agent_personas_run_as_user_id_idx\",\"columns\":[\"run_as_user_id\"]},{\"name\":\"agent_personas_acts_as_profile_id_idx\",\"columns\":[\"acts_as_profile_id\"]}],\"version\":\"71e955ef\"}},\"@happyvertical/smrt-personas:AgentPersonaCollection\":{\"name\":\"agentpersonacollection\",\"className\":\"AgentPersonaCollection\",\"qualifiedName\":\"@happyvertical/smrt-personas:AgentPersonaCollection\",\"collection\":\"agentpersonas\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/personas/src/agent-persona.ts\",\"packageName\":\"@happyvertical/smrt-personas\",\"fields\":{},\"methods\":{\"byTenantAndClass\":{\"name\":\"byTenantAndClass\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"agentClass\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<AgentPersona[]>\",\"isStatic\":false,\"isPublic\":true},\"findActive\":{\"name\":\"findActive\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"agentClass\",\"type\":\"string\",\"optional\":false},{\"name\":\"context\",\"type\":\"object\",\"optional\":true,\"memberTypes\":[\"string | null\"]}],\"returnType\":\"Promise<AgentPersona[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"agent_personas\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"AgentPersona\",\"exportName\":\"AgentPersonaCollection\",\"collectionExportName\":\"AgentPersonaCollectionCollection\",\"schema\":{\"tableName\":\"agent_personas\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"agent_personas\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"agent_class\\\" TEXT,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"context_type\\\" TEXT,\\n \\\"context_id\\\" TEXT,\\n \\\"instructions\\\" TEXT,\\n \\\"allowed_tools\\\" TEXT,\\n \\\"run_as_user_id\\\" UUID NOT NULL,\\n \\\"acts_as_profile_id\\\" UUID,\\n \\\"memory_scope\\\" TEXT,\\n \\\"priority\\\" INTEGER DEFAULT 0,\\n \\\"enabled\\\" BOOLEAN\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"agent_class\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"context_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"context_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"instructions\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"allowed_tools\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"run_as_user_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"acts_as_profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"memory_scope\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"priority\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"enabled\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"agent_personas_tenant_id_agent_class_idx\",\"columns\":[\"tenant_id\",\"agent_class\",\"name\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"agent_personas_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"agent_personas_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"agent_personas_run_as_user_id_idx\",\"columns\":[\"run_as_user_id\"]},{\"name\":\"agent_personas_acts_as_profile_id_idx\",\"columns\":[\"acts_as_profile_id\"]}],\"version\":\"71e955ef\"}},\"@happyvertical/smrt-personas:DirectiveProposal\":{\"name\":\"directiveproposal\",\"className\":\"DirectiveProposal\",\"qualifiedName\":\"@happyvertical/smrt-personas:DirectiveProposal\",\"collection\":\"directiveproposals\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/personas/src/directive-proposal.ts\",\"packageName\":\"@happyvertical/smrt-personas\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"personaId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"AgentPersona\",\"_meta\":{\"required\":true}},\"agentClass\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"promptKey\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"proposedInstructions\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"currentInstructions\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"rationale\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"evidence\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"status\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"fingerprint\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"confidence\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"proposedBy\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"reviewedBy\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"reviewedAt\":{\"type\":\"datetime\",\"required\":false,\"_meta\":{\"nullable\":true}},\"reviewNote\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"activatedOverrideId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}}},\"methods\":{\"getEvidence\":{\"name\":\"getEvidence\",\"async\":false,\"parameters\":[],\"returnType\":\"DirectiveEvidence\",\"isStatic\":false,\"isPublic\":true},\"setEvidence\":{\"name\":\"setEvidence\",\"async\":false,\"parameters\":[{\"name\":\"value\",\"type\":\"DirectiveEvidence\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"isPending\":{\"name\":\"isPending\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"directive_proposals\",\"api\":{\"include\":[\"list\",\"get\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"tenantScoped\":{\"mode\":\"required\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"DirectiveProposal\",\"collectionExportName\":\"DirectiveProposalCollection\",\"validationRules\":[{\"field\":\"personaId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"}],\"schema\":{\"tableName\":\"directive_proposals\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"directive_proposals\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"persona_id\\\" UUID NOT NULL,\\n \\\"agent_class\\\" TEXT,\\n \\\"prompt_key\\\" TEXT,\\n \\\"proposed_instructions\\\" TEXT,\\n \\\"current_instructions\\\" TEXT,\\n \\\"rationale\\\" TEXT,\\n \\\"evidence\\\" TEXT,\\n \\\"status\\\" TEXT,\\n \\\"fingerprint\\\" TEXT,\\n \\\"confidence\\\" REAL DEFAULT 0,\\n \\\"proposed_by\\\" TEXT,\\n \\\"reviewed_by\\\" TEXT,\\n \\\"reviewed_at\\\" TIMESTAMP,\\n \\\"review_note\\\" TEXT,\\n \\\"activated_override_id\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"persona_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false,\"foreignKey\":{\"table\":\"agent_personas\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"agent_class\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"prompt_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"proposed_instructions\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"current_instructions\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"rationale\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"evidence\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"fingerprint\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"confidence\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"proposed_by\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"reviewed_by\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"reviewed_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"review_note\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"activated_override_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"directive_proposals_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"directive_proposals_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"directive_proposals_persona_id_idx\",\"columns\":[\"persona_id\"]}],\"version\":\"96be8911\"}},\"@happyvertical/smrt-personas:DirectiveProposalCollection\":{\"name\":\"directiveproposalcollection\",\"className\":\"DirectiveProposalCollection\",\"qualifiedName\":\"@happyvertical/smrt-personas:DirectiveProposalCollection\",\"collection\":\"directiveproposals\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/personas/src/directive-proposal.ts\",\"packageName\":\"@happyvertical/smrt-personas\",\"fields\":{},\"methods\":{\"pending\":{\"name\":\"pending\",\"async\":true,\"parameters\":[{\"name\":\"options\",\"type\":\"object\",\"optional\":true,\"memberTypes\":[\"string\",\"number\"]}],\"returnType\":\"Promise<DirectiveProposal[]>\",\"isStatic\":false,\"isPublic\":true},\"findByFingerprint\":{\"name\":\"findByFingerprint\",\"async\":true,\"parameters\":[{\"name\":\"personaId\",\"type\":\"string\",\"optional\":false},{\"name\":\"fingerprint\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<DirectiveProposal[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"directive_proposals\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"DirectiveProposal\",\"exportName\":\"DirectiveProposalCollection\",\"collectionExportName\":\"DirectiveProposalCollectionCollection\",\"schema\":{\"tableName\":\"directive_proposals\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"directive_proposals\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"persona_id\\\" UUID NOT NULL,\\n \\\"agent_class\\\" TEXT,\\n \\\"prompt_key\\\" TEXT,\\n \\\"proposed_instructions\\\" TEXT,\\n \\\"current_instructions\\\" TEXT,\\n \\\"rationale\\\" TEXT,\\n \\\"evidence\\\" TEXT,\\n \\\"status\\\" TEXT,\\n \\\"fingerprint\\\" TEXT,\\n \\\"confidence\\\" REAL DEFAULT 0,\\n \\\"proposed_by\\\" TEXT,\\n \\\"reviewed_by\\\" TEXT,\\n \\\"reviewed_at\\\" TIMESTAMP,\\n \\\"review_note\\\" TEXT,\\n \\\"activated_override_id\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"persona_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false,\"foreignKey\":{\"table\":\"agent_personas\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"agent_class\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"prompt_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"proposed_instructions\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"current_instructions\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"rationale\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"evidence\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"fingerprint\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"confidence\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"proposed_by\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"reviewed_by\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"reviewed_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"review_note\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"activated_override_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"directive_proposals_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"directive_proposals_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"directive_proposals_persona_id_idx\",\"columns\":[\"persona_id\"]}],\"version\":\"96be8911\"}},\"@happyvertical/smrt-personas:Feedback\":{\"name\":\"feedback\",\"className\":\"Feedback\",\"qualifiedName\":\"@happyvertical/smrt-personas:Feedback\",\"collection\":\"feedbacks\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/personas/src/feedback.ts\",\"packageName\":\"@happyvertical/smrt-personas\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"personaId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"AgentPersona\",\"_meta\":{\"required\":true}},\"agentClass\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"memoryScope\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"scope\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"key\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"signalType\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"source\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"correlationId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"required\":true}},\"correlationType\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"rating\":{\"type\":\"decimal\",\"required\":false,\"_meta\":{\"nullable\":true}},\"metric\":{\"type\":\"decimal\",\"required\":false,\"_meta\":{\"nullable\":true}},\"success\":{\"type\":\"boolean\",\"required\":false,\"_meta\":{\"nullable\":true}},\"correction\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"comment\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"actorId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"nullable\":true}},\"metadata\":{\"type\":\"text\",\"required\":false,\"_meta\":{}},\"reinforcedAt\":{\"type\":\"datetime\",\"required\":false,\"_meta\":{\"nullable\":true}}},\"methods\":{\"isHuman\":{\"name\":\"isHuman\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"value\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"updateMetadata\":{\"name\":\"updateMetadata\",\"async\":false,\"parameters\":[{\"name\":\"patch\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getCorrectionValue\":{\"name\":\"getCorrectionValue\",\"async\":false,\"parameters\":[],\"returnType\":\"string | undefined\",\"isStatic\":false,\"isPublic\":true},\"toLearningOutcome\":{\"name\":\"toLearningOutcome\",\"async\":false,\"parameters\":[{\"name\":\"options\",\"type\":\"FeedbackOutcomeOptions\",\"optional\":true}],\"returnType\":\"LearningOutcome | null\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"agent_feedback\",\"api\":{\"include\":[\"list\",\"get\",\"create\"]},\"cli\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"tenantScoped\":{\"mode\":\"optional\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"Feedback\",\"collectionExportName\":\"FeedbackCollection\",\"validationRules\":[{\"field\":\"personaId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"correlationId\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"agent_feedback\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"agent_feedback\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"persona_id\\\" UUID NOT NULL,\\n \\\"agent_class\\\" TEXT,\\n \\\"memory_scope\\\" TEXT,\\n \\\"scope\\\" TEXT,\\n \\\"key\\\" TEXT,\\n \\\"signal_type\\\" TEXT,\\n \\\"source\\\" TEXT,\\n \\\"correlation_id\\\" TEXT NOT NULL,\\n \\\"correlation_type\\\" TEXT,\\n \\\"rating\\\" REAL,\\n \\\"metric\\\" REAL,\\n \\\"success\\\" BOOLEAN,\\n \\\"correction\\\" TEXT,\\n \\\"comment\\\" TEXT,\\n \\\"actor_id\\\" TEXT,\\n \\\"metadata\\\" TEXT,\\n \\\"reinforced_at\\\" TIMESTAMP\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"persona_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false,\"foreignKey\":{\"table\":\"agent_personas\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"agent_class\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"memory_scope\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"scope\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"signal_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"correlation_id\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false},\"correlation_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"rating\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false},\"metric\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false},\"success\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false},\"correction\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"comment\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"actor_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"reinforced_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"agent_feedback_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"agent_feedback_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"agent_feedback_persona_id_idx\",\"columns\":[\"persona_id\"]}],\"version\":\"91715a87\"}},\"@happyvertical/smrt-personas:FeedbackCollection\":{\"name\":\"feedbackcollection\",\"className\":\"FeedbackCollection\",\"qualifiedName\":\"@happyvertical/smrt-personas:FeedbackCollection\",\"collection\":\"feedbacks\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/personas/src/feedback.ts\",\"packageName\":\"@happyvertical/smrt-personas\",\"fields\":{},\"methods\":{\"forPersona\":{\"name\":\"forPersona\",\"async\":true,\"parameters\":[{\"name\":\"personaId\",\"type\":\"string\",\"optional\":false},{\"name\":\"options\",\"type\":\"object\",\"optional\":true,\"memberTypes\":[\"number\"]}],\"returnType\":\"Promise<Feedback[]>\",\"isStatic\":false,\"isPublic\":true},\"forScope\":{\"name\":\"forScope\",\"async\":true,\"parameters\":[{\"name\":\"memoryScope\",\"type\":\"string\",\"optional\":false},{\"name\":\"options\",\"type\":\"object\",\"optional\":true,\"memberTypes\":[\"number\"]}],\"returnType\":\"Promise<Feedback[]>\",\"isStatic\":false,\"isPublic\":true},\"byCorrelation\":{\"name\":\"byCorrelation\",\"async\":true,\"parameters\":[{\"name\":\"correlationId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Feedback[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"agent_feedback\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"Feedback\",\"exportName\":\"FeedbackCollection\",\"collectionExportName\":\"FeedbackCollectionCollection\",\"schema\":{\"tableName\":\"agent_feedback\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"agent_feedback\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"persona_id\\\" UUID NOT NULL,\\n \\\"agent_class\\\" TEXT,\\n \\\"memory_scope\\\" TEXT,\\n \\\"scope\\\" TEXT,\\n \\\"key\\\" TEXT,\\n \\\"signal_type\\\" TEXT,\\n \\\"source\\\" TEXT,\\n \\\"correlation_id\\\" TEXT NOT NULL,\\n \\\"correlation_type\\\" TEXT,\\n \\\"rating\\\" REAL,\\n \\\"metric\\\" REAL,\\n \\\"success\\\" BOOLEAN,\\n \\\"correction\\\" TEXT,\\n \\\"comment\\\" TEXT,\\n \\\"actor_id\\\" TEXT,\\n \\\"metadata\\\" TEXT,\\n \\\"reinforced_at\\\" TIMESTAMP\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"persona_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false,\"foreignKey\":{\"table\":\"agent_personas\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"agent_class\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"memory_scope\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"scope\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"signal_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"correlation_id\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false},\"correlation_type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"rating\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false},\"metric\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false},\"success\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false},\"correction\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"comment\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"actor_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"reinforced_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"agent_feedback_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"agent_feedback_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"agent_feedback_persona_id_idx\",\"columns\":[\"persona_id\"]}],\"version\":\"91715a87\"}}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-agents\",\"@happyvertical/smrt-core\",\"@happyvertical/smrt-messages\",\"@happyvertical/smrt-prompts\",\"@happyvertical/smrt-tenancy\",\"@happyvertical/smrt-users\"]}"));
9
9
  //#endregion
10
10
  //#region src/directive-principal.ts
11
11
  var ACTIVATE_DIRECTIVE_PERMISSION = "personas.activate-directive";
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-personas",
5
- "packageVersion": "0.49.2",
5
+ "packageVersion": "0.49.4",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-personas:AgentPersona": {
8
8
  "name": "agentpersona",
@@ -261,7 +261,8 @@
261
261
  "agent_class",
262
262
  "name"
263
263
  ],
264
- "unique": true
264
+ "unique": true,
265
+ "nullsNotDistinct": true
265
266
  },
266
267
  {
267
268
  "name": "agent_personas_slug_context_idx",
@@ -358,7 +359,7 @@
358
359
  "collectionExportName": "AgentPersonaCollectionCollection",
359
360
  "schema": {
360
361
  "tableName": "agent_personas",
361
- "ddl": "CREATE TABLE IF NOT EXISTS \"agent_personas\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
362
+ "ddl": "CREATE TABLE IF NOT EXISTS \"agent_personas\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"agent_class\" TEXT,\n \"name\" TEXT DEFAULT '',\n \"context_type\" TEXT,\n \"context_id\" TEXT,\n \"instructions\" TEXT,\n \"allowed_tools\" TEXT,\n \"run_as_user_id\" UUID NOT NULL,\n \"acts_as_profile_id\" UUID,\n \"memory_scope\" TEXT,\n \"priority\" INTEGER DEFAULT 0,\n \"enabled\" BOOLEAN\n);",
362
363
  "columns": {
363
364
  "id": {
364
365
  "type": "UUID",
@@ -384,25 +385,112 @@
384
385
  "type": "TIMESTAMP",
385
386
  "notNull": true,
386
387
  "default": "current_timestamp"
388
+ },
389
+ "tenant_id": {
390
+ "type": "UUID",
391
+ "referenceKind": "tenantId",
392
+ "notNull": true,
393
+ "unique": false
394
+ },
395
+ "agent_class": {
396
+ "type": "TEXT",
397
+ "notNull": false,
398
+ "unique": false
399
+ },
400
+ "name": {
401
+ "type": "TEXT",
402
+ "notNull": false,
403
+ "unique": false,
404
+ "default": ""
405
+ },
406
+ "context_type": {
407
+ "type": "TEXT",
408
+ "notNull": false,
409
+ "unique": false
410
+ },
411
+ "context_id": {
412
+ "type": "TEXT",
413
+ "notNull": false,
414
+ "unique": false
415
+ },
416
+ "instructions": {
417
+ "type": "TEXT",
418
+ "notNull": false,
419
+ "unique": false
420
+ },
421
+ "allowed_tools": {
422
+ "type": "TEXT",
423
+ "notNull": false,
424
+ "unique": false
425
+ },
426
+ "run_as_user_id": {
427
+ "type": "UUID",
428
+ "referenceKind": "crossPackageRef",
429
+ "notNull": true,
430
+ "unique": false
431
+ },
432
+ "acts_as_profile_id": {
433
+ "type": "UUID",
434
+ "referenceKind": "crossPackageRef",
435
+ "notNull": false,
436
+ "unique": false
437
+ },
438
+ "memory_scope": {
439
+ "type": "TEXT",
440
+ "notNull": false,
441
+ "unique": false
442
+ },
443
+ "priority": {
444
+ "type": "INTEGER",
445
+ "notNull": false,
446
+ "unique": false,
447
+ "default": 0
448
+ },
449
+ "enabled": {
450
+ "type": "BOOLEAN",
451
+ "notNull": false,
452
+ "unique": false
387
453
  }
388
454
  },
389
455
  "indexes": [
456
+ {
457
+ "name": "agent_personas_tenant_id_agent_class_idx",
458
+ "columns": [
459
+ "tenant_id",
460
+ "agent_class",
461
+ "name"
462
+ ],
463
+ "unique": true,
464
+ "nullsNotDistinct": true
465
+ },
390
466
  {
391
467
  "name": "agent_personas_slug_context_idx",
392
468
  "columns": [
393
469
  "slug",
394
470
  "context"
395
- ],
396
- "unique": true
471
+ ]
397
472
  },
398
473
  {
399
- "name": "agent_personas_created_at_idx",
474
+ "name": "agent_personas_tenant_id_created_at_idx",
400
475
  "columns": [
476
+ "tenant_id",
401
477
  "created_at"
402
478
  ]
479
+ },
480
+ {
481
+ "name": "agent_personas_run_as_user_id_idx",
482
+ "columns": [
483
+ "run_as_user_id"
484
+ ]
485
+ },
486
+ {
487
+ "name": "agent_personas_acts_as_profile_id_idx",
488
+ "columns": [
489
+ "acts_as_profile_id"
490
+ ]
403
491
  }
404
492
  ],
405
- "version": "48e54c2f"
493
+ "version": "71e955ef"
406
494
  }
407
495
  },
408
496
  "@happyvertical/smrt-personas:DirectiveProposal": {
@@ -790,7 +878,7 @@
790
878
  "collectionExportName": "DirectiveProposalCollectionCollection",
791
879
  "schema": {
792
880
  "tableName": "directive_proposals",
793
- "ddl": "CREATE TABLE IF NOT EXISTS \"directive_proposals\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
881
+ "ddl": "CREATE TABLE IF NOT EXISTS \"directive_proposals\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"persona_id\" UUID NOT NULL,\n \"agent_class\" TEXT,\n \"prompt_key\" TEXT,\n \"proposed_instructions\" TEXT,\n \"current_instructions\" TEXT,\n \"rationale\" TEXT,\n \"evidence\" TEXT,\n \"status\" TEXT,\n \"fingerprint\" TEXT,\n \"confidence\" REAL DEFAULT 0,\n \"proposed_by\" TEXT,\n \"reviewed_by\" TEXT,\n \"reviewed_at\" TIMESTAMP,\n \"review_note\" TEXT,\n \"activated_override_id\" TEXT\n);",
794
882
  "columns": {
795
883
  "id": {
796
884
  "type": "UUID",
@@ -816,25 +904,122 @@
816
904
  "type": "TIMESTAMP",
817
905
  "notNull": true,
818
906
  "default": "current_timestamp"
907
+ },
908
+ "tenant_id": {
909
+ "type": "UUID",
910
+ "referenceKind": "tenantId",
911
+ "notNull": true,
912
+ "unique": false
913
+ },
914
+ "persona_id": {
915
+ "type": "UUID",
916
+ "referenceKind": "foreignKey",
917
+ "notNull": true,
918
+ "unique": false,
919
+ "foreignKey": {
920
+ "table": "agent_personas",
921
+ "column": "id",
922
+ "onDelete": "NO ACTION",
923
+ "onUpdate": "CASCADE"
924
+ }
925
+ },
926
+ "agent_class": {
927
+ "type": "TEXT",
928
+ "notNull": false,
929
+ "unique": false
930
+ },
931
+ "prompt_key": {
932
+ "type": "TEXT",
933
+ "notNull": false,
934
+ "unique": false
935
+ },
936
+ "proposed_instructions": {
937
+ "type": "TEXT",
938
+ "notNull": false,
939
+ "unique": false
940
+ },
941
+ "current_instructions": {
942
+ "type": "TEXT",
943
+ "notNull": false,
944
+ "unique": false
945
+ },
946
+ "rationale": {
947
+ "type": "TEXT",
948
+ "notNull": false,
949
+ "unique": false
950
+ },
951
+ "evidence": {
952
+ "type": "TEXT",
953
+ "notNull": false,
954
+ "unique": false
955
+ },
956
+ "status": {
957
+ "type": "TEXT",
958
+ "notNull": false,
959
+ "unique": false
960
+ },
961
+ "fingerprint": {
962
+ "type": "TEXT",
963
+ "notNull": false,
964
+ "unique": false
965
+ },
966
+ "confidence": {
967
+ "type": "REAL",
968
+ "notNull": false,
969
+ "unique": false,
970
+ "default": 0
971
+ },
972
+ "proposed_by": {
973
+ "type": "TEXT",
974
+ "notNull": false,
975
+ "unique": false
976
+ },
977
+ "reviewed_by": {
978
+ "type": "TEXT",
979
+ "notNull": false,
980
+ "unique": false
981
+ },
982
+ "reviewed_at": {
983
+ "type": "TIMESTAMP",
984
+ "notNull": false,
985
+ "unique": false
986
+ },
987
+ "review_note": {
988
+ "type": "TEXT",
989
+ "notNull": false,
990
+ "unique": false
991
+ },
992
+ "activated_override_id": {
993
+ "type": "TEXT",
994
+ "notNull": false,
995
+ "unique": false
819
996
  }
820
997
  },
821
998
  "indexes": [
822
999
  {
823
1000
  "name": "directive_proposals_slug_context_idx",
824
1001
  "columns": [
1002
+ "tenant_id",
825
1003
  "slug",
826
1004
  "context"
827
1005
  ],
828
1006
  "unique": true
829
1007
  },
830
1008
  {
831
- "name": "directive_proposals_created_at_idx",
1009
+ "name": "directive_proposals_tenant_id_created_at_idx",
832
1010
  "columns": [
1011
+ "tenant_id",
833
1012
  "created_at"
834
1013
  ]
1014
+ },
1015
+ {
1016
+ "name": "directive_proposals_persona_id_idx",
1017
+ "columns": [
1018
+ "persona_id"
1019
+ ]
835
1020
  }
836
1021
  ],
837
- "version": "f9669b44"
1022
+ "version": "96be8911"
838
1023
  }
839
1024
  },
840
1025
  "@happyvertical/smrt-personas:Feedback": {
@@ -1219,7 +1404,8 @@
1219
1404
  "slug",
1220
1405
  "context"
1221
1406
  ],
1222
- "unique": true
1407
+ "unique": true,
1408
+ "nullsNotDistinct": true
1223
1409
  },
1224
1410
  {
1225
1411
  "name": "agent_feedback_tenant_id_created_at_idx",
@@ -1315,7 +1501,7 @@
1315
1501
  "collectionExportName": "FeedbackCollectionCollection",
1316
1502
  "schema": {
1317
1503
  "tableName": "agent_feedback",
1318
- "ddl": "CREATE TABLE IF NOT EXISTS \"agent_feedback\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1504
+ "ddl": "CREATE TABLE IF NOT EXISTS \"agent_feedback\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"persona_id\" UUID NOT NULL,\n \"agent_class\" TEXT,\n \"memory_scope\" TEXT,\n \"scope\" TEXT,\n \"key\" TEXT,\n \"signal_type\" TEXT,\n \"source\" TEXT,\n \"correlation_id\" TEXT NOT NULL,\n \"correlation_type\" TEXT,\n \"rating\" REAL,\n \"metric\" REAL,\n \"success\" BOOLEAN,\n \"correction\" TEXT,\n \"comment\" TEXT,\n \"actor_id\" TEXT,\n \"metadata\" TEXT,\n \"reinforced_at\" TIMESTAMP\n);",
1319
1505
  "columns": {
1320
1506
  "id": {
1321
1507
  "type": "UUID",
@@ -1341,25 +1527,132 @@
1341
1527
  "type": "TIMESTAMP",
1342
1528
  "notNull": true,
1343
1529
  "default": "current_timestamp"
1530
+ },
1531
+ "tenant_id": {
1532
+ "type": "UUID",
1533
+ "referenceKind": "tenantId",
1534
+ "notNull": false,
1535
+ "unique": false
1536
+ },
1537
+ "persona_id": {
1538
+ "type": "UUID",
1539
+ "referenceKind": "foreignKey",
1540
+ "notNull": true,
1541
+ "unique": false,
1542
+ "foreignKey": {
1543
+ "table": "agent_personas",
1544
+ "column": "id",
1545
+ "onDelete": "NO ACTION",
1546
+ "onUpdate": "CASCADE"
1547
+ }
1548
+ },
1549
+ "agent_class": {
1550
+ "type": "TEXT",
1551
+ "notNull": false,
1552
+ "unique": false
1553
+ },
1554
+ "memory_scope": {
1555
+ "type": "TEXT",
1556
+ "notNull": false,
1557
+ "unique": false
1558
+ },
1559
+ "scope": {
1560
+ "type": "TEXT",
1561
+ "notNull": false,
1562
+ "unique": false
1563
+ },
1564
+ "key": {
1565
+ "type": "TEXT",
1566
+ "notNull": false,
1567
+ "unique": false
1568
+ },
1569
+ "signal_type": {
1570
+ "type": "TEXT",
1571
+ "notNull": false,
1572
+ "unique": false
1573
+ },
1574
+ "source": {
1575
+ "type": "TEXT",
1576
+ "notNull": false,
1577
+ "unique": false
1578
+ },
1579
+ "correlation_id": {
1580
+ "type": "TEXT",
1581
+ "notNull": true,
1582
+ "unique": false
1583
+ },
1584
+ "correlation_type": {
1585
+ "type": "TEXT",
1586
+ "notNull": false,
1587
+ "unique": false
1588
+ },
1589
+ "rating": {
1590
+ "type": "REAL",
1591
+ "notNull": false,
1592
+ "unique": false
1593
+ },
1594
+ "metric": {
1595
+ "type": "REAL",
1596
+ "notNull": false,
1597
+ "unique": false
1598
+ },
1599
+ "success": {
1600
+ "type": "BOOLEAN",
1601
+ "notNull": false,
1602
+ "unique": false
1603
+ },
1604
+ "correction": {
1605
+ "type": "TEXT",
1606
+ "notNull": false,
1607
+ "unique": false
1608
+ },
1609
+ "comment": {
1610
+ "type": "TEXT",
1611
+ "notNull": false,
1612
+ "unique": false
1613
+ },
1614
+ "actor_id": {
1615
+ "type": "TEXT",
1616
+ "notNull": false,
1617
+ "unique": false
1618
+ },
1619
+ "metadata": {
1620
+ "type": "TEXT",
1621
+ "notNull": false,
1622
+ "unique": false
1623
+ },
1624
+ "reinforced_at": {
1625
+ "type": "TIMESTAMP",
1626
+ "notNull": false,
1627
+ "unique": false
1344
1628
  }
1345
1629
  },
1346
1630
  "indexes": [
1347
1631
  {
1348
1632
  "name": "agent_feedback_slug_context_idx",
1349
1633
  "columns": [
1634
+ "tenant_id",
1350
1635
  "slug",
1351
1636
  "context"
1352
1637
  ],
1353
- "unique": true
1638
+ "unique": true,
1639
+ "nullsNotDistinct": true
1354
1640
  },
1355
1641
  {
1356
- "name": "agent_feedback_created_at_idx",
1642
+ "name": "agent_feedback_tenant_id_created_at_idx",
1357
1643
  "columns": [
1644
+ "tenant_id",
1358
1645
  "created_at"
1359
1646
  ]
1647
+ },
1648
+ {
1649
+ "name": "agent_feedback_persona_id_idx",
1650
+ "columns": [
1651
+ "persona_id"
1652
+ ]
1360
1653
  }
1361
1654
  ],
1362
- "version": "c8bb487d"
1655
+ "version": "91715a87"
1363
1656
  }
1364
1657
  }
1365
1658
  },
@@ -3,12 +3,12 @@
3
3
  "sensitiveFieldsExcluded": true,
4
4
  "generatedAt": "1970-01-01T00:00:00.000Z",
5
5
  "packageName": "@happyvertical/smrt-personas",
6
- "packageVersion": "0.49.2",
6
+ "packageVersion": "0.49.4",
7
7
  "sourceManifestPath": "dist/manifest.json",
8
8
  "agentDocPath": "AGENTS.md",
9
9
  "sourceHashes": {
10
- "manifest": "16ef14a0c3e6977a766c847450807012b29c9abb6bf14831d7845ca473c1923a",
11
- "packageJson": "f14ba5993926953a0022e49c586b4941158c295327796000bbd80eea369a8487",
10
+ "manifest": "0ec4e6c17ca5b061f5a616aada2d6d24f4f972ffc3beee4c65a71a935da88bb7",
11
+ "packageJson": "7a12e747924f2c767f35748f5ce1b59c03e991656ebd8b0684e8311980e23a39",
12
12
  "agents": "fe6c54f7d6c724b76906629eeb7bd17a332faad631179771acea73db1e159733"
13
13
  },
14
14
  "exports": [
@@ -1348,7 +1348,7 @@
1348
1348
  "junctionCollections": 0,
1349
1349
  "hierarchicalObjects": 0,
1350
1350
  "polymorphicAssociations": 0,
1351
- "uuidColumns": 13
1351
+ "uuidColumns": 20
1352
1352
  },
1353
1353
  "agentDoc": "# @happyvertical/smrt-personas\n\nTenant-owned, context-scoped agent personas and their resolution. Layers over\n`@happyvertical/smrt-agents`' `TenantAgent` availability/ceiling gate to decide\n*how* an agent behaves for a given tenant and context (its `TenantAgent` binding\ndecides *whether* it runs and caps its capabilities).\n\nThis is the L2 layer of the \"learning agents\" epic (#1885): the persona foundation\n(`AgentPersona` + `PersonaResolver`), the **persona learning & adaptation loop**\n(#1889) — feedback → confidence-scored reinforcement → a scheduled reflection\nrunner that emits pending directive proposals → a permission-gated approval\nsurface that activates an approved rewrite as a tenant/persona-scoped prompt\noverride — and the persona-as-durable-instance / multi-instance helpers (#1890,\nbelow). `ExecuteAsPrincipal` remains a separate issue (#1888).\n\n## Models\n\n- **AgentPersona** (`@TenantScoped({ mode: 'required' })`, table `agent_personas`):\n a behavioral profile for one agent class within one tenant. Many per\n `(tenant, agentClass)`; unique on `(tenant_id, agent_class, name)` via\n `conflictColumns`. Fields:\n - `agentClass` — canonical qualified agent type (e.g.\n `@happyvertical/smrt-agents:Praeco`); stored canonical so it lines up with\n `TenantAgent.agentClass`.\n - `name` — persona name, unique per `(tenant, agentClass)`.\n - `contextType` / `contextId` — optional scoping. No `contextType` = a\n tenant-wide default; `contextType` only = type-scoped; both = exact context.\n - `instructions` — system prompt layered onto the agent.\n - `allowedTools` — JSON array of tool ids stored as a string; use\n `getAllowedTools()` / `setAllowedTools()` (tolerant `try/catch` parse).\n - `runAsUserId` — `@crossPackageRef('@happyvertical/smrt-users:User')`, the\n principal the persona runs as.\n - `actsAsProfileId` — optional `@crossPackageRef('@happyvertical/smrt-profiles:Profile')`,\n a `Bot` identity for audit/attribution.\n - `memoryScope` — memory/reflection partition key (empty → resolver-derived).\n - `priority` — integer; higher wins among personas that apply at the same\n tenant level.\n - `enabled` — boolean; only enabled personas are resolved.\n\n- **Feedback** (`@TenantScoped({ mode: 'optional' })`, table `agent_feedback`):\n one reinforcement signal against a persona and the learning episode it judges.\n Human signals (`accept` / `reject` / `correction` / `rating`) and autonomous\n signals (`outcome` / `metric`) each carry a required **`correlationId`** (+\n optional `correlationType`) back to the AI call / dispatch / job. `scope` /\n `key` name the `LearningMemory` episode; `toLearningOutcome()` maps the signal\n onto a `LearningOutcome` (feeds reinforcement, #1886). `FeedbackCollection`:\n `forPersona`, `forScope`, `byCorrelation`.\n\n- **DirectiveProposal** (`@TenantScoped({ mode: 'required' })`, table\n `directive_proposals`): a pending, human-reviewable proposed edit to a\n persona's `instructions`. Read-only generated surface (`api`/`cli`/`mcp` =\n `list`/`get`) — writes go through the gated approval service, not CRUD. Key\n fields: `promptKey`, `proposedInstructions`, `currentInstructions` (diff),\n `rationale`, `evidence` (JSON: episode + feedback ids), `status`\n (`pending`/`approved`/`rejected`/`superseded`), `fingerprint` (dedup so a\n rejected rewrite is never re-surfaced), `proposedBy`, `reviewedBy` /\n `reviewedAt` / `activatedOverrideId`. `DirectiveProposalCollection`:\n `pending(...)` (the review queue), `findByFingerprint(...)`.\n\n## Learning loop (#1889)\n\n- **Persona instructions via prompt overrides** (`persona-prompt.ts`): a\n persona's instructions apply through a per-persona registered prompt key\n (`persona.<id>.instructions`, neutral empty base template) plus a\n tenant-scoped `prompt_override`. Two personas of the same tenant/class resolve\n different instructions without colliding on the override `(key, context)`\n identity. `ensurePersonaInstructionsPrompt` (idempotent registration,\n `editable` configurable), `applyPersonaInstructions` /\n `upsertPromptTemplateOverride` (write the override — flows through\n `PromptOverride.save()` → `validatePromptOverride`, so a non-editable template\n is refused), `resolvePersonaInstructions`.\n- **Memory scoping** (`persona-memory.ts`): `personaLearningMemory` routes a\n `LearningMemory` by the persona's `memoryScope` (used as `owner_id`), so\n personas learn independently. `reinforceFromFeedback` applies a `Feedback`\n signal to memory as automatic, confidence-only reinforcement (ungated).\n- **ReflectionRunner** (`reflection-runner.ts`): a schedulable pass that, under\n the autonomous reflection principal (which **lacks**\n `personas.activate-directive`), reinforces recent feedback, consolidates\n episodes + feedback via an injected `reflect` boundary (the AI call, mocked in\n tests), and records a **pending** `DirectiveProposal` (deduped by fingerprint).\n It cannot activate anything.\n- **The gate = a permission split** (`directive-principal.ts`,\n `directive-approval.ts`): activating a directive is the permissioned operation\n `personas.activate-directive` (contributed to the manifest permission catalog\n via `registerPermissionDefinitions`). `DirectiveApprovalService.approve` /\n `reject` first `assertCanActivate(principal)`; approval writes the\n persona-scoped override and records an `accept` signal, rejection records a\n `reject` signal and closes the proposal. A `DirectivePrincipal` is built from\n granted slugs (`principalFromPermissions`) or a `PermissionResolver`\n (`resolveDirectivePrincipal`).\n\n## Svelte UI\n\n`@happyvertical/smrt-personas/svelte` ships a minimal, presentational\n`DirectiveReviewQueue` component (Svelte 5): it lists pending proposals with a\ncurrent-vs-proposed diff and Approve/Reject actions, delegating to `onApprove`\n(optionally with reviewer-edited text) / `onReject` callbacks a host wires to\nthe gated `DirectiveApprovalService`. Built with `svelte-package`; Svelte tests\nrun in CI only.\n\n## Collection\n\n`AgentPersonaCollection`:\n\n- `byTenantAndClass(tenantId, agentClass)` — all personas for the pair\n (canonicalized), ordered by descending priority then name.\n- `findActive(tenantId, agentClass, context?)` — enabled personas applicable to\n a context, same ordering.\n\n## PersonaResolver\n\n`resolve(tenantId, agentClass, context, options) → ResolvedPersona` layers,\nbottom to top: **manifest defaults → `TenantAgent` gate/ceiling → AgentPersona**.\n\n- **Hierarchy inheritance** mirrors `TenantAgentCollection.resolveForTenant`:\n walks the requesting tenant then its ancestors (`options.getAncestorIds`,\n nearest first). The nearest level with any applicable persona wins (a closer\n level shadows a farther one).\n- **Selection within a level**: most context-specific first\n (exact > type-scoped > tenant-wide), then highest `priority`, then name.\n- **Ceiling**: `options.availability` (a `PersonaAvailabilityGate`) gates\n availability and intersects the resolved `allowedTools`. Build one from a\n `ResolvedAgentAvailability` with `availabilityFromResolvedAgent()`.\n- **Default fallback**: when no persona applies, returns a defined default\n (`source: 'default'`, `name: 'default'`) from manifest defaults + the gate.\n\nBecause the walk reads personas across tenants, `resolve()` is intended for a\nsystem/admin path where cross-tenant reads are allowed — not inside a strict\nper-tenant interceptor context (same expectation as `resolveForTenant`).\n\n## Persona as Durable Instance (#1890)\n\nA persona is a **durable instance** of an agent class — N per tenant, each\nindependently scheduled, memory-scoped, and permission-scoped. `persona-instance.ts`\nwires that to the `@happyvertical/smrt-agents` multi-instance primitives (which are\nper-package opt-in via `static multiInstance`, singleton by default):\n\n- **Identity** — `personaInstanceKey(persona)` returns the persona id, or `null`\n for the `default` persona (`DEFAULT_PERSONA_NAME`). A `null` key reuses the\n **singleton** runtime identity (class-keyed dispatch subscriber + un-suffixed\n memory scope). `agentOptionsForPersona(persona)` always projects\n `{ personaId, instanceKey, tenantId }`: `personaId` owns durable settings;\n `instanceKey` owns execution partitioning.\n- **Scheduling** — `schedulePersonaInstance(schedules, persona, { cron, … })`\n creates an `AgentSchedule` for the instance. The instance key rides in\n `agentConfig` (which the scheduler spreads into the agent constructor →\n `AgentOptions.personaId` / `instanceKey`); `agentId` is left **null** on purpose, because the\n scheduler copies `agentId`→`SmrtJob.objectId` and the `TaskRunner`\n `loadFromId()`s it against the agent's STI table — a persona id is not a row\n there. The default persona carries its `personaId` but no instance key → runs\n the singleton while retaining persona-owned settings.\n- **Admin** — `buildPersonaInstanceAdmin(personas, { tenantId, agentClass,\n manifest })` renders the class's `uiSlots`/`adminRoutes` **once per instance**\n (with the per-instance dispatch subscriber); `addPersonaInstance()` /\n `removePersonaInstance(personaId)` are the add/remove affordances.\n- **Non-destructive upgrade** — `upgradeSingletonToDefaultPersona(personas, {\n tenantId, agentClass, runAsUserId, … })` maps an existing singleton to a single\n `default` persona. It's null-keyed, so the running agent's dispatch subscriber,\n memory, and config are untouched; idempotent (a second call returns the\n existing default with `created: false` and never overwrites it).\n\n## Dependencies\n\nLeaf package (acyclic by construction — nothing depends back on it):\n\n- Runtime: `@happyvertical/smrt-core`, `@happyvertical/smrt-tenancy`,\n `@happyvertical/smrt-agents` (the `TenantAgent` type it bridges, plus the\n `AgentSchedule`/multi-instance surface `persona-instance.ts` builds on),\n `@happyvertical/smrt-messages` (the persona-fixed outbound messaging tool),\n `@happyvertical/smrt-prompts` (persona instructions via `PromptOverride` +\n `resolvePrompt`), `@happyvertical/smrt-users` (the permission catalog slug +\n `PermissionResolver` principal), and `@happyvertical/sql` (`DatabaseInterface`\n type). These edges are all acyclic (none of those packages depend on personas).\n- Svelte peer + `@happyvertical/smrt-ui` for the optional `./svelte` review-queue\n component.\n- `runAsUserId` / `actsAsProfileId` reference `@happyvertical/smrt-users` and\n `@happyvertical/smrt-profiles` via `@crossPackageRef` string ids only. No\n inter-`smrt-*` `peerDependencies`.\n\n## Gotchas\n\n- **`conflictColumns` replaces the default `(slug, context)` unique index** — the\n unique key is `(tenant_id, agent_class, name)`, so same-named personas across\n tenants are allowed and tenant isolation is preserved.\n- **`allowedTools` is text, not `type: 'json'`** — stored as a JSON string and\n read through the helpers, so it never auto-hydrates to an object.\n- **Resolver runs outside strict tenant context** — it deliberately crosses\n tenants to walk the hierarchy.\n- **The gate is the permission split, not a bespoke check** — the reflection\n principal simply lacks `personas.activate-directive`, so it can only propose;\n everything privileged in `DirectiveApprovalService` calls `assertCanActivate`\n first. Instruction rewrites are gated; confidence-only reinforcement is not.\n- **Persona messaging is fixed by trusted wiring** —\n `createPersonaMessagingTool({ personaId })` exposes `messages.send` without\n accepting persona, account, endpoint, or credential ids from tool arguments.\n It requires both the persona tool allow-list and the live principal's\n `messages.send` permission.\n- **Persona instructions live in the override layer, not the base prompt** — the\n per-persona prompt key registers a neutral empty template, so re-registration\n stays idempotent as instructions change; the tenant-scoped override carries the\n actual text. Activation still honours `validatePromptOverride` editability.\n- **Directive dedup is by fingerprint across all statuses** — the runner skips a\n proposal whose `(personaId, promptKey, proposedInstructions)` fingerprint\n already exists (pending, approved, or rejected), so a rejected rewrite is never\n re-surfaced.\n"
1354
1354
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-personas",
3
- "version": "0.49.2",
3
+ "version": "0.49.4",
4
4
  "smrtJsdoc": "strict",
5
5
  "description": "Tenant-owned, context-scoped agent personas and resolution for the SMRT framework",
6
6
  "type": "module",
@@ -25,20 +25,20 @@
25
25
  "./manifest.json": "./dist/manifest.json"
26
26
  },
27
27
  "dependencies": {
28
- "@happyvertical/smrt-agents": "0.49.2",
29
- "@happyvertical/smrt-core": "0.49.2",
30
- "@happyvertical/smrt-messages": "0.49.2",
31
- "@happyvertical/smrt-prompts": "0.49.2",
32
- "@happyvertical/smrt-tenancy": "0.49.2",
33
- "@happyvertical/smrt-ui": "0.49.2",
34
- "@happyvertical/smrt-users": "0.49.2",
28
+ "@happyvertical/smrt-agents": "0.49.4",
29
+ "@happyvertical/smrt-core": "0.49.4",
30
+ "@happyvertical/smrt-messages": "0.49.4",
31
+ "@happyvertical/smrt-prompts": "0.49.4",
32
+ "@happyvertical/smrt-tenancy": "0.49.4",
33
+ "@happyvertical/smrt-ui": "0.49.4",
34
+ "@happyvertical/smrt-users": "0.49.4",
35
35
  "@happyvertical/sql": "^0.89.6"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "svelte": "^5.56.4"
39
39
  },
40
40
  "devDependencies": {
41
- "@happyvertical/smrt-vitest": "0.49.2",
41
+ "@happyvertical/smrt-vitest": "0.49.4",
42
42
  "@sveltejs/package": "^2.5.8",
43
43
  "@sveltejs/vite-plugin-svelte": "^7.1.2",
44
44
  "@types/node": "24.13.2",