65faf99e11
Make every text artifact that goes into Shira's system prompt editable from
the EspoCRM admin UI, with code-level defaults kept as a safety floor.
* AssistantRule + CaseMemory: flip `tab: true` so admins can browse/edit from
the navbar. No longer invisible.
* New entity AssistantPrompt — one row per prompt section (tool_rules,
writing_style, legal_assistance, personality_case, personality_office,
other_rules_case, other_rules_office). Edits in the UI override the
in-code defaults; an inactive or missing row falls back to code.
Seeded on install with the current Python defaults via AfterInstall.
* New entity UserProfile — replaces /opt/data/profiles/{uid}.md. ACL is
own/all/no so each lawyer sees their own, admins see all. Injected into
the prompt's '=== ABOUT THIS USER ===' block.
* New entity AssistantSkill — replaces /opt/data/skills/. Tab-visible.
Context provider returns metadata only; full body fetched on demand.
* 3 new ContextProviders (AssistantPrompt, UserProfile, AssistantSkill)
injected into context by SmartAssistantService::chat at the same point
AssistantRule has been injecting since 2026-05-27.
* 3 new Controller classes (one-liner extends Record) — without these
EspoCRM returns 404 on the REST endpoint even when scopes/entityDefs
are correct. Same pattern as the AssistantRule fix in 2.9.2.
* New custom view smart-assistant:views/fields/prompt-editor — monospace
font, dir=auto for mixed RTL/LTR, taller textarea. Used by all three
long-text content fields.
* New admin panel 'ניהול שירה' that groups all five surfaces (prompts,
rules, skills, user profiles, case memory) under one Admin section.
* Hebrew labels for all new scopes added to fa_IR/Global.json.
Paired with shira-hermes (separate commit): prompt_builder.py refactored
to read each section from context['assistantPrompts'] with code defaults
as fallback; save_memory tool now goes through SmartAssistant/action/executeTool
so CaseMemory actually gets populated instead of dropping 'm Notes.
Migration script scripts/migrate_legacy_memory_notes.py in shira-hermes
moves existing 'm Notes into CaseMemory rows (one-shot, idempotent).
Refs Task Master none — schema additions, no destructive changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
46 lines
1.3 KiB
PHP
46 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Espo\Modules\SmartAssistant\Services;
|
|
|
|
use Espo\ORM\EntityManager;
|
|
use Espo\Core\Utils\Log;
|
|
|
|
/**
|
|
* Lists active skills (metadata only — name/description/triggers) for the
|
|
* system prompt's "=== SKILLS (learned workflows) ===" hint. The full body
|
|
* is fetched on demand by shira-hermes' read_skill tool via REST.
|
|
*/
|
|
class AssistantSkillContextProvider
|
|
{
|
|
private EntityManager $entityManager;
|
|
private Log $log;
|
|
|
|
public function __construct(EntityManager $entityManager, Log $log)
|
|
{
|
|
$this->entityManager = $entityManager;
|
|
$this->log = $log;
|
|
}
|
|
|
|
/**
|
|
* @return array<int, array{name: string, description: string, triggers: string}>
|
|
*/
|
|
public function listSkills(): array
|
|
{
|
|
$entries = $this->entityManager->getRDBRepository('AssistantSkill')
|
|
->where(['isActive' => true, 'deleted' => false])
|
|
->order('name', 'ASC')
|
|
->find();
|
|
|
|
$skills = [];
|
|
foreach ($entries as $entry) {
|
|
$skills[] = [
|
|
'name' => (string) $entry->get('name'),
|
|
'description' => (string) ($entry->get('description') ?? ''),
|
|
'triggers' => (string) ($entry->get('triggers') ?? ''),
|
|
];
|
|
}
|
|
|
|
return $skills;
|
|
}
|
|
}
|