UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

78 lines (77 loc) • 2.98 kB
export function isWordOf(words, v) { return words.some((w) => w === v); } export const OVERLAY_OPS = Object.freeze(["replace", "append", "add", "drop"]); export const HOST_ROLES = Object.freeze(["general", "code", "coordinator", "cowork"]); export function isHostRole(v) { return isWordOf(HOST_ROLES, v); } export const HOST_FORMS = Object.freeze(["standard", "minimal"]); export const PROMPT_TRAITS = Object.freeze([ "lean_prompt", "fable_5_mitigations", "thrifty_sonic", "turn_updates", "silent_turn_reminder", "amber_astrolabe", "bison_cairn", "larch_cistern", "haiku_5_5_early_stopping_guidance", "elapsed_time_reminder", "timed_silent_turn_reminder", "finishing_work_guidance", "memory_guidance", "fable_identity_5", "fable_identity_5_1", "fable_identity_5_2", "llm_rnd_capabilities", "read_before_edit", ]); export const PROMPT_TRAIT_BUNDLES = Object.freeze({ fable_5_1_prompt_bundle: Object.freeze(["turn_updates", "silent_turn_reminder"]), opus_5_prompt_bundle: Object.freeze(["bison_cairn", "larch_cistern"]), opus_5_5_prompt_bundle: Object.freeze(["silent_turn_reminder"]), fable_5_2_prompt_bundle: Object.freeze(["silent_turn_reminder", "finishing_work_guidance", "memory_guidance", "timed_silent_turn_reminder"]), }); export const PROMPT_TRAIT_EXCLUSIVE_GROUPS = Object.freeze([ Object.freeze(["fable_identity_5", "fable_identity_5_1", "fable_identity_5_2"]), ]); const DEPLOYMENT_TRAIT = /^x-[a-z0-9]+-[a-z0-9][a-z0-9._-]*$/; export const PROMPT_TRAIT_NAME_MAX = 64; export function isPromptTraitName(v) { if (typeof v !== "string") return false; if (isWordOf(PROMPT_TRAITS, v) || Object.prototype.hasOwnProperty.call(PROMPT_TRAIT_BUNDLES, v)) return true; return v.length <= PROMPT_TRAIT_NAME_MAX && DEPLOYMENT_TRAIT.test(v); } export function bundleMembersOf(name) { return Object.prototype.hasOwnProperty.call(PROMPT_TRAIT_BUNDLES, name) ? PROMPT_TRAIT_BUNDLES[name] : []; } export const PROMPT_FACT_NAMES = Object.freeze([ "policyEnabled", "hooksEnabled", "isolationEnabled", "readFaceOpen", "writeFaceOpen", "withinTaskCompactionEnabled", "supervisorEnabled", "orchestrationEnabled", "orchestrationDeferred", "awarenessEnabled", "goalEnabled", "worktreeIsolated", "teammateEnabled", "isSubagent", "memoryStoreAbsent", "skillToolMounted", "shellFirstSession", "executionEnvironmentDeclared", "workToolsAbsent", "actingToolsAbsent", ]); export const TOOL_CARD_FACT_NAMES = Object.freeze(["shellFirstSession"]); export const ACTING_FACE = Object.freeze({ actingToolsAbsent: false }); export const ANSWERING_FACE = Object.freeze({ actingToolsAbsent: true }); export const PROMPT_LOCALES = Object.freeze(["canonical", "zh-Hans"]); export const RENDERER_IDS = Object.freeze(["role-base", "mcp-instructions", "reminder-mark", "environment", "memory"]);